diff options
author | Johannes Schickel | 2010-05-18 18:16:47 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-05-18 18:16:47 +0000 |
commit | 62717eafc4a0baf3e68f849d4a6c22578802e8a0 (patch) | |
tree | da3d1e6efe1dd65e985b50d7ed33acd349e670ac /engines/tinsel | |
parent | e4d1c8a1bdf8db48b7232837d14c489a5045b66b (diff) | |
download | scummvm-rg350-62717eafc4a0baf3e68f849d4a6c22578802e8a0.tar.gz scummvm-rg350-62717eafc4a0baf3e68f849d4a6c22578802e8a0.tar.bz2 scummvm-rg350-62717eafc4a0baf3e68f849d4a6c22578802e8a0.zip |
Replace some strncpy usages with Common::strlcpy.
svn-id: r49086
Diffstat (limited to 'engines/tinsel')
-rw-r--r-- | engines/tinsel/detection.cpp | 4 | ||||
-rw-r--r-- | engines/tinsel/handle.cpp | 3 | ||||
-rw-r--r-- | engines/tinsel/saveload.cpp | 5 |
3 files changed, 4 insertions, 8 deletions
diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index 49fc817b34..70a2f475ee 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -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 diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp index e26ff9218e..de573feee2 100644 --- a/engines/tinsel/handle.cpp +++ b/engines/tinsel/handle.cpp @@ -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 diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp index c56d295e72..b90ace4613 100644 --- a/engines/tinsel/saveload.cpp +++ b/engines/tinsel/saveload.cpp @@ -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; |