From e7027eab55d9b3b63ddc1c26f3e222692c8c9499 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 30 Aug 2014 11:19:24 +0300 Subject: Improve error checking and error messages in string-collation functions. src/sysdep.c (str_collate) [__STDC_ISO_10646__]: Improve the wording of the error messages. (str_collate) [WINDOWSNT]: Signal an error if w32_compare_strings sets errno. src/w32proc.c (get_lcid_callback): Accept locale specifications without the country part, as in "enu" vs "enu_USA". (w32_compare_strings): Signal an error if a locale was specified, but couldn't be translated into a valid LCID. --- src/w32proc.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/w32proc.c') diff --git a/src/w32proc.c b/src/w32proc.c index 0b441d45186..399ed009ce3 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -3164,6 +3164,12 @@ get_lcid_callback (LPTSTR locale_num_str) if (GetLocaleInfo (try_lcid, LOCALE_SABBREVLANGNAME, locval, LOCALE_NAME_MAX_LENGTH)) { + /* This is for when they only specify the language, as in "ENU". */ + if (stricmp (locval, lname) == 0) + { + found_lcid = try_lcid; + return FALSE; + } strcat (locval, "_"); if (GetLocaleInfo (try_lcid, LOCALE_SABBREVCTRYNAME, locval + strlen (locval), LOCALE_NAME_MAX_LENGTH)) @@ -3287,6 +3293,8 @@ w32_compare_strings (const char *s1, const char *s2, char *locname, if (new_lcid > 0) lcid = new_lcid; + else + error ("Invalid locale %s: Invalid argument", locname); } if (ignore_case) -- cgit v1.2.1