summaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2011-07-16 18:43:22 +0000
committeralberth <alberth@openttd.org>2011-07-16 18:43:22 +0000
commitd55b380b695c184a6bfc99790f8ff738c84867cc (patch)
treec9f0dac6c86a885ba071d9497071083327e43620 /src/string.cpp
parent20c2b5fdde6f3f70dc0a955ef803b8a0fa21e0e5 (diff)
downloadopenttd-d55b380b695c184a6bfc99790f8ff738c84867cc.tar.xz
(svn r22669) -Codechange: For non-windows, only test for file existence again if strtolower actually changed the name.
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/string.cpp b/src/string.cpp
index 7aa081c45..0c2777371 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -319,10 +319,17 @@ size_t Utf8StringLength(const char *s)
* using certain locales: eg in Turkish the uppercase 'I' was converted to
* '?', so just revert to the old functionality
* @param str string to convert
+ * @return String has changed.
*/
-void strtolower(char *str)
+bool strtolower(char *str)
{
- for (; *str != '\0'; str++) *str = tolower(*str);
+ bool changed = false;
+ for (; *str != '\0'; str++) {
+ char new_str = tolower(*str);
+ changed |= new_str != *str;
+ *str = new_str;
+ }
+ return changed;
}
/**