[Scummvm-cvs-logs] SF.net SVN: scummvm:[49086] scummvm/trunk/engines/tinsel
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Tue May 18 20:16:47 CEST 2010
Revision: 49086
http://scummvm.svn.sourceforge.net/scummvm/?rev=49086&view=rev
Author: lordhoto
Date: 2010-05-18 18:16:47 +0000 (Tue, 18 May 2010)
Log Message:
-----------
Replace some strncpy usages with Common::strlcpy.
Modified Paths:
--------------
scummvm/trunk/engines/tinsel/detection.cpp
scummvm/trunk/engines/tinsel/handle.cpp
scummvm/trunk/engines/tinsel/saveload.cpp
Modified: scummvm/trunk/engines/tinsel/detection.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/detection.cpp 2010-05-18 18:16:21 UTC (rev 49085)
+++ scummvm/trunk/engines/tinsel/detection.cpp 2010-05-18 18:16:47 UTC (rev 49086)
@@ -954,9 +954,7 @@
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
Modified: scummvm/trunk/engines/tinsel/handle.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/handle.cpp 2010-05-18 18:16:21 UTC (rev 49085)
+++ scummvm/trunk/engines/tinsel/handle.cpp 2010-05-18 18:16:47 UTC (rev 49086)
@@ -288,8 +288,7 @@
}
// 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
Modified: scummvm/trunk/engines/tinsel/saveload.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/saveload.cpp 2010-05-18 18:16:21 UTC (rev 49085)
+++ scummvm/trunk/engines/tinsel/saveload.cpp 2010-05-18 18:16:47 UTC (rev 49086)
@@ -365,9 +365,8 @@
}
#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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list