diff options
author | Max Horn | 2009-09-27 19:24:18 +0000 |
---|---|---|
committer | Max Horn | 2009-09-27 19:24:18 +0000 |
commit | 460d7b269bdd22cd4c9df941ab3e2d5bb640297a (patch) | |
tree | 5c2c6f50e0c096ab36d89675d86dded4abb5b264 /engines/sci/engine/kstring.cpp | |
parent | 4edecad9db05c169bdccf2d45f212eb4e643bdb9 (diff) | |
download | scummvm-rg350-460d7b269bdd22cd4c9df941ab3e2d5bb640297a.tar.gz scummvm-rg350-460d7b269bdd22cd4c9df941ab3e2d5bb640297a.tar.bz2 scummvm-rg350-460d7b269bdd22cd4c9df941ab3e2d5bb640297a.zip |
Simplify kFormat slightly
svn-id: r44417
Diffstat (limited to 'engines/sci/engine/kstring.cpp')
-rw-r--r-- | engines/sci/engine/kstring.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index 961b28485f..3f068fd044 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -364,7 +364,7 @@ reg_t kReadNumber(EngineState *s, int, int argc, reg_t *argv) { ** the supplied parameters and writes it to the targ_address. */ reg_t kFormat(EngineState *s, int, int argc, reg_t *argv) { - int *arguments; + uint16 *arguments; reg_t dest = argv[0]; char targetbuf[512]; char *target = targetbuf; @@ -392,9 +392,9 @@ reg_t kFormat(EngineState *s, int, int argc, reg_t *argv) { debugC(2, kDebugLevelStrings, "Formatting \"%s\"\n", source); - arguments = (int*)malloc(sizeof(int) * argc); + arguments = (uint16 *)malloc(sizeof(uint16) * argc); #ifdef SATISFY_PURIFY - memset(arguments, 0, sizeof(int) * argc); + memset(arguments, 0, sizeof(uint16) * argc); #endif for (i = startarg; i < argc; i++) @@ -530,12 +530,11 @@ reg_t kFormat(EngineState *s, int, int argc, reg_t *argv) { if (xfer == 'x') format_string = "%x"; + int val = arguments[paramindex]; if (!unsigned_var) - if (arguments[paramindex] & 0x8000) - /* sign extend */ - arguments[paramindex] = (~0xffff) | arguments[paramindex]; + val = (int16)arguments[paramindex]; - target += sprintf(target, format_string, arguments[paramindex++]); + target += sprintf(target, format_string, val); CHECK_OVERFLOW1(target, 0, NULL_REG); unsigned_var = 0; |