From abada7e2cd02933caa7a2643c0771b3ee7a63cfe Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 20 Feb 2003 21:04:19 +0000 Subject: Call camel_iconv_init(). (camel_shutdown): Call camel_iconv_shutdown(). 2003-02-20 Jeffrey Stedfast * camel.c (camel_init): Call camel_iconv_init(). (camel_shutdown): Call camel_iconv_shutdown(). * camel-sasl-digest-md5.c (digest_response): Updated to use camel-iconv and the new camel-charset-map functions. * camel-mime-utils.c: Updated to use camel-iconv and the new camel-charset-map functions. * camel-mime-part-utils.c (check_html_charset): Use camel_charset_canonical_name() instead of e_iconv_charset_name() which is longer available. (convert_buffer): Use camel-iconv. (simple_data_wrapper_construct_from_parser): Since camel_charset_iso_to_windows() returns the charset in it's canonical format, no need to re-canonicalise it. * camel-mime-part.c (process_header): Use camel_charset_canonical_name() instead of e_iconv_charset_name() which is longer available. * camel-mime-message.c (process_header): Use camel_charset_canonical_name() instead of e_iconv_charset_name() which is longer available. * camel-mime-filter-charset.c: Use camel-iconv. * camel-folder-summary.c (message_info_new): Use camel_charset_canonical_name() instead of e_iconv_charset_name() which is longer available. (content_info_new): Use camel_charset_locale_name(). (camel_message_info_new_from_header): Same as message_info_new(). * camel-search-private.c: Use g_alloca() instead of alloca(). * camel-filter-search.c (check_header): Use camel_charset_canonical_name() instead of e_iconv_charset_name() which is longer available. * camel-charset-map.c (camel_charset_locale_name): New function, replaces e_iconv_locale_charset(). (camel_charset_canonical_name): New function, similar to e_iconv_charset_name() but instead of returning the iconv-friendly name, it returns the canonical name. (g_iconv will do the iconv-friendly name conversions for us). svn path=/trunk/; revision=19977 --- camel/camel-mime-part-utils.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'camel/camel-mime-part-utils.c') diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c index c6fbd65404..c7c0d15907 100644 --- a/camel/camel-mime-part-utils.c +++ b/camel/camel-mime-part-utils.c @@ -31,10 +31,11 @@ #include #include -#include #include #include "string-utils.h" +#include "camel-iconv.h" +#include "camel-charset-map.h" #include "camel-mime-part-utils.h" #include "camel-mime-message.h" #include "camel-multipart.h" @@ -49,7 +50,6 @@ #include "camel-mime-filter-crlf.h" #include "camel-mime-filter-save.h" #include "camel-html-parser.h" -#include "camel-charset-map.h" #define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x)) #include */ @@ -87,7 +87,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 = e_iconv_charset_name (charset); + charset = camel_charset_canonical_name (charset); header_content_type_unref(ct); } break; @@ -97,7 +97,7 @@ check_html_charset(char *buffer, int length) } } while (charset == NULL && state != CAMEL_HTML_PARSER_EOF); - camel_object_unref((CamelObject *)hp); + camel_object_unref (hp); return charset; } @@ -113,12 +113,12 @@ convert_buffer (GByteArray *in, const char *to, const char *from) if (in->len == 0) return g_byte_array_new(); - + d(printf("converting buffer from %s to %s:\n", from, to)); d(fwrite(in->data, 1, (int)in->len, stdout)); d(printf("\n")); - cd = e_iconv_open(to, from); + cd = camel_iconv_open(to, from); if (cd == (iconv_t) -1) { g_warning ("Cannot convert from '%s' to '%s': %s", from, to, strerror (errno)); return NULL; @@ -135,7 +135,7 @@ convert_buffer (GByteArray *in, const char *to, const char *from) outbuf = out->data + converted; outleft = outlen - converted; - converted = e_iconv (cd, &inbuf, &inleft, &outbuf, &outleft); + converted = camel_iconv (cd, &inbuf, &inleft, &outbuf, &outleft); if (converted == (size_t) -1) { if (errno != E2BIG && errno != EINVAL) goto fail; @@ -164,17 +164,17 @@ convert_buffer (GByteArray *in, const char *to, const char *from) */ /* flush the iconv conversion */ - e_iconv (cd, NULL, NULL, &outbuf, &outleft); + camel_iconv (cd, NULL, NULL, &outbuf, &outleft); /* now set the true length on the GByteArray */ converted = outbuf - (char *)out->data; g_byte_array_set_size (out, converted); - + d(printf("converted data:\n")); d(fwrite(out->data, 1, (int)out->len, stdout)); d(printf("\n")); - - e_iconv_close (cd); + + camel_iconv_close (cd); return out; @@ -183,7 +183,7 @@ convert_buffer (GByteArray *in, const char *to, const char *from) g_byte_array_free (out, TRUE); - e_iconv_close (cd); + camel_iconv_close (cd); return NULL; } @@ -262,7 +262,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 = e_iconv_charset_name (charset); + charset = camel_charset_canonical_name (charset); if (fdec) { d(printf ("Adding CRLF conversion filter\n")); @@ -313,10 +313,8 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser */ if (!strncasecmp (charset, "iso-8859", 8)) { /* check for Windows-specific chars... */ - if (broken_windows_charset (buffer, charset)) { + if (broken_windows_charset (buffer, charset)) charset = camel_charset_iso_to_windows (charset); - charset = e_iconv_charset_name (charset); - } } out = convert_buffer (buffer, "UTF-8", charset); -- cgit v1.2.3