all repos — mgba @ c50bd95258ef067a07bc68ddd27557e61902eafe

mGBA Game Boy Advance Emulator

Fix naming of savegames from files with no .
Jeffrey Pfau jeffrey@endrift.com
Fri, 18 Jul 2014 00:53:08 -0700
commit

c50bd95258ef067a07bc68ddd27557e61902eafe

parent

5a0247ac7871b72f909451479e4dba994f07f08e

1 files changed, 2 insertions(+), 3 deletions(-)

jump to
M src/gba/gba-thread.csrc/gba/gba-thread.c

@@ -248,9 +248,8 @@ savedata = malloc((dotPoint - threadContext->fname + 5) * sizeof(char));

strncpy(savedata, threadContext->fname, dotPoint - threadContext->fname + 1); strcat(savedata, "sav"); } else { - savedata = malloc(strlen(threadContext->fname + 5)); - strcpy(savedata, threadContext->fname); - strcat(savedata, "sav"); + savedata = malloc(strlen(threadContext->fname + 5) * sizeof(char)); + sprintf(savedata, "%s.sav", threadContext->fname); } threadContext->save = VFileOpen(savedata, O_RDWR | O_CREAT); free(savedata);