Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ba5cade7
Commit
ba5cade7
authored
Oct 31, 2012
by
Christian Costa
Committed by
Alexandre Julliard
Nov 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Implement CompareStringOrdinal.
parent
9d888b37
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
1 deletion
+109
-1
kernel32.spec
dlls/kernel32/kernel32.spec
+1
-0
locale.c
dlls/kernel32/locale.c
+33
-0
locale.c
dlls/kernel32/tests/locale.c
+75
-1
No files found.
dlls/kernel32/kernel32.spec
View file @
ba5cade7
...
@@ -201,6 +201,7 @@
...
@@ -201,6 +201,7 @@
@ stdcall CompareStringA(long long str long str long)
@ stdcall CompareStringA(long long str long str long)
@ stdcall CompareStringW(long long wstr long wstr long)
@ stdcall CompareStringW(long long wstr long wstr long)
@ stdcall CompareStringEx(wstr long wstr long wstr long ptr ptr long)
@ stdcall CompareStringEx(wstr long wstr long wstr long ptr ptr long)
@ stdcall CompareStringOrdinal(wstr long wstr long long)
@ stdcall ConnectNamedPipe(long ptr)
@ stdcall ConnectNamedPipe(long ptr)
@ stub ConsoleMenuControl
@ stub ConsoleMenuControl
@ stub ConsoleSubst
@ stub ConsoleSubst
...
...
dlls/kernel32/locale.c
View file @
ba5cade7
...
@@ -3047,6 +3047,39 @@ INT WINAPI CompareStringA(LCID lcid, DWORD flags,
...
@@ -3047,6 +3047,39 @@ INT WINAPI CompareStringA(LCID lcid, DWORD flags,
return
ret
;
return
ret
;
}
}
/******************************************************************************
* CompareStringOrdinal (KERNEL32.@)
*/
INT
WINAPI
CompareStringOrdinal
(
const
WCHAR
*
str1
,
INT
len1
,
const
WCHAR
*
str2
,
INT
len2
,
BOOL
ignore_case
)
{
int
ret
,
len
;
if
(
!
str1
||
!
str2
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
if
(
len1
<
0
)
len1
=
strlenW
(
str1
);
if
(
len2
<
0
)
len2
=
strlenW
(
str2
);
len
=
min
(
len1
,
len2
);
if
(
ignore_case
)
{
ret
=
memicmpW
(
str1
,
str2
,
len
);
}
else
{
ret
=
0
;
for
(;
len
>
0
;
len
--
)
if
((
ret
=
(
*
str1
++
-
*
str2
++
)))
break
;
}
if
(
!
ret
)
ret
=
len1
-
len2
;
if
(
ret
<
0
)
return
CSTR_LESS_THAN
;
if
(
ret
>
0
)
return
CSTR_GREATER_THAN
;
return
CSTR_EQUAL
;
}
/*************************************************************************
/*************************************************************************
* lstrcmp (KERNEL32.@)
* lstrcmp (KERNEL32.@)
* lstrcmpA (KERNEL32.@)
* lstrcmpA (KERNEL32.@)
...
...
dlls/kernel32/tests/locale.c
View file @
ba5cade7
...
@@ -87,6 +87,7 @@ static INT (WINAPI *pIdnToAscii)(DWORD, LPCWSTR, INT, LPWSTR, INT);
...
@@ -87,6 +87,7 @@ static INT (WINAPI *pIdnToAscii)(DWORD, LPCWSTR, INT, LPWSTR, INT);
static
INT
(
WINAPI
*
pIdnToUnicode
)(
DWORD
,
LPCWSTR
,
INT
,
LPWSTR
,
INT
);
static
INT
(
WINAPI
*
pIdnToUnicode
)(
DWORD
,
LPCWSTR
,
INT
,
LPWSTR
,
INT
);
static
INT
(
WINAPI
*
pGetLocaleInfoEx
)(
LPCWSTR
,
LCTYPE
,
LPWSTR
,
INT
);
static
INT
(
WINAPI
*
pGetLocaleInfoEx
)(
LPCWSTR
,
LCTYPE
,
LPWSTR
,
INT
);
static
BOOL
(
WINAPI
*
pIsValidLocaleName
)(
LPCWSTR
);
static
BOOL
(
WINAPI
*
pIsValidLocaleName
)(
LPCWSTR
);
static
INT
(
WINAPI
*
pCompareStringOrdinal
)(
const
WCHAR
*
,
INT
,
const
WCHAR
*
,
INT
,
BOOL
);
static
void
InitFunctionPointers
(
void
)
static
void
InitFunctionPointers
(
void
)
{
{
...
@@ -106,6 +107,7 @@ static void InitFunctionPointers(void)
...
@@ -106,6 +107,7 @@ static void InitFunctionPointers(void)
pIdnToUnicode
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"IdnToUnicode"
);
pIdnToUnicode
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"IdnToUnicode"
);
pGetLocaleInfoEx
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"GetLocaleInfoEx"
);
pGetLocaleInfoEx
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"GetLocaleInfoEx"
);
pIsValidLocaleName
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"IsValidLocaleName"
);
pIsValidLocaleName
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"IsValidLocaleName"
);
pCompareStringOrdinal
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"CompareStringOrdinal"
);
}
}
#define eq(received, expected, label, type) \
#define eq(received, expected, label, type) \
...
@@ -3478,11 +3480,82 @@ static void test_IsValidLocaleName(void)
...
@@ -3478,11 +3480,82 @@ static void test_IsValidLocaleName(void)
ok
(
!
ret
,
"IsValidLocaleName should have failed
\n
"
);
ok
(
!
ret
,
"IsValidLocaleName should have failed
\n
"
);
}
}
void
test_CompareStringOrdinal
(
void
)
{
INT
ret
;
WCHAR
test1
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
WCHAR
test2
[]
=
{
'T'
,
'e'
,
'S'
,
't'
,
0
};
WCHAR
test3
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'3'
,
0
};
WCHAR
null1
[]
=
{
'a'
,
0
,
'a'
,
0
};
WCHAR
null2
[]
=
{
'a'
,
0
,
'b'
,
0
};
WCHAR
bills1
[]
=
{
'b'
,
'i'
,
'l'
,
'l'
,
'\''
,
's'
,
0
};
WCHAR
bills2
[]
=
{
'b'
,
'i'
,
'l'
,
'l'
,
's'
,
0
};
WCHAR
coop1
[]
=
{
'c'
,
'o'
,
'-'
,
'o'
,
'p'
,
0
};
WCHAR
coop2
[]
=
{
'c'
,
'o'
,
'o'
,
'p'
,
0
};
WCHAR
nonascii1
[]
=
{
0x0102
,
0
};
WCHAR
nonascii2
[]
=
{
0x0201
,
0
};
if
(
!
pCompareStringOrdinal
)
{
win_skip
(
"CompareStringOrdinal not supported
\n
"
);
return
;
}
/* Check errors */
SetLastError
(
0xdeadbeef
);
ret
=
pCompareStringOrdinal
(
NULL
,
0
,
NULL
,
0
,
FALSE
);
ok
(
!
ret
,
"Got %u, expected 0
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Got %x, expected %x
\n
"
,
GetLastError
(),
ERROR_INVALID_PARAMETER
);
SetLastError
(
0xdeadbeef
);
ret
=
pCompareStringOrdinal
(
test1
,
-
1
,
NULL
,
0
,
FALSE
);
ok
(
!
ret
,
"Got %u, expected 0
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Got %x, expected %x
\n
"
,
GetLastError
(),
ERROR_INVALID_PARAMETER
);
SetLastError
(
0xdeadbeef
);
ret
=
pCompareStringOrdinal
(
NULL
,
0
,
test1
,
-
1
,
FALSE
);
ok
(
!
ret
,
"Got %u, expected 0
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Got %x, expected %x
\n
"
,
GetLastError
(),
ERROR_INVALID_PARAMETER
);
/* Check case */
ret
=
pCompareStringOrdinal
(
test1
,
-
1
,
test1
,
-
1
,
FALSE
);
ok
(
ret
==
CSTR_EQUAL
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_EQUAL
);
ret
=
pCompareStringOrdinal
(
test1
,
-
1
,
test2
,
-
1
,
FALSE
);
ok
(
ret
==
CSTR_GREATER_THAN
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_GREATER_THAN
);
ret
=
pCompareStringOrdinal
(
test2
,
-
1
,
test1
,
-
1
,
FALSE
);
ok
(
ret
==
CSTR_LESS_THAN
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_LESS_THAN
);
ret
=
pCompareStringOrdinal
(
test1
,
-
1
,
test2
,
-
1
,
TRUE
);
ok
(
ret
==
CSTR_EQUAL
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_EQUAL
);
/* Check different sizes */
ret
=
pCompareStringOrdinal
(
test1
,
3
,
test2
,
-
1
,
TRUE
);
ok
(
ret
==
CSTR_LESS_THAN
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_LESS_THAN
);
ret
=
pCompareStringOrdinal
(
test1
,
-
1
,
test2
,
3
,
TRUE
);
ok
(
ret
==
CSTR_GREATER_THAN
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_GREATER_THAN
);
/* Check null character */
ret
=
pCompareStringOrdinal
(
null1
,
3
,
null2
,
3
,
FALSE
);
ok
(
ret
==
CSTR_LESS_THAN
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_LESS_THAN
);
ret
=
pCompareStringOrdinal
(
null1
,
3
,
null2
,
3
,
TRUE
);
ok
(
ret
==
CSTR_LESS_THAN
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_LESS_THAN
);
ret
=
pCompareStringOrdinal
(
test1
,
5
,
test3
,
5
,
FALSE
);
ok
(
ret
==
CSTR_LESS_THAN
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_LESS_THAN
);
ret
=
pCompareStringOrdinal
(
test1
,
4
,
test1
,
5
,
FALSE
);
ok
(
ret
==
CSTR_LESS_THAN
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_LESS_THAN
);
/* Check ordinal behaviour */
ret
=
pCompareStringOrdinal
(
bills1
,
-
1
,
bills2
,
-
1
,
FALSE
);
ok
(
ret
==
CSTR_LESS_THAN
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_LESS_THAN
);
ret
=
pCompareStringOrdinal
(
coop2
,
-
1
,
coop1
,
-
1
,
FALSE
);
ok
(
ret
==
CSTR_GREATER_THAN
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_GREATER_THAN
);
ret
=
pCompareStringOrdinal
(
nonascii1
,
-
1
,
nonascii2
,
-
1
,
FALSE
);
ok
(
ret
==
CSTR_LESS_THAN
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_LESS_THAN
);
ret
=
pCompareStringOrdinal
(
nonascii1
,
-
1
,
nonascii2
,
-
1
,
TRUE
);
ok
(
ret
==
CSTR_LESS_THAN
,
"Got %u, expected %u
\n
"
,
ret
,
CSTR_LESS_THAN
);
}
START_TEST
(
locale
)
START_TEST
(
locale
)
{
{
InitFunctionPointers
();
InitFunctionPointers
();
test_EnumTimeFormatsA
();
test_EnumTimeFormatsA
();
test_EnumDateFormatsA
();
test_EnumDateFormatsA
();
test_GetLocaleInfoA
();
test_GetLocaleInfoA
();
...
@@ -3512,6 +3585,7 @@ START_TEST(locale)
...
@@ -3512,6 +3585,7 @@ START_TEST(locale)
test_IdnToAscii
();
test_IdnToAscii
();
test_IdnToUnicode
();
test_IdnToUnicode
();
test_IsValidLocaleName
();
test_IsValidLocaleName
();
test_CompareStringOrdinal
();
/* this requires collation table patch to make it MS compatible */
/* this requires collation table patch to make it MS compatible */
if
(
0
)
test_sorting
();
if
(
0
)
test_sorting
();
}
}
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