From f6ab82d144fe61ec29156068b54b744974065616 Mon Sep 17 00:00:00 2001 From: Zerocker Date: Sun, 7 Jun 2020 22:19:47 +0900 Subject: [PATCH] Fix a couple of warnings --- src/game/save_file.c | 2 +- src/game/text_save.inc.h | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/game/save_file.c b/src/game/save_file.c index a8db910b..934b122e 100644 --- a/src/game/save_file.c +++ b/src/game/save_file.c @@ -391,7 +391,6 @@ BAD_RETURN(s32) save_file_copy(s32 srcFileIndex, s32 destFileIndex) { void save_file_load_all(void) { s32 file; - s32 validSlots; gMainMenuDataModified = FALSE; gSaveFileModified = FALSE; @@ -405,6 +404,7 @@ void save_file_load_all(void) { gSaveFileModified = TRUE; gMainMenuDataModified = TRUE; #else + s32 validSlots; read_eeprom_data(&gSaveBuffer, sizeof(gSaveBuffer)); if (save_file_need_bswap(&gSaveBuffer)) diff --git a/src/game/text_save.inc.h b/src/game/text_save.inc.h index 8128711e..1325f0a5 100644 --- a/src/game/text_save.inc.h +++ b/src/game/text_save.inc.h @@ -79,7 +79,7 @@ static s32 write_text_save(s32 fileIndex) { struct SaveFile *savedata; struct MainMenuSaveData *menudata; char filename[SYS_MAX_PATH] = { 0 }; - char value[SYS_MAX_PATH] = { 0 }; + char *value; u32 i, bit, flags, coins, stars, starFlags; if (snprintf(filename, sizeof(filename), FILENAME_FORMAT, sys_save_path(), fileIndex) < 0) @@ -87,7 +87,7 @@ static s32 write_text_save(s32 fileIndex) { file = fopen(filename, "wt"); if (file == NULL) { - printf("Savefile '%s' not found!\n", path); + printf("Savefile '%s' not found!\n", filename); return -1; } else printf("Saving updated progress to '%s'\n", filename); @@ -204,7 +204,6 @@ static s32 write_text_save(s32 fileIndex) { */ static s32 read_text_save(s32 fileIndex) { char filename[SYS_MAX_PATH] = { 0 }; - char temp[SYS_MAX_PATH] = { 0 }; const char *value; ini_t *savedata; @@ -243,9 +242,8 @@ static s32 read_text_save(s32 fileIndex) { for (i = 1; i < NUM_FLAGS; i++) { value = ini_get(savedata, "flags", sav_flags[i]); - if (value) { - flag = strtol(value, &temp, 10); + flag = value[0] - '0'; // Flag should be 0 or 1 if (flag) { flag = 1 << i; // Flags defined in 'save_file' header gSaveBuffer.files[fileIndex][0].flags |= flag;