talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 37cb4e9144caaf69e0b8abb4eb31736a122f727e
parent 211b303a031cb650d77cb2aabd89d29c63a21596
Author: Colin Leroy <colin@colino.net>
Date:   Thu, 21 Feb 2008 08:05:09 +0000

2008-02-21 [colin]	3.3.0cvs20

	* src/matcher.c
		Fix bug 1527, 'filtering is case sensitive when it
		shouldn't be'

Diffstat:
MChangeLog | 6++++++
MPATCHSETS | 1+
Mconfigure.ac | 2+-
Msrc/matcher.c | 21++++++++++++---------
4 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,9 @@ +2008-02-21 [colin] 3.3.0cvs20 + + * src/matcher.c + Fix bug 1527, 'filtering is case sensitive when it + shouldn't be' + 2008-02-20 [colin] 3.3.0cvs19 * src/main.c diff --git a/PATCHSETS b/PATCHSETS @@ -3233,3 +3233,4 @@ ( cvs diff -u -r 1.30.2.26 -r 1.30.2.27 tools/README; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 tools/csv2addressbook.pl; ) > 3.3.0cvs17.patchset ( cvs diff -u -r 1.1.2.20 -r 1.1.2.21 manual/plugins.xml; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 manual/es/plugins.xml; cvs diff -u -r 1.1.2.8 -r 1.1.2.9 manual/fr/plugins.xml; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 manual/pl/plugins.xml; ) > 3.3.0cvs18.patchset ( cvs diff -u -r 1.115.2.188 -r 1.115.2.189 src/main.c; ) > 3.3.0cvs19.patchset +( cvs diff -u -r 1.75.2.57 -r 1.75.2.58 src/matcher.c; ) > 3.3.0cvs20.patchset diff --git a/configure.ac b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=3 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=19 +EXTRA_VERSION=20 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/matcher.c b/src/matcher.c @@ -257,11 +257,7 @@ MatcherProp *matcherprop_new(gint criteria, const gchar *header, prop->criteria = criteria; prop->header = header != NULL ? g_strdup(header) : NULL; - if (matchtype == MATCHTYPE_MATCHCASE || - matchtype == MATCHTYPE_REGEXPCASE) - prop->expr = expr != NULL ? g_utf8_casefold(expr, -1) : NULL; - else - prop->expr = expr != NULL ? g_strdup(expr) : NULL; + prop->expr = expr != NULL ? g_strdup(expr) : NULL; prop->matchtype = matchtype; prop->preg = NULL; @@ -447,6 +443,7 @@ static gboolean matcherprop_string_match(MatcherProp *prop, const gchar *str, const gchar *debug_context) { gchar *str1; + gchar *down_expr; gboolean ret = FALSE; gboolean should_free = FALSE; if (str == NULL) @@ -455,9 +452,11 @@ static gboolean matcherprop_string_match(MatcherProp *prop, const gchar *str, if (prop->matchtype == MATCHTYPE_REGEXPCASE || prop->matchtype == MATCHTYPE_MATCHCASE) { str1 = g_utf8_casefold(str, -1); + down_expr = g_utf8_casefold(prop->expr, -1); should_free = TRUE; } else { str1 = (gchar *)str; + down_expr = (gchar *)prop->expr; should_free = FALSE; } @@ -467,7 +466,7 @@ static gboolean matcherprop_string_match(MatcherProp *prop, const gchar *str, if (!prop->preg && (prop->error == 0)) { prop->preg = g_new0(regex_t, 1); /* if regexp then don't use the escaped string */ - if (regcomp(prop->preg, prop->expr, + if (regcomp(prop->preg, down_expr, REG_NOSUB | REG_EXTENDED | ((prop->matchtype == MATCHTYPE_REGEXPCASE) ? REG_ICASE : 0)) != 0) { @@ -476,8 +475,10 @@ static gboolean matcherprop_string_match(MatcherProp *prop, const gchar *str, prop->preg = NULL; } } - if (prop->preg == NULL) - return FALSE; + if (prop->preg == NULL) { + ret = FALSE; + goto free_strs; + } if (regexec(prop->preg, str1, 0, NULL, 0) == 0) ret = TRUE; @@ -507,7 +508,7 @@ static gboolean matcherprop_string_match(MatcherProp *prop, const gchar *str, case MATCHTYPE_MATCHCASE: case MATCHTYPE_MATCH: - ret = (strstr(str1, prop->expr) != NULL); + ret = (strstr(str1, down_expr) != NULL); /* debug output */ if (debug_filtering_session @@ -534,8 +535,10 @@ static gboolean matcherprop_string_match(MatcherProp *prop, const gchar *str, break; } +free_strs: if (should_free) { g_free(str1); + g_free(down_expr); } return ret; }