diff --git a/simgear/nasal/iolib.c b/simgear/nasal/iolib.c index c08296a9..16d31338 100644 --- a/simgear/nasal/iolib.c +++ b/simgear/nasal/iolib.c @@ -143,7 +143,7 @@ static naRef f_open(naContext c, naRef me, int argc, naRef* args) // frees buffer before tossing an error static int getcguard(naContext ctx, FILE* f, void* buf) { - char c; + int c; naModUnlock(); c = fgetc(f); naModLock(); if(ferror(f)) { naFree(buf); @@ -159,8 +159,8 @@ static naRef f_readln(naContext ctx, naRef me, int argc, naRef* args) { naRef result; struct naIOGhost* g = argc==1 ? ioghost(args[0]) : 0; - int i=0, sz = 128; - char c, *buf; + int i=0, sz = 128, c, c2; + char *buf; if(!g || g->type != &naStdIOType) naRuntimeError(ctx, "bad argument to readln()"); buf = naAlloc(sz); @@ -168,7 +168,7 @@ static naRef f_readln(naContext ctx, naRef me, int argc, naRef* args) c = getcguard(ctx, g->handle, buf); if(c == EOF || c == '\n') break; if(c == '\r') { - char c2 = getcguard(ctx, g->handle, buf); + c2 = getcguard(ctx, g->handle, buf); if(c2 != EOF && c2 != '\n') if(EOF == ungetc(c2, g->handle)) break;