[CRT] Only write to the output buffer when necessary in _strlwr. CORE-16667
authorThomas Faber <thomas.faber@reactos.org>
Sun, 9 Feb 2020 09:20:48 +0000 (10:20 +0100)
committerThomas Faber <thomas.faber@reactos.org>
Sun, 9 Feb 2020 09:23:01 +0000 (10:23 +0100)
Like e884290d292, this is also a hack and is missing locale awareness.

sdk/lib/crt/string/strlwr.c

index 5966a5b..53d06dc 100644 (file)
@@ -7,9 +7,13 @@
 char * CDECL _strlwr(char *x)
 {
        char  *y=x;
+       char ch, lower;
 
        while (*y) {
-               *y=tolower(*y);
+               ch = *y;
+               lower = tolower(ch);
+               if (ch != lower)
+                       *y = lower;
                y++;
        }
        return x;