# HG changeset patch # User Eugene Zagidullin # Date 1196019419 -10800 # Node ID 2984f6c7221a407e2cd68621cf947b3773a1648f # Parent 9a7822a4762e7cc201cc1e78d00e57401bacd3c2 demac: tag reading routine now case-insensitive diff -r 9a7822a4762e -r 2984f6c7221a src/demac/apev2.c --- a/src/demac/apev2.c Sun Nov 25 18:03:23 2007 +0100 +++ b/src/demac/apev2.c Sun Nov 25 22:36:59 2007 +0300 @@ -51,6 +51,21 @@ #define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif +static gboolean strcase_equal (gconstpointer v1, gconstpointer v2) { + return (g_ascii_strcasecmp((gchar *)v1, (gchar *)v2) == 0); +} + +static guint strcase_hash (gconstpointer v) { + gchar *tmp; + gchar buf[TMP_BUFSIZE+1]; + gchar *p = buf; + + for(tmp=(gchar*)v; (*tmp && (p < buf+TMP_BUFSIZE)); tmp++) + *(p++) = g_ascii_toupper(*tmp); + *p = '\0'; + return g_str_hash((gconstpointer)buf); +} + GHashTable* parse_apev2_tag(VFSFile *vfd) { unsigned char tmp[TMP_BUFSIZE+1]; unsigned char tmp2[TMP_BUFSIZE+1]; @@ -84,7 +99,7 @@ return NULL; } - hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); /* string-keyed table with dynamically allocated keys and items */ + hash = g_hash_table_new_full(strcase_hash, strcase_equal, g_free, g_free); /* string-keyed table with dynamically allocated keys and items */ aud_vfs_fseek(vfd, -tag_size, SEEK_END); int i;