diff options
Diffstat (limited to 'camel/camel-mime-part-utils.c')
-rw-r--r-- | camel/camel-mime-part-utils.c | 30 |
1 files changed, 14 insertions, 16 deletions
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 <unistd.h> #include <errno.h> -#include <gal/util/e-iconv.h> #include <glib/gunicode.h> #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 <stdio.h>*/ @@ -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); |