mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 00:15:14 +01:00
Snes9x - Fix warnings for string truncation. (#1053)
This commit is contained in:
parent
37fdefbc55
commit
ce1a40b012
@ -2280,16 +2280,12 @@ void S9xApplyCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
|||||||
|
|
||||||
case LoadOopsFile:
|
case LoadOopsFile:
|
||||||
{
|
{
|
||||||
char filename[PATH_MAX + 1];
|
const char *filename = S9xGetFilename("oops", SNAPSHOT_DIR);
|
||||||
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
|
||||||
|
|
||||||
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
|
||||||
snprintf(filename, PATH_MAX + 1, "%s%s%s.%.*s", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, _MAX_EXT - 1, "oops");
|
|
||||||
|
|
||||||
if (S9xUnfreezeGame(filename))
|
if (S9xUnfreezeGame(filename))
|
||||||
{
|
{
|
||||||
snprintf(buf, 256, "%s.%.*s loaded", def, _MAX_EXT - 1, "oops");
|
snprintf(buf, 256, "%.240s.oops loaded", S9xBasename(Memory.ROMFilename));
|
||||||
S9xSetInfoString (buf);
|
S9xSetInfoString(buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
S9xMessage(S9X_ERROR, S9X_FREEZE_FILE_NOT_FOUND, "Oops file not found");
|
S9xMessage(S9X_ERROR, S9X_FREEZE_FILE_NOT_FOUND, "Oops file not found");
|
||||||
@ -2321,11 +2317,11 @@ void S9xApplyCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
|||||||
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
||||||
|
|
||||||
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
||||||
snprintf(filename, PATH_MAX + 1, "%s%s%s.%03d", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, i - QuickLoad000);
|
snprintf(filename, PATH_MAX + 1, "%.2s%.512s%.512s.%03d", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, i - QuickLoad000);
|
||||||
|
|
||||||
if (S9xUnfreezeGame(filename))
|
if (S9xUnfreezeGame(filename))
|
||||||
{
|
{
|
||||||
snprintf(buf, 256, "%s.%03d loaded", def, i - QuickLoad000);
|
snprintf(buf, 256, "%.240s.%03d loaded", def, i - QuickLoad000);
|
||||||
S9xSetInfoString(buf);
|
S9xSetInfoString(buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2350,9 +2346,9 @@ void S9xApplyCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
|||||||
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
||||||
|
|
||||||
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
||||||
snprintf(filename, PATH_MAX + 1, "%s%s%s.%03d", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, i - QuickSave000);
|
snprintf(filename, PATH_MAX + 1, "%.2s%.512s%.512s.%03d", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, i - QuickSave000);
|
||||||
|
|
||||||
snprintf(buf, 256, "%s.%03d saved", def, i - QuickSave000);
|
snprintf(buf, 256, "%.240s.%03d saved", def, i - QuickSave000);
|
||||||
S9xSetInfoString(buf);
|
S9xSetInfoString(buf);
|
||||||
|
|
||||||
S9xFreezeGame(filename);
|
S9xFreezeGame(filename);
|
||||||
|
@ -1009,11 +1009,7 @@ void S9xResetSaveTimer (bool8 dontsave)
|
|||||||
|
|
||||||
if (!Settings.DontSaveOopsSnapshot && !dontsave && t != -1 && time(NULL) - t > 300)
|
if (!Settings.DontSaveOopsSnapshot && !dontsave && t != -1 && time(NULL) - t > 300)
|
||||||
{
|
{
|
||||||
char filename[PATH_MAX + 1];
|
const char *filename = S9xGetFilename("oops", SNAPSHOT_DIR);
|
||||||
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
|
||||||
|
|
||||||
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
|
||||||
snprintf(filename, PATH_MAX + 1, "%s%s%s.%.*s", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, _MAX_EXT - 1, "oops");
|
|
||||||
S9xMessage(S9X_INFO, S9X_FREEZE_FILE_INFO, SAVE_INFO_OOPS);
|
S9xMessage(S9X_INFO, S9X_FREEZE_FILE_INFO, SAVE_INFO_OOPS);
|
||||||
S9xFreezeGame(filename);
|
S9xFreezeGame(filename);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user