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
da125003
Commit
da125003
authored
Mar 24, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Reimplement IsValidLocaleName() using the locale.nls data.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fffbe3fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
3 deletions
+34
-3
locale.c
dlls/kernelbase/locale.c
+34
-3
No files found.
dlls/kernelbase/locale.c
View file @
da125003
...
...
@@ -729,6 +729,38 @@ done:
}
static
int
compare_locale_names
(
const
WCHAR
*
n1
,
const
WCHAR
*
n2
)
{
for
(;;)
{
WCHAR
ch1
=
*
n1
++
;
WCHAR
ch2
=
*
n2
++
;
if
(
ch1
>=
'a'
&&
ch1
<=
'z'
)
ch1
-=
'a'
-
'A'
;
else
if
(
ch1
==
'_'
)
ch1
=
'-'
;
if
(
ch2
>=
'a'
&&
ch2
<=
'z'
)
ch2
-=
'a'
-
'A'
;
else
if
(
ch2
==
'_'
)
ch2
=
'-'
;
if
(
!
ch1
||
ch1
!=
ch2
)
return
ch1
-
ch2
;
}
}
static
const
NLS_LOCALE_LCNAME_INDEX
*
find_lcname_entry
(
const
WCHAR
*
name
)
{
int
min
=
0
,
max
=
locale_table
->
nb_lcnames
-
1
;
while
(
min
<=
max
)
{
int
res
,
pos
=
(
min
+
max
)
/
2
;
const
WCHAR
*
str
=
locale_strings
+
lcnames_index
[
pos
].
name
;
res
=
compare_locale_names
(
name
,
str
+
1
);
if
(
res
<
0
)
max
=
pos
-
1
;
else
if
(
res
>
0
)
min
=
pos
+
1
;
else
return
&
lcnames_index
[
pos
];
}
return
NULL
;
}
/***********************************************************************
* init_locale
*/
...
...
@@ -5190,9 +5222,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH IsValidLocale( LCID lcid, DWORD flags )
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
IsValidLocaleName
(
const
WCHAR
*
locale
)
{
LCID
lcid
;
return
!
RtlLocaleNameToLcid
(
locale
,
&
lcid
,
2
);
if
(
locale
==
LOCALE_NAME_USER_DEFAULT
)
return
FALSE
;
return
!!
find_lcname_entry
(
locale
);
}
...
...
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