aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
author1 <NotZed@Ximian.com>2001-10-12 06:08:20 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-12 06:08:20 +0800
commita5fa3f992dd32fdf99bfcf550a8ce62df2b74d13 (patch)
treeae2d252c33e30e674ad58be332f3cd98e409e3db /camel
parent736e73548cb39a7aaad61f01704ac60ccb74f79e (diff)
downloadgsoc2013-evolution-a5fa3f992dd32fdf99bfcf550a8ce62df2b74d13.tar.gz
gsoc2013-evolution-a5fa3f992dd32fdf99bfcf550a8ce62df2b74d13.tar.zst
gsoc2013-evolution-a5fa3f992dd32fdf99bfcf550a8ce62df2b74d13.zip
Removed charset/locale charset lookup and iconv_open/close functions,
2001-10-11 <NotZed@Ximian.com> * camel-charset-map.[ch]: Removed charset/locale charset lookup and iconv_open/close functions, moved to gal. Fixed all callers. svn path=/trunk/; revision=13602
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-charset-map.c308
-rw-r--r--camel/camel-charset-map.h9
-rw-r--r--camel/camel-filter-search.c4
-rw-r--r--camel/camel-folder-summary.c8
-rw-r--r--camel/camel-mime-filter-charset.c9
-rw-r--r--camel/camel-mime-message.c4
-rw-r--r--camel/camel-mime-part-utils.c10
-rw-r--r--camel/camel-mime-part.c5
-rw-r--r--camel/camel-mime-utils.c33
-rw-r--r--camel/camel-pgp-context.c7
-rw-r--r--camel/camel-sasl-digest-md5.c8
-rw-r--r--camel/camel-tcp-stream.c3
-rw-r--r--camel/camel-uid-cache.c4
-rw-r--r--camel/camel.c2
15 files changed, 58 insertions, 361 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 85dc5005a5..a5012ff2f9 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,8 @@
+2001-10-11 <NotZed@Ximian.com>
+
+ * camel-charset-map.[ch]: Removed charset/locale charset lookup
+ and iconv_open/close functions, moved to gal. Fixed all callers.
+
2001-10-11 Jeffrey Stedfast <fejj@ximian.com>
* camel-tcp-stream-ssl.c (ssl_cert_is_saved): Same.
diff --git a/camel/camel-charset-map.c b/camel/camel-charset-map.c
index fd530165ed..ff63f86844 100644
--- a/camel/camel-charset-map.c
+++ b/camel/camel-charset-map.c
@@ -203,7 +203,6 @@ void main(void)
#include <string.h>
#include <ctype.h>
#include <glib.h>
-#include <e-util/e-msgport.h>
#ifdef ENABLE_THREADS
#include <pthread.h>
#endif
@@ -211,157 +210,6 @@ void main(void)
#include <alloca.h>
#endif
-#define cd(x) /* 'cache debug' */
-
-#ifdef ENABLE_THREADS
-static pthread_mutex_t iconv_charsets_lock = PTHREAD_MUTEX_INITIALIZER;
-#define ICONV_CHARSETS_LOCK() pthread_mutex_lock (&iconv_charsets_lock)
-#define ICONV_CHARSETS_UNLOCK() pthread_mutex_unlock (&iconv_charsets_lock)
-#else
-#define ICONV_CHARSETS_LOCK()
-#define ICONV_CHARSETS_UNLOCK()
-#endif /* ENABLE_THREADS */
-
-struct _iconv_cache_node {
- EDListNode ln;
-
- iconv_t ip;
-};
-
-struct _iconv_cache {
- EDListNode ln;
-
- char *conv;
-
- EDList inuse; /* opened ic's in use - if both these lists empty == failed to open conversion */
- EDList free; /* opened ic's free */
-};
-
-#define CAMEL_ICONV_CACHE_SIZE (16)
-
-static EDList iconv_cache_list;
-
-static GHashTable *iconv_charsets = NULL;
-static char *locale_charset = NULL;
-
-struct {
- char *charset;
- char *iconv_name;
-} known_iconv_charsets[] = {
- /* charset name, iconv-friendly charset name */
- { "iso-8859-1", "iso-8859-1" },
- { "iso8859-1", "iso-8859-1" },
- /* the above mostly serves as an example for iso-style charsets,
- but we have code that will populate the iso-*'s if/when they
- show up in camel_charset_map_to_iconv() so I'm
- not going to bother putting them all in here... */
- { "windows-cp1251", "cp1251" },
- { "windows-1251", "cp1251" },
- { "cp1251", "cp1251" },
- /* the above mostly serves as an example for windows-style
- charsets, but we have code that will parse and convert them
- to their cp#### equivalents if/when they show up in
- camel_charset_map_to_iconv() so I'm not going to bother
- putting them all in here either... */
- { "ks_c_5601-1987", "euc-kr" },
- { NULL, NULL }
-};
-
-
-static void
-shutdown_foreach (gpointer key, gpointer value, gpointer data)
-{
- g_free (key);
- g_free (value);
-}
-
-static void
-flush_iconv_entry(struct _iconv_cache *ic)
-{
- struct _iconv_cache_node *node;
-
- cd(printf("Flushing iconv cache entry: %s\n", ic->conv));
-
- while ( (node = (struct _iconv_cache_node *)e_dlist_remhead(&ic->inuse)) ) {
- iconv_close(node->ip);
- g_free(node);
- }
- while ( (node = (struct _iconv_cache_node *)e_dlist_remhead(&ic->free)) ) {
- iconv_close(node->ip);
- g_free(node);
- }
- g_free(ic->conv);
- g_free(ic);
-}
-
-static void
-camel_charset_map_shutdown (void)
-{
- struct _iconv_cache *ic, *in;
-
- g_hash_table_foreach (iconv_charsets, shutdown_foreach, NULL);
- g_hash_table_destroy (iconv_charsets);
- g_free (locale_charset);
-
- ic = (struct _iconv_cache *)iconv_cache_list.head;
- in = (struct _iconv_cache *)ic->ln.next;
- while (in) {
- flush_iconv_entry(ic);
- ic = in;
- in = (struct _iconv_cache *)in->ln.next;
- }
-}
-
-void
-camel_charset_map_init (void)
-{
- char *locale;
- int i;
-
- if (iconv_charsets)
- return;
-
- iconv_charsets = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- for (i = 0; known_iconv_charsets[i].charset != NULL; i++) {
- g_hash_table_insert (iconv_charsets, g_strdup (known_iconv_charsets[i].charset),
- g_strdup (known_iconv_charsets[i].iconv_name));
- }
-
- e_dlist_init(&iconv_cache_list);
-
- locale = setlocale (LC_ALL, NULL);
-
- if (!locale || !strcmp (locale, "C") || !strcmp (locale, "POSIX")) {
- /* The locale "C" or "POSIX" is a portable locale; its
- * LC_CTYPE part corresponds to the 7-bit ASCII character
- * set.
- */
-
- locale_charset = NULL;
- } else {
- /* A locale name is typically of the form language[_terri-
- * tory][.codeset][@modifier], where language is an ISO 639
- * language code, territory is an ISO 3166 country code, and
- * codeset is a character set or encoding identifier like
- * ISO-8859-1 or UTF-8.
- */
- char *p;
- int len;
-
- p = strchr (locale, '@');
- if (p == NULL)
- p = strchr (locale, '/'); /* This is a hack for Solaris systems */
-
- len = p ? (p - locale) : strlen (locale);
- if ((p = strchr (locale, '.'))) {
- locale_charset = g_strndup (p + 1, len - (p - locale) + 1);
- g_strdown (locale_charset);
- }
- }
-
- g_atexit (camel_charset_map_shutdown);
-}
-
void
camel_charset_init (CamelCharset *c)
{
@@ -444,161 +292,5 @@ camel_charset_best (const char *in, int len)
return camel_charset_best_name (&charset);
}
-const char *
-camel_charset_locale_name (void)
-{
- return locale_charset;
-}
-
-const char *
-camel_charset_to_iconv (const char *name)
-{
- const char *charset;
-
- if (name == NULL)
- return NULL;
-
- ICONV_CHARSETS_LOCK ();
- charset = g_hash_table_lookup (iconv_charsets, name);
- if (!charset) {
- /* Attempt to friendlyify the charset */
- char *new_charset, *p;
- int len;
-
- if (!g_strncasecmp (name, "iso", 3) && name[3] != '-' && name[3] != '_') {
- /* Hack to convert charsets like ISO8859-1 to iconv-friendly ISO-8859-1 */
- len = strlen (name);
- new_charset = g_malloc (len + 2);
- memcpy (new_charset, name, 3);
- new_charset[3] = '-';
- memcpy (new_charset + 4, name + 3, len - 3);
- new_charset[len + 1] = '\0';
- } else if (!g_strncasecmp (name, "windows-", 8)) {
- /* Convert charsets like windows-1251 and windows-cp1251 to iconv-friendly cp1251 */
- new_charset = (char *) name + 8;
- if (!g_strncasecmp (new_charset, "cp", 2))
- new_charset += 2;
-
- for (p = new_charset; *p && isdigit ((unsigned) *p); p++);
- if (*p == '\0')
- new_charset = g_strdup_printf ("cp%s", new_charset);
- else
- new_charset = g_strdup (name);
- } else {
- /* *shrug* - add it to the hash table just the way it is? */
- new_charset = g_strdup (name);
- }
-
- g_hash_table_insert (iconv_charsets, g_strdup (name), new_charset);
- charset = new_charset;
- }
- ICONV_CHARSETS_UNLOCK ();
-
- return charset;
-}
-
-iconv_t camel_charset_iconv_open(const char *oto, const char *ofrom)
-{
- const char *to, *from;
- char *tofrom;
- struct _iconv_cache *ic, *icnew = NULL;
- struct _iconv_cache_node *node;
- iconv_t ip;
-
- to = camel_charset_to_iconv(oto);
- from = camel_charset_to_iconv(ofrom);
- tofrom = alloca(strlen(to) +strlen(from) + 1);
- sprintf(tofrom, "%s%s", to, from);
-
- ICONV_CHARSETS_LOCK();
- ic = (struct _iconv_cache *)iconv_cache_list.head;
- while (ic->ln.next) {
- if (!strcasecmp(ic->conv, tofrom))
- break;
- ic = (struct _iconv_cache *)ic->ln.next;
- }
-
- if (ic->ln.next == NULL) {
- int extra = e_dlist_length(&iconv_cache_list) - CAMEL_ICONV_CACHE_SIZE;
- struct _iconv_cache *old = (struct _iconv_cache *)iconv_cache_list.head,
- *next = (struct _iconv_cache *)old->ln.next;
-
- /* flush any 'old' entries out, if we can */
- while (extra>0 && next) {
- if (e_dlist_empty(&old->inuse)) {
- e_dlist_remove(&old->ln);
- flush_iconv_entry(old);
- extra--;
- }
- old = next;
- next = (struct _iconv_cache *)old->ln.next;
- }
-
- icnew = ic = g_malloc(sizeof(*ic));
- e_dlist_init(&ic->inuse);
- e_dlist_init(&ic->free);
- ic->conv = g_strdup(tofrom);
- } else {
- e_dlist_remove(&ic->ln);
- }
-
- node = (struct _iconv_cache_node *)e_dlist_remhead(&ic->free);
- if (node) {
- cd(printf("Returning cached success of: %s to %s\n", from, to));
- e_dlist_addhead(&ic->inuse, &node->ln);
- ip = node->ip;
- } else {
- if (e_dlist_empty(&ic->inuse) && icnew == NULL) {
- cd(printf("returning cached failure of conversion: %s to %s\n", from, to));
- ip = (iconv_t)-1;
- } else {
- ip = iconv_open(to, from);
- if (ip != (iconv_t)-1) {
- cd(printf("Creating cached opening of: %s to %s = %p\n", from, to, ip));
- node = g_malloc(sizeof(*node));
- node->ip = ip;
- e_dlist_addhead(&ic->inuse, &node->ln);
- }
- }
- }
-
- e_dlist_addtail(&iconv_cache_list, &ic->ln);
-
- ICONV_CHARSETS_UNLOCK();
-
- return ip;
-}
-
-void camel_charset_iconv_close(iconv_t ip)
-{
- struct _iconv_cache *ic;
- struct _iconv_cache_node *node;
-
- if (ip == (iconv_t)-1)
- return;
-
- ICONV_CHARSETS_LOCK();
- ic = (struct _iconv_cache *)iconv_cache_list.tailpred;
- while (ic->ln.prev) {
- cd(printf("closing iconv %p, checking against name '%s'\n", ip, ic->conv));
- node = (struct _iconv_cache_node *)ic->inuse.head;
- while (node->ln.next) {
- cd(printf("closing iconv %p, checking against node '%p'\n", ip, node->ip));
- if (node->ip == ip) {
- e_dlist_remove(&node->ln);
- e_dlist_addhead(&ic->free, &node->ln);
- ICONV_CHARSETS_UNLOCK();
- return;
- }
- node = (struct _iconv_cache_node *)node->ln.next;
- }
- ic = (struct _iconv_cache *)ic->ln.prev;
- }
-
- ICONV_CHARSETS_UNLOCK();
-
- g_warning("Trying to close iconv i dont know about: %p", ip);
-}
-
#endif /* !BUILD_MAP */
diff --git a/camel/camel-charset-map.h b/camel/camel-charset-map.h
index 749f02dfc2..581e8e8488 100644
--- a/camel/camel-charset-map.h
+++ b/camel/camel-charset-map.h
@@ -30,8 +30,6 @@ struct _CamelCharset {
int level;
};
-void camel_charset_map_init (void);
-
void camel_charset_init(CamelCharset *);
void camel_charset_step(CamelCharset *, const char *in, int len);
const char *camel_charset_best_name(CamelCharset *);
@@ -39,11 +37,4 @@ const char *camel_charset_best_name(CamelCharset *);
/* helper function */
const char *camel_charset_best(const char *in, int len);
-const char *camel_charset_locale_name (void);
-
-const char *camel_charset_to_iconv (const char *name);
-
-iconv_t camel_charset_iconv_open(const char *to, const char *from);
-void camel_charset_iconv_close(iconv_t ic);
-
#endif /* ! _CAMEL_CHARSET_MAP_H */
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c
index 45aec201e5..9366a2f610 100644
--- a/camel/camel-filter-search.c
+++ b/camel/camel-filter-search.c
@@ -34,6 +34,8 @@
#include <string.h>
#include <ctype.h>
+#include <gal/util/e-iconv.h>
+
#include "e-util/e-sexp.h"
#include "camel-mime-message.h"
@@ -129,7 +131,7 @@ check_header (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMess
else {
ct = camel_mime_part_get_content_type(CAMEL_MIME_PART(fms->message));
if (ct)
- charset = camel_charset_to_iconv(header_content_type_param(ct, "charset"));
+ charset = e_iconv_charset_name(header_content_type_param(ct, "charset"));
}
}
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index a83517ebcd..9179b63e6e 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -29,6 +29,8 @@
#include <errno.h>
#include <stdlib.h>
+#include <gal/util/e-iconv.h>
+
#include "camel-folder-summary.h"
#include <camel/camel-file-utils.h>
@@ -1492,7 +1494,7 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
&& (strcasecmp(charset, "us-ascii") == 0))
charset = NULL;
- charset = camel_charset_to_iconv(charset);
+ charset = e_iconv_charset_name(charset);
subject = summary_format_string(h, "subject", charset);
from = summary_format_address(h, "from");
@@ -1742,7 +1744,7 @@ content_info_new (CamelFolderSummary *s, struct _header_raw *h)
ci = camel_folder_summary_content_info_new (s);
- charset = camel_charset_locale_name ();
+ charset = e_iconv_locale_charset();
ci->id = header_msgid_decode (header_raw_find (&h, "content-id", NULL));
ci->description = header_decode_string (header_raw_find (&h, "content-description", NULL), NULL);
ci->encoding = header_content_encoding_decode (header_raw_find (&h, "content-transfer-encoding", NULL));
@@ -2447,7 +2449,7 @@ camel_message_info_new_from_header (struct _header_raw *header)
&& (strcasecmp(charset, "us-ascii") == 0))
charset = NULL;
- charset = camel_charset_to_iconv(charset);
+ charset = e_iconv_charset_name(charset);
subject = summary_format_string(header, "subject", charset);
from = summary_format_address(header, "from");
diff --git a/camel/camel-mime-filter-charset.c b/camel/camel-mime-filter-charset.c
index bb9dd06acb..4154d44bea 100644
--- a/camel/camel-mime-filter-charset.c
+++ b/camel/camel-mime-filter-charset.c
@@ -24,6 +24,8 @@
#include <string.h>
#include <errno.h>
+#include <gal/util/e-iconv.h>
+
#include "camel-mime-filter-charset.h"
#include "camel-charset-map.h"
@@ -61,7 +63,7 @@ camel_mime_filter_charset_finalize(CamelObject *o)
g_free(f->from);
g_free(f->to);
if (f->ic != (iconv_t)-1) {
- camel_charset_iconv_close(f->ic);
+ e_iconv_close(f->ic);
f->ic = (iconv_t) -1;
}
}
@@ -231,10 +233,7 @@ camel_mime_filter_charset_new_convert (const char *from_charset, const char *to_
{
CamelMimeFilterCharset *new = CAMEL_MIME_FILTER_CHARSET (camel_object_new (camel_mime_filter_charset_get_type ()));
- from_charset = camel_charset_to_iconv (from_charset);
- to_charset = camel_charset_to_iconv (to_charset);
-
- new->ic = camel_charset_iconv_open (to_charset, from_charset);
+ new->ic = e_iconv_open (to_charset, from_charset);
if (new->ic == (iconv_t) -1) {
g_warning("Cannot create charset conversion from %s to %s: %s", from_charset, to_charset, strerror(errno));
camel_object_unref ((CamelObject *)new);
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index 53edc4f53b..8cc530c2b9 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -32,6 +32,8 @@
#include <stdio.h>
#include <string.h>
+#include <gal/util/e-iconv.h>
+
#include "camel-mime-message.h"
#include "camel-multipart.h"
#include "camel-stream-mem.h"
@@ -537,7 +539,7 @@ process_header (CamelMedium *medium, const char *header_name, const char *header
case HEADER_SUBJECT:
g_free (message->subject);
if (((CamelMimePart *)message)->content_type)
- charset = camel_charset_to_iconv(header_content_type_param(((CamelMimePart *)message)->content_type, "charset"));
+ charset = e_iconv_charset_name(header_content_type_param(((CamelMimePart *)message)->content_type, "charset"));
else
charset = NULL;
message->subject = g_strstrip (header_decode_string (header_value, charset));
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
index 8314330f21..597b1e9045 100644
--- a/camel/camel-mime-part-utils.c
+++ b/camel/camel-mime-part-utils.c
@@ -31,6 +31,8 @@
#include <unistd.h>
#include <errno.h>
+#include <gal/util/e-iconv.h>
+
#include "string-utils.h"
#include "camel-mime-part-utils.h"
#include "camel-mime-message.h"
@@ -80,7 +82,7 @@ check_html_charset(char *buffer, int length)
&& (val = camel_html_parser_attr(hp, "content"))
&& (ct = header_content_type_decode(val))) {
charset = header_content_type_param(ct, "charset");
- charset = camel_charset_to_iconv (charset);
+ charset = e_iconv_charset_name (charset);
header_content_type_unref(ct);
}
break;
@@ -105,7 +107,7 @@ static GByteArray *convert_buffer(GByteArray *in, const char *to, const char *fr
d(printf("converting buffer from %s to %s: '%.*s'\n", from, to, (int)in->len, in->data));
- ic = camel_charset_iconv_open(to, from);
+ ic = e_iconv_open(to, from);
if (ic == (iconv_t) -1) {
g_warning("Cannot convert from '%s' to '%s': %s", from, to, strerror(errno));
return NULL;
@@ -146,7 +148,7 @@ static GByteArray *convert_buffer(GByteArray *in, const char *to, const char *fr
break;
} while (1);
- camel_charset_iconv_close(ic);
+ e_iconv_close(ic);
return out;
}
@@ -188,7 +190,7 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser
ct = camel_mime_parser_content_type(mp);
if (header_content_type_is(ct, "text", "*")) {
charset = header_content_type_param(ct, "charset");
- charset = camel_charset_to_iconv (charset);
+ charset = e_iconv_charset_name(charset);
if (fdec) {
d(printf("Adding CRLF conversion filter\n"));
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 5e6d6b3b09..547c448ea4 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -30,6 +30,9 @@
#include <string.h>
#include <stdio.h>
#include <ctype.h>
+
+#include <gal/util/e-iconv.h>
+
#include "hash-table-utils.h"
#include "camel-mime-parser.h"
#include "camel-stream-mem.h"
@@ -213,7 +216,7 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_
case HEADER_DESCRIPTION: /* raw header->utf8 conversion */
g_free (mime_part->description);
if (mime_part->content_type)
- charset = camel_charset_to_iconv(header_content_type_param(mime_part->content_type, "charset"));
+ charset = e_iconv_charset_name(header_content_type_param(mime_part->content_type, "charset"));
else
charset = NULL;
mime_part->description = g_strstrip (header_decode_string (header_value, charset));
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 2a1a92995b..451c9c8854 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -48,6 +48,7 @@
#include <glib.h>
#include <gal/unicode/gunicode.h>
+#include <gal/util/e-iconv.h>
#include "camel-mime-utils.h"
#include "camel-charset-map.h"
@@ -1109,7 +1110,7 @@ rfc2047_decode_word(const char *in, int len)
memcpy (encname, in + 2, tmplen);
encname[tmplen] = '\0';
- charset = camel_charset_to_iconv (encname);
+ charset = e_iconv_charset_name (encname);
inbuf = decword;
@@ -1118,7 +1119,7 @@ rfc2047_decode_word(const char *in, int len)
outbuf = outbase;
retry:
- ic = camel_charset_iconv_open ("UTF-8", charset);
+ ic = e_iconv_open ("UTF-8", charset);
if (ic != (iconv_t)-1) {
ret = iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
if (ret >= 0) {
@@ -1126,13 +1127,13 @@ rfc2047_decode_word(const char *in, int len)
*outbuf = 0;
decoded = g_strdup (outbase);
}
- camel_charset_iconv_close (ic);
+ e_iconv_close (ic);
} else {
w(g_warning ("Cannot decode charset, header display may be corrupt: %s: %s",
charset, g_strerror (errno)));
if (!retried) {
- charset = camel_charset_locale_name ();
+ charset = e_iconv_locale_charset ();
if (!charset)
charset = "iso-8859-1";
@@ -1192,7 +1193,7 @@ append_8bit (GString *out, const char *inbuf, int inlen, const char *charset)
int outlen;
iconv_t ic;
- ic = camel_charset_iconv_open ("UTF-8", charset);
+ ic = e_iconv_open ("UTF-8", charset);
if (ic == (iconv_t) -1)
return FALSE;
@@ -1202,14 +1203,14 @@ append_8bit (GString *out, const char *inbuf, int inlen, const char *charset)
if (iconv(ic, &inbuf, &inlen, &outbuf, &outlen) == -1) {
w(g_warning("Conversion to '%s' failed: %s", charset, strerror(errno)));
g_free(outbase);
- camel_charset_iconv_close(ic);
+ e_iconv_close(ic);
return FALSE;
}
*outbuf = 0;
g_string_append(out, outbase);
g_free(outbase);
- camel_charset_iconv_close(ic);
+ e_iconv_close(ic);
return TRUE;
@@ -1223,7 +1224,7 @@ header_decode_text (const char *in, int inlen, const char *default_charset)
const char *inptr, *inend, *start, *chunk, *locale_charset;
char *dword = NULL;
- locale_charset = camel_charset_locale_name();
+ locale_charset = e_iconv_locale_charset();
out = g_string_new("");
inptr = in;
@@ -1303,7 +1304,7 @@ rfc2047_encode_word(GString *outstring, const char *in, int len, const char *typ
ascii = alloca (bufflen);
if (strcasecmp (type, "UTF-8") != 0)
- ic = camel_charset_iconv_open (type, "UTF-8");
+ ic = e_iconv_open (type, "UTF-8");
while (inlen) {
int convlen, i, proclen;
@@ -1381,7 +1382,7 @@ rfc2047_encode_word(GString *outstring, const char *in, int len, const char *typ
}
if (ic != (iconv_t) -1)
- camel_charset_iconv_close(ic);
+ e_iconv_close(ic);
}
@@ -1939,7 +1940,7 @@ rfc2184_decode (const char *in, int len)
return NULL;
encoding = g_strndup (in, inptr - in);
- charset = camel_charset_to_iconv (encoding);
+ charset = e_iconv_charset_name (encoding);
g_free (encoding);
inptr = memchr (inptr + 1, '\'', inend - inptr - 1);
@@ -1956,7 +1957,7 @@ rfc2184_decode (const char *in, int len)
inbuf = decword = hex_decode (inptr, inend - inptr);
inlen = strlen (inbuf);
- ic = camel_charset_iconv_open("UTF-8", charset);
+ ic = e_iconv_open("UTF-8", charset);
if (ic != (iconv_t) -1) {
int ret;
@@ -1971,7 +1972,7 @@ rfc2184_decode (const char *in, int len)
decoded = outbase;
}
- camel_charset_iconv_close(ic);
+ e_iconv_close(ic);
} else {
decoded = decword;
}
@@ -2110,8 +2111,8 @@ header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2
inbuf = value;
inlen = strlen (inbuf);
- charset = camel_charset_locale_name ();
- ic = camel_charset_iconv_open ("UTF-8", charset ? charset : "ISO-8859-1");
+ charset = e_iconv_locale_charset();
+ ic = e_iconv_open ("UTF-8", charset ? charset : "ISO-8859-1");
if (ic != (iconv_t) -1) {
int ret;
@@ -2124,7 +2125,7 @@ header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2
*outbuf = '\0';
}
- camel_charset_iconv_close (ic);
+ e_iconv_close (ic);
g_free (value);
value = outbase;
diff --git a/camel/camel-pgp-context.c b/camel/camel-pgp-context.c
index 180a1a10e2..575b6006ac 100644
--- a/camel/camel-pgp-context.c
+++ b/camel/camel-pgp-context.c
@@ -52,6 +52,7 @@
#include <iconv.h>
#include <gal/unicode/gunicode.h>
+#include <gal/util/e-iconv.h>
#define d(x)
@@ -999,11 +1000,11 @@ pgp_verify (CamelCipherContext *ctx, CamelCipherHash hash, CamelStream *istream,
desc = outbuf = g_new (unsigned char, outlen + 1);
- locale = camel_charset_locale_name ();
+ locale = e_iconv_locale_charset();
if (!locale)
locale = "iso-8859-1";
- cd = camel_charset_iconv_open ("UTF-8", locale);
+ cd = e_iconv_open ("UTF-8", locale);
if (cd != (iconv_t) -1) {
const char *inbuf;
int ret;
@@ -1013,7 +1014,7 @@ pgp_verify (CamelCipherContext *ctx, CamelCipherHash hash, CamelStream *istream,
if (ret >= 0) {
iconv (cd, NULL, 0, &outbuf, &outlen);
}
- camel_charset_iconv_close (cd);
+ e_iconv_close (cd);
*outbuf = '\0';
} else {
diff --git a/camel/camel-sasl-digest-md5.c b/camel/camel-sasl-digest-md5.c
index b2f2427048..7a34fa59b7 100644
--- a/camel/camel-sasl-digest-md5.c
+++ b/camel/camel-sasl-digest-md5.c
@@ -33,7 +33,7 @@
#include "camel-mime-utils.h"
#include "camel-charset-map.h"
#include <e-util/md5-utils.h>
-
+#include <gal/util/e-iconv.h>
#define d(x)
@@ -698,11 +698,11 @@ digest_response (struct _DigestResponse *resp)
const char *buf;
iconv_t cd;
- charset = camel_charset_locale_name ();
+ charset = e_iconv_locale_charset();
if (!charset)
charset = "iso-8859-1";
- cd = camel_charset_iconv_open (resp->charset, charset);
+ cd = e_iconv_open (resp->charset, charset);
len = strlen (resp->username);
outlen = 2 * len; /* plenty of space */
@@ -720,7 +720,7 @@ digest_response (struct _DigestResponse *resp)
}
if (cd != (iconv_t) -1)
- camel_charset_iconv_close (cd);
+ e_iconv_close (cd);
g_byte_array_append (buffer, username, strlen (username));
g_free (username);
diff --git a/camel/camel-tcp-stream.c b/camel/camel-tcp-stream.c
index 30a483fbf3..f63c6be041 100644
--- a/camel/camel-tcp-stream.c
+++ b/camel/camel-tcp-stream.c
@@ -41,8 +41,7 @@ static gpointer tcp_get_socket (CamelTcpStream *stream);
static void
camel_tcp_stream_class_init (CamelTcpStreamClass *camel_tcp_stream_class)
{
- CamelStreamClass *camel_stream_class =
- CAMEL_STREAM_CLASS (camel_tcp_stream_class);
+ /*CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_tcp_stream_class);*/
parent_class = CAMEL_STREAM_CLASS (camel_type_get_global_classfuncs (CAMEL_STREAM_TYPE));
diff --git a/camel/camel-uid-cache.c b/camel/camel-uid-cache.c
index 37cbde3110..15e463c157 100644
--- a/camel/camel-uid-cache.c
+++ b/camel/camel-uid-cache.c
@@ -178,7 +178,7 @@ camel_uid_cache_get_new_uids (CamelUIDCache *cache, GPtrArray *uids)
struct _uid_state *state;
uid = uids->pdata[i];
- if (g_hash_table_lookup_extended (cache->uids, uid, &old_uid, &state)) {
+ if (g_hash_table_lookup_extended (cache->uids, uid, (void **)&old_uid, (void **)&state)) {
g_hash_table_remove (cache->uids, uid);
g_free (old_uid);
} else {
@@ -210,7 +210,7 @@ camel_uid_cache_save_uid (CamelUIDCache *cache, const char *uid)
g_return_if_fail (uid != NULL);
- if (g_hash_table_lookup_extended (cache->uids, uid, &old_uid, &state)) {
+ if (g_hash_table_lookup_extended (cache->uids, uid, (void **)&old_uid, (void **)&state)) {
state->save = TRUE;
state->level = cache->level;
} else {
diff --git a/camel/camel.c b/camel/camel.c
index 854fe1e896..ab6795f6ba 100644
--- a/camel/camel.c
+++ b/camel/camel.c
@@ -65,8 +65,6 @@ camel_init (const char *configdir, gboolean nss_init)
if (getenv ("CAMEL_VERBOSE_DEBUG"))
camel_verbose_debug = TRUE;
- camel_charset_map_init ();
-
#ifdef HAVE_NSS
if (nss_init) {
PR_Init (PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 10);