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
72c3b8f3
Commit
72c3b8f3
authored
Jun 12, 2023
by
Victor Chiletto
Committed by
Alexandre Julliard
Jul 12, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Skip exhaustive locale search with valid snames.
parent
45dd09d0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
13 deletions
+26
-13
msvcr110.c
dlls/msvcr110/tests/msvcr110.c
+2
-2
msvcr120.c
dlls/msvcr120/tests/msvcr120.c
+2
-2
locale.c
dlls/msvcrt/locale.c
+22
-9
No files found.
dlls/msvcr110/tests/msvcr110.c
View file @
72c3b8f3
...
...
@@ -153,14 +153,14 @@ static void test_setlocale(void)
ok
(
!
ret
,
"setlocale(en-us.1250) succeeded (%s)
\n
"
,
ret
);
ret
=
p_setlocale
(
LC_ALL
,
"zh-Hans"
);
todo_wine
ok
((
ret
!=
NULL
ok
((
ret
!=
NULL
||
broken
(
ret
==
NULL
)),
/* Vista */
"expected success, but got NULL
\n
"
);
if
(
ret
)
ok
(
!
strcmp
(
ret
,
"zh-Hans"
),
"setlocale zh-Hans failed
\n
"
);
ret
=
p_setlocale
(
LC_ALL
,
"zh-Hant"
);
todo_wine
ok
((
ret
!=
NULL
ok
((
ret
!=
NULL
||
broken
(
ret
==
NULL
)),
/* Vista */
"expected success, but got NULL
\n
"
);
if
(
ret
)
...
...
dlls/msvcr120/tests/msvcr120.c
View file @
72c3b8f3
...
...
@@ -598,11 +598,11 @@ static void test____lc_locale_name_func(void)
p_setlocale
(
LC_ALL
,
"zh-Hans"
);
lc_names
=
p____lc_locale_name_func
();
todo_wine
ok
(
!
lstrcmpW
(
lc_names
[
1
],
L"zh-Hans"
),
"lc_names[1] expected zh-Hans got %s
\n
"
,
wine_dbgstr_w
(
lc_names
[
1
]));
ok
(
!
lstrcmpW
(
lc_names
[
1
],
L"zh-Hans"
),
"lc_names[1] expected zh-Hans got %s
\n
"
,
wine_dbgstr_w
(
lc_names
[
1
]));
p_setlocale
(
LC_ALL
,
"zh-Hant"
);
lc_names
=
p____lc_locale_name_func
();
todo_wine
ok
(
!
lstrcmpW
(
lc_names
[
1
],
L"zh-Hant"
),
"lc_names[1] expected zh-Hant got %s
\n
"
,
wine_dbgstr_w
(
lc_names
[
1
]));
ok
(
!
lstrcmpW
(
lc_names
[
1
],
L"zh-Hant"
),
"lc_names[1] expected zh-Hant got %s
\n
"
,
wine_dbgstr_w
(
lc_names
[
1
]));
p_setlocale
(
LC_ALL
,
"C"
);
lc_names
=
p____lc_locale_name_func
();
...
...
dlls/msvcrt/locale.c
View file @
72c3b8f3
...
...
@@ -343,6 +343,7 @@ BOOL locale_to_sname(const char *locale, unsigned short *codepage, BOOL *sname_m
if
(
!
locale
[
0
]
||
(
cp
==
locale
&&
!
region
))
{
GetUserDefaultLocaleName
(
sname
,
sname_size
);
}
else
{
WCHAR
wbuf
[
LOCALE_NAME_MAX_LENGTH
];
locale_search_t
search
;
memset
(
&
search
,
0
,
sizeof
(
locale_search_t
));
...
...
@@ -364,21 +365,33 @@ BOOL locale_to_sname(const char *locale, unsigned short *codepage, BOOL *sname_m
if
(
!
cp
&&
!
region
)
{
remap_synonym
(
search
.
search_language
);
#if _MSVCR_VER >= 110
search
.
allow_sname
=
TRUE
;
#endif
}
MultiByteToWideChar
(
CP_ACP
,
0
,
search
.
search_language
,
-
1
,
wbuf
,
LOCALE_NAME_MAX_LENGTH
);
if
(
search
.
allow_sname
&&
IsValidLocaleName
(
wbuf
))
{
search
.
match_flags
=
FOUND_SNAME
;
wcsncpy
(
sname
,
wbuf
,
sname_size
);
}
else
{
EnumSystemLocalesEx
(
find_best_locale_proc
,
0
,
(
LPARAM
)
&
search
,
NULL
);
EnumSystemLocalesEx
(
find_best_locale_proc
,
0
,
(
LPARAM
)
&
search
,
NULL
);
if
(
!
search
.
match_flags
)
return
FALSE
;
if
(
!
search
.
match_flags
)
return
FALSE
;
/* If we were given something that didn't match, fail */
if
(
search
.
search_language
[
0
]
&&
!
(
search
.
match_flags
&
(
FOUND_SNAME
|
FOUND_LANGUAGE
)))
return
FALSE
;
if
(
search
.
search_country
[
0
]
&&
!
(
search
.
match_flags
&
FOUND_COUNTRY
))
return
FALSE
;
/* If we were given something that didn't match, fail */
if
(
search
.
search_language
[
0
]
&&
!
(
search
.
match_flags
&
(
FOUND_SNAME
|
FOUND_LANGUAGE
)))
return
FALSE
;
if
(
search
.
search_country
[
0
]
&&
!
(
search
.
match_flags
&
FOUND_COUNTRY
))
return
FALSE
;
LCIDToLocaleName
(
search
.
found_lang_id
,
sname
,
sname_size
,
LOCALE_ALLOW_NEUTRAL_NAMES
);
}
LCIDToLocaleName
(
search
.
found_lang_id
,
sname
,
sname_size
,
LOCALE_ALLOW_NEUTRAL_NAMES
);
is_sname
=
(
search
.
match_flags
&
FOUND_SNAME
)
!=
0
;
}
...
...
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