#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
*
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;
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);
#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
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;
{
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;