Alexandre Julliard : kernel32: Also match script name when looking for a locale.
Alexandre Julliard
julliard at winehq.org
Mon Nov 13 16:24:19 CST 2017
Module: wine
Branch: master
Commit: de7e687801e3e66c27c0b9822767e37f52d93c09
URL: http://source.winehq.org/git/wine.git/?a=commit;h=de7e687801e3e66c27c0b9822767e37f52d93c09
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Nov 13 19:04:04 2017 +0100
kernel32: Also match script name when looking for a locale.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/locale.c | 36 +++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 64966e5..47d0c89 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -406,6 +406,24 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type,
if (strcmpiW( buffer, data->lang )) return TRUE;
matches++; /* language name matched */
+ if (data->script)
+ {
+ if (GetLocaleInfoW( lcid, LOCALE_SSCRIPTS | LOCALE_NOUSEROVERRIDE,
+ buffer, sizeof(buffer)/sizeof(WCHAR) ))
+ {
+ const WCHAR *p = buffer;
+ unsigned int len = strlenW( data->script );
+ while (*p)
+ {
+ if (!strncmpiW( p, data->script, len ) && (!p[len] || p[len] == ';')) break;
+ if (!(p = strchrW( p, ';'))) goto done;
+ p++;
+ }
+ if (!*p) goto done;
+ matches++; /* script matched */
+ }
+ }
+
if (data->country)
{
if (GetLocaleInfoW( lcid, LOCALE_SISO3166CTRYNAME|LOCALE_NOUSEROVERRIDE,
@@ -489,16 +507,24 @@ static void parse_locale_name( const WCHAR *str, struct locale_name *name )
strcpyW( name->win_name, name->lang );
*p++ = 0;
name->country = p;
- if (!(p = strpbrkW( p, winsepW ))) goto done;
- if (*p == '-')
+ if ((p = strpbrkW( p, winsepW )) && *p == '-')
{
*p++ = 0;
name->script = name->country;
name->country = p;
- if (!(p = strpbrkW( p, winsepW ))) goto done;
+ p = strpbrkW( p, winsepW );
+ }
+ if (p)
+ {
+ *p++ = 0;
+ name->modifier = p;
+ }
+ /* second value can be script or country, check length to resolve the ambiguity */
+ if (!name->script && strlenW( name->country ) == 4)
+ {
+ name->script = name->country;
+ name->country = NULL;
}
- *p++ = 0;
- name->modifier = p;
}
else /* Unix format */
{
More information about the wine-cvs
mailing list