Use case insensitive ordering

This commit is contained in:
Přemysl Eric Janouch 2016-10-23 18:35:15 +02:00
parent 214c6e848b
commit b9a27cf187
Signed by: p
GPG Key ID: B715679E3A361BE6
1 changed files with 14 additions and 3 deletions

View File

@ -101,6 +101,7 @@ enum
#include <unistr.h>
#include <uniwidth.h>
#include <uniconv.h>
#include <unicase.h>
// We need cURL to extract links from Internet stream playlists. It'd be way
// too much code to do this all by ourselves, and there's nothing better around.
@ -783,10 +784,21 @@ load_config_colors (struct config_item *subtree, void *user_data)
#undef XX
}
static int
app_casecmp (const uint8_t *a, const uint8_t *b)
{
int res;
// XXX: this seems to produce some strange results
if (u8_casecmp (a, strlen ((const char *) a), b, strlen ((const char *) b),
NULL, NULL, &res))
res = u8_strcmp (a, b);
return res;
}
static int
str_vector_sort_utf8_cb (const void *a, const void *b)
{
return u8_strcmp (*(const uint8_t **) a, *(const uint8_t **) b);
return app_casecmp (*(const uint8_t **) a, *(const uint8_t **) b);
}
static void
@ -2143,8 +2155,7 @@ library_tab_compare (char **a, char **b)
if (xa.type != xb.type)
return xa.type - xb.type;
// TODO: this should be case insensitive
return u8_strcmp ((uint8_t *) xa.path, (uint8_t *) xb.path);
return app_casecmp ((uint8_t *) xa.path, (uint8_t *) xb.path);
}
static void