aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-filter-charset.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-mime-filter-charset.c')
-rw-r--r--camel/camel-mime-filter-charset.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/camel/camel-mime-filter-charset.c b/camel/camel-mime-filter-charset.c
index f8eafa9633..0e1c111786 100644
--- a/camel/camel-mime-filter-charset.c
+++ b/camel/camel-mime-filter-charset.c
@@ -20,15 +20,16 @@
*/
-#include <iconv.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <string.h>
#include <errno.h>
-#include <gal/util/e-iconv.h>
-
#include "camel-mime-filter-charset.h"
#include "camel-charset-map.h"
+#include "camel-iconv.h"
#define d(x)
@@ -63,8 +64,8 @@ camel_mime_filter_charset_finalize(CamelObject *o)
g_free(f->from);
g_free(f->to);
- if (f->ic != (iconv_t)-1) {
- e_iconv_close(f->ic);
+ if (f->ic != (iconv_t) -1) {
+ camel_iconv_close (f->ic);
f->ic = (iconv_t) -1;
}
}
@@ -76,11 +77,11 @@ reset(CamelMimeFilter *mf)
char buf[16];
char *buffer;
size_t outlen = 16;
-
+
/* what happens with the output bytes if this resets the state? */
if (f->ic != (iconv_t) -1) {
buffer = buf;
- e_iconv(f->ic, NULL, 0, &buffer, &outlen);
+ camel_iconv (f->ic, NULL, 0, &buffer, &outlen);
}
}
@@ -104,7 +105,7 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
if (inleft > 0) {
do {
- converted = e_iconv (charset->ic, &inbuf, &inleft, &outbuf, &outleft);
+ converted = camel_iconv (charset->ic, &inbuf, &inleft, &outbuf, &outleft);
if (converted == (size_t) -1) {
if (errno == E2BIG) {
/*
@@ -144,7 +145,7 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
}
/* flush the iconv conversion */
- e_iconv (charset->ic, NULL, NULL, &outbuf, &outleft);
+ camel_iconv (charset->ic, NULL, NULL, &outbuf, &outleft);
*out = mf->outbuf;
*outlen = mf->outsize - outleft;
@@ -178,7 +179,7 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s
inleft = len;
do {
- converted = e_iconv (charset->ic, &inbuf, &inleft, &outbuf, &outleft);
+ converted = camel_iconv (charset->ic, &inbuf, &inleft, &outbuf, &outleft);
if (converted == (size_t) -1) {
if (errno == E2BIG || errno == EINVAL)
break;
@@ -248,19 +249,21 @@ camel_mime_filter_charset_init (CamelMimeFilterCharset *obj)
CamelMimeFilterCharset *
camel_mime_filter_charset_new (void)
{
- CamelMimeFilterCharset *new = CAMEL_MIME_FILTER_CHARSET (camel_object_new (camel_mime_filter_charset_get_type ()));
- return new;
+ return CAMEL_MIME_FILTER_CHARSET (camel_object_new (camel_mime_filter_charset_get_type ()));
}
CamelMimeFilterCharset *
camel_mime_filter_charset_new_convert (const char *from_charset, const char *to_charset)
{
- CamelMimeFilterCharset *new = CAMEL_MIME_FILTER_CHARSET (camel_object_new (camel_mime_filter_charset_get_type ()));
+ CamelMimeFilterCharset *new;
+
+ new = CAMEL_MIME_FILTER_CHARSET (camel_object_new (camel_mime_filter_charset_get_type ()));
- new->ic = e_iconv_open (to_charset, from_charset);
+ new->ic = camel_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);
+ g_warning ("Cannot create charset conversion from %s to %s: %s",
+ from_charset, to_charset, g_strerror (errno));
+ camel_object_unref (new);
new = NULL;
} else {
new->from = g_strdup (from_charset);