mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 19:36:18 +01:00
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
This commit is contained in:
parent
a2f54a3408
commit
7483315f83
@ -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;
|
||||
}
|
||||
|
@ -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("[DŽ]", G_REGEX_CASELESS, 0, "DŽ", -1, 0, 0, TRUE);
|
||||
TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "Dž", -1, 0, 0, FALSE);
|
||||
TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "dž", -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);
|
||||
|
Loading…
Reference in New Issue
Block a user