Skip to content

Commit 3669658

Browse files
committed
[LIBCNTPR] Implement NT version of tolower
1 parent 080ac7b commit 3669658

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

sdk/lib/crt/string/ctype.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,7 @@ int __cdecl _toupper(int c)
865865
return(c);
866866
}
867867

868+
#ifndef _LIBCNT_
868869
/*
869870
* @implemented
870871
*/
@@ -874,6 +875,7 @@ int __cdecl tolower(int c)
874875
return (c - upalpha);
875876
return(c);
876877
}
878+
#endif /* _LIBCNT_ */
877879

878880
/*
879881
* @implemented

sdk/lib/crt/string/string.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ list(APPEND CRT_STRING_ASM_SOURCE
112112

113113
list(APPEND LIBCNTPR_STRING_SOURCE
114114
string/mbstowcs_nt.c
115+
string/tolower_nt.c
115116
string/towupper_nt.c
116117
string/wcstombs_nt.c
117118
)

sdk/lib/crt/string/tolower_nt.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* PROJECT: ReactOS NT CRT library
3+
* LICENSE: MIT (https://spdx.org/licenses/MIT)
4+
* PURPOSE: Implementation of tolower
5+
* COPYRIGHT: Copyright 2025 Timo Kreuzer <[email protected]>
6+
*/
7+
8+
#include <string.h>
9+
10+
_Check_return_
11+
_CRTIMP
12+
int
13+
__cdecl
14+
tolower(
15+
_In_ int _C)
16+
{
17+
if (((char)_C >= 'A') && ((char)_C <= 'Z'))
18+
{
19+
return _C + ('a' - 'A');
20+
}
21+
22+
return _C;
23+
}

0 commit comments

Comments
 (0)