diff options
author | Sven Hesse | 2009-07-05 11:26:42 +0000 |
---|---|---|
committer | Sven Hesse | 2009-07-05 11:26:42 +0000 |
commit | 704895b35ff365525e894f8caf92c4383d446209 (patch) | |
tree | 8d18ed31ac90f7897aae859caa1fc212e6699719 /engines/gob/util.cpp | |
parent | d2c2386c6ad70cb1e7edd40b1c007c5f863be99c (diff) | |
download | scummvm-rg350-704895b35ff365525e894f8caf92c4383d446209.tar.gz scummvm-rg350-704895b35ff365525e894f8caf92c4383d446209.tar.bz2 scummvm-rg350-704895b35ff365525e894f8caf92c4383d446209.zip |
Commenting prepareStr a bit and renaming it to cleanupStr
svn-id: r42120
Diffstat (limited to 'engines/gob/util.cpp')
-rw-r--r-- | engines/gob/util.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index 6c38dcb5a9..4830c4be51 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -452,7 +452,7 @@ static const char trStr2[] = " "; static const char trStr3[] = " "; -void Util::prepareStr(char *str) { +void Util::cleanupStr(char *str) { char *start, *end; char buf[300]; @@ -460,17 +460,20 @@ void Util::prepareStr(char *str) { strcat(buf, trStr2); strcat(buf, trStr3); + // Translating "wrong" characters for (size_t i = 0; i < strlen(str); i++) - str[i] = buf[str[i] - 32]; + str[i] = buf[MIN<int>(str[i] - 32, 32)]; + // Trim spaces left while (str[0] == ' ') cutFromStr(str, 0, 1); + // Trim spaces right while ((strlen(str) > 0) && (str[strlen(str) - 1] == ' ')) cutFromStr(str, strlen(str) - 1, 1); + // Merge double spaces start = strchr(str, ' '); - while (start) { if (start[1] == ' ') { cutFromStr(str, start - str, 1); |