shithub: riscv

Download patch

ref: 1e315f896d9496e22546304ef8b2de74b9451fc4
parent: c834f535b799e0087d74103e96ddb03df457c597
author: Ori Bernstein <[email protected]>
date: Mon Aug 10 15:35:05 EDT 2020

aux/ms2, aux/na: fix warnings

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.

--- a/sys/src/cmd/aux/ms2.c
+++ b/sys/src/cmd/aux/ms2.c
@@ -18,7 +18,7 @@
 int	halfswap;
 int	srec = 2;
 uvlong	addr;
-ulong 	psize = 4096;
+uvlong 	psize = 4096;
 Biobuf 	stdout;
 Fhdr	exech;
 Biobuf *bio;
--- a/sys/src/cmd/aux/na/na.y
+++ b/sys/src/cmd/aux/na/na.y
@@ -826,7 +826,7 @@
 	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 @@
 	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);