Alexandre Julliard : kernelbase: Reimplement LOCALE_SNATIVEDIGITS in GetLocaleInfoW/Ex using the locale.nls data.
Alexandre Julliard
julliard at winehq.org
Tue Mar 29 15:09:53 CDT 2022
Module: wine
Branch: master
Commit: ec5d3c9fe753f53f6efe6d308b5d40bbbc1f052a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ec5d3c9fe753f53f6efe6d308b5d40bbbc1f052a
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Mar 29 08:37:02 2022 +0200
kernelbase: Reimplement LOCALE_SNATIVEDIGITS in GetLocaleInfoW/Ex using the locale.nls data.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernelbase/locale.c | 33 +++++++++++++++++++++++++++++++--
dlls/usp10/tests/usp10.c | 4 ----
2 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c
index 2a74cab6500..16b923915a9 100644
--- a/dlls/kernelbase/locale.c
+++ b/dlls/kernelbase/locale.c
@@ -896,6 +896,35 @@ static int locale_return_strarray( DWORD pos, WORD idx, LCTYPE type, WCHAR *buff
}
+static int locale_return_strarray_concat( DWORD pos, LCTYPE type, WCHAR *buffer, int len )
+{
+ WORD i, count = locale_strings[pos];
+ const DWORD *array = (const DWORD *)(locale_strings + pos + 1);
+ int ret;
+
+ if (type & LOCALE_RETURN_NUMBER)
+ {
+ SetLastError( ERROR_INVALID_FLAGS );
+ return 0;
+ }
+ for (i = 0, ret = 1; i < count; i++) ret += locale_strings[array[i]];
+
+ if (!len) return ret;
+ if (ret > len)
+ {
+ SetLastError( ERROR_INSUFFICIENT_BUFFER );
+ return 0;
+ }
+ for (i = 0; i < count; i++)
+ {
+ memcpy( buffer, locale_strings + array[i] + 1, locale_strings[array[i]] * sizeof(WCHAR) );
+ buffer += locale_strings[array[i]];
+ }
+ *buffer = 0;
+ return ret;
+}
+
+
/* get locale information from the locale.nls file */
static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE type,
WCHAR *buffer, int len )
@@ -967,7 +996,7 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ
return -1;
case LOCALE_SNATIVEDIGITS:
- return -1;
+ return locale_return_strarray_concat( locale->snativedigits, type, buffer, len );
case LOCALE_SCURRENCY:
return locale_return_string( locale->scurrency, type, buffer, len );
@@ -1285,7 +1314,7 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ
return -1;
case LOCALE_IDIGITSUBSTITUTION:
- return -1;
+ return locale_return_number( locale->idigitsubstitution, type, buffer, len );
}
SetLastError( ERROR_INVALID_FLAGS );
return 0;
diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index c18076bab53..aee751423b3 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -3613,7 +3613,6 @@ static BOOL CALLBACK enum_proc(LGRPID group, LCID lcid, LPSTR locale, LONG_PTR l
SCRIPT_CONTROL sc;
SCRIPT_STATE ss;
LCID lcid_old;
- BOOL todo;
if (!IsValidLocale(lcid, LCID_INSTALLED)) return TRUE;
@@ -3624,10 +3623,7 @@ static BOOL CALLBACK enum_proc(LGRPID group, LCID lcid, LPSTR locale, LONG_PTR l
lcid_old = GetThreadLocale();
if (!SetThreadLocale(lcid)) return TRUE;
- todo = !GetLocaleInfoW(lcid, LOCALE_IDIGITSUBSTITUTION | LOCALE_RETURN_NUMBER, NULL, 0);
-
hr = ScriptRecordDigitSubstitution(lcid, &sds);
- todo_wine_if( todo )
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ScriptApplyDigitSubstitution(&sds, &sc, &ss);
More information about the wine-cvs
mailing list