diff options
author | Max Kellermann <max@duempel.org> | 2008-10-15 19:36:37 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-15 19:36:37 +0200 |
commit | 047043d2a8ee4482a845ed9860dbf4cd01540eef (patch) | |
tree | ec8542ca3ea28e255bd857f01b7b8672fb029da5 /src/locate.c | |
parent | 7366191f0d0d5c50ee051a3b60fc31ad86bce721 (diff) | |
download | mpd-047043d2a8ee4482a845ed9860dbf4cd01540eef.tar.gz mpd-047043d2a8ee4482a845ed9860dbf4cd01540eef.tar.xz mpd-047043d2a8ee4482a845ed9860dbf4cd01540eef.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/locate.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/locate.c b/src/locate.c index 05463b5c9..6b8e87734 100644 --- a/src/locate.c +++ b/src/locate.c @@ -22,6 +22,8 @@ #include "tag.h" #include "song.h" +#include <glib.h> + #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 |