aboutsummaryrefslogtreecommitdiff
path: root/src/locate.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-15 19:36:37 +0200
committerMax Kellermann <max@duempel.org>2008-10-15 19:36:37 +0200
commit047043d2a8ee4482a845ed9860dbf4cd01540eef (patch)
treeec8542ca3ea28e255bd857f01b7b8672fb029da5 /src/locate.c
parent7366191f0d0d5c50ee051a3b60fc31ad86bce721 (diff)
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 'src/locate.c')
-rw-r--r--src/locate.c12
1 files changed, 8 insertions, 4 deletions
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 <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