commit 31d5a22c39ba5405641829d99e36d19a672c15fb
Author: phantomjinx <[email protected]>
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 | 44 +-------------------------------------------
1 files changed, 1 insertions(+), 43 deletions(-)
---
diff --git a/src/misc.c b/src/misc.c
index ec86b38..0080f10 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -174,53 +174,11 @@ gchar *concat_dir_if_relative(G_CONST_RETURN gchar
*base_dir, G_CONST_RETURN gch
return g_build_filename(base_dir, rel_dir, NULL);
}
-/* 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);
-
- 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2