From: Darko Koruga Date: Fri, 29 Jun 2001 07:48:04 +0000 (+0000) Subject: Make MIME types case insensitive X-Git-Tag: VERSION_0_5_0~44 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=5e357024ca7f009b50760b744b7d0e026b8d15f8 Make MIME types case insensitive --- diff --git a/ChangeLog.claws b/ChangeLog.claws index 5a1d05f1d..a80ae633e 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,8 @@ +2001-06-29 [darko] + + * src/procmime.c + make MIME types case insensitive + 2001-06-28 [alfons] * po/nl.po diff --git a/src/procmime.c b/src/procmime.c index af71a81e3..4b80c2fa9 100644 --- a/src/procmime.c +++ b/src/procmime.c @@ -753,6 +753,27 @@ gchar *procmime_get_mime_type(const gchar *filename) return NULL; } +static guint procmime_str_hash(gconstpointer gptr) +{ + guint hash_result = 0; + const char *str; + + for (str = gptr; str && *str; str++) { + if (isupper(*str)) hash_result += (*str + ' '); + else hash_result += *str; + } + + return hash_result; +} + +static gint procmime_str_equal(gconstpointer gptr1, gconstpointer gptr2) +{ + const char *str1 = gptr1; + const char *str2 = gptr2; + + return !strcasecmp(str1, str2); +} + static GHashTable *procmime_get_mime_type_table(void) { GHashTable *table = NULL; @@ -765,7 +786,7 @@ static GHashTable *procmime_get_mime_type_table(void) if (!mime_type_list) return NULL; } - table = g_hash_table_new(g_str_hash, g_str_equal); + table = g_hash_table_new(procmime_str_hash, procmime_str_equal); for (cur = mime_type_list; cur != NULL; cur = cur->next) { gint i;