aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorD G Turner2011-06-02 03:44:31 +0100
committerD G Turner2011-06-02 03:44:31 +0100
commit0d379b3783e368160476c78d31b05a9e9914e782 (patch)
tree03263a5a287dc616493a6c81f486938ad0e2e92b
parent4b6c1a0c2b53fdb71090759fbd89a6852d84af4b (diff)
downloadscummvm-rg350-0d379b3783e368160476c78d31b05a9e9914e782.tar.gz
scummvm-rg350-0d379b3783e368160476c78d31b05a9e9914e782.tar.bz2
scummvm-rg350-0d379b3783e368160476c78d31b05a9e9914e782.zip
CINE: Replace snprintf() usage with Common::String::format()
Safer and less portability issues.
-rw-r--r--engines/cine/detection.cpp16
-rw-r--r--engines/cine/saveload.cpp5
-rw-r--r--engines/cine/various.cpp7
3 files changed, 9 insertions, 19 deletions
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp
index 0ef2c87288..64eee4574f 100644
--- a/engines/cine/detection.cpp
+++ b/engines/cine/detection.cpp
@@ -185,10 +185,7 @@ void CineMetaEngine::removeSaveState(const char *target, int slot) const {
memset(saveNames, 0, sizeof(saveNames));
Common::InSaveFile *in;
- char tmp[80];
-
- snprintf(tmp, 80, "%s.dir", target);
- in = g_system->getSavefileManager()->openForLoading(tmp);
+ in = g_system->getSavefileManager()->openForLoading(Common::String::format("%s.dir", target));
if (!in)
return;
@@ -202,12 +199,10 @@ void CineMetaEngine::removeSaveState(const char *target, int slot) const {
strncpy(saveNames[slot], slotName, 20);
// Update savegame descriptions
- char indexFile[80];
- snprintf(indexFile, 80, "%s.dir", target);
-
+ Common::String indexFile = Common::String::format("%s.dir", target);
Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving(indexFile);
if (!out) {
- warning("Unable to open file %s for saving", indexFile);
+ warning("Unable to open file %s for saving", indexFile.c_str());
return;
}
@@ -246,12 +241,11 @@ Common::Error CineEngine::saveGameState(int slot, const char *desc) {
currentSaveName[slot][sizeof(CommandeType) - 1] = 0;
// Update savegame descriptions
- char indexFile[80];
- snprintf(indexFile, 80, "%s.dir", _targetName.c_str());
+ Common::String indexFile = Common::String::format("%s.dir", _targetName.c_str());
Common::OutSaveFile *fHandle = _saveFileMan->openForSaving(indexFile);
if (!fHandle) {
- warning("Unable to open file %s for saving", indexFile);
+ warning("Unable to open file %s for saving", indexFile.c_str());
return Common::kUnknownError;
}
diff --git a/engines/cine/saveload.cpp b/engines/cine/saveload.cpp
index 700875e302..e51d07b1a5 100644
--- a/engines/cine/saveload.cpp
+++ b/engines/cine/saveload.cpp
@@ -460,10 +460,7 @@ void saveSeqList(Common::OutSaveFile &out) {
bool CineEngine::loadSaveDirectory() {
Common::InSaveFile *fHandle;
- char tmp[80];
-
- snprintf(tmp, 80, "%s.dir", _targetName.c_str());
- fHandle = _saveFileMan->openForLoading(tmp);
+ fHandle = _saveFileMan->openForLoading(Common::String::format("%s.dir", _targetName.c_str()));
if (!fHandle) {
return false;
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index 1892a78cca..81e72d6905 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -440,13 +440,12 @@ void CineEngine::makeSystemMenu() {
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
- char saveString[256], tmp[80];
-
- snprintf(tmp, 80, "%s.dir", _targetName.c_str());
+ char saveString[256];
+ Common::String tmp = Common::String::format("%s.dir", _targetName.c_str());
Common::OutSaveFile *fHandle = _saveFileMan->openForSaving(tmp);
if (!fHandle) {
- warning("Unable to open file %s for saving", tmp);
+ warning("Unable to open file %s for saving", tmp.c_str());
break;
}