mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
Replace some strncpy usages with Common::strlcpy.
svn-id: r49086
This commit is contained in:
parent
e4d1c8a1bd
commit
62717eafc4
@ -954,9 +954,7 @@ Common::Error TinselEngine::loadGameState(int slot) {
|
||||
Common::Error TinselEngine::saveGameState(int slot, const char *desc) {
|
||||
Common::String saveName = _vm->getSavegameFilename((int16)(slot + 1));
|
||||
char saveDesc[SG_DESC_LEN];
|
||||
strncpy(saveDesc, desc, SG_DESC_LEN);
|
||||
// Make sure that saveDesc is 0-terminated
|
||||
saveDesc[SG_DESC_LEN - 1] = '\0';
|
||||
Common::strlcpy(saveDesc, desc, SG_DESC_LEN);
|
||||
SaveGame((char *)saveName.c_str(), saveDesc);
|
||||
ProcessSRQueue(); // This shouldn't be needed, but for some reason it is...
|
||||
return Common::kNoError; // TODO: return success/failure
|
||||
|
@ -288,8 +288,7 @@ void LoadFile(MEMHANDLE *pH) {
|
||||
}
|
||||
|
||||
// extract and zero terminate the filename
|
||||
strncpy(szFilename, pH->szName, sizeof(pH->szName));
|
||||
szFilename[sizeof(pH->szName)] = 0;
|
||||
Common::strlcpy(szFilename, pH->szName, sizeof(pH->szName));
|
||||
|
||||
if (f.open(szFilename)) {
|
||||
// read the data
|
||||
|
@ -365,9 +365,8 @@ int getList(Common::SaveFileManager *saveFileMan, const Common::String &target)
|
||||
}
|
||||
#endif
|
||||
|
||||
strncpy(savedFiles[i].name, fname.c_str(), FNAMELEN);
|
||||
strncpy(savedFiles[i].desc, hdr.desc, SG_DESC_LEN);
|
||||
savedFiles[i].desc[SG_DESC_LEN - 1] = 0;
|
||||
Common::strlcpy(savedFiles[i].name, fname.c_str(), FNAMELEN);
|
||||
Common::strlcpy(savedFiles[i].desc, hdr.desc, SG_DESC_LEN);
|
||||
savedFiles[i].dateTime = hdr.dateTime;
|
||||
|
||||
++numSfiles;
|
||||
|
Loading…
Reference in New Issue
Block a user