aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2010-11-01 16:02:28 +0000
committerMax Horn2010-11-01 16:02:28 +0000
commite27b05ef358102fd60235a5f78d7d51e9f25a5f4 (patch)
tree50e994a47741bf619de730f6a3ece5d0a0cc7e95
parent7a853650047064fb15720bb58ce7c5eec28ef606 (diff)
downloadscummvm-rg350-e27b05ef358102fd60235a5f78d7d51e9f25a5f4.tar.gz
scummvm-rg350-e27b05ef358102fd60235a5f78d7d51e9f25a5f4.tar.bz2
scummvm-rg350-e27b05ef358102fd60235a5f78d7d51e9f25a5f4.zip
COMMON: Rename String::printf() to String::format()
This is a first step towards getting rid of all uses of regular printf, fprintf, vprintf, vfprintf, puts, fputs, etc. in our codebase. The name format() reflects the purpose of the function, and parallels String.format() in Java, boost::format, and others. svn-id: r54004
-rw-r--r--backends/platform/wii/options.cpp2
-rw-r--r--base/commandLine.cpp2
-rw-r--r--common/str.cpp2
-rw-r--r--common/str.h2
-rw-r--r--engines/agos/animation.cpp4
-rw-r--r--engines/agos/saveload.cpp6
-rw-r--r--engines/groovie/script.cpp4
-rw-r--r--engines/hugo/file.cpp4
-rw-r--r--engines/kyra/resource_intern.cpp2
-rw-r--r--engines/kyra/saveload.cpp2
-rw-r--r--engines/kyra/staticres.cpp4
-rw-r--r--engines/lastexpress/data/scene.cpp8
-rw-r--r--engines/lastexpress/entities/august.cpp8
-rw-r--r--engines/lastexpress/entities/entity.h38
-rw-r--r--engines/lastexpress/game/action.cpp10
-rw-r--r--engines/lastexpress/game/entities.cpp42
-rw-r--r--engines/lastexpress/game/inventory.cpp2
-rw-r--r--engines/lastexpress/game/inventory.h2
-rw-r--r--engines/lastexpress/game/object.cpp4
-rw-r--r--engines/lastexpress/game/savepoint.h4
-rw-r--r--engines/lastexpress/game/scenes.cpp4
-rw-r--r--engines/lastexpress/game/state.h18
-rw-r--r--engines/lastexpress/helpers.h2
-rw-r--r--engines/parallaction/detection.cpp2
-rw-r--r--engines/sci/detection.cpp8
-rw-r--r--engines/sci/engine/kernel.cpp4
-rw-r--r--engines/sci/engine/kfile.cpp2
-rw-r--r--engines/sci/engine/kmisc.cpp6
-rw-r--r--engines/sci/engine/kvideo.cpp4
-rw-r--r--engines/sci/engine/message.cpp2
-rw-r--r--engines/sci/engine/vm.cpp4
-rw-r--r--engines/sci/engine/workarounds.cpp2
-rw-r--r--engines/sci/resource.cpp2
-rw-r--r--engines/sci/sci.cpp2
-rw-r--r--engines/scumm/he/logic_he.cpp6
-rw-r--r--engines/scumm/imuse/imuse.cpp4
-rw-r--r--engines/teenagent/detection.cpp2
-rw-r--r--engines/teenagent/teenagent.cpp6
-rw-r--r--engines/testbed/graphics.cpp4
-rw-r--r--engines/testbed/misc.cpp2
-rw-r--r--engines/testbed/sound.cpp8
-rw-r--r--engines/testbed/testbed.cpp4
-rw-r--r--engines/testbed/testsuite.cpp2
-rw-r--r--engines/toon/audio.cpp2
-rw-r--r--engines/toon/detection.cpp4
-rw-r--r--engines/toon/toon.cpp12
-rw-r--r--gui/about.cpp2
-rw-r--r--test/common/str.h10
48 files changed, 141 insertions, 141 deletions
diff --git a/backends/platform/wii/options.cpp b/backends/platform/wii/options.cpp
index 2a47958e3b..ffabc5ae97 100644
--- a/backends/platform/wii/options.cpp
+++ b/backends/platform/wii/options.cpp
@@ -183,7 +183,7 @@ void WiiOptionsDialog::handleTickle() {
break;
default:
- label = String::printf(_("Network not initialised (%d)"), status);
+ label = String::format(_("Network not initialised (%d)"), status);
break;
}
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index cf59ae6dfd..6ee3ef382d 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -613,7 +613,7 @@ static void listTargets() {
description = g.description();
}
- targets.push_back(Common::String::printf("%-20s %s", name.c_str(), description.c_str()));
+ targets.push_back(Common::String::format("%-20s %s", name.c_str(), description.c_str()));
}
Common::sort(targets.begin(), targets.end());
diff --git a/common/str.cpp b/common/str.cpp
index c3c19adfe6..c21e4412db 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -430,7 +430,7 @@ uint String::hash() const {
}
// static
-String String::printf(const char *fmt, ...) {
+String String::format(const char *fmt, ...) {
String output;
assert(output.isStorageIntern());
diff --git a/common/str.h b/common/str.h
index e3dec6cdc2..56feaacf1b 100644
--- a/common/str.h
+++ b/common/str.h
@@ -218,7 +218,7 @@ public:
/**
* Printf-like function. Returns a formatted String.
*/
- static Common::String printf(const char *fmt, ...) GCC_PRINTF(1,2);
+ static Common::String format(const char *fmt, ...) GCC_PRINTF(1,2);
public:
typedef char * iterator;
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index af85c50114..4fe8f8e6bc 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -250,7 +250,7 @@ bool MoviePlayerDXA::load() {
}
}
- Common::String videoName = Common::String::printf("%s.dxa", baseName);
+ Common::String videoName = Common::String::format("%s.dxa", baseName);
if (!loadFile(videoName))
error("Failed to load video file %s", videoName.c_str());
@@ -410,7 +410,7 @@ MoviePlayerSMK::MoviePlayerSMK(AGOSEngine_Feeble *vm, const char *name)
}
bool MoviePlayerSMK::load() {
- Common::String videoName = Common::String::printf("%s.smk", baseName);
+ Common::String videoName = Common::String::format("%s.smk", baseName);
if (!loadFile(videoName))
error("Failed to load video file %s", videoName.c_str());
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index ffa95506c5..eefa2460ec 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -154,7 +154,7 @@ void AGOSEngine::quickLoadOrSave() {
Subroutine *sub;
success = loadGame(genSaveName(_saveLoadSlot));
if (!success) {
- buf = Common::String::printf(_("Failed to load game state from file:\n\n%s"), filename);
+ buf = Common::String::format(_("Failed to load game state from file:\n\n%s"), filename);
} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
drawIconArray(2, me(), 0, 0);
setBitFlag(97, true);
@@ -189,7 +189,7 @@ void AGOSEngine::quickLoadOrSave() {
} else {
success = saveGame(_saveLoadSlot, _saveLoadName);
if (!success)
- buf = Common::String::printf(_("Failed to save game state to file:\n\n%s"), filename);
+ buf = Common::String::format(_("Failed to save game state to file:\n\n%s"), filename);
}
if (!success) {
@@ -197,7 +197,7 @@ void AGOSEngine::quickLoadOrSave() {
dialog.runModal();
} else if (_saveLoadType == 1) {
- buf = Common::String::printf(_("Successfully saved game state in file:\n\n%s"), filename);
+ buf = Common::String::format(_("Successfully saved game state in file:\n\n%s"), filename);
GUI::TimedMessageDialog dialog(buf, 1500);
dialog.runModal();
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 9fd7fa7d63..4abfff74f2 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -214,7 +214,7 @@ void Script::directGameLoad(int slot) {
void Script::step() {
// Prepare the base debug string
- _debugString = _scriptFile + Common::String::printf("@0x%04X: ", _currentInstruction);
+ _debugString = _scriptFile + Common::String::format("@0x%04X: ", _currentInstruction);
// Get the current opcode
byte opcode = readScript8bits();
@@ -222,7 +222,7 @@ void Script::step() {
opcode = opcode & 0x7F;
// Show the opcode debug string
- _debugString += Common::String::printf("op 0x%02X: ", opcode);
+ _debugString += Common::String::format("op 0x%02X: ", opcode);
// Only output if we're not re-doing the previous instruction
if (_currentInstruction != _oldInstruction) {
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index 44dd287ed1..c8f9586c74 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -294,7 +294,7 @@ void FileManager::saveGame(int16 slot, const char *descrip) {
if (slot == -1)
path = _vm->_initFilename;
else
- path = Common::String::printf(_vm->_saveFilename.c_str(), slot);
+ path = Common::String::format(_vm->_saveFilename.c_str(), slot);
Common::WriteStream *out = _vm->getSaveFileManager()->openForSaving(path);
if (!out) {
@@ -366,7 +366,7 @@ void FileManager::restoreGame(int16 slot) {
if (slot == -1)
path = _vm->_initFilename;
else
- path = Common::String::printf(_vm->_saveFilename.c_str(), slot);
+ path = Common::String::format(_vm->_saveFilename.c_str(), slot);
Common::SeekableReadStream *in = _vm->getSaveFileManager()->openForLoading(path);
if (!in)
diff --git a/engines/kyra/resource_intern.cpp b/engines/kyra/resource_intern.cpp
index 445ea579a0..dff8759d55 100644
--- a/engines/kyra/resource_intern.cpp
+++ b/engines/kyra/resource_intern.cpp
@@ -102,7 +102,7 @@ int TlkArchive::listMembers(Common::ArchiveMemberList &list) {
uint count = 0;
for (; count < _entryCount; ++count) {
- const Common::String name = Common::String::printf("%08u.AUD", _fileEntries[count * 2 + 0]);
+ const Common::String name = Common::String::format("%08u.AUD", _fileEntries[count * 2 + 0]);
list.push_back(Common::ArchiveMemberList::value_type(new Common::GenericArchiveMember(name, this)));
}
diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp
index c9450e3f27..c5658c0445 100644
--- a/engines/kyra/saveload.cpp
+++ b/engines/kyra/saveload.cpp
@@ -230,7 +230,7 @@ const char *KyraEngine_v1::getSavegameFilename(int num) {
Common::String KyraEngine_v1::getSavegameFilename(const Common::String &target, int num) {
assert(num >= 0 && num <= 999);
- return target + Common::String::printf(".%03d", num);
+ return target + Common::String::format(".%03d", num);
}
bool KyraEngine_v1::saveFileLoadable(int slot) {
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index edfa61e5b4..cf270942bf 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -209,7 +209,7 @@ bool StaticResource::tryKyraDatLoad() {
return false;
// load the ID map for our game
- const Common::String filenamePattern = Common::String::printf("0%01X%01X%01X000%01X", game, platform, special, lang);
+ const Common::String filenamePattern = Common::String::format("0%01X%01X%01X000%01X", game, platform, special, lang);
Common::SeekableReadStream *idMap = _vm->resource()->createReadStream(filenamePattern);
if (!idMap)
return false;
@@ -328,7 +328,7 @@ bool StaticResource::prefetchId(int id) {
ResData data;
data.id = id;
data.type = dDesc->_value.type;
- Common::SeekableReadStream *fileStream = _vm->resource()->createReadStream(Common::String::printf("%08X", dDesc->_value.filename));
+ Common::SeekableReadStream *fileStream = _vm->resource()->createReadStream(Common::String::format("%08X", dDesc->_value.filename));
if (!fileStream)
return false;
diff --git a/engines/lastexpress/data/scene.cpp b/engines/lastexpress/data/scene.cpp
index 4c8cb9bd17..8e90d93828 100644
--- a/engines/lastexpress/data/scene.cpp
+++ b/engines/lastexpress/data/scene.cpp
@@ -79,7 +79,7 @@ SceneHotspot *SceneHotspot::load(Common::SeekableReadStream *stream) {
Common::String SceneHotspot::toString() const {
Common::String output = "";
- output += Common::String::printf(" hotspot: scene=%d location=%02d action=%d param1=%02d param2=%02d param3=%02d cursor=%02d rect=(%d, %d)x(%d, %d)",
+ output += Common::String::format(" hotspot: scene=%d location=%02d action=%d param1=%02d param2=%02d param3=%02d cursor=%02d rect=(%d, %d)x(%d, %d)",
scene, location, action, param1, param2, param3, cursor, rect.left, rect.top, rect.right, rect.bottom);
return output;
@@ -209,9 +209,9 @@ Common::Rect Scene::draw(Graphics::Surface *surface) {
Common::String Scene::toString() {
Common::String output = "";
- output += Common::String::printf("Scene: name=%s, sig=%02d, entityPosition=%d, location=%d\n", _name, _sig, entityPosition, location);
- output += Common::String::printf(" car=%02d, position=%02d, type=%02d, param1=%02d\n", car, position, type, param1);
- output += Common::String::printf(" param2=%02d, param3=%02d, hotspot=%d\n", param2, param3, _hotspot);
+ output += Common::String::format("Scene: name=%s, sig=%02d, entityPosition=%d, location=%d\n", _name, _sig, entityPosition, location);
+ output += Common::String::format(" car=%02d, position=%02d, type=%02d, param1=%02d\n", car, position, type, param1);
+ output += Common::String::format(" param2=%02d, param3=%02d, hotspot=%d\n", param2, param3, _hotspot);
// Hotspots
if (_hotspots.size() != 0) {
diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp
index 36d8ed4fe4..e9aff248e4 100644
--- a/engines/lastexpress/entities/august.cpp
+++ b/engines/lastexpress/entities/august.cpp
@@ -455,11 +455,11 @@ IMPLEMENT_FUNCTION_I(20, August, function20, bool)
}
if (params->param1) {
- strcpy((char *)&parameters->seq2, Common::String::printf("%s%s", (char *)&parameters->seq1, "Gc").c_str());
+ strcpy((char *)&parameters->seq2, Common::String::format("%s%s", (char *)&parameters->seq1, "Gc").c_str());
getObjects()->update(kObjectCompartment3, kEntityPlayer, kObjectLocation1, kCursorKeepValue, kCursorKeepValue);
} else {
- strcpy((char *)&parameters->seq2, Common::String::printf("%s%s", (char *)&parameters->seq1, "Ec").c_str());
+ strcpy((char *)&parameters->seq2, Common::String::format("%s%s", (char *)&parameters->seq1, "Ec").c_str());
}
setCallback(1);
@@ -474,7 +474,7 @@ IMPLEMENT_FUNCTION_I(20, August, function20, bool)
case 1: {
getData()->location = kLocationOutsideCompartment;
- Common::String sequence2 = Common::String::printf("%s%s", (char *)&parameters->seq2, "Pc");
+ Common::String sequence2 = Common::String::format("%s%s", (char *)&parameters->seq2, "Pc");
strcpy((char *)&parameters->seq2, (char *)&parameters->seq1);
getEntities()->drawSequenceLeft(kEntityAugust, sequence2.c_str());
@@ -493,7 +493,7 @@ IMPLEMENT_FUNCTION_I(20, August, function20, bool)
case 2:
case 3:
getSavePoints()->push(kEntityAugust, kEntityMertens, kAction269436673);
- strcpy((char *)&parameters->seq2, Common::String::printf("%s%s", (char *)&parameters->seq1, "Qc").c_str());
+ strcpy((char *)&parameters->seq2, Common::String::format("%s%s", (char *)&parameters->seq1, "Qc").c_str());
getEntities()->drawSequenceLeft(kEntityAugust, (char *)&parameters->seq2);
break;
diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index 3e12df8612..33ca244c5e 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -79,7 +79,7 @@ public:
}
Common::String toString() {
- return Common::String::printf("IIII: %d %d %d %d %d %d %d %d\n", param1, param2, param3, param4, param5, param6, param7, param8);
+ return Common::String::format("IIII: %d %d %d %d %d %d %d %d\n", param1, param2, param3, param4, param5, param6, param7, param8);
}
void update(uint32 index) {
@@ -128,7 +128,7 @@ public:
}
Common::String toString() {
- return Common::String::printf("SIII: %s %d %d %d %d %d\n", seq, param4, param5, param6, param7, param8);
+ return Common::String::format("SIII: %s %d %d %d %d %d\n", seq, param4, param5, param6, param7, param8);
}
void update(uint32 index) {
@@ -168,7 +168,7 @@ public:
}
Common::String toString() {
- return Common::String::printf("SIIS: %s %d %d %s\n", seq1, param4, param5, seq2);
+ return Common::String::format("SIIS: %s %d %d %s\n", seq1, param4, param5, seq2);
}
void update(uint32 index) {
@@ -203,7 +203,7 @@ public:
}
Common::String toString() {
- return Common::String::printf("ISSI: %d %s %s %d\n", param1, seq1, seq2, param8);
+ return Common::String::format("ISSI: %d %s %s %d\n", param1, seq1, seq2, param8);
}
void update(uint32 index) {
@@ -242,7 +242,7 @@ public:
}
Common::String toString() {
- return Common::String::printf("ISII: %d %s %d %d %d %d\n", param1, seq, param5, param6, param7, param8);
+ return Common::String::format("ISII: %d %s %d %d %d %d\n", param1, seq, param5, param6, param7, param8);
}
void update(uint32 index) {
@@ -282,7 +282,7 @@ public:
}
Common::String toString() {
- return Common::String::printf("SSII: %s %s %d %d\n", seq1, seq2, param7, param8);
+ return Common::String::format("SSII: %s %s %d %d\n", seq1, seq2, param7, param8);
}
void update(uint32 index) {
@@ -315,7 +315,7 @@ public:
}
Common::String toString() {
- return Common::String::printf("SSS: %s %s %s\n", seq1, seq2, seq3);
+ return Common::String::format("SSS: %s %s %s\n", seq1, seq2, seq3);
}
void update(uint32) {
@@ -343,7 +343,7 @@ public:
}
Common::String toString() {
- return Common::String::printf("IISS: %d %d %s %s\n", param1, param2, seq1, seq2);
+ return Common::String::format("IISS: %d %d %s %s\n", param1, param2, seq1, seq2);
}
void update(uint32 index) {
@@ -382,7 +382,7 @@ public:
}
Common::String toString() {
- return Common::String::printf("IISI: %d %d %s %d %d %d\n", param1, param2, seq, param6, param7, param8);
+ return Common::String::format("IISI: %d %d %s %d %d %d\n", param1, param2, seq, param6, param7, param8);
}
void update(uint32 index) {
@@ -426,7 +426,7 @@ public:
}
Common::String toString() {
- return Common::String::printf("IIIS: %d %d %d %s %d %d\n", param1, param2, param3, seq, param7, param8);
+ return Common::String::format("IIIS: %d %d %d %s %d %d\n", param1, param2, param3, seq, param7, param8);
}
void update(uint32 index) {
@@ -579,20 +579,20 @@ public:
Common::String toString() {
Common::String str = "";
- str += Common::String::printf("Entity position: %d - Location: %d - Car: %d\n", entityPosition, location, car);
- str += Common::String::printf("Entity: %d - Item: %d - Direction: %d\n", entity, inventoryItem, direction);
- str += Common::String::printf("Clothes: %d - Position: %d - Direction switch: %d\n", clothes, position, directionSwitch);
+ str += Common::String::format("Entity position: %d - Location: %d - Car: %d\n", entityPosition, location, car);
+ str += Common::String::format("Entity: %d - Item: %d - Direction: %d\n", entity, inventoryItem, direction);
+ str += Common::String::format("Clothes: %d - Position: %d - Direction switch: %d\n", clothes, position, directionSwitch);
str += "\n";
- str += Common::String::printf("field_497: %02d - field_49B: %i - field_4A1: %i\n", field_497, field_49B, field_4A1);
- str += Common::String::printf("field_4A9: %02d - field_4AA: %i - Car 2: %d\n", field_4A9, field_4AA, car2);
+ str += Common::String::format("field_497: %02d - field_49B: %i - field_4A1: %i\n", field_497, field_49B, field_4A1);
+ str += Common::String::format("field_4A9: %02d - field_4AA: %i - Car 2: %d\n", field_4A9, field_4AA, car2);
str += "\n";
str += "Sequence: " + sequenceName + " - Sequence 2: " + sequenceName2 + "\n";
str += "Sequence prefix: " + sequenceNamePrefix + " - Sequence copy: " + sequenceNameCopy + "\n";
- str += Common::String::printf("Current frame: %i - Current frame 2: %i - Process entity: %d\n", currentFrame, currentFrame2, doProcessEntity);
+ str += Common::String::format("Current frame: %i - Current frame 2: %i - Process entity: %d\n", currentFrame, currentFrame2, doProcessEntity);
str += "\n";
- str += Common::String::printf("Current call: %d\n", currentCall);
- str += Common::String::printf("Functions: %d %d %d %d %d %d %d %d\n", callbacks[0], callbacks[1], callbacks[2], callbacks[3], callbacks[4], callbacks[5], callbacks[6], callbacks[7]);
- str += Common::String::printf("Callbacks: %d %d %d %d %d %d %d %d\n", callbacks[8], callbacks[9], callbacks[10], callbacks[11], callbacks[12], callbacks[13], callbacks[14], callbacks[15]);
+ str += Common::String::format("Current call: %d\n", currentCall);
+ str += Common::String::format("Functions: %d %d %d %d %d %d %d %d\n", callbacks[0], callbacks[1], callbacks[2], callbacks[3], callbacks[4], callbacks[5], callbacks[6], callbacks[7]);
+ str += Common::String::format("Callbacks: %d %d %d %d %d %d %d %d\n", callbacks[8], callbacks[9], callbacks[10], callbacks[11], callbacks[12], callbacks[13], callbacks[14], callbacks[15]);
return str;
}
diff --git a/engines/lastexpress/game/action.cpp b/engines/lastexpress/game/action.cpp
index 84f406931d..8058d22f05 100644
--- a/engines/lastexpress/game/action.cpp
+++ b/engines/lastexpress/game/action.cpp
@@ -454,7 +454,7 @@ IMPLEMENT_ACTION(savePoint)
IMPLEMENT_ACTION(playSound)
// Check that the file is not already buffered
- if (hotspot.param2 || !getSound()->isBuffered(Common::String::printf("LIB%03d", hotspot.param1), true))
+ if (hotspot.param2 || !getSound()->isBuffered(Common::String::format("LIB%03d", hotspot.param1), true))
getSound()->playSoundEvent(kEntityPlayer, hotspot.param1, hotspot.param2);
return kSceneInvalid;
@@ -464,7 +464,7 @@ IMPLEMENT_ACTION(playSound)
// Action 4
IMPLEMENT_ACTION(playMusic)
// Check that the file is not already buffered
- Common::String filename = Common::String::printf("MUS%03d", hotspot.param1);
+ Common::String filename = Common::String::format("MUS%03d", hotspot.param1);
if (!getSound()->isBuffered(filename) && (hotspot.param1 != 50 || getProgress().chapter == kChapter5))
getSound()->playSound(kEntityPlayer, filename, SoundManager::kFlagDefault, hotspot.param2);
@@ -1182,7 +1182,7 @@ IMPLEMENT_ACTION(29)
getProgress().field_C = 1;
getSound()->playSoundEvent(kEntityPlayer, hotspot.param1, hotspot.param2);
- Common::String filename = Common::String::printf("MUS%03d", hotspot.param3);
+ Common::String filename = Common::String::format("MUS%03d", hotspot.param3);
if (!getSound()->isBuffered(filename))
getSound()->playSound(kEntityPlayer, filename, SoundManager::kFlagDefault);
@@ -1407,7 +1407,7 @@ IMPLEMENT_ACTION(playMusicChapter)
}
if (id) {
- Common::String filename = Common::String::printf("MUS%03d", id);
+ Common::String filename = Common::String::format("MUS%03d", id);
if (!getSound()->isBuffered(filename))
getSound()->playSound(kEntityPlayer, filename, SoundManager::kFlagDefault);
@@ -1439,7 +1439,7 @@ IMPLEMENT_ACTION(playMusicChapterSetupTrain)
break;
}
- Common::String filename = Common::String::printf("MUS%03d", hotspot.param1);
+ Common::String filename = Common::String::format("MUS%03d", hotspot.param1);
if (!getSound()->isBuffered(filename) && hotspot.param3 & id) {
getSound()->playSound(kEntityPlayer, filename, SoundManager::kFlagDefault);
diff --git a/engines/lastexpress/game/entities.cpp b/engines/lastexpress/game/entities.cpp
index 40fae3ae9b..adba0f1b4c 100644
--- a/engines/lastexpress/game/entities.cpp
+++ b/engines/lastexpress/game/entities.cpp
@@ -1532,7 +1532,7 @@ void Entities::getSequenceName(EntityIndex index, EntityDirection direction, Com
case 1:
if (data->entityPosition < kPosition_2587)
- sequence1 = Common::String::printf("%02d%01d-01u.seq", index, data->clothes);
+ sequence1 = Common::String::format("%02d%01d-01u.seq", index, data->clothes);
break;
case 2:
@@ -1554,22 +1554,22 @@ void Entities::getSequenceName(EntityIndex index, EntityDirection direction, Com
break;
if (data->entityPosition >= kPosition_8513) {
- sequence1 = Common::String::printf("%02d%01d-%02deu.seq", index, data->clothes, position);
+ sequence1 = Common::String::format("%02d%01d-%02deu.seq", index, data->clothes, position);
} else {
- sequence1 = Common::String::printf("%02d%01d-03u.seq", index, data->clothes);
- sequence2 = Common::String::printf("%02d%01d-%02deu.seq", index, data->clothes, position);
+ sequence1 = Common::String::format("%02d%01d-03u.seq", index, data->clothes);
+ sequence2 = Common::String::format("%02d%01d-%02deu.seq", index, data->clothes, position);
data->field_4A9 = true;
}
break;
case 18:
if (data->entityPosition < kPosition_9270)
- sequence1 = Common::String::printf("%02d%01d-18u.seq", index, data->clothes);
+ sequence1 = Common::String::format("%02d%01d-18u.seq", index, data->clothes);
break;
case 22:
if (getData(kEntityPlayer)->entityPosition > data->entityPosition)
- sequence1 = Common::String::printf("%02d%01d-22u.seq", index, data->clothes);
+ sequence1 = Common::String::format("%02d%01d-22u.seq", index, data->clothes);
break;
case 23:
@@ -1592,18 +1592,18 @@ void Entities::getSequenceName(EntityIndex index, EntityDirection direction, Com
break;
if (data->entityPosition >= kPosition_2087) {
- sequence1 = Common::String::printf("%02d%01d-38u.seq", index, data->clothes);
+ sequence1 = Common::String::format("%02d%01d-38u.seq", index, data->clothes);
data->field_4A9 = true;
} else {
- sequence1 = Common::String::printf("%02d%01d-%02deu.seq", index, data->clothes, position);
- sequence2 = Common::String::printf("%02d%01d-38u.seq", index, data->clothes);
+ sequence1 = Common::String::format("%02d%01d-%02deu.seq", index, data->clothes, position);
+ sequence2 = Common::String::format("%02d%01d-38u.seq", index, data->clothes);
data->field_4AA = true;
}
break;
case 40:
if (getData(kEntityPlayer)->entityPosition > data->entityPosition)
- sequence1 = Common::String::printf("%02d%01d-40u.seq", index, data->clothes);
+ sequence1 = Common::String::format("%02d%01d-40u.seq", index, data->clothes);
break;
}
break;
@@ -1615,7 +1615,7 @@ void Entities::getSequenceName(EntityIndex index, EntityDirection direction, Com
case 1:
if (getData(kEntityPlayer)->entityPosition < data->entityPosition)
- sequence1 = Common::String::printf("%02d%01d-01d.seq", index, data->clothes);
+ sequence1 = Common::String::format("%02d%01d-01d.seq", index, data->clothes);
break;
case 2:
@@ -1637,23 +1637,23 @@ void Entities::getSequenceName(EntityIndex index, EntityDirection direction, Com
break;
if (data->entityPosition <= kPosition_8513) {
- sequence1 = Common::String::printf("%02d%01d-03d.seq", index, data->clothes);
+ sequence1 = Common::String::format("%02d%01d-03d.seq", index, data->clothes);
data->field_4A9 = true;
} else {
- sequence1 = Common::String::printf("%02d%01d-%02ded.seq", index, data->clothes, position);
- sequence2 = Common::String::printf("%02d%01d-03d.seq", index, data->clothes);
+ sequence1 = Common::String::format("%02d%01d-%02ded.seq", index, data->clothes, position);
+ sequence2 = Common::String::format("%02d%01d-03d.seq", index, data->clothes);
data->field_4AA = true;
}
break;
case 18:
if (getData(kEntityPlayer)->entityPosition < data->entityPosition)
- sequence1 = Common::String::printf("%02d%01d-18d.seq", index, data->clothes);
+ sequence1 = Common::String::format("%02d%01d-18d.seq", index, data->clothes);
break;
case 22:
if (data->entityPosition > kPosition_850)
- sequence1 = Common::String::printf("%02d%01d-22d.seq", index, data->clothes);
+ sequence1 = Common::String::format("%02d%01d-22d.seq", index, data->clothes);
break;
case 23:
@@ -1676,17 +1676,17 @@ void Entities::getSequenceName(EntityIndex index, EntityDirection direction, Com
break;
if (data->entityPosition <= kPosition_2087) {
- sequence1 = Common::String::printf("%02d%01d-%02ded.seq", index, data->clothes, position);
+ sequence1 = Common::String::format("%02d%01d-%02ded.seq", index, data->clothes, position);
} else {
- sequence1 = Common::String::printf("%02d%01d-38d.seq", index, data->clothes);
- sequence2 = Common::String::printf("%02d%01d-%02ded.seq", index, data->clothes, position);
+ sequence1 = Common::String::format("%02d%01d-38d.seq", index, data->clothes);
+ sequence2 = Common::String::format("%02d%01d-%02ded.seq", index, data->clothes, position);
data->field_4A9 = true;
}
break;
case 40:
if (getData(kEntityPlayer)->entityPosition > kPosition_8013)
- sequence1 = Common::String::printf("%02d%01d-40d.seq", index, data->clothes);
+ sequence1 = Common::String::format("%02d%01d-40d.seq", index, data->clothes);
break;
}
break;
@@ -1694,7 +1694,7 @@ void Entities::getSequenceName(EntityIndex index, EntityDirection direction, Com
// First part of sequence is already set
case kDirectionLeft:
case kDirectionRight:
- sequence1 = Common::String::printf("%s%02d.seq", data->sequenceNamePrefix.c_str(), position);
+ sequence1 = Common::String::format("%s%02d.seq", data->sequenceNamePrefix.c_str(), position);
break;
}
}
diff --git a/engines/lastexpress/game/inventory.cpp b/engines/lastexpress/game/inventory.cpp
index 0223176cb6..ae9aca56b6 100644
--- a/engines/lastexpress/game/inventory.cpp
+++ b/engines/lastexpress/game/inventory.cpp
@@ -422,7 +422,7 @@ Common::String Inventory::toString() {
Common::String ret = "";
for (int i = 0; i < kPortraitOriginal; i++)
- ret += Common::String::printf("%d : %s\n", i, _entries[i].toString().c_str());
+ ret += Common::String::format("%d : %s\n", i, _entries[i].toString().c_str());
return ret;
}
diff --git a/engines/lastexpress/game/inventory.h b/engines/lastexpress/game/inventory.h
index af3478bfae..bae6c8d261 100644
--- a/engines/lastexpress/game/inventory.h
+++ b/engines/lastexpress/game/inventory.h
@@ -76,7 +76,7 @@ public:
}
Common::String toString() {
- return Common::String::printf("{ %d - %d - %d - %d - %d - %d - %d }", cursor, scene, field_2, isSelectable, isPresent, manualSelect, location);
+ return Common::String::format("{ %d - %d - %d - %d - %d - %d - %d }", cursor, scene, field_2, isSelectable, isPresent, manualSelect, location);
}
void saveLoadWithSerializer(Common::Serializer &s) {
diff --git a/engines/lastexpress/game/object.cpp b/engines/lastexpress/game/object.cpp
index f0e81781b6..4f296debcb 100644
--- a/engines/lastexpress/game/object.cpp
+++ b/engines/lastexpress/game/object.cpp
@@ -35,7 +35,7 @@
namespace LastExpress {
Common::String Objects::Object::toString() {
- return Common::String::printf("{ %s - %d - %d - %d - %d }", ENTITY_NAME(entity), location, cursor, cursor2, location2);
+ return Common::String::format("{ %s - %d - %d - %d - %d }", ENTITY_NAME(entity), location, cursor, cursor2, location2);
}
Objects::Objects(LastExpressEngine *engine) : _engine(engine) {}
@@ -101,7 +101,7 @@ Common::String Objects::toString() {
Common::String ret = "";
for (int i = 0; i < ARRAYSIZE(_objects); i++)
- ret += Common::String::printf("%d : %s\n", i, _objects[i].toString().c_str());
+ ret += Common::String::format("%d : %s\n", i, _objects[i].toString().c_str());
return ret;
}
diff --git a/engines/lastexpress/game/savepoint.h b/engines/lastexpress/game/savepoint.h
index 6b2c12751d..ca507ab8ab 100644
--- a/engines/lastexpress/game/savepoint.h
+++ b/engines/lastexpress/game/savepoint.h
@@ -73,7 +73,7 @@ struct SavePoint {
}
Common::String toString() {
- return Common::String::printf("{ %s - %d - %s - %s }", ENTITY_NAME(entity1), action, ENTITY_NAME(entity2), param.charValue);
+ return Common::String::format("{ %s - %d - %s - %s }", ENTITY_NAME(entity1), action, ENTITY_NAME(entity2), param.charValue);
}
};
@@ -97,7 +97,7 @@ public:
}
Common::String toString() {
- return Common::String::printf(" { %s - %d - %s - %d }", ENTITY_NAME(entity1), action, ENTITY_NAME(entity2), param);
+ return Common::String::format(" { %s - %d - %s - %d }", ENTITY_NAME(entity1), action, ENTITY_NAME(entity2), param);
}
};
diff --git a/engines/lastexpress/game/scenes.cpp b/engines/lastexpress/game/scenes.cpp
index 7fd0a3f0ac..cf50d3e425 100644
--- a/engines/lastexpress/game/scenes.cpp
+++ b/engines/lastexpress/game/scenes.cpp
@@ -78,7 +78,7 @@ void SceneManager::loadSceneDataFile(ArchiveIndex archive) {
case kArchiveCd1:
case kArchiveCd2:
case kArchiveCd3:
- if (!_sceneLoader->load(getArchive(Common::String::printf("CD%iTRAIN.DAT", archive))))
+ if (!_sceneLoader->load(getArchive(Common::String::format("CD%iTRAIN.DAT", archive))))
error("SceneManager::loadSceneDataFile: cannot load data file CD%iTRAIN.DAT", archive);
break;
@@ -586,7 +586,7 @@ void SceneManager::updateDoorsAndClock() {
// Load door sequence
Scene *scene = getScenes()->get(getState()->scene);
- Common::String name = Common::String::printf("633X%c-%02d.seq", (index - firstIndex) + 65, scene->position);
+ Common::String name = Common::String::format("633X%c-%02d.seq", (index - firstIndex) + 65, scene->position);
Sequence *sequence = loadSequence1(name, 255);
// If the sequence doesn't exists, skip
diff --git a/engines/lastexpress/game/state.h b/engines/lastexpress/game/state.h
index 135ee6bb4e..da81794ce1 100644
--- a/engines/lastexpress/game/state.h
+++ b/engines/lastexpress/game/state.h
@@ -466,7 +466,7 @@ public:
for (uint i = 0; i < 128; i++) {
Common::String name = "";
uint val = getValueName(i, &name);
- ret += Common::String::printf("(%03d) %s = %d\n", i, name.c_str(), val);
+ ret += Common::String::format("(%03d) %s = %d\n", i, name.c_str(), val);
}
return ret;
@@ -527,9 +527,9 @@ public:
uint8 minutes = 0;
getHourMinutes(time, &hours, &minutes);
- ret += Common::String::printf("Time: %d (%d:%d) - Time delta: %d - Ticks: %d\n", time, hours, minutes, timeDelta, timeTicks);
- ret += Common::String::printf("Brightness: %d - Volume: %d - UseBackup: %d\n", brightness, volume, sceneUseBackup);
- ret += Common::String::printf("Scene: %d - Scene backup: %d - Scene backup 2: %d\n", scene, sceneBackup, sceneBackup2);
+ ret += Common::String::format("Time: %d (%d:%d) - Time delta: %d - Ticks: %d\n", time, hours, minutes, timeDelta, timeTicks);
+ ret += Common::String::format("Brightness: %d - Volume: %d - UseBackup: %d\n", brightness, volume, sceneUseBackup);
+ ret += Common::String::format("Scene: %d - Scene backup: %d - Scene backup 2: %d\n", scene, sceneBackup, sceneBackup2);
return ret;
}
@@ -598,11 +598,11 @@ public:
Common::String toString() {
Common::String ret = "";
- ret += Common::String::printf("Unknown: 0:%02d - 3:%02d - 4:%02d - 5:%02d\n", flag_0, flag_3, flag_4, flag_5);
- ret += Common::String::printf("FrameInterval: %02d - ShouldRedraw:%02d - ShouldDrawEggOrHourGlass:%02d\n", frameInterval, shouldRedraw, shouldDrawEggOrHourGlass);
- ret += Common::String::printf("IsGameRunning: %02d\n", isGameRunning);
- ret += Common::String::printf("Mouse: RightClick:%02d - LeftClick:%02d\n", mouseRightClick, mouseLeftClick);
- ret += Common::String::printf("Entities: 0:%02d - 1:%02d\n", flag_entities_0, flag_entities_1);
+ ret += Common::String::format("Unknown: 0:%02d - 3:%02d - 4:%02d - 5:%02d\n", flag_0, flag_3, flag_4, flag_5);
+ ret += Common::String::format("FrameInterval: %02d - ShouldRedraw:%02d - ShouldDrawEggOrHourGlass:%02d\n", frameInterval, shouldRedraw, shouldDrawEggOrHourGlass);
+ ret += Common::String::format("IsGameRunning: %02d\n", isGameRunning);
+ ret += Common::String::format("Mouse: RightClick:%02d - LeftClick:%02d\n", mouseRightClick, mouseLeftClick);
+ ret += Common::String::format("Entities: 0:%02d - 1:%02d\n", flag_entities_0, flag_entities_1);
return ret;
}
diff --git a/engines/lastexpress/helpers.h b/engines/lastexpress/helpers.h
index eb54a1a3ce..fa8eeb25e5 100644
--- a/engines/lastexpress/helpers.h
+++ b/engines/lastexpress/helpers.h
@@ -94,7 +94,7 @@ extern const char *g_actionNames[];
extern const char *g_directionNames[];
extern const char *g_entityNames[];
-#define ACTION_NAME(action) (action > 18 ? Common::String::printf("%d", action).c_str() : g_actionNames[action])
+#define ACTION_NAME(action) (action > 18 ? Common::String::format("%d", action).c_str() : g_actionNames[action])
#define DIRECTION_NAME(direction) (direction >= 6 ? "INVALID" : g_directionNames[direction])
#define ENTITY_NAME(index) (index >= 40 ? "INVALID" : g_entityNames[index])
diff --git a/engines/parallaction/detection.cpp b/engines/parallaction/detection.cpp
index e00a087923..f67a77aa21 100644
--- a/engines/parallaction/detection.cpp
+++ b/engines/parallaction/detection.cpp
@@ -325,7 +325,7 @@ int ParallactionMetaEngine::getMaximumSaveSlot() const { return 99; }
void ParallactionMetaEngine::removeSaveState(const char *target, int slot) const {
Common::String filename = ConfMan.getDomain(target)->getVal("gameid");
- filename += Common::String::printf(".0%02d", slot);
+ filename += Common::String::format(".0%02d", slot);
g_system->getSavefileManager()->removeSavefile(filename);
}
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 2292692ac1..80da7b1375 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -676,7 +676,7 @@ SaveStateList SciMetaEngine::listSaves(const char *target) const {
}
SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
- Common::String fileName = Common::String::printf("%s.%03d", target, slot);
+ Common::String fileName = Common::String::format("%s.%03d", target, slot);
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fileName);
if (in) {
@@ -727,12 +727,12 @@ SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int sl
int SciMetaEngine::getMaximumSaveSlot() const { return 99; }
void SciMetaEngine::removeSaveState(const char *target, int slot) const {
- Common::String fileName = Common::String::printf("%s.%03d", target, slot);
+ Common::String fileName = Common::String::format("%s.%03d", target, slot);
g_system->getSavefileManager()->removeSavefile(fileName);
}
Common::Error SciEngine::loadGameState(int slot) {
- Common::String fileName = Common::String::printf("%s.%03d", _targetName.c_str(), slot);
+ Common::String fileName = Common::String::format("%s.%03d", _targetName.c_str(), slot);
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
Common::SeekableReadStream *in = saveFileMan->openForLoading(fileName);
@@ -751,7 +751,7 @@ Common::Error SciEngine::loadGameState(int slot) {
}
Common::Error SciEngine::saveGameState(int slot, const char *desc) {
- Common::String fileName = Common::String::printf("%s.%03d", _targetName.c_str(), slot);
+ Common::String fileName = Common::String::format("%s.%03d", _targetName.c_str(), slot);
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
Common::OutSaveFile *out = saveFileMan->openForSaving(fileName);
const char *version = "";
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index b1ee6abaff..d17d4f3fb3 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -66,12 +66,12 @@ const Common::String &Kernel::getSelectorName(uint selector) {
// We need this for proper workaround tables
// TODO: maybe check, if there is a fixed selector-table and error() out in that case
for (uint loopSelector = _selectorNames.size(); loopSelector <= selector; ++loopSelector)
- _selectorNames.push_back(Common::String::printf("<noname%d>", loopSelector));
+ _selectorNames.push_back(Common::String::format("<noname%d>", loopSelector));
}
// Ensure that the selector has a name
if (_selectorNames[selector].empty())
- _selectorNames[selector] = Common::String::printf("<noname%d>", selector);
+ _selectorNames[selector] = Common::String::format("<noname%d>", selector);
return _selectorNames[selector];
}
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 3b41c851e1..324cb642d4 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -584,7 +584,7 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
g_system->getTimeAndDate(curTime);
curTime.tm_year += 1900; // fixup year
curTime.tm_mon++; // fixup month
- game_description = Common::String::printf("%02d.%02d.%04d / %02d:%02d:%02d", curTime.tm_mday, curTime.tm_mon, curTime.tm_year, curTime.tm_hour, curTime.tm_min, curTime.tm_sec);
+ game_description = Common::String::format("%02d.%02d.%04d / %02d:%02d:%02d", curTime.tm_mday, curTime.tm_mon, curTime.tm_year, curTime.tm_hour, curTime.tm_min, curTime.tm_sec);
}
delete dialog;
g_sci->_soundCmd->pauseAll(false); // unpause music ( we can't have it paused during save)
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 6d3cd78586..13fe14a995 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -424,12 +424,12 @@ reg_t kStub(EngineState *s, int argc, reg_t *argv) {
}
Common::String warningMsg = "Dummy function k" + kernel->getKernelName(kernelCallNr) +
- Common::String::printf("[%x]", kernelCallNr) +
+ Common::String::format("[%x]", kernelCallNr) +
" invoked. Params: " +
- Common::String::printf("%d", argc) + " (";
+ Common::String::format("%d", argc) + " (";
for (int i = 0; i < argc; i++) {
- warningMsg += Common::String::printf("%04x:%04x", PRINT_REG(argv[i]));
+ warningMsg += Common::String::format("%04x:%04x", PRINT_REG(argv[i]));
warningMsg += (i == argc - 1 ? ")" : ", ");
}
diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp
index e97ae38702..f52068bc8b 100644
--- a/engines/sci/engine/kvideo.cpp
+++ b/engines/sci/engine/kvideo.cpp
@@ -287,10 +287,10 @@ reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) {
// Looks to be setting the video size and position. Called with 4 extra integer
// parameters (e.g. 86, 41, 235, 106)
default:
- warningMsg = Common::String::printf("PlayVMD - unsupported subop %d. Params: %d (", operation, argc);
+ warningMsg = Common::String::format("PlayVMD - unsupported subop %d. Params: %d (", operation, argc);
for (int i = 0; i < argc; i++) {
- warningMsg += Common::String::printf("%04x:%04x", PRINT_REG(argv[i]));
+ warningMsg += Common::String::format("%04x:%04x", PRINT_REG(argv[i]));
warningMsg += (i == argc - 1 ? ")" : ", ");
}
diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp
index 6e1b326c4f..046ed4e500 100644
--- a/engines/sci/engine/message.cpp
+++ b/engines/sci/engine/message.cpp
@@ -218,7 +218,7 @@ int MessageState::nextMessage(reg_t buf) {
return record.talker;
} else {
MessageTuple &t = _cursorStack.top();
- outputString(buf, Common::String::printf("Msg %d: %d %d %d %d not found", _cursorStack.getModule(), t.noun, t.verb, t.cond, t.seq));
+ outputString(buf, Common::String::format("Msg %d: %d %d %d %d not found", _cursorStack.getModule(), t.noun, t.verb, t.cond, t.seq));
return 0;
}
} else {
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 7342f8ca7b..650f01469a 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -144,13 +144,13 @@ static bool validate_variable(reg_t *r, reg_t *stack_base, int type, int max, in
const char *names[4] = {"global", "local", "temp", "param"};
if (index < 0 || index >= max) {
- Common::String txt = Common::String::printf(
+ Common::String txt = Common::String::format(
"[VM] Attempt to use invalid %s variable %04x ",
names[type], index);
if (max == 0)
txt += "(variable type invalid)";
else
- txt += Common::String::printf("(out of range [%d..%d])", 0, max - 1);
+ txt += Common::String::format("(out of range [%d..%d])", 0, max - 1);
if (type == VAR_PARAM || type == VAR_TEMP) {
int total_offset = r - stack_base;
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 559d9f07ba..23a6b24fd4 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -463,7 +463,7 @@ SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroun
curMethodName = g_sci->getKernel()->getSelectorName(lastCall->debugSelector);
} else if (lastCall->debugExportId != -1) {
curObjectName = "";
- curMethodName = curMethodName.printf("export %d", lastCall->debugExportId);
+ curMethodName = Common::String::format("export %d", lastCall->debugExportId);
}
}
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 123c1e38c3..768aa054a5 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -779,7 +779,7 @@ void ChunkResourceSource::loadResource(ResourceManager *resMan, Resource *res) {
}
void ResourceManager::addResourcesFromChunk(uint16 id) {
- addSource(new ChunkResourceSource(Common::String::printf("Chunk %d", id), id));
+ addSource(new ChunkResourceSource(Common::String::format("Chunk %d", id), id));
scanNewSources();
}
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index f8d25efe73..0df75d53fb 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -743,7 +743,7 @@ bool SciEngine::hasMacIconBar() const {
}
Common::String SciEngine::getSavegameName(int nr) const {
- return _targetName + Common::String::printf(".%03d", nr);
+ return _targetName + Common::String::format(".%03d", nr);
}
Common::String SciEngine::getSavegamePattern() const {
diff --git a/engines/scumm/he/logic_he.cpp b/engines/scumm/he/logic_he.cpp
index 36aeaf4a3c..ed92c33105 100644
--- a/engines/scumm/he/logic_he.cpp
+++ b/engines/scumm/he/logic_he.cpp
@@ -77,11 +77,11 @@ int32 LogicHE::dispatch(int op, int numArgs, int32 *args) {
#if 1
Common::String str;
- str = Common::String::printf("LogicHE::dispatch(%d, %d, [", op, numArgs);
+ str = Common::String::format("LogicHE::dispatch(%d, %d, [", op, numArgs);
if (numArgs > 0)
- str += Common::String::printf("%d", args[0]);
+ str += Common::String::format("%d", args[0]);
for (int i = 1; i < numArgs; i++) {
- str += Common::String::printf(", %d", args[i]);
+ str += Common::String::format(", %d", args[i]);
}
str += "])";
diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp
index 3a672d57b5..8cccbc227a 100644
--- a/engines/scumm/imuse/imuse.cpp
+++ b/engines/scumm/imuse/imuse.cpp
@@ -700,9 +700,9 @@ int32 IMuseInternal::doCommand_internal(int numargs, int a[]) {
{
Common::String string = "doCommand - ";
- string += Common::String::printf("%d (%d/%d)", a[0], (int)param, (int)cmd);
+ string += Common::String::format("%d (%d/%d)", a[0], (int)param, (int)cmd);
for (i = 1; i < numargs; ++i)
- string += Common::String::printf(", %d", a[i]);
+ string += Common::String::format(", %d", a[i]);
debugC(DEBUG_IMUSE, "%s", string.c_str());
}
diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp
index a2dab9658d..0bdf35a37d 100644
--- a/engines/teenagent/detection.cpp
+++ b/engines/teenagent/detection.cpp
@@ -137,7 +137,7 @@ public:
// }
static Common::String generateGameStateFileName(const char *target, int slot) {
- return Common::String::printf("%s.%02d", target, slot);
+ return Common::String::format("%s.%02d", target, slot);
}
virtual SaveStateList listSaves(const char *target) const {
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index c30809eef4..4d300ff7fd 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -197,9 +197,9 @@ void TeenAgentEngine::deinit() {
Common::Error TeenAgentEngine::loadGameState(int slot) {
debug(0, "loading from slot %d", slot);
Common::ScopedPtr<Common::InSaveFile>
- in(_saveFileMan->openForLoading(Common::String::printf("teenagent.%02d", slot)));
+ in(_saveFileMan->openForLoading(Common::String::format("teenagent.%02d", slot)));
if (!in)
- in.reset(_saveFileMan->openForLoading(Common::String::printf("teenagent.%d", slot)));
+ in.reset(_saveFileMan->openForLoading(Common::String::format("teenagent.%d", slot)));
if (!in)
return Common::kReadPermissionDenied;
@@ -232,7 +232,7 @@ Common::Error TeenAgentEngine::loadGameState(int slot) {
Common::Error TeenAgentEngine::saveGameState(int slot, const char *desc) {
debug(0, "saving to slot %d", slot);
- Common::ScopedPtr<Common::OutSaveFile> out(_saveFileMan->openForSaving(Common::String::printf("teenagent.%02d", slot)));
+ Common::ScopedPtr<Common::OutSaveFile> out(_saveFileMan->openForSaving(Common::String::format("teenagent.%02d", slot)));
if (!out)
return Common::kWritingFailed;
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index 086db21c67..079239c920 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -769,7 +769,7 @@ TestExitStatus GFXtests::scaledCursors() {
// Switch Graphics mode
// FIXME: Crashes with "3x" mode now.:
- info = Common::String::printf("Testing : Scaled cursors with GFX Mode %s\n", gfxMode->name);
+ info = Common::String::format("Testing : Scaled cursors with GFX Mode %s\n", gfxMode->name);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("\tInfo! Skipping sub-test : Scaled Cursors :: GFX Mode %s\n", gfxMode->name);
gfxMode++;
@@ -1104,7 +1104,7 @@ TestExitStatus GFXtests::pixelFormats() {
Common::Point pt(0, 170);
Common::String msg;
- msg = Common::String::printf("Testing Pixel Formats, %d of %d", numFormatsTested, pfList.size());
+ msg = Common::String::format("Testing Pixel Formats, %d of %d", numFormatsTested, pfList.size());
Testsuite::writeOnScreen(msg, pt, true);
// CopyRectToScreen could have been used, but that may involve writing code which
diff --git a/engines/testbed/misc.cpp b/engines/testbed/misc.cpp
index 2159974c51..36687f570e 100644
--- a/engines/testbed/misc.cpp
+++ b/engines/testbed/misc.cpp
@@ -28,7 +28,7 @@
namespace Testbed {
Common::String MiscTests::getHumanReadableFormat(TimeDate &td) {
- return Common::String::printf("%d:%d:%d on %d/%d/%d (dd/mm/yyyy)", td.tm_hour, td.tm_min, td.tm_sec, td.tm_mday, td.tm_mon + 1, td.tm_year + 1900);
+ return Common::String::format("%d:%d:%d on %d/%d/%d (dd/mm/yyyy)", td.tm_hour, td.tm_min, td.tm_sec, td.tm_mday, td.tm_mon + 1, td.tm_year + 1900);
}
void MiscTests::timerCallback(void *arg) {
diff --git a/engines/testbed/sound.cpp b/engines/testbed/sound.cpp
index e256621553..615793da74 100644
--- a/engines/testbed/sound.cpp
+++ b/engines/testbed/sound.cpp
@@ -193,7 +193,7 @@ TestExitStatus SoundSubsystem::audiocdOutput() {
AudioCD.play(i, 1, 0, 0);
while (AudioCD.isPlaying()) {
g_system->delayMillis(500);
- Testsuite::writeOnScreen(Common::String::printf("Playing Now: track%02d", i), pt);
+ Testsuite::writeOnScreen(Common::String::format("Playing Now: track%02d", i), pt);
}
g_system->delayMillis(500);
}
@@ -234,19 +234,19 @@ TestExitStatus SoundSubsystem::sampleRates() {
Common::Point pt(0, 100);
mixer->playStream(Audio::Mixer::kPlainSoundType, &handle, s1);
- Testsuite::writeOnScreen(Common::String::printf("Playing at smaple rate: %d", s1->getRate()), pt);
+ Testsuite::writeOnScreen(Common::String::format("Playing at smaple rate: %d", s1->getRate()), pt);
g_system->delayMillis(1000);
mixer->stopHandle(handle);
g_system->delayMillis(1000);
mixer->playStream(Audio::Mixer::kSpeechSoundType, &handle, s2);
- Testsuite::writeOnScreen(Common::String::printf("Playing at sample rate : %d", s2->getRate()), pt);
+ Testsuite::writeOnScreen(Common::String::format("Playing at sample rate : %d", s2->getRate()), pt);
g_system->delayMillis(1000);
mixer->stopHandle(handle);
g_system->delayMillis(1000);
mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, s3);
- Testsuite::writeOnScreen(Common::String::printf("Playing at sample rate : %d", s3->getRate()), pt);
+ Testsuite::writeOnScreen(Common::String::format("Playing at sample rate : %d", s3->getRate()), pt);
g_system->delayMillis(1000);
mixer->stopHandle(handle);
g_system->delayMillis(1000);
diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp
index 071fba8c2c..1ceecb8ebf 100644
--- a/engines/testbed/testbed.cpp
+++ b/engines/testbed/testbed.cpp
@@ -48,10 +48,10 @@ void TestbedExitDialog::init() {
GUI::ListWidget::ColorList colors;
for (Common::Array<Testsuite *>::const_iterator i = _testsuiteList.begin(); i != _testsuiteList.end(); ++i) {
- strArray.push_back(Common::String::printf("%s :", (*i)->getDescription()));
+ strArray.push_back(Common::String::format("%s :", (*i)->getDescription()));
colors.push_back(GUI::ThemeEngine::kFontColorNormal);
if ((*i)->isEnabled()) {
- strArray.push_back(Common::String::printf("Passed: %d Failed: %d Skipped: %d", (*i)->getNumTestsPassed(), (*i)->getNumTestsFailed(), (*i)->getNumTestsSkipped()));
+ strArray.push_back(Common::String::format("Passed: %d Failed: %d Skipped: %d", (*i)->getNumTestsPassed(), (*i)->getNumTestsFailed(), (*i)->getNumTestsSkipped()));
} else {
strArray.push_back("Skipped");
}
diff --git a/engines/testbed/testsuite.cpp b/engines/testbed/testsuite.cpp
index 8cb9ffe309..fa8764e869 100644
--- a/engines/testbed/testsuite.cpp
+++ b/engines/testbed/testsuite.cpp
@@ -233,7 +233,7 @@ uint Testsuite::parseEvents() {
}
void Testsuite::updateStats(const char *prefix, const char *info, uint testNum, uint numTests, Common::Point pt) {
- Common::String text = Common::String::printf(" Running %s: %s (%d of %d) ", prefix, info, testNum, numTests);
+ Common::String text = Common::String::format(" Running %s: %s (%d of %d) ", prefix, info, testNum, numTests);
writeOnScreen(text, pt);
uint barColor = kColorSpecial;
// below the text a rectangle denoting the progress in the testsuite can be drawn.
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index 4381dad6f7..90f2e3ae34 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -98,7 +98,7 @@ void AudioManager::playMusic(Common::String dir, Common::String music) {
debugC(1, kDebugAudio, "playMusic(%s, %s)", dir.c_str(), music.c_str());
// two musics can be played at same time
- Common::String path = Common::String::printf("act%d/%s/%s.mus", _vm->state()->_currentChapter, dir.c_str(), music.c_str());
+ Common::String path = Common::String::format("act%d/%s/%s.mus", _vm->state()->_currentChapter, dir.c_str(), music.c_str());
if (_currentMusicName == music)
return;
diff --git a/engines/toon/detection.cpp b/engines/toon/detection.cpp
index e9649b1560..4b8c987d1e 100644
--- a/engines/toon/detection.cpp
+++ b/engines/toon/detection.cpp
@@ -159,7 +159,7 @@ bool ToonMetaEngine::hasFeature(MetaEngineFeature f) const {
}
void ToonMetaEngine::removeSaveState(const char *target, int slot) const {
- Common::String fileName = Common::String::printf("%s.%03d", target, slot);
+ Common::String fileName = Common::String::format("%s.%03d", target, slot);
g_system->getSavefileManager()->removeSavefile(fileName);
}
@@ -209,7 +209,7 @@ SaveStateList ToonMetaEngine::listSaves(const char *target) const {
}
SaveStateDescriptor ToonMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
- Common::String fileName = Common::String::printf("%s.%03d", target, slot);
+ Common::String fileName = Common::String::format("%s.%03d", target, slot);
Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName);
if (file) {
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 7a6a2fc87a..3f8d0b2b5f 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -948,7 +948,7 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) {
// load package
- strcpy(temp, createRoomFilename(Common::String::printf("%s.pak", _gameState->_locations[_gameState->_currentScene]._name).c_str()).c_str());
+ strcpy(temp, createRoomFilename(Common::String::format("%s.pak", _gameState->_locations[_gameState->_currentScene]._name).c_str()).c_str());
resources()->openPackage(temp, true);
strcpy(temp, state()->_locations[SceneId]._name);
@@ -993,7 +993,7 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) {
strcpy(temp, state()->_locations[SceneId]._name);
strcat(temp, ".svi");
- strcpy(temp2, createRoomFilename(Common::String::printf("%s.svl", _gameState->_locations[_gameState->_currentScene]._name).c_str()).c_str());
+ strcpy(temp2, createRoomFilename(Common::String::format("%s.svl", _gameState->_locations[_gameState->_currentScene]._name).c_str()).c_str());
_audioManager->loadAudioPack(1, temp, temp2);
strcpy(temp, state()->_locations[SceneId]._name);
strcpy(temp2, state()->_locations[SceneId]._name);
@@ -1580,7 +1580,7 @@ void ToonEngine::exitScene() {
_currentTextLineCharacterId = 0;
char temp[256];
- strcpy(temp, createRoomFilename(Common::String::printf("%s.pak", _gameState->_locations[_gameState->_currentScene]._name).c_str()).c_str());
+ strcpy(temp, createRoomFilename(Common::String::format("%s.pak", _gameState->_locations[_gameState->_currentScene]._name).c_str()).c_str());
resources()->closePackage(temp);
@@ -2808,7 +2808,7 @@ bool ToonEngine::canLoadGameStateCurrently() {
}
Common::String ToonEngine::getSavegameName(int nr) {
- return _targetName + Common::String::printf(".%03d", nr);
+ return _targetName + Common::String::format(".%03d", nr);
}
bool ToonEngine::saveGame(int32 slot, Common::String saveGameDesc) {
@@ -2828,7 +2828,7 @@ bool ToonEngine::saveGame(int32 slot, Common::String saveGameDesc) {
if (!saveGameDesc.empty()) {
savegameDescription = saveGameDesc;
} else {
- savegameDescription = Common::String::printf("Quick save #%d", slot);
+ savegameDescription = Common::String::format("Quick save #%d", slot);
}
}
@@ -4329,7 +4329,7 @@ int32 ToonEngine::pauseSceneAnimationScript(int32 animScriptId, int32 tickToWait
}
Common::String ToonEngine::createRoomFilename(Common::String name) {
- Common::String file = Common::String::printf("ACT%d/%s/%s", _gameState->_currentChapter, _gameState->_locations[_gameState->_currentScene]._name, name.c_str());
+ Common::String file = Common::String::format("ACT%d/%s/%s", _gameState->_currentChapter, _gameState->_locations[_gameState->_currentScene]._name, name.c_str());
return file;
}
diff --git a/gui/about.cpp b/gui/about.cpp
index 3caab084ca..86d28b4f61 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -93,7 +93,7 @@ AboutDialog::AboutDialog()
version += gScummVMVersion;
_lines.push_back(version);
- Common::String date = Common::String::printf(_("(built on %s)"), gScummVMBuildDate);
+ Common::String date = Common::String::format(_("(built on %s)"), gScummVMBuildDate);
_lines.push_back("C2" + date);
for (i = 0; i < ARRAYSIZE(copyright_text); i++)
diff --git a/test/common/str.h b/test/common/str.h
index 0908b21c1e..5d9fe29af9 100644
--- a/test/common/str.h
+++ b/test/common/str.h
@@ -316,12 +316,12 @@ class StringTestSuite : public CxxTest::TestSuite
}
void test_string_printf() {
- TS_ASSERT_EQUALS( Common::String::printf(""), "" );
- TS_ASSERT_EQUALS( Common::String::printf("%s", "test"), "test" );
- TS_ASSERT_EQUALS( Common::String::printf("%s.s%.02d", "monkey", 1), "monkey.s01" );
- TS_ASSERT_EQUALS( Common::String::printf("Some %s to make this string longer than the default built-in %s %d", "text", "capacity", 123456), "Some text to make this string longer than the default built-in capacity 123456" );
+ TS_ASSERT_EQUALS( Common::String::format(""), "" );
+ TS_ASSERT_EQUALS( Common::String::format("%s", "test"), "test" );
+ TS_ASSERT_EQUALS( Common::String::format("%s.s%.02d", "monkey", 1), "monkey.s01" );
+ TS_ASSERT_EQUALS( Common::String::format("Some %s to make this string longer than the default built-in %s %d", "text", "capacity", 123456), "Some text to make this string longer than the default built-in capacity 123456" );
- Common::String s = Common::String::printf("%s%X", "test", 1234);
+ Common::String s = Common::String::format("%s%X", "test", 1234);
TS_ASSERT_EQUALS(s, "test4D2");
TS_ASSERT_EQUALS(s.size(), 7U);
}