From e27b05ef358102fd60235a5f78d7d51e9f25a5f4 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 1 Nov 2010 16:02:28 +0000 Subject: 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 --- engines/sci/engine/kernel.cpp | 4 ++-- engines/sci/engine/kfile.cpp | 2 +- engines/sci/engine/kmisc.cpp | 6 +++--- engines/sci/engine/kvideo.cpp | 4 ++-- engines/sci/engine/message.cpp | 2 +- engines/sci/engine/vm.cpp | 4 ++-- engines/sci/engine/workarounds.cpp | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) (limited to 'engines/sci/engine') 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("", loopSelector)); + _selectorNames.push_back(Common::String::format("", loopSelector)); } // Ensure that the selector has a name if (_selectorNames[selector].empty()) - _selectorNames[selector] = Common::String::printf("", selector); + _selectorNames[selector] = Common::String::format("", 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); } } -- cgit v1.2.3