diff options
author | Sven Hesse | 2009-07-06 13:52:47 +0000 |
---|---|---|
committer | Sven Hesse | 2009-07-06 13:52:47 +0000 |
commit | 77c7c1cf813bc9bbc22d2ff3cf2a8d7af754bbf4 (patch) | |
tree | 9127e2c484d1c394a7ef03e35e78b80251fb9f46 | |
parent | de995433c6f7dcb7aac0c93870d08e5eaebe16c0 (diff) | |
download | scummvm-rg350-77c7c1cf813bc9bbc22d2ff3cf2a8d7af754bbf4.tar.gz scummvm-rg350-77c7c1cf813bc9bbc22d2ff3cf2a8d7af754bbf4.tar.bz2 scummvm-rg350-77c7c1cf813bc9bbc22d2ff3cf2a8d7af754bbf4.zip |
Loop over the string instead of copying and then editing it (hopefully, the PSP GCC won't ICE again here :P)
svn-id: r42176
-rw-r--r-- | engines/gob/hotspots.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index d47c31840d..fb8e29f528 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -1795,23 +1795,24 @@ uint32 Hotspots::getCurrentHotspot() const { } void Hotspots::cleanFloatString(const Hotspot &spot) const { - static char tempStr[256]; //the static keyword is unnecessary, but was added to work around a PSP compiler ICE. + char *to, *from; - // Get the string - strncpy0(tempStr, GET_VARO_STR(spot.key), 255); + to = from = GET_VARO_STR(spot.key); + for (int i = 0; (i < 257) && (*from != '\0'); i++, from++) { + char c = *from; + + // Skip spaces + if (c == ' ') + continue; - // Remove spaces - char *ptr; - while ((ptr = strchr(tempStr, ' '))) - _vm->_util->cutFromStr(tempStr, (ptr - tempStr), 1); + // Convert decimal separator if necessary + if ((_vm->_global->_language == kLanguageBritish) && (c == '.')) + c = ','; - // Exchange decimal separator if needed - if (_vm->_global->_language == kLanguageBritish) - while ((ptr = strchr(tempStr, '.'))) - *ptr = ','; + *to++ = c; + } - // Write it back - WRITE_VARO_STR(spot.key, tempStr); + *to = '\0'; } void Hotspots::checkStringMatch(const Hotspot &spot, const InputDesc &input, |