diff options
author | Simei Yin | 2017-07-15 14:18:17 +0200 |
---|---|---|
committer | Simei Yin | 2017-07-15 14:30:46 +0200 |
commit | 4a6feaefc8e18598defacaa03ebdd334a4708cb4 (patch) | |
tree | ed7a13614d8480bcb08ff7e484423a684a013e73 /engines | |
parent | 6b78f4a567114203809074deb7247f3d1b852e3c (diff) | |
download | scummvm-rg350-4a6feaefc8e18598defacaa03ebdd334a4708cb4.tar.gz scummvm-rg350-4a6feaefc8e18598defacaa03ebdd334a4708cb4.tar.bz2 scummvm-rg350-4a6feaefc8e18598defacaa03ebdd334a4708cb4.zip |
SLUDGE: Use String::format instead of sprintf
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sludge/backdrop.cpp | 3 | ||||
-rw-r--r-- | engines/sludge/builtin.cpp | 5 | ||||
-rw-r--r-- | engines/sludge/sludger.cpp | 6 | ||||
-rw-r--r-- | engines/sludge/variable.cpp | 7 | ||||
-rw-r--r-- | engines/sludge/zbuffer.cpp | 3 |
5 files changed, 9 insertions, 15 deletions
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp index 8e2916e5fe..25008b0510 100644 --- a/engines/sludge/backdrop.cpp +++ b/engines/sludge/backdrop.cpp @@ -308,8 +308,7 @@ void loadBackDrop(int fileNum, int x, int y) { } if (!loadHSI(bigDataFile, x, y, false)) { - char mess[200]; - sprintf(mess, "Can't paste overlay image outside scene dimensions\n\nX = %i\nY = %i\nWidth = %i\nHeight = %i", x, y, sceneWidth, sceneHeight); + Common::String mess = Common::String::format("Can't paste overlay image outside scene dimensions\n\nX = %i\nY = %i\nWidth = %i\nHeight = %i", x, y, sceneWidth, sceneHeight); fatal(mess); } diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp index 56db190c82..9821eff1cc 100644 --- a/engines/sludge/builtin.cpp +++ b/engines/sludge/builtin.cpp @@ -2507,7 +2507,7 @@ builtIn(setThumbnailSize) { return BR_ERROR; trimStack(fun->stack); if (thumbWidth < 0 || thumbHeight < 0 || thumbWidth > (int)winWidth || thumbHeight > (int)winHeight) { - Common::String buff = thumbWidth + " x " + thumbHeight; + Common::String buff = Common::String::format("%i x %i", thumbWidth, thumbWidth); fatal("Invalid thumbnail size", buff); return BR_ERROR; } @@ -2624,8 +2624,7 @@ builtReturn callBuiltIn(int whichFunc, int numParams, loadedFunction *fun) { if (whichFunc < NUM_FUNCS) { if (paramNum[whichFunc] != -1) { if (paramNum[whichFunc] != numParams) { - char buff[100]; - sprintf(buff, "Built in function must have %i parameter%s", paramNum[whichFunc], (paramNum[whichFunc] == 1) ? "" : "s"); + Common::String buff = Common::String::format("Built in function must have %i parameter%s", paramNum[whichFunc], (paramNum[whichFunc] == 1) ? "" : "s"); Common::String msg = buff; fatal(msg); return BR_ERROR; diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp index d84688e1d0..49edb2b4ff 100644 --- a/engines/sludge/sludger.cpp +++ b/engines/sludge/sludger.cpp @@ -167,14 +167,14 @@ Common::File *openAndVerify(const Common::String &filename, char extra1, char ex debug(kSludgeDebugDataLoad, "minVersion %i", minVersion); fileVersion = majVersion * 256 + minVersion; - char txtVer[120]; + Common::String txtVer = ""; if (fileVersion > WHOLE_VERSION) { - sprintf(txtVer, ERROR_VERSION_TOO_LOW_2, majVersion, minVersion); + txtVer = Common::String::format(ERROR_VERSION_TOO_LOW_2, majVersion, minVersion); fatal(ERROR_VERSION_TOO_LOW_1, txtVer); return NULL; } else if (fileVersion < MINIM_VERSION) { - sprintf(txtVer, ERROR_VERSION_TOO_HIGH_2, majVersion, minVersion); + txtVer = Common::String::format(ERROR_VERSION_TOO_HIGH_2, majVersion, minVersion); fatal(ERROR_VERSION_TOO_HIGH_1, txtVer); return NULL; } diff --git a/engines/sludge/variable.cpp b/engines/sludge/variable.cpp index 2b0d15feff..a1c736aa93 100644 --- a/engines/sludge/variable.cpp +++ b/engines/sludge/variable.cpp @@ -307,11 +307,8 @@ Common::String getTextFromAnyVar(const variable &from) { } case SVT_INT: { - char *buff = new char[10]; - sprintf(buff, "%i", from.varData.intValue); - Common::String res = buff; - delete []buff; - return res; + Common::String buff = Common::String::format("%i", from.varData.intValue); + return buff; } case SVT_FILE: { diff --git a/engines/sludge/zbuffer.cpp b/engines/sludge/zbuffer.cpp index 18094fb0df..e09e57d6f1 100644 --- a/engines/sludge/zbuffer.cpp +++ b/engines/sludge/zbuffer.cpp @@ -115,8 +115,7 @@ bool setZBuffer(int num) { return fatal("Extended Z-buffer format not supported in this version of the SLUDGE engine"); } if (width != sceneWidth || height != sceneHeight) { - char tmp[256]; - sprintf(tmp, "Z-w: %d Z-h:%d w: %d, h:%d", width, height, sceneWidth, sceneHeight); + Common::String tmp = Common::String::format("Z-w: %d Z-h:%d w: %d, h:%d", width, height, sceneWidth, sceneHeight); return fatal("Z-buffer width and height don't match scene width and height", tmp); } |