]> git.lizzy.rs Git - plan9front.git/commitdiff
aux/ms2, aux/na: fix warnings
authorOri Bernstein <ori@eigenstate.org>
Tue, 11 Aug 2020 02:35:05 +0000 (19:35 -0700)
committerOri Bernstein <ori@eigenstate.org>
Tue, 11 Aug 2020 02:35:05 +0000 (19:35 -0700)
aux/na was comparing the return of putc with <0, when it should
have been comparing against EOF, which is not specified as -ve.

aux/ms2 was zero-extending the mask for the address when it
should have been sign extended.

sys/src/cmd/aux/ms2.c
sys/src/cmd/aux/na/na.y

index 38ba774d40ee74f7dadf1fea18f387f1d09994ec..be30fbf66acc498c96dcd31b0dcd242f2eb4c209 100644 (file)
@@ -18,7 +18,7 @@ int   binary;
 int    halfswap;
 int    srec = 2;
 uvlong addr;
-ulong  psize = 4096;
+uvlong         psize = 4096;
 Biobuf         stdout;
 Fhdr   exech;
 Biobuf *bio;
index 6350186d743afe306ed02320e5fdc80d883c3659..adb27b8fcf3186251d7d9389292ee72cab26ba95 100644 (file)
@@ -826,7 +826,7 @@ yyerror(char *s, ...)
        va_start(ap, s);
        fprintf(stderr, "%s: %d: ", yyfilename, yyline);
        vfprintf(stderr, s, ap);
-       if (putc('\n', stderr) < 0)
+       if (putc('\n', stderr) == EOF)
                exits("io");
        errors++;
        va_end(ap);
@@ -840,7 +840,7 @@ yywarn(char *s, ...)
        va_start(ap, s);
        fprintf(stderr, "%s: %d: warning: ", yyfilename, yyline);
        vfprintf(stderr, s, ap);
-       if (putc('\n', stderr) < 0)
+       if (putc('\n', stderr) == EOF)
                exits("io");
        warnings++;
        va_end(ap);