2008-02-21 [colin] 3.3.0cvs20
authorColin Leroy <colin@colino.net>
Thu, 21 Feb 2008 08:05:09 +0000 (08:05 +0000)
committerColin Leroy <colin@colino.net>
Thu, 21 Feb 2008 08:05:09 +0000 (08:05 +0000)
* src/matcher.c
Fix bug 1527, 'filtering is case sensitive when it
shouldn't be'

ChangeLog
PATCHSETS
configure.ac
src/matcher.c

index 46357b008db1306a46db2582469dfaa181d00d88..13606a73bcc1c3224b65535e5c6b02a2b42c0571 100644 (file)
--- 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
index 8d5c2ef33b725b7808d0a567317045417cf47071..feca69b881b0ea4532217fceeaf58fe2b6bdb889 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index 19c49ff412e316413f7e3f89662b5260f5f82d10..e593ee71c27a0c4c17c20aec6a4b628e02163cfe 100644 (file)
@@ -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=
 
index eba5b05ff6b6586554b165bd5a09a71bd4f21864..844ff32734834e55556dc6a6e93240b4eb215900 100644 (file)
@@ -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;
 }