From 53b3175cfabe78b6ce3403f38d59addb218cb61b Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Thu, 28 Jun 2012 23:20:39 +0200 Subject: [PATCH] regex: Add new GRegexError code from PCRE 8.31 --- glib/gregex.c | 3 +++ glib/gregex.h | 7 +++++-- glib/tests/regex.c | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/glib/gregex.c b/glib/gregex.c index 825911b31..8921ad391 100644 --- a/glib/gregex.c +++ b/glib/gregex.c @@ -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 */ diff --git a/glib/gregex.h b/glib/gregex.h index 29e5c6af4..306b9d227 100644 --- a/glib/gregex.h +++ b/glib/gregex.h @@ -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; /** diff --git a/glib/tests/regex.c b/glib/tests/regex.c index 2359a418d..7975c5c7c 100644 --- a/glib/tests/regex.c +++ b/glib/tests/regex.c @@ -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