wrc: Avoid loading locale.nls when not necessary.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-04-04 10:43:09 +02:00
parent 2d2dba5374
commit 701ed2591b
2 changed files with 16 additions and 12 deletions

View File

@ -177,29 +177,32 @@ static int parse_accel_string( const string_t *key, int flags )
*/
static void put_string(const string_t *str, int isterm, language_t lang)
{
int cnt, codepage;
int cnt;
if (win32)
{
string_t *newstr;
codepage = get_language_codepage( lang );
newstr = convert_string_unicode( str, codepage );
if (str->type == str_char && check_valid_utf8( str, codepage ))
if (str->type == str_char)
{
print_location( &str->loc );
warning( "string \"%s\" seems to be UTF-8 but codepage %u is in use, maybe use --utf8?\n",
str->str.cstr, codepage );
int codepage = get_language_codepage( lang );
string_t *newstr = convert_string_unicode( str, codepage );
if (check_valid_utf8( str, codepage ))
{
print_location( &str->loc );
warning( "string \"%s\" seems to be UTF-8 but codepage %u is in use, maybe use --utf8?\n",
str->str.cstr, codepage );
}
str = newstr;
}
if (!isterm) put_word(newstr->size);
for(cnt = 0; cnt < newstr->size; cnt++)
if (!isterm) put_word(str->size);
for(cnt = 0; cnt < str->size; cnt++)
{
WCHAR c = newstr->str.wstr[cnt];
WCHAR c = str->str.wstr[cnt];
if (isterm && !c) break;
put_word(c);
}
if (isterm) put_word(0);
free_string(newstr);
}
else
{

View File

@ -385,6 +385,7 @@ int get_language_codepage( language_t lang )
const NLS_LOCALE_LCID_INDEX *entry;
if (!lang) return 1252;
if (lang == MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT )) return 1252;
if (!locale_table) load_locale_nls();
if (!(entry = find_lcid_entry( lang ))) return -1;
return get_locale_data( entry->idx )->idefaultansicodepage;