aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorD G Turner2011-06-02 02:20:51 +0100
committerD G Turner2011-06-02 02:20:51 +0100
commit8356656575b4c07229dc0e9bd97fa2f67573de73 (patch)
tree2d5884b8d2ab89ccae17c36fdb48cca9a98ab35b
parent092142d8800f4b7f136098d9cbad6ee8d5ffbe8b (diff)
downloadscummvm-rg350-8356656575b4c07229dc0e9bd97fa2f67573de73.tar.gz
scummvm-rg350-8356656575b4c07229dc0e9bd97fa2f67573de73.tar.bz2
scummvm-rg350-8356656575b4c07229dc0e9bd97fa2f67573de73.zip
GOB: Replace snprintf() usage with Common::String::format()
Safer and less portability issues.
-rw-r--r--engines/gob/resources.cpp5
-rw-r--r--engines/gob/save/savehandler.cpp3
-rw-r--r--engines/gob/sound/sound.cpp6
3 files changed, 4 insertions, 10 deletions
diff --git a/engines/gob/resources.cpp b/engines/gob/resources.cpp
index 92eec0ee25..d5497c25be 100644
--- a/engines/gob/resources.cpp
+++ b/engines/gob/resources.cpp
@@ -603,10 +603,7 @@ bool Resources::dumpResource(const Resource &resource, uint16 id,
Common::String fileName = _fileBase;
- char idStr[7];
-
- snprintf(idStr, 7, "_%05d", id);
- fileName += idStr;
+ fileName += Common::String::format("_%05d", id);
fileName += ".";
fileName += ext;
diff --git a/engines/gob/save/savehandler.cpp b/engines/gob/save/savehandler.cpp
index 9e46f1db6f..71de629f93 100644
--- a/engines/gob/save/savehandler.cpp
+++ b/engines/gob/save/savehandler.cpp
@@ -154,8 +154,7 @@ Common::String SlotFileIndexed::build(int slot) const {
if ((slot < 0) || (((uint32) slot) >= _slotCount))
return Common::String();
- char buf[4];
- snprintf(buf, sizeof(buf), "%02d", slot);
+ Common::String buf = Common::String::format("%02d", slot);
return _base + "." + _ext + buf;
}
diff --git a/engines/gob/sound/sound.cpp b/engines/gob/sound/sound.cpp
index 0ad17c1e33..212116f689 100644
--- a/engines/gob/sound/sound.cpp
+++ b/engines/gob/sound/sound.cpp
@@ -667,15 +667,13 @@ void Sound::bgPlay(const char *base, const char *ext, SoundType type, int count)
_bgatmos->stopBA();
_bgatmos->queueClear();
- int length = strlen(base) + 7;
- char *fileName = new char[length];
SoundDesc *sndDesc;
for (int i = 1; i <= count; i++) {
- snprintf(fileName, length, "%s%02d.%s", base, i, ext);
+ Common::String fileName = Common::String::format("%s%02d.%s", base, i, ext);
sndDesc = new SoundDesc;
- if (sampleLoad(sndDesc, type, fileName))
+ if (sampleLoad(sndDesc, type, fileName.c_str()))
_bgatmos->queueSample(*sndDesc);
else
delete sndDesc;