https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d528e634778337edf1c61…
commit d528e634778337edf1c615aeaa3fef47b7510d2b
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Sun Feb 9 10:20:48 2020 +0100
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Sun Feb 9 10:23:01 2020 +0100
[CRT] Only write to the output buffer when necessary in _strlwr. CORE-16667
Like e884290d292, this is also a hack and is missing locale awareness.
---
sdk/lib/crt/string/strlwr.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sdk/lib/crt/string/strlwr.c b/sdk/lib/crt/string/strlwr.c
index 5966a5bf3aa..53d06dc9d96 100644
--- a/sdk/lib/crt/string/strlwr.c
+++ b/sdk/lib/crt/string/strlwr.c
@@ -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;