Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
91d63c0c
Commit
91d63c0c
authored
Apr 05, 2004
by
Lionel Ulmer
Committed by
Alexandre Julliard
Apr 05, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add better NULL checks to lstrcmp[i](A/W) functions.
parent
def71887
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
5 deletions
+42
-5
locale.c
dlls/kernel/locale.c
+32
-4
locale.c
dlls/kernel/tests/locale.c
+10
-1
No files found.
dlls/kernel/locale.c
View file @
91d63c0c
...
...
@@ -2356,8 +2356,15 @@ INT WINAPI CompareStringA(LCID lcid, DWORD style,
*/
int
WINAPI
lstrcmpA
(
LPCSTR
str1
,
LPCSTR
str2
)
{
int
ret
=
CompareStringA
(
GetThreadLocale
(),
0
,
str1
,
-
1
,
str2
,
-
1
);
int
ret
;
if
((
str1
==
NULL
)
&&
(
str2
==
NULL
))
return
0
;
if
(
str1
==
NULL
)
return
-
1
;
if
(
str2
==
NULL
)
return
1
;
ret
=
CompareStringA
(
GetThreadLocale
(),
0
,
str1
,
-
1
,
str2
,
-
1
);
if
(
ret
)
ret
-=
2
;
return
ret
;
}
...
...
@@ -2378,8 +2385,15 @@ int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
*/
int
WINAPI
lstrcmpiA
(
LPCSTR
str1
,
LPCSTR
str2
)
{
int
ret
=
CompareStringA
(
GetThreadLocale
(),
NORM_IGNORECASE
,
str1
,
-
1
,
str2
,
-
1
);
int
ret
;
if
((
str1
==
NULL
)
&&
(
str2
==
NULL
))
return
0
;
if
(
str1
==
NULL
)
return
-
1
;
if
(
str2
==
NULL
)
return
1
;
ret
=
CompareStringA
(
GetThreadLocale
(),
NORM_IGNORECASE
,
str1
,
-
1
,
str2
,
-
1
);
if
(
ret
)
ret
-=
2
;
return
ret
;
}
...
...
@@ -2390,8 +2404,15 @@ int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
*/
int
WINAPI
lstrcmpW
(
LPCWSTR
str1
,
LPCWSTR
str2
)
{
int
ret
=
CompareStringW
(
GetThreadLocale
(),
0
,
str1
,
-
1
,
str2
,
-
1
);
int
ret
;
if
((
str1
==
NULL
)
&&
(
str2
==
NULL
))
return
0
;
if
(
str1
==
NULL
)
return
-
1
;
if
(
str2
==
NULL
)
return
1
;
ret
=
CompareStringW
(
GetThreadLocale
(),
0
,
str1
,
-
1
,
str2
,
-
1
);
if
(
ret
)
ret
-=
2
;
return
ret
;
}
...
...
@@ -2402,8 +2423,15 @@ int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
*/
int
WINAPI
lstrcmpiW
(
LPCWSTR
str1
,
LPCWSTR
str2
)
{
int
ret
=
CompareStringW
(
GetThreadLocale
(),
NORM_IGNORECASE
,
str1
,
-
1
,
str2
,
-
1
);
int
ret
;
if
((
str1
==
NULL
)
&&
(
str2
==
NULL
))
return
0
;
if
(
str1
==
NULL
)
return
-
1
;
if
(
str2
==
NULL
)
return
1
;
ret
=
CompareStringW
(
GetThreadLocale
(),
NORM_IGNORECASE
,
str1
,
-
1
,
str2
,
-
1
);
if
(
ret
)
ret
-=
2
;
return
ret
;
}
...
...
dlls/kernel/tests/locale.c
View file @
91d63c0c
...
...
@@ -795,8 +795,17 @@ static void test_CompareStringA()
ok
(
!
ret
,
"CompareStringA must fail with invalid flag
\n
"
);
ret
=
lstrcmpA
(
""
,
""
);
ok
(
!
ret
,
"lstrcmpA(
\"\"
,
\"\"
) should return 0, got %d
\n
"
,
ret
);
ok
(
ret
==
0
,
"lstrcmpA(
\"\"
,
\"\"
) should return 0, got %d
\n
"
,
ret
);
ret
=
lstrcmpA
(
NULL
,
NULL
);
ok
(
ret
==
0
,
"lstrcmpA(NULL, NULL) should return 0, got %d
\n
"
,
ret
);
ret
=
lstrcmpA
(
""
,
NULL
);
ok
(
ret
==
1
,
"lstrcmpA(
\"\"
, NULL) should return 1, got %d
\n
"
,
ret
);
ret
=
lstrcmpA
(
NULL
,
""
);
ok
(
ret
==
-
1
,
"lstrcmpA(NULL,
\"\"
) should return -1, got %d
\n
"
,
ret
);
ret
=
CompareStringA
(
LOCALE_SYSTEM_DEFAULT
,
0
,
"EndDialog"
,
-
1
,
"_Property"
,
-
1
);
ok
(
ret
==
3
,
"EndDialog vs _Property ... expected 3, got %d
\n
"
,
ret
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment