]> git.mxchange.org Git - simgear.git/blobdiff - simgear/nasal/parse.c
Add a function to calculate the normalmap from a regular texture.
[simgear.git] / simgear / nasal / parse.c
index 22cfed485c4ee2e777c1a0f97ff2b9638e66164d..920d7342acbaaa4642a1d7a7c994c6a157359a3d 100644 (file)
@@ -107,7 +107,7 @@ void* naParseAlloc(struct Parser* p, int bytes)
         p->leftInChunk = sz;
     }
 
-    result = p->chunks[0] + p->chunkSizes[0] - p->leftInChunk;
+    result = (char *)p->chunks[0] + p->chunkSizes[0] - p->leftInChunk;
     p->leftInChunk -= bytes;
     return (void*)result;
 }
@@ -489,6 +489,9 @@ naRef naParseCode(struct Context* c, naRef srcFile, int firstLine,
     struct Token* t;
     struct Parser p;
 
+    // Protect from garbage collection
+    naVec_append(c->temps, srcFile);
+
     // Catch parser errors here.
     *errLine = 0;
     if(setjmp(p.jumpHandle)) {
@@ -520,6 +523,7 @@ naRef naParseCode(struct Context* c, naRef srcFile, int firstLine,
 
     // Clean up our mess
     naParseDestroy(&p);
+    naVec_append(c->temps, codeObj);
 
     return codeObj;
 }