Alexandre Julliard : wrc: Avoid loading locale.nls when not necessary.
Alexandre Julliard
julliard at winehq.org
Mon Apr 4 15:37:51 CDT 2022
Module: wine
Branch: master
Commit: 701ed2591b4dfc5bac273b6f6c75f8fa69377fdc
URL: https://source.winehq.org/git/wine.git/?a=commit;h=701ed2591b4dfc5bac273b6f6c75f8fa69377fdc
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Apr 4 10:43:09 2022 +0200
wrc: Avoid loading locale.nls when not necessary.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/wrc/genres.c | 27 +++++++++++++++------------
tools/wrc/utils.c | 1 +
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/tools/wrc/genres.c b/tools/wrc/genres.c
index 81e7a52c9a9..aeec61a06bd 100644
--- a/tools/wrc/genres.c
+++ b/tools/wrc/genres.c
@@ -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
{
diff --git a/tools/wrc/utils.c b/tools/wrc/utils.c
index 3aaecdd1f78..bafc763692a 100644
--- a/tools/wrc/utils.c
+++ b/tools/wrc/utils.c
@@ -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;
More information about the wine-cvs
mailing list