From 9ddb128d520b4856cc57f1384b97899ce510d091 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Mon, 7 Sep 2009 19:00:57 +0200 Subject: [PATCH] fix compiler warnings --- debian/changelog | 7 +++++++ hacks.cpp | 21 +++++++++++++-------- snapshot.cpp | 4 ++-- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index 60ba9dc..4be6592 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +drnoksnes (1.0.2) unstable; urgency=low + + * Some bugs and warnings fixed. + * About dialog. + + -- Javier S. Pedro Mon, 7 Sep 2009 18:06:22 +0200 + drnoksnes (1.0.1) unstable; urgency=low * New artwork, icons and GUI layout by wazd. Thanks a lot! diff --git a/hacks.cpp b/hacks.cpp index 69ba90d..1f9baa8 100644 --- a/hacks.cpp +++ b/hacks.cpp @@ -124,19 +124,24 @@ static int loadHacks(char * line) void S9xHacksLoadFile(const char * file) { + unsigned long gameCrc; + char * line; + FILE * fp; + if (!Settings.HacksEnabled) goto no_hacks; if (!file) goto no_hacks; // At this point, the ROM is already loaded. - FILE * fp = fopen(file, "r"); + fp = fopen(file, "r"); if (!fp) { fprintf(stderr, "Can't open hacks file %s: %s\n", file, strerror(errno)); goto no_hacks; } - const unsigned long gameCrc = getGameCrc32(); - char * line = (char*) malloc(kLineBufferSize + 1); + // Get current ROM CRC + gameCrc = getGameCrc32(); + line = (char*) malloc(kLineBufferSize + 1); do { fgets(line, kLineBufferSize, fp); @@ -145,16 +150,16 @@ void S9xHacksLoadFile(const char * file) *pos = '\0'; if (gameCrc == parseCrc32(line)) { - // A hit! :) + // Hit! This line's CRC matches our current ROM CRC. int res = loadHacks(pos + 1); if (res > 0) { - printf("Hacks: searched %s for crc32 %lx, %d hacks loaded\n", + printf("Hacks: searched %s for crc %lx, %d hacks loaded\n", file, gameCrc, res); } else if (res < 0) { - printf("Hacks: searched %s for crc32 %lx, error parsing line\n", + printf("Hacks: searched %s for crc %lx, error parsing line\n", file, gameCrc); } else { - printf("Hacks: searched %s for crc32 %lx, no hacks\n", + printf("Hacks: searched %s for crc %lx, no hacks\n", file, gameCrc); } goto hacks_found; @@ -162,7 +167,7 @@ void S9xHacksLoadFile(const char * file) } while (!feof(fp) && !ferror(fp)); if (ferror(fp)) { - fprintf(stderr, "Error reading hacks file: %s\n"); + fprintf(stderr, "Error reading hacks file: %s\n", file); } printf("Hacks: searched %s for crc %lu; nothing found\n", file, gameCrc); diff --git a/snapshot.cpp b/snapshot.cpp index 44d554d..cbe993c 100644 --- a/snapshot.cpp +++ b/snapshot.cpp @@ -407,7 +407,7 @@ static int UnfreezeBlock (const char *name, uint8 *block, int size); bool8 S9xFreezeGame (const char *filename) { - if (ss_st = OPEN_STREAM(filename, "wb")) + if ((ss_st = OPEN_STREAM(filename, "wb"))) { Freeze(); CLOSE_STREAM(ss_st); @@ -419,7 +419,7 @@ bool8 S9xFreezeGame (const char *filename) bool8 S9xUnfreezeGame (const char *filename) { - if (ss_st = OPEN_STREAM(filename, "rb")) + if ((ss_st = OPEN_STREAM(filename, "rb"))) { int result; if ((result = Unfreeze()) != SUCCESS) -- 1.7.9.5