EBookBackendSexp: Restore suffix search functionality
authorTristan Van Berkom <tristanvb@openismus.com>
Thu, 21 Feb 2013 09:14:34 +0000 (18:14 +0900)
committerTristan Van Berkom <tristanvb@openismus.com>
Thu, 21 Feb 2013 09:19:03 +0000 (18:19 +0900)
All suffix searches using EBookBackendSexp had been broken as
of commit 5236e0b1f82ec1ef9d2e87e2f8e493471b8cd57e. This patch
restores suffix searches to work properly again.

addressbook/libedata-book/e-book-backend-sexp.c

index c80eae4..f8712b2 100644 (file)
@@ -707,8 +707,10 @@ endswith_helper (const gchar *ps1,
        glong s1len = g_utf8_strlen (s1, -1);
        glong s2len = g_utf8_strlen (s2, -1);
 
-       if (s1len >= s2len)
-               res = TRUE;
+       if (s1len < s2len)
+               res = FALSE;
+       else
+               res = e_util_utf8_strstrcase (g_utf8_offset_to_pointer (s1, s1len - s2len), s2) != NULL;
 
        g_free (s1);
        g_free (s2);