Commit d4ec5228821b8bdd8019cb5dafa2ea3659ddb1f9
1 parent
cb76e138
Workaround compiler warnings at -O1
Signed-off-by: Paul Brook <paul@codesourcery.com>
Showing
1 changed file
with
6 additions
and
2 deletions
qemu-io.c
@@ -210,7 +210,9 @@ read_f(int argc, char **argv) | @@ -210,7 +210,9 @@ read_f(int argc, char **argv) | ||
210 | int c, cnt; | 210 | int c, cnt; |
211 | char *buf; | 211 | char *buf; |
212 | int64_t offset; | 212 | int64_t offset; |
213 | - int count, total; | 213 | + int count; |
214 | + /* Some compilers get confused and warn if this is not initialized. */ | ||
215 | + int total = 0; | ||
214 | int pattern = 0, pattern_offset = 0, pattern_count = 0; | 216 | int pattern = 0, pattern_offset = 0, pattern_count = 0; |
215 | 217 | ||
216 | while ((c = getopt(argc, argv, "Cl:pP:qs:v")) != EOF) { | 218 | while ((c = getopt(argc, argv, "Cl:pP:qs:v")) != EOF) { |
@@ -527,7 +529,9 @@ write_f(int argc, char **argv) | @@ -527,7 +529,9 @@ write_f(int argc, char **argv) | ||
527 | int c, cnt; | 529 | int c, cnt; |
528 | char *buf; | 530 | char *buf; |
529 | int64_t offset; | 531 | int64_t offset; |
530 | - int count, total; | 532 | + int count; |
533 | + /* Some compilers get confused and warn if this is not initialized. */ | ||
534 | + int total = 0; | ||
531 | int pattern = 0xcd; | 535 | int pattern = 0xcd; |
532 | 536 | ||
533 | while ((c = getopt(argc, argv, "CpP:q")) != EOF) { | 537 | while ((c = getopt(argc, argv, "CpP:q")) != EOF) { |