commit 4a3341d4bcac128a6e96b07c5c2f448b4db621d6 Author: phantomjinx <p.g.richard...@phantomjinx.co.uk> Date: Sun Jun 6 19:45:17 2010 +0100
Filter seems to not work properly when trying to filter tracks * The filter-as-type search bar does not seem to filter against tracks correctly, rendering most of the time a blank view. * misc.c * Proposed Changed is to modify utf8_strcasestr search function to defer to g_strrstr instead, which seems built into glib since its first development. src/misc.c | 56 ++++---------------------------------------------------- 1 files changed, 4 insertions(+), 52 deletions(-) --- diff --git a/src/misc.c b/src/misc.c index 7246d20..9133de7 100644 --- a/src/misc.c +++ b/src/misc.c @@ -62,59 +62,11 @@ const gchar *SCRIPTDIR = PACKAGE_DATA_DIR G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARA * * \*------------------------------------------------------------------*/ -/* Copied g_utf8_strcasestr from GtkSourceView */ -gchar *utf8_strcasestr (const gchar *haystack, const gchar *needle) -{ - gsize needle_len; - gsize haystack_len; - gchar *ret = NULL; - gchar *p; - gchar *casefold; - gchar *caseless_haystack; - gint i; - - g_return_val_if_fail (haystack != NULL, NULL); - g_return_val_if_fail (needle != NULL, NULL); - - casefold = g_utf8_casefold (haystack, -1); - caseless_haystack = g_utf8_normalize (casefold, -1, G_NORMALIZE_ALL); - g_free (casefold); - - needle_len = g_utf8_strlen (needle, -1); - haystack_len = g_utf8_strlen (caseless_haystack, -1); - - if (needle_len == 0) - { - ret = (gchar *)haystack; - goto finally_1; - } - - if (haystack_len < needle_len) - { - ret = NULL; - goto finally_1; - } - - p = (gchar*)caseless_haystack; - needle_len = strlen (needle); - i = 0; - - while (*p) - { - if ((strncmp (p, needle, needle_len) == 0)) - { - ret = g_utf8_offset_to_pointer (haystack, i); - goto finally_1; - } - - p = g_utf8_next_char (p); - i++; - } - -finally_1: - g_free (caseless_haystack); +gchar *utf8_strcasestr(const gchar *haystack, const gchar *needle) { + g_return_val_if_fail (haystack != NULL, NULL); + g_return_val_if_fail (needle != NULL, NULL); - return ret; + return g_strrstr(haystack, needle); } /* Calculate the time in ms passed since @old_time. @old_time is ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ gtkpod-cvs2 mailing list gtkpod-cvs2@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2