From 4a2a09a7bae99778d6e11df7da7d0a166815030f Mon Sep 17 00:00:00 2001 From: NotZed Date: Thu, 10 Feb 2000 05:03:43 +0000 Subject: Removed a bizarre comparison construct for converting case. 2000-02-10 NotZed * camel/hash-table-utils.c (g_strcase_hash): Removed a bizarre comparison construct for converting case. 2000-02-09 NotZed * camel/data-wrapper-repository.c (data_wrapper_repository_init): Uses case-insensitive compares. * camel/gmime-content-field.c (gmime_content_field_new): Uses case-insensitive compares. svn path=/trunk/; revision=1723 --- ChangeLog | 14 ++++++++++++++ camel/data-wrapper-repository.c | 16 +++++++++------- camel/gmime-content-field.c | 4 ++-- camel/hash-table-utils.c | 4 +--- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index b475971882..61ea4aa6da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ +2000-02-10 NotZed + + * camel/hash-table-utils.c (g_strcase_hash): Removed a bizarre + comparison construct for converting case. + 2000-02-09 NotZed + * camel/data-wrapper-repository.c (data_wrapper_repository_init): + Uses case-insensitive compares. + + * camel/gmime-content-field.c (gmime_content_field_new): Uses + case-insensitive compares. + + * camel/data-wrapper-repository.c (data_wrapper_repository_init): + Use case-insensitive mime types. + * camel/camel-simple-data-wrapper-stream.c (read): Increment the copy source address to match the data read offset. (seek): Actually implement the seek. diff --git a/camel/data-wrapper-repository.c b/camel/data-wrapper-repository.c index 7d1b1dc05f..2bc6a28abc 100644 --- a/camel/data-wrapper-repository.c +++ b/camel/data-wrapper-repository.c @@ -28,15 +28,14 @@ #include "data-wrapper-repository.h" #include "camel-multipart.h" - - +#include +#include "hash-table-utils.h" static DataWrapperRepository _repository; static _initialized = -1; GMimeContentField *_content_field; - /** * data_wrapper_repository_init: initialize data wrapper repository * @@ -49,7 +48,7 @@ gint data_wrapper_repository_init () { if (_initialized != -1) return -1; - _repository.mime_links = g_hash_table_new (g_str_hash, g_str_equal); + _repository.mime_links = g_hash_table_new (g_strcase_hash, g_strcase_equal); data_wrapper_repository_set_data_wrapper_type ("multipart", camel_multipart_get_type()); _content_field = gmime_content_field_new (NULL, NULL); _initialized = 1; @@ -102,13 +101,16 @@ data_wrapper_repository_get_data_wrapper_type (const gchar *mime_type) gboolean exists; gchar *old_mime_type; GtkType gtk_type; - + + printf("looking up type '%s'\n", mime_type); + /* find if the complete mime type exists */ exists = g_hash_table_lookup_extended (_repository.mime_links, (gpointer)mime_type, (gpointer)&old_mime_type, (gpointer)>k_type); - if (exists) /* the complete mime type exists, return it */ + if (exists) { /* the complete mime type exists, return it */ + printf( "exists!\n"); return gtk_type; - else { + } else { /* the complete mime type association does not exists */ /* is there an association for the main mime type ? */ gmime_content_field_construct_from_string (_content_field, mime_type); diff --git a/camel/gmime-content-field.c b/camel/gmime-content-field.c index 3c1f4fbc7b..bec9721e0a 100644 --- a/camel/gmime-content-field.c +++ b/camel/gmime-content-field.c @@ -29,7 +29,7 @@ #include "string-utils.h" #include "camel-log.h" #include - +#include "hash-table-utils.h" /** * gmime_content_field_new: Creates a new GMimeContentField object @@ -52,7 +52,7 @@ gmime_content_field_new (const gchar *type, const gchar *subtype) ctf = g_new (GMimeContentField, 1); ctf->type = g_strdup (type); ctf->subtype = g_strdup (subtype); - ctf->parameters = g_hash_table_new (g_str_hash, g_str_equal); + ctf->parameters = g_hash_table_new (g_strcase_hash, g_strcase_equal); ctf->ref = 1; return ctf; diff --git a/camel/hash-table-utils.c b/camel/hash-table-utils.c index fa326020cb..cbd75296dd 100644 --- a/camel/hash-table-utils.c +++ b/camel/hash-table-utils.c @@ -62,12 +62,10 @@ g_strcase_hash (gconstpointer v) { const char *s = (char*)v; const char *p; - char c; guint h=0, g; for(p = s; *p != '\0'; p += 1) { - c = isupper ((guchar)*p) ? tolower ((guchar)*p) : *p; - h = ( h << 4 ) + c; + h = ( h << 4 ) + toupper(*p); if ( ( g = h & 0xf0000000 ) ) { h = h ^ (g >> 24); h = h ^ g; -- cgit