mirror of
git://source.winehq.org/git/wine.git
synced 2024-07-22 19:23:08 +00:00
kernelbase: Reimplement LOCALE_SNATIVEDIGITS in GetLocaleInfoW/Ex using the locale.nls data.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f0d43939ff
commit
ec5d3c9fe7
|
@ -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 */
|
/* get locale information from the locale.nls file */
|
||||||
static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE type,
|
static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE type,
|
||||||
WCHAR *buffer, int len )
|
WCHAR *buffer, int len )
|
||||||
|
@ -967,7 +996,7 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
case LOCALE_SNATIVEDIGITS:
|
case LOCALE_SNATIVEDIGITS:
|
||||||
return -1;
|
return locale_return_strarray_concat( locale->snativedigits, type, buffer, len );
|
||||||
|
|
||||||
case LOCALE_SCURRENCY:
|
case LOCALE_SCURRENCY:
|
||||||
return locale_return_string( locale->scurrency, type, buffer, len );
|
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;
|
return -1;
|
||||||
|
|
||||||
case LOCALE_IDIGITSUBSTITUTION:
|
case LOCALE_IDIGITSUBSTITUTION:
|
||||||
return -1;
|
return locale_return_number( locale->idigitsubstitution, type, buffer, len );
|
||||||
}
|
}
|
||||||
SetLastError( ERROR_INVALID_FLAGS );
|
SetLastError( ERROR_INVALID_FLAGS );
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -3613,7 +3613,6 @@ static BOOL CALLBACK enum_proc(LGRPID group, LCID lcid, LPSTR locale, LONG_PTR l
|
||||||
SCRIPT_CONTROL sc;
|
SCRIPT_CONTROL sc;
|
||||||
SCRIPT_STATE ss;
|
SCRIPT_STATE ss;
|
||||||
LCID lcid_old;
|
LCID lcid_old;
|
||||||
BOOL todo;
|
|
||||||
|
|
||||||
if (!IsValidLocale(lcid, LCID_INSTALLED)) return TRUE;
|
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();
|
lcid_old = GetThreadLocale();
|
||||||
if (!SetThreadLocale(lcid)) return TRUE;
|
if (!SetThreadLocale(lcid)) return TRUE;
|
||||||
|
|
||||||
todo = !GetLocaleInfoW(lcid, LOCALE_IDIGITSUBSTITUTION | LOCALE_RETURN_NUMBER, NULL, 0);
|
|
||||||
|
|
||||||
hr = ScriptRecordDigitSubstitution(lcid, &sds);
|
hr = ScriptRecordDigitSubstitution(lcid, &sds);
|
||||||
todo_wine_if( todo )
|
|
||||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||||
|
|
||||||
hr = ScriptApplyDigitSubstitution(&sds, &sc, &ss);
|
hr = ScriptApplyDigitSubstitution(&sds, &sc, &ss);
|
||||||
|
|
Loading…
Reference in a new issue