aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-11-30 04:41:08 +0800
committerDan Winship <danw@src.gnome.org>2000-11-30 04:41:08 +0800
commitac3f575649ef80153a7b0e3226a06aa04066f658 (patch)
treec9b228cad9b38ac8114f914f46038a28d63a1a3b /camel
parentf02e5c1f654fe86702843821381a60a0eff3bc55 (diff)
downloadgsoc2013-evolution-ac3f575649ef80153a7b0e3226a06aa04066f658.tar
gsoc2013-evolution-ac3f575649ef80153a7b0e3226a06aa04066f658.tar.gz
gsoc2013-evolution-ac3f575649ef80153a7b0e3226a06aa04066f658.tar.bz2
gsoc2013-evolution-ac3f575649ef80153a7b0e3226a06aa04066f658.tar.lz
gsoc2013-evolution-ac3f575649ef80153a7b0e3226a06aa04066f658.tar.xz
gsoc2013-evolution-ac3f575649ef80153a7b0e3226a06aa04066f658.tar.zst
gsoc2013-evolution-ac3f575649ef80153a7b0e3226a06aa04066f658.zip
Use iconv instead of unicode_iconv.
* camel-mime-utils.c: * camel-mime-filter-charset.c: Use iconv instead of unicode_iconv. svn path=/trunk/; revision=6721
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog3
-rw-r--r--camel/camel-mime-filter-charset.c28
-rw-r--r--camel/camel-mime-utils.c27
3 files changed, 31 insertions, 27 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 47945a66b4..6329faab7d 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,8 @@
2000-11-29 Dan Winship <danw@helixcode.com>
+ * camel-mime-utils.c:
+ * camel-mime-filter-charset.c: Use iconv instead of unicode_iconv.
+
* providers/imap/camel-imap-command.c (imap_read_untagged): Fix
some off-by-one-ness.
diff --git a/camel/camel-mime-filter-charset.c b/camel/camel-mime-filter-charset.c
index 40562dc88d..6c1f668713 100644
--- a/camel/camel-mime-filter-charset.c
+++ b/camel/camel-mime-filter-charset.c
@@ -19,7 +19,7 @@
*/
-#include <unicode.h>
+#include <iconv.h>
#include <string.h>
#include <errno.h>
@@ -59,9 +59,9 @@ camel_mime_filter_charset_finalize(CamelObject *o)
g_free(f->from);
g_free(f->to);
- if (f->ic != (unicode_iconv_t)-1) {
- unicode_iconv_close(f->ic);
- f->ic = (unicode_iconv_t) -1;
+ if (f->ic != (iconv_t)-1) {
+ iconv_close(f->ic);
+ f->ic = (iconv_t) -1;
}
}
@@ -74,9 +74,9 @@ reset(CamelMimeFilter *mf)
int outlen = 16;
/* what happens with the output bytes if this resets the state? */
- if (f->ic != (unicode_iconv_t) -1) {
+ if (f->ic != (iconv_t) -1) {
buffer = buf;
- unicode_iconv(f->ic, NULL, 0, &buffer, &outlen);
+ iconv(f->ic, NULL, 0, &buffer, &outlen);
}
}
@@ -89,7 +89,7 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
char *outbuf;
int inlen, outlen;
- if (f->ic == (unicode_iconv_t) -1) {
+ if (f->ic == (iconv_t) -1) {
goto donothing;
}
@@ -106,7 +106,7 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
d(memset(outbuf, 0, outlen));
if (inlen>0) {
- converted = unicode_iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen);
+ converted = iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen);
if (converted == -1) {
if (errno != EINVAL) {
g_warning("error occured converting: %s", strerror(errno));
@@ -121,7 +121,7 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
/* this 'resets' the output stream, returning back to the initial
shift state for multishift charactersets */
- converted = unicode_iconv(f->ic, NULL, 0, &outbuf, &outlen);
+ converted = iconv(f->ic, NULL, 0, &outbuf, &outlen);
if (converted == -1) {
g_warning("Conversion failed to complete: %s", strerror(errno));
}
@@ -155,7 +155,7 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s
char *outbuf;
int inlen, outlen;
- if (f->ic == (unicode_iconv_t) -1) {
+ if (f->ic == (iconv_t) -1) {
goto donothing;
}
@@ -165,7 +165,7 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s
inlen = len;
outbuf = mf->outbuf;
outlen = mf->outsize;
- converted = unicode_iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen);
+ converted = iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen);
if (converted == -1) {
if (errno != EINVAL) {
g_warning("error occured converting: %s", strerror(errno));
@@ -208,7 +208,7 @@ camel_mime_filter_charset_class_init (CamelMimeFilterCharsetClass *klass)
static void
camel_mime_filter_charset_init (CamelMimeFilterCharset *obj)
{
- obj->ic = (unicode_iconv_t)-1;
+ obj->ic = (iconv_t)-1;
}
/**
@@ -230,8 +230,8 @@ camel_mime_filter_charset_new_convert(const char *from_charset, const char *to_c
{
CamelMimeFilterCharset *new = CAMEL_MIME_FILTER_CHARSET ( camel_object_new (camel_mime_filter_charset_get_type ()));
- new->ic = unicode_iconv_open(to_charset, from_charset);
- if (new->ic == (unicode_iconv_t) -1) {
+ new->ic = 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);
new = NULL;
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 82162a0239..ccdd03634e 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -33,6 +33,7 @@
#include <unistd.h>
#include <unicode.h>
+#include <iconv.h>
#include <glib.h>
#include <time.h>
@@ -874,7 +875,7 @@ rfc2047_decode_word(const char *in, int len)
char *outbase = NULL;
char *inbuf, *outbuf;
int inlen, outlen;
- unicode_iconv_t ic;
+ iconv_t ic;
d(printf("decoding '%.*s'\n", len, in));
@@ -920,10 +921,10 @@ rfc2047_decode_word(const char *in, int len)
outbuf = outbase;
/* TODO: Should this cache iconv converters? */
- ic = unicode_iconv_open("UTF-8", encname);
- if (ic != (unicode_iconv_t)-1) {
- ret = unicode_iconv(ic, (const char **)&inbuf, &inlen, &outbuf, &outlen);
- unicode_iconv_close(ic);
+ ic = iconv_open("UTF-8", encname);
+ if (ic != (iconv_t)-1) {
+ ret = iconv(ic, (const char **)&inbuf, &inlen, &outbuf, &outlen);
+ iconv_close(ic);
if (ret>=0) {
*outbuf = 0;
decoded = g_strdup(outbase);
@@ -1098,7 +1099,7 @@ header_decode_string(const char *in)
static void
rfc2047_encode_word(GString *outstring, const char *in, int len, const char *type, unsigned short safemask)
{
- unicode_iconv_t ic;
+ iconv_t ic;
char *buffer, *out, *ascii;
size_t inlen, outlen, enclen;
@@ -1112,15 +1113,15 @@ rfc2047_encode_word(GString *outstring, const char *in, int len, const char *typ
/* if we can't convert from utf-8, just encode as utf-8 */
if (!strcasecmp(type, "UTF-8")
- || (ic = unicode_iconv_open(type, "UTF-8")) == (unicode_iconv_t)-1) {
+ || (ic = iconv_open(type, "UTF-8")) == (iconv_t)-1) {
memcpy(buffer, in, len);
out = buffer+len;
type = "UTF-8";
} else {
- if (unicode_iconv(ic, &in, &inlen, &out, &outlen) == -1) {
+ if (iconv(ic, &in, &inlen, &out, &outlen) == -1) {
w(g_warning("Conversion problem: conversion truncated: %s", strerror(errno)));
}
- unicode_iconv_close(ic);
+ iconv_close(ic);
}
enclen = out-buffer;
@@ -3126,16 +3127,16 @@ void run_test(void)
inbuf = "Dra¾en Kaèar";
inlen = strlen(inbuf);
outbuf = buffer;
- ic = unicode_iconv_open("UTF-8", "ISO-8859-1");
- unicode_iconv(ic, &inbuf, &inlen, &outbuf, &outlen);
+ ic = iconv_open("UTF-8", "ISO-8859-1");
+ iconv(ic, &inbuf, &inlen, &outbuf, &outlen);
test_phrase(buffer);
outlen = 256;
inbuf = "This is an encoded phrase Tomasz K³oczko";
inlen = strlen(inbuf);
outbuf = buffer;
- ic = unicode_iconv_open("UTF-8", "ISO-8859-2");
- unicode_iconv(ic, &inbuf, &inlen, &outbuf, &outlen);
+ ic = iconv_open("UTF-8", "ISO-8859-2");
+ iconv(ic, &inbuf, &inlen, &outbuf, &outlen);
test_phrase(buffer);
}