Commit 701ed259 authored by Alexandre Julliard's avatar Alexandre Julliard

wrc: Avoid loading locale.nls when not necessary.

parent 2d2dba53
...@@ -177,29 +177,32 @@ static int parse_accel_string( const string_t *key, int flags ) ...@@ -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) static void put_string(const string_t *str, int isterm, language_t lang)
{ {
int cnt, codepage; int cnt;
if (win32) if (win32)
{ {
string_t *newstr;
codepage = get_language_codepage( lang ); if (str->type == str_char)
newstr = convert_string_unicode( str, codepage );
if (str->type == str_char && check_valid_utf8( str, codepage ))
{ {
print_location( &str->loc ); int codepage = get_language_codepage( lang );
warning( "string \"%s\" seems to be UTF-8 but codepage %u is in use, maybe use --utf8?\n", string_t *newstr = convert_string_unicode( str, codepage );
str->str.cstr, 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); if (!isterm) put_word(str->size);
for(cnt = 0; cnt < newstr->size; cnt++) for(cnt = 0; cnt < str->size; cnt++)
{ {
WCHAR c = newstr->str.wstr[cnt]; WCHAR c = str->str.wstr[cnt];
if (isterm && !c) break; if (isterm && !c) break;
put_word(c); put_word(c);
} }
if (isterm) put_word(0); if (isterm) put_word(0);
free_string(newstr);
} }
else else
{ {
......
...@@ -385,6 +385,7 @@ int get_language_codepage( language_t lang ) ...@@ -385,6 +385,7 @@ int get_language_codepage( language_t lang )
const NLS_LOCALE_LCID_INDEX *entry; const NLS_LOCALE_LCID_INDEX *entry;
if (!lang) return 1252; if (!lang) return 1252;
if (lang == MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT )) return 1252;
if (!locale_table) load_locale_nls(); if (!locale_table) load_locale_nls();
if (!(entry = find_lcid_entry( lang ))) return -1; if (!(entry = find_lcid_entry( lang ))) return -1;
return get_locale_data( entry->idx )->idefaultansicodepage; return get_locale_data( entry->idx )->idefaultansicodepage;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment