diff lwar/replace.c @ 264:346966cffeef

Clean up various warnings when building under -Wall Add some gimmicks to prevent fread() and fwrite() warnings about ignoring the return value. Yes, this is probably not a good thing to do, but doing something with a non-success return value is going to involve crashing out or something anyway. Also fix several warnings about variables used while possibly uninitialized. The code flow shows that this cannot be the case but initializing them to a plausible value at declaration time costs pretty much nothing and it makes gcc happy. Also caught a use of | instead of || which probably would have caused a certain check for duplicate declarations in __os9 sections to behave oddly.
author William Astle <lost@l-w.ca>
date Wed, 06 Feb 2013 21:43:10 -0700
parents 7317fbe024af
children 6f4c4d59666f
line wrap: on
line diff
--- a/lwar/replace.c	Tue Feb 05 22:39:34 2013 -0700
+++ b/lwar/replace.c	Wed Feb 06 21:43:10 2013 -0700
@@ -56,7 +56,7 @@
 		perror("Cannot open archive file");
 	}
 	
-	fread(buf, 1, 6, f);
+	(void)(fread(buf, 1, 6, f) && 1);
 	if (memcmp("LWAR1V", buf, 6))
 	{
 		fprintf(stderr, "%s is not a valid archive file.\n", archive_file);
@@ -153,7 +153,7 @@
 			perror("");
 			exit(1);
 		}
-		fread(buf, 1, 6, f2);
+		(void)(fread(buf, 1, 6, f2) && 1);
 		if (mergeflag && !memcmp("LWAR1V", buf, 6))
 		{
 			// add archive contents...