mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-02 00:07:59 +00:00
ENGINES: Get rid of some s(n)printf calls
This commit is contained in:
parent
d21ddbce79
commit
86240bb0dc
@ -227,9 +227,9 @@ void MainMenuDialog::save() {
|
||||
Common::String result(_saveDialog->getResultString());
|
||||
if (result.empty()) {
|
||||
// If the user was lazy and entered no save name, come up with a default name.
|
||||
char buf[20];
|
||||
snprintf(buf, 20, "Save %d", slot + 1);
|
||||
_engine->saveGameState(slot, buf);
|
||||
Common::String buf;
|
||||
buf = Common::String::format("Save %d", slot + 1);
|
||||
_engine->saveGameState(slot, buf.c_str());
|
||||
} else {
|
||||
_engine->saveGameState(slot, result.c_str());
|
||||
}
|
||||
|
@ -206,12 +206,8 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics:
|
||||
|
||||
// Error out on size switch failure
|
||||
if (gfxError & OSystem::kTransactionSizeChangeFailed) {
|
||||
char buffer[16];
|
||||
snprintf(buffer, 16, "%dx%d", width, height);
|
||||
|
||||
Common::String message = "Could not switch to resolution: '";
|
||||
message += buffer;
|
||||
message += "'.";
|
||||
Common::String message;
|
||||
message = Common::String::format("Could not switch to resolution: '%dx%d'.", width, height);
|
||||
|
||||
GUIErrorMessage(message);
|
||||
error("%s", message.c_str());
|
||||
|
@ -52,20 +52,20 @@ void SaveStateDescriptor::setWriteProtectedFlag(bool state) {
|
||||
}
|
||||
|
||||
void SaveStateDescriptor::setSaveDate(int year, int month, int day) {
|
||||
char buffer[32];
|
||||
snprintf(buffer, 32, "%.2d.%.2d.%.4d", day, month, year);
|
||||
Common::String buffer;
|
||||
buffer = Common::String::format("%.2d.%.2d.%.4d", day, month, year);
|
||||
setVal("save_date", buffer);
|
||||
}
|
||||
|
||||
void SaveStateDescriptor::setSaveTime(int hour, int min) {
|
||||
char buffer[32];
|
||||
snprintf(buffer, 32, "%.2d:%.2d", hour, min);
|
||||
Common::String buffer;
|
||||
buffer = Common::String::format("%.2d:%.2d", hour, min);
|
||||
setVal("save_time", buffer);
|
||||
}
|
||||
|
||||
void SaveStateDescriptor::setPlayTime(int hours, int minutes) {
|
||||
char buffer[32];
|
||||
snprintf(buffer, 32, "%.2d:%.2d", hours, minutes);
|
||||
Common::String buffer;
|
||||
buffer = Common::String::format("%.2d:%.2d", hours, minutes);
|
||||
setVal("play_time", buffer);
|
||||
}
|
||||
|
||||
|
@ -49,9 +49,7 @@ public:
|
||||
}
|
||||
|
||||
SaveStateDescriptor(int s, const Common::String &d) : _thumbnail() {
|
||||
char buf[16];
|
||||
sprintf(buf, "%d", s);
|
||||
setVal("save_slot", buf);
|
||||
setVal("save_slot", Common::String::format("%d", s));
|
||||
setVal("description", d);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user