Mercurial > hg > index.cgi
comparison 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 |
comparison
equal
deleted
inserted
replaced
263:8dd8c3bdca7c | 264:346966cffeef |
---|---|
54 } | 54 } |
55 } | 55 } |
56 perror("Cannot open archive file"); | 56 perror("Cannot open archive file"); |
57 } | 57 } |
58 | 58 |
59 fread(buf, 1, 6, f); | 59 (void)(fread(buf, 1, 6, f) && 1); |
60 if (memcmp("LWAR1V", buf, 6)) | 60 if (memcmp("LWAR1V", buf, 6)) |
61 { | 61 { |
62 fprintf(stderr, "%s is not a valid archive file.\n", archive_file); | 62 fprintf(stderr, "%s is not a valid archive file.\n", archive_file); |
63 exit(1); | 63 exit(1); |
64 } | 64 } |
151 { | 151 { |
152 fprintf(stderr, "Cannot open file %s:", files[i]); | 152 fprintf(stderr, "Cannot open file %s:", files[i]); |
153 perror(""); | 153 perror(""); |
154 exit(1); | 154 exit(1); |
155 } | 155 } |
156 fread(buf, 1, 6, f2); | 156 (void)(fread(buf, 1, 6, f2) && 1); |
157 if (mergeflag && !memcmp("LWAR1V", buf, 6)) | 157 if (mergeflag && !memcmp("LWAR1V", buf, 6)) |
158 { | 158 { |
159 // add archive contents... | 159 // add archive contents... |
160 for (;;) | 160 for (;;) |
161 { | 161 { |