Commit 4847bbaa authored by Max Kellermann's avatar Max Kellermann

dirvec, songvec: sort using g_utf8_collate()

Path names in the directory and song structs are always encoded in UTF-8. Don't use strcmp(), it cannot handle UTF-8 characters properly. Use GLib's UTF-8 aware g_utf8_collate() function for that.
parent b7fe09fa
...@@ -19,7 +19,7 @@ static int dirvec_cmp(const void *d1, const void *d2) ...@@ -19,7 +19,7 @@ static int dirvec_cmp(const void *d1, const void *d2)
{ {
const struct directory *a = ((const struct directory * const *)d1)[0]; const struct directory *a = ((const struct directory * const *)d1)[0];
const struct directory *b = ((const struct directory * const *)d2)[0]; const struct directory *b = ((const struct directory * const *)d2)[0];
return strcmp(a->path, b->path); return g_utf8_collate(a->path, b->path);
} }
void dirvec_init(void) void dirvec_init(void)
......
...@@ -14,7 +14,7 @@ static int songvec_cmp(const void *s1, const void *s2) ...@@ -14,7 +14,7 @@ static int songvec_cmp(const void *s1, const void *s2)
{ {
const struct song *a = ((const struct song * const *)s1)[0]; const struct song *a = ((const struct song * const *)s1)[0];
const struct song *b = ((const struct song * const *)s2)[0]; const struct song *b = ((const struct song * const *)s2)[0];
return strcmp(a->url, b->url); return g_utf8_collate(a->url, b->url);
} }
static size_t sv_size(const struct songvec *sv) static size_t sv_size(const struct songvec *sv)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment