From d55b380b695c184a6bfc99790f8ff738c84867cc Mon Sep 17 00:00:00 2001 From: alberth Date: Sat, 16 Jul 2011 18:43:22 +0000 Subject: (svn r22669) -Codechange: For non-windows, only test for file existence again if strtolower actually changed the name. --- src/string.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/string.cpp') 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; } /** -- cgit v1.2.3-54-g00ecf