aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@novell.com>2004-08-06 01:38:05 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-08-06 01:38:05 +0800
commit796231864882de932677fb1adb5296143d9a3f38 (patch)
treec2734d0c915b1fab27f0da3e5fc099c669c8a0c9 /camel
parent132c7a5a27f26c2a6f0dcb569cbf05d13fc9b1e2 (diff)
downloadgsoc2013-evolution-796231864882de932677fb1adb5296143d9a3f38.tar
gsoc2013-evolution-796231864882de932677fb1adb5296143d9a3f38.tar.gz
gsoc2013-evolution-796231864882de932677fb1adb5296143d9a3f38.tar.bz2
gsoc2013-evolution-796231864882de932677fb1adb5296143d9a3f38.tar.lz
gsoc2013-evolution-796231864882de932677fb1adb5296143d9a3f38.tar.xz
gsoc2013-evolution-796231864882de932677fb1adb5296143d9a3f38.tar.zst
gsoc2013-evolution-796231864882de932677fb1adb5296143d9a3f38.zip
In the case of start() or end() failing, loop starting with the first
2004-08-03 Jeffrey Stedfast <fejj@novell.com> * camel-url-scanner.c (camel_url_scanner_scan): In the case of start() or end() failing, loop starting with the first character immediately following the failed match position. Fixes bug #62136. svn path=/trunk/; revision=26831
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-url-scanner.c36
2 files changed, 28 insertions, 14 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index f0df9b17c1..4a9c83f055 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -4,6 +4,12 @@
2004-08-03 Jeffrey Stedfast <fejj@novell.com>
+ * camel-url-scanner.c (camel_url_scanner_scan): In the case of
+ start() or end() failing, loop starting with the first character
+ immediately following the failed match position. Fixes bug #62136.
+
+2004-08-03 Jeffrey Stedfast <fejj@novell.com>
+
* providers/imap4/camel-imap4-store.c (imap4_construct): Pass a
reconnect func.
diff --git a/camel/camel-url-scanner.c b/camel/camel-url-scanner.c
index 891a47610e..1240731f9b 100644
--- a/camel/camel-url-scanner.c
+++ b/camel/camel-url-scanner.c
@@ -30,6 +30,7 @@
#include <ctype.h>
#include "e-util/e-trie.h"
+#include "camel-utf8.h"
#include "camel-url-scanner.h"
@@ -76,29 +77,36 @@ camel_url_scanner_add (CamelUrlScanner *scanner, urlpattern_t *pattern)
gboolean
camel_url_scanner_scan (CamelUrlScanner *scanner, const char *in, size_t inlen, urlmatch_t *match)
{
- const char *pos, *inend;
+ const char *pos, *inptr, *inend;
urlpattern_t *pat;
int pattern;
g_return_val_if_fail (scanner != NULL, FALSE);
g_return_val_if_fail (in != NULL, FALSE);
- if (!(pos = e_trie_search (scanner->trie, in, inlen, &pattern)))
- return FALSE;
-
- pat = g_ptr_array_index (scanner->patterns, pattern);
-
- match->pattern = pat->pattern;
- match->prefix = pat->prefix;
-
+ inptr = in;
inend = in + inlen;
- if (!pat->start (in, pos, inend, match))
- return FALSE;
- if (!pat->end (in, pos, inend, match))
- return FALSE;
+ do {
+ if (!(pos = e_trie_search (scanner->trie, inptr, inlen, &pattern)))
+ return FALSE;
+
+ pat = g_ptr_array_index (scanner->patterns, pattern);
+
+ match->pattern = pat->pattern;
+ match->prefix = pat->prefix;
+
+ if (pat->start (in, pos, inend, match) && pat->end (in, pos, inend, match))
+ return TRUE;
+
+ inptr = pos;
+ if (camel_utf8_getc_limit ((const unsigned char **) &inptr, inend) == 0xffff)
+ break;
+
+ inlen = inend - inptr;
+ } while (inptr < inend);
- return TRUE;
+ return FALSE;
}