From 047043d2a8ee4482a845ed9860dbf4cd01540eef Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 15 Oct 2008 19:36:37 +0200 Subject: locate: use g_utf8_casefold() instead of string_toupper() string_toupper() and strDupToUpper() were not able to deal with character sets other than US-ASCII. Use GLib's g_utf8_casefold() for strings. --- src/locate.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/locate.c') diff --git a/src/locate.c b/src/locate.c index 05463b5c..6b8e8773 100644 --- a/src/locate.c +++ b/src/locate.c @@ -22,6 +22,8 @@ #include "tag.h" #include "song.h" +#include + #define LOCATE_TAG_FILE_KEY "file" #define LOCATE_TAG_FILE_KEY_OLD "filename" #define LOCATE_TAG_ANY_KEY "any" @@ -132,11 +134,13 @@ strstrSearchTag(struct song *song, enum tag_type type, char *str) int8_t visitedTypes[TAG_NUM_OF_ITEM_TYPES] = { 0 }; if (type == LOCATE_TAG_FILE_TYPE || type == LOCATE_TAG_ANY_TYPE) { - char path_max_tmp[MPD_PATH_MAX]; + char path_max_tmp[MPD_PATH_MAX], *p; - string_toupper(song_get_url(song, path_max_tmp)); + song_get_url(song, path_max_tmp); + p = g_utf8_casefold(path_max_tmp, -1); if (strstr(path_max_tmp, str)) ret = 1; + g_free(p); if (ret == 1 || type == LOCATE_TAG_FILE_TYPE) return ret; } @@ -151,10 +155,10 @@ strstrSearchTag(struct song *song, enum tag_type type, char *str) continue; } - duplicate = strDupToUpper(song->tag->items[i]->value); + duplicate = g_utf8_casefold(song->tag->items[i]->value, -1); if (*str && strstr(duplicate, str)) ret = 1; - free(duplicate); + g_free(duplicate); } /** If the search critieron was not visited during the sweep -- cgit v1.2.3