From 82964704a85fe09bfebe7314e5d606ac2f0ad69d Mon Sep 17 00:00:00 2001 From: kichikuou Date: Mon, 20 Feb 2017 18:30:05 +0900 Subject: [PATCH] Fix "Fail to save" warning --- src/savedata.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/savedata.c b/src/savedata.c index 9f80d73..404bd80 100644 --- a/src/savedata.c +++ b/src/savedata.c @@ -773,19 +773,19 @@ static void* loadGameData(int no, int *status, int *size) { } static int saveGameData(int no, char *buf, int size) { - FILE *fp; - int status = SAVE_SAVEOK1; + FILE *fp; + int status = SAVE_SAVEOK1; backup_oldfile(saveDataFile[no]); - fp = fopen(saveDataFile[no],"wb"); - if (fp == NULL) { - return SAVE_SAVEERR; - } - if (size != fwrite(buf, size, 1, fp)) { - status = SAVE_SAVEERR; - } - fclose(fp); - return status; + fp = fopen(saveDataFile[no],"wb"); + if (fp == NULL) { + return SAVE_SAVEERR; + } + if (1 != fwrite(buf, size, 1, fp)) { + status = SAVE_SAVEERR; + } + fclose(fp); + return status; } /* 指定ファイルからの画像の読み込み thanx tajiru@wizard */