File tree Expand file tree Collapse file tree 3 files changed +95
-2
lines changed
Expand file tree Collapse file tree 3 files changed +95
-2
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * PROJECT: ReactOS NT CRT library
3+ * LICENSE: MIT (https://spdx.org/licenses/MIT)
4+ * PURPOSE: Implementation of _wcsicmp
5+ * COPYRIGHT: Copyright 2025 Timo Kreuzer <[email protected] > 6+ */
7+
8+ #include <string.h>
9+
10+ _Check_return_
11+ int
12+ __cdecl
13+ _wcsicmp (
14+ _In_z_ wchar_t const * _String1 ,
15+ _In_z_ wchar_t const * _String2 )
16+ {
17+ wchar_t const * p1 = _String1 ;
18+ wchar_t const * p2 = _String2 ;
19+ wchar_t chr1 , chr2 ;
20+
21+ while (1 )
22+ {
23+ chr1 = * p1 ++ ;
24+ chr2 = * p2 ++ ;
25+
26+ if (chr1 != chr2 )
27+ {
28+ if ((chr1 >= 'A' ) && (chr1 <= 'Z' ))
29+ chr1 += ('a' - 'A' );
30+ if ((chr2 >= 'A' ) && (chr2 <= 'Z' ))
31+ chr2 += ('a' - 'A' );
32+
33+ if (chr1 != chr2 )
34+ return chr1 - chr2 ;
35+ }
36+ else if (chr1 == 0 )
37+ {
38+ break ;
39+ }
40+ }
41+
42+ return 0 ;
43+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * PROJECT: ReactOS NT CRT library
3+ * LICENSE: MIT (https://spdx.org/licenses/MIT)
4+ * PURPOSE: Implementation of _wcsnicmp
5+ * COPYRIGHT: Copyright 2025 Timo Kreuzer <[email protected] > 6+ */
7+
8+ #include <string.h>
9+
10+ _Check_return_
11+ int
12+ __cdecl
13+ _wcsnicmp (
14+ _In_reads_or_z_ (_MaxCount ) wchar_t const * _String1 ,
15+ _In_reads_or_z_ (_MaxCount ) wchar_t const * _String2 ,
16+ _In_ size_t _MaxCount )
17+ {
18+ wchar_t const * p1 = _String1 ;
19+ wchar_t const * p2 = _String2 ;
20+ size_t remaining = _MaxCount ;
21+ wchar_t chr1 , chr2 ;
22+
23+ while (remaining -- != 0 )
24+ {
25+ chr1 = * p1 ++ ;
26+ chr2 = * p2 ++ ;
27+
28+ if (chr1 != chr2 )
29+ {
30+ if ((chr1 >= 'A' ) && (chr1 <= 'Z' ))
31+ chr1 += ('a' - 'A' );
32+ if ((chr2 >= 'A' ) && (chr2 <= 'Z' ))
33+ chr2 += ('a' - 'A' );
34+
35+ if (chr1 != chr2 )
36+ return chr1 - chr2 ;
37+ }
38+ else if (chr1 == 0 )
39+ {
40+ break ;
41+ }
42+ }
43+
44+ return 0 ;
45+ }
Original file line number Diff line number Diff line change 11
22list (APPEND LIBCNTPR_WSTRING_SOURCE
3- wstring/wcsicmp.c
43 wstring/wcslwr.c
5- wstring/wcsnicmp.c
64 wstring/wcsupr.c
75 wstring/wcscspn.c
86 wstring/wcsspn.c
@@ -14,6 +12,13 @@ list(APPEND CRT_WSTRING_SOURCE
1412 wstring/mbrtowc.c
1513 wstring/wcrtomb.c
1614 wstring/wcscoll.c
15+ wstring/wcsicmp.c
16+ wstring/wcsnicmp.c
1717 wstring/wcstok.c
1818 wstring/wcsxfrm.c
1919)
20+
21+ list (APPEND LIBCNTPR_WSTRING_SOURCE
22+ wstring/_wcsicmp_nt.c
23+ wstring/_wcsnicmp_nt.c
24+ )
You can’t perform that action at this time.
0 commit comments