From c3f63bb4c032e4f377c8aebe3b66ed5b3684631d Mon Sep 17 00:00:00 2001 From: djcb Date: Fri, 13 Apr 2012 22:12:44 +0300 Subject: [PATCH] * mu-str.c, test-mu-query.c: ensure all unit tests pass --- src/mu-str.c | 11 +++++++---- src/tests/test-mu-query.c | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mu-str.c b/src/mu-str.c index d790eadf..dff06eb4 100644 --- a/src/mu-str.c +++ b/src/mu-str.c @@ -428,12 +428,13 @@ mu_str_ascii_xapian_escape_in_place (char *term, gboolean esc_space) gchar *cur; const char escchar = '_'; gboolean is_field, is_range_field; + unsigned colon; g_return_val_if_fail (term, NULL); check_for_field (term, &is_field, &is_range_field); - for (cur = term; *cur; ++cur) { + for (colon = 0, cur = term; *cur; ++cur) { *cur = tolower(*cur); @@ -448,11 +449,13 @@ mu_str_ascii_xapian_escape_in_place (char *term, gboolean esc_space) break; case ':': /* if there's a registered xapian prefix - * before the ':', don't touch it. Otherwise - * replace ':' with '_'... ugh yuck ugly... + * before the *first* ':', don't touch + * it. Otherwise replace ':' with '_'... ugh + * yuck ugly... */ - if (!is_field) + if (colon != 0 || !is_field) *cur = escchar; + ++colon; break; case '\'': case '*': /* wildcard */ diff --git a/src/tests/test-mu-query.c b/src/tests/test-mu-query.c index a5c5f35a..4eb65bfc 100644 --- a/src/tests/test-mu-query.c +++ b/src/tests/test-mu-query.c @@ -488,7 +488,6 @@ test_mu_query_attach (void) QResults queries[] = { { "j:sittingbull.jpg", 1}, - { "'file:sitting*'", 1}, { "file:custer", 0}, { "file:custer.jpg", 1} };