regex: Add new GRegexError code from PCRE 8.31
authorChristian Persch <chpe@gnome.org>
Thu, 28 Jun 2012 21:20:39 +0000 (23:20 +0200)
committerChristian Persch <chpe@gnome.org>
Sat, 7 Jul 2012 20:08:08 +0000 (22:08 +0200)
glib/gregex.c
glib/gregex.h
glib/tests/regex.c

index 825911b..8921ad3 100644 (file)
@@ -518,6 +518,9 @@ translate_compile_error (gint *errcode, const gchar **errmsg)
     case G_REGEX_ERROR_NAME_TOO_LONG:
       *errmsg = _("name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)");
       break;
+    case G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE:
+      *errmsg = _("character value in \\u.... sequence is too large");
+      break;
 
     case 116: /* erroffset passed as NULL */
       /* This should not happen as we never pass a NULL erroffset */
index 29e5c6a..306b9d2 100644 (file)
@@ -130,7 +130,9 @@ G_BEGIN_DECLS
  * @G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES: too many forward references. Since: 2.34
  * @G_REGEX_ERROR_NAME_TOO_LONG: the name is too long in "(*MARK)", "(*PRUNE)", 
  *     "(*SKIP)", or "(*THEN)". Since: 2.34
- * 
+ * @G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE: the character value in the \\u sequence is
+ *     too large. Since: 2.34
+ *
  * Error codes returned by regular expressions functions.
  *
  * Since: 2.14
@@ -194,7 +196,8 @@ typedef enum
   G_REGEX_ERROR_MISSING_NAME = 169,
   G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS = 171,
   G_REGEX_ERROR_TOO_MANY_FORWARD_REFERENCES = 172,
-  G_REGEX_ERROR_NAME_TOO_LONG = 175
+  G_REGEX_ERROR_NAME_TOO_LONG = 175,
+  G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE = 176
 } GRegexError;
 
 /**
index 2359a41..7975c5c 100644 (file)
@@ -2166,6 +2166,7 @@ main (int argc, char *argv[])
   TEST_NEW_FAIL ("\\k", 0, G_REGEX_ERROR_MISSING_NAME);
   TEST_NEW_FAIL ("a[\\NB]c", 0, G_REGEX_ERROR_NOT_SUPPORTED_IN_CLASS);
   TEST_NEW_FAIL ("(*:0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEFG)XX", 0, G_REGEX_ERROR_NAME_TOO_LONG);
+  TEST_NEW_FAIL ("\\u0100", G_REGEX_RAW | G_REGEX_JAVASCRIPT_COMPAT, G_REGEX_ERROR_CHARACTER_VALUE_TOO_LARGE);
 
   /* These errors can't really be tested sanely:
    * G_REGEX_ERROR_EXPRESSION_TOO_LARGE