Removed a bizarre comparison construct for converting case.
authorNotZed <notzed@zedzone.helixcode.com>
Thu, 10 Feb 2000 05:03:43 +0000 (05:03 +0000)
committerMichael Zucci <zucchi@src.gnome.org>
Thu, 10 Feb 2000 05:03:43 +0000 (05:03 +0000)
2000-02-10  NotZed  <notzed@zedzone.helixcode.com>

* camel/hash-table-utils.c (g_strcase_hash): Removed a bizarre
comparison construct for converting case.

2000-02-09  NotZed  <notzed@zedzone.helixcode.com>

* 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
camel/gmime-content-field.c
camel/hash-table-utils.c

index 7d1b1dc..2bc6a28 100644 (file)
 
 #include "data-wrapper-repository.h"
 #include "camel-multipart.h"
-
-
+#include <string.h>
+#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)&gtk_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);
index 3c1f4fb..bec9721 100644 (file)
@@ -29,7 +29,7 @@
 #include "string-utils.h"
 #include "camel-log.h"
 #include <string.h>
-
+#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;
index fa32602..cbd7529 100644 (file)
@@ -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;