aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-utils.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-02-26 03:43:22 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-02-26 03:43:22 +0800
commit74205e83d12157f4c3c379722a0e6736d19c13ce (patch)
treecc32c6df4eec053249dfe58764e5349306577088 /camel/camel-mime-utils.c
parentf9f6af4bcef7e33543a343048e0da492d3941861 (diff)
downloadgsoc2013-evolution-74205e83d12157f4c3c379722a0e6736d19c13ce.tar
gsoc2013-evolution-74205e83d12157f4c3c379722a0e6736d19c13ce.tar.gz
gsoc2013-evolution-74205e83d12157f4c3c379722a0e6736d19c13ce.tar.bz2
gsoc2013-evolution-74205e83d12157f4c3c379722a0e6736d19c13ce.tar.lz
gsoc2013-evolution-74205e83d12157f4c3c379722a0e6736d19c13ce.tar.xz
gsoc2013-evolution-74205e83d12157f4c3c379722a0e6736d19c13ce.tar.zst
gsoc2013-evolution-74205e83d12157f4c3c379722a0e6736d19c13ce.zip
Same as the ones below.
2003-02-25 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-message.c: Same as the ones below. * camel-mime-part.c: Reverted back to pre-camel-iconv * camel-filter-search.c: Same as below. * camel-folder-summary.c: Reverted back to pre-camel-iconv * camel.c (camel_init): Reverted to pre-camel-iconv * camel-charset-map.c (camel_charset_locale_name): Removed (part of the revert). (camel_charset_canonical_name): Same. * camel-mime-filter-charset.c: Revert back to using e_iconv from GAL. * camel-mime-part-utils.c: Revert back to using e_iconv from GAL. * camel-mime-utils.c: Revert back to using e_iconv from GAL. * camel-sasl-digest-md5.c: Revert back to using e-iconv from GAL. svn path=/trunk/; revision=20056
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r--camel/camel-mime-utils.c77
1 files changed, 38 insertions, 39 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index b12c116b28..9513d920e3 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -46,10 +46,9 @@
#include <regex.h>
#include <glib.h>
-#include <glib/gunicode.h>
-#include "e-time-utils.h"
+#include <gal/util/e-iconv.h>
+#include <e-util/e-time-utils.h>
-#include "camel-iconv.h"
#include "camel-mime-utils.h"
#include "camel-charset-map.h"
#include "camel-service.h" /* for camel_gethostbyname() */
@@ -1012,7 +1011,7 @@ rfc2047_decode_word(const char *in, size_t len)
d(printf("found ?, encoding is '%c'\n", inptr[0]));
inptr++;
tmplen = inend-inptr-2;
- decword = alloca(tmplen); /* this will always be more-than-enough room */
+ decword = g_alloca (tmplen); /* this will always be more-than-enough room */
switch(toupper(inptr[0])) {
case 'Q':
inlen = quoted_decode(inptr+2, tmplen, decword);
@@ -1033,7 +1032,7 @@ rfc2047_decode_word(const char *in, size_t len)
if (inlen > 0) {
/* yuck, all this snot is to setup iconv! */
tmplen = inptr - in - 3;
- encname = alloca (tmplen + 1);
+ encname = g_alloca (tmplen + 1);
memcpy (encname, in + 2, tmplen);
encname[tmplen] = '\0';
@@ -1049,30 +1048,30 @@ rfc2047_decode_word(const char *in, size_t len)
if (p)
*p = '\0';
- charset = camel_charset_canonical_name (encname);
+ charset = e_iconv_charset_name (encname);
inbuf = decword;
outlen = inlen * 6 + 16;
- outbase = alloca (outlen);
+ outbase = g_alloca (outlen);
outbuf = outbase;
retry:
- ic = camel_iconv_open ("UTF-8", charset);
+ ic = e_iconv_open ("UTF-8", charset);
if (ic != (iconv_t) -1) {
- ret = camel_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
+ ret = e_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
if (ret != (size_t) -1) {
- camel_iconv (ic, NULL, 0, &outbuf, &outlen);
+ e_iconv (ic, NULL, 0, &outbuf, &outlen);
*outbuf = 0;
decoded = g_strdup (outbase);
}
- camel_iconv_close (ic);
+ e_iconv_close (ic);
} else {
w(g_warning ("Cannot decode charset, header display may be corrupt: %s: %s",
charset, strerror (errno)));
if (!retried) {
- charset = camel_charset_locale_name ();
+ charset = e_iconv_locale_charset ();
if (!charset)
charset = "iso-8859-1";
@@ -1120,24 +1119,24 @@ append_8bit (GString *out, const char *inbuf, size_t inlen, const char *charset)
size_t outlen;
iconv_t ic;
- ic = camel_iconv_open ("UTF-8", charset);
+ ic = e_iconv_open ("UTF-8", charset);
if (ic == (iconv_t) -1)
return FALSE;
outlen = inlen * 6 + 16;
outbuf = outbase = g_malloc(outlen);
- if (camel_iconv (ic, &inbuf, &inlen, &outbuf, &outlen) == (size_t) -1) {
+ if (e_iconv (ic, &inbuf, &inlen, &outbuf, &outlen) == (size_t) -1) {
w(g_warning("Conversion to '%s' failed: %s", charset, strerror (errno)));
g_free(outbase);
- camel_iconv_close (ic);
+ e_iconv_close (ic);
return FALSE;
}
*outbuf = 0;
g_string_append(out, outbase);
g_free(outbase);
- camel_iconv_close (ic);
+ e_iconv_close (ic);
return TRUE;
@@ -1151,9 +1150,9 @@ header_decode_text (const char *in, size_t 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("");
+ out = g_string_new ("");
inptr = in;
inend = inptr + inlen;
chunk = NULL;
@@ -1224,14 +1223,14 @@ rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char *
/* convert utf8->encoding */
bufflen = len * 6 + 16;
- buffer = alloca (bufflen);
+ buffer = g_alloca (bufflen);
inlen = len;
inptr = in;
- ascii = alloca (bufflen);
+ ascii = g_alloca (bufflen);
if (strcasecmp (type, "UTF-8") != 0)
- ic = camel_iconv_open (type, "UTF-8");
+ ic = e_iconv_open (type, "UTF-8");
while (inlen) {
size_t convlen, proclen;
@@ -1279,13 +1278,13 @@ rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char *
hopefully-small-enough chunks, and leave it at that */
convlen = MIN(inlen, CAMEL_FOLD_PREENCODED);
p = inptr;
- if (camel_iconv (ic, &inptr, &convlen, &out, &outlen) == (size_t) -1) {
+ if (e_iconv (ic, &inptr, &convlen, &out, &outlen) == (size_t) -1) {
w(g_warning("Conversion problem: conversion truncated: %s", strerror (errno)));
/* blah, we include it anyway, better than infinite loop ... */
inptr = p + convlen;
} else {
/* make sure we flush out any shift state */
- camel_iconv (ic, NULL, 0, &out, &outlen);
+ e_iconv (ic, NULL, 0, &out, &outlen);
}
inlen -= (inptr - p);
}
@@ -1310,7 +1309,7 @@ rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char *
}
if (ic != (iconv_t) -1)
- camel_iconv_close (ic);
+ e_iconv_close (ic);
}
@@ -1867,7 +1866,7 @@ rfc2184_decode (const char *in, size_t len)
return NULL;
encoding = g_strndup (in, inptr - in);
- charset = camel_charset_canonical_name (encoding);
+ charset = e_iconv_charset_name (encoding);
g_free (encoding);
inptr = memchr (inptr + 1, '\'', inend - inptr - 1);
@@ -1884,22 +1883,22 @@ rfc2184_decode (const char *in, size_t len)
inbuf = decword = hex_decode (inptr, inend - inptr);
inlen = strlen (inbuf);
- ic = camel_iconv_open ("UTF-8", charset);
+ ic = e_iconv_open ("UTF-8", charset);
if (ic != (iconv_t) -1) {
size_t ret;
outlen = inlen * 6 + 16;
outbuf = outbase = g_malloc (outlen);
- ret = camel_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
+ ret = e_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
if (ret != (size_t) -1) {
- camel_iconv (ic, NULL, 0, &outbuf, &outlen);
+ e_iconv (ic, NULL, 0, &outbuf, &outlen);
*outbuf = '\0';
g_free (decoded);
decoded = outbase;
}
- camel_iconv_close (ic);
+ e_iconv_close (ic);
} else {
decoded = decword;
}
@@ -2039,21 +2038,21 @@ 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_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) {
size_t ret;
outlen = inlen * 6 + 16;
outbuf = outbase = g_malloc (outlen);
- ret = camel_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
+ ret = e_iconv (ic, &inbuf, &inlen, &outbuf, &outlen);
if (ret != (size_t) -1) {
- camel_iconv (ic, NULL, 0, &outbuf, &outlen);
+ e_iconv (ic, NULL, 0, &outbuf, &outlen);
*outbuf = '\0';
}
- camel_iconv_close (ic);
+ e_iconv_close (ic);
g_free (value);
value = outbase;
@@ -2968,7 +2967,7 @@ header_encode_param (const unsigned char *in, gboolean *encoded)
charset = "iso-8859-1";
if (strcasecmp (charset, "UTF-8") != 0)
- cd = camel_iconv_open (charset, "UTF-8");
+ cd = e_iconv_open (charset, "UTF-8");
if (cd == (iconv_t) -1) {
charset = "UTF-8";
@@ -2984,13 +2983,13 @@ header_encode_param (const unsigned char *in, gboolean *encoded)
outptr = outbuf = g_malloc (outleft);
inbuf = in;
- if (camel_iconv (cd, &inbuf, &inleft, &outptr, &outleft) == (size_t) -1) {
+ if (e_iconv (cd, &inbuf, &inleft, &outptr, &outleft) == (size_t) -1) {
w(g_warning ("Conversion problem: conversion truncated: %s", strerror (errno)));
} else {
- camel_iconv (cd, NULL, 0, &outptr, &outleft);
+ e_iconv (cd, NULL, 0, &outptr, &outleft);
}
- camel_iconv_close (cd);
+ e_iconv_close (cd);
inptr = outbuf;
inend = outptr;
@@ -3547,7 +3546,7 @@ header_raw_append_parse(struct _header_raw **list, const char *header, int offse
printf("Invalid header line: '%s'\n", header);
return;
}
- name = alloca(fieldlen+1);
+ name = g_alloca (fieldlen + 1);
memcpy(name, header, fieldlen);
name[fieldlen] = 0;