Mercurial > hg > index.cgi
comparison lwlink/output.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 | 7de7b14ebaee |
children | a640ff4ed95f |
comparison
equal
deleted
inserted
replaced
263:8dd8c3bdca7c | 264:346966cffeef |
---|---|
28 #include "lwlink.h" | 28 #include "lwlink.h" |
29 | 29 |
30 // this prevents warnings about not using the return value of fwrite() | 30 // this prevents warnings about not using the return value of fwrite() |
31 // and, theoretically, can be replaced with a function that handles things | 31 // and, theoretically, can be replaced with a function that handles things |
32 // better in the future | 32 // better in the future |
33 #define writebytes(s, l, c, f) do { int r; r = fwrite((s), (l), (c), (f)); } while (0) | 33 //#define writebytes(s, l, c, f) do { int r; r = fwrite((s), (l), (c), (f)); (void)r; } while (0) |
34 #define writebytes(s, l, c, f) do { (void)(fwrite((s), (l), (c), (f)) && 1); } while (0) | |
34 | 35 |
35 void do_output_os9(FILE *of); | 36 void do_output_os9(FILE *of); |
36 void do_output_decb(FILE *of); | 37 void do_output_decb(FILE *of); |
37 void do_output_raw(FILE *of); | 38 void do_output_raw(FILE *of); |
38 void do_output_lwex0(FILE *of); | 39 void do_output_lwex0(FILE *of); |