[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117780: Improve error checking and error messages i
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] trunk r117780: Improve error checking and error messages in string-collation functions. |
Date: |
Sat, 30 Aug 2014 08:20:04 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117780
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2014-08-30 11:19:24 +0300
message:
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.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/sysdep.c sysdep.c-20091113204419-o5vbwnq5f7feedwu-448
src/w32proc.c w32proc.c-20091113204419-o5vbwnq5f7feedwu-814
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-08-29 21:19:45 +0000
+++ b/src/ChangeLog 2014-08-30 08:19:24 +0000
@@ -1,3 +1,15 @@
+2014-08-30 Eli Zaretskii <address@hidden>
+
+ * 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.
+
+ * 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.
+
2014-08-29 Michael Albinus <address@hidden>
* sysdep.c (str_collate) [__STDC_ISO_10646__]: Move up setting errno.
=== modified file 'src/sysdep.c'
--- a/src/sysdep.c 2014-08-29 21:19:45 +0000
+++ b/src/sysdep.c 2014-08-30 08:19:24 +0000
@@ -3747,7 +3747,7 @@
locale_t loc = newlocale (LC_COLLATE_MASK | LC_CTYPE_MASK,
SSDATA (locale), 0);
if (!loc)
- error ("Wrong locale: %s", strerror (errno));
+ error ("Invalid locale %s: %s", SSDATA (locale), strerror (errno));
if (! NILP (ignore_case))
for (int i = 1; i < 3; i++)
@@ -3774,8 +3774,13 @@
res = wcscoll (p1, p2);
err = errno;
}
- if (err)
- error ("Wrong argument: %s", strerror (err));
+# ifndef HAVE_NEWLOCALE
+ if (err)
+ error ("Invalid locale or string for collation: %s", strerror (err));
+# else
+ if (err)
+ error ("Invalid string for collation: %s", strerror (err));
+# endif
SAFE_FREE ();
return res;
@@ -3789,7 +3794,14 @@
{
char *loc = STRINGP (locale) ? SSDATA (locale) : NULL;
-
- return w32_compare_strings (SDATA (s1), SDATA (s2), loc, !NILP
(ignore_case));
+ int res, err = errno;
+
+ errno = 0;
+ res = w32_compare_strings (SDATA (s1), SDATA (s2), loc, !NILP (ignore_case));
+ if (errno)
+ error ("Invalid string for collation: %s", strerror (errno));
+
+ errno = err;
+ return res;
}
#endif /* WINDOWSNT */
=== modified file 'src/w32proc.c'
--- a/src/w32proc.c 2014-08-29 19:18:06 +0000
+++ b/src/w32proc.c 2014-08-30 08:19:24 +0000
@@ -3164,6 +3164,12 @@
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 @@
if (new_lcid > 0)
lcid = new_lcid;
+ else
+ error ("Invalid locale %s: Invalid argument", locname);
}
if (ignore_case)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117780: Improve error checking and error messages in string-collation functions.,
Eli Zaretskii <=