[glib] regex: Fix unicode othercasing
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] regex: Fix unicode othercasing
- Date: Mon, 2 Jul 2012 14:08:16 +0000 (UTC)
commit 7483315f83cac1f54fd72c331e6eff0781b8560f
Author: Christian Persch <chpe gnome org>
Date: Sun Jun 17 22:51:44 2012 +0200
regex: Fix unicode othercasing
Reorder the toupper/tolower calls when othercaseing, so this
function is bug-for-bug compatible with the pcre internal tables.
https://bugzilla.gnome.org/show_bug.cgi?id=678273
glib/pcre/pcre_tables.c | 4 ++--
glib/tests/regex.c | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/glib/pcre/pcre_tables.c b/glib/pcre/pcre_tables.c
index 5bac855..ddbf950 100644
--- a/glib/pcre/pcre_tables.c
+++ b/glib/pcre/pcre_tables.c
@@ -589,10 +589,10 @@ _pcre_ucp_othercase(const unsigned int c)
{
unsigned int oc;
- if ((oc = g_unichar_tolower(c)) != c)
- return oc;
if ((oc = g_unichar_toupper(c)) != c)
return oc;
+ if ((oc = g_unichar_tolower(c)) != c)
+ return oc;
return c;
}
diff --git a/glib/tests/regex.c b/glib/tests/regex.c
index a155e3a..72a0155 100644
--- a/glib/tests/regex.c
+++ b/glib/tests/regex.c
@@ -2332,6 +2332,12 @@ main (int argc, char *argv[])
/* This failed with PCRE 7.2 (gnome bug #455640) */
TEST_MATCH(".*$", 0, 0, "\xe1\xbb\x85", -1, 0, 0, TRUE);
+ /* Test that othercasing in our pcre/glib integration is bug-for-bug compatible
+ * with pcre's internal tables. Bug #678273 */
+ TEST_MATCH("[Ç]", G_REGEX_CASELESS, 0, "Ç", -1, 0, 0, TRUE);
+ TEST_MATCH("[Ç]", G_REGEX_CASELESS, 0, "Ç", -1, 0, 0, FALSE);
+ TEST_MATCH("[Ç]", G_REGEX_CASELESS, 0, "Ç", -1, 0, 0, TRUE);
+
/* TEST_MATCH_NEXT#(pattern, string, string_len, start_position, ...) */
TEST_MATCH_NEXT0("a", "x", -1, 0);
TEST_MATCH_NEXT0("a", "ax", -1, 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]