aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-utils.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-01-11 12:28:52 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-01-11 12:28:52 +0800
commitf79c4faf50deeee2fda26c675b38da3ad019a489 (patch)
tree2024e7736ec59453a0b561df3d4046b0c65895c6 /camel/camel-mime-utils.c
parentce1cd2b1ae0906ad56add2a737a4591af21c8acd (diff)
downloadgsoc2013-evolution-f79c4faf50deeee2fda26c675b38da3ad019a489.tar
gsoc2013-evolution-f79c4faf50deeee2fda26c675b38da3ad019a489.tar.gz
gsoc2013-evolution-f79c4faf50deeee2fda26c675b38da3ad019a489.tar.bz2
gsoc2013-evolution-f79c4faf50deeee2fda26c675b38da3ad019a489.tar.lz
gsoc2013-evolution-f79c4faf50deeee2fda26c675b38da3ad019a489.tar.xz
gsoc2013-evolution-f79c4faf50deeee2fda26c675b38da3ad019a489.tar.zst
gsoc2013-evolution-f79c4faf50deeee2fda26c675b38da3ad019a489.zip
if e_iconv() returns -1, check that errno != EINVAL - if errno *is*
2004-01-10 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-utils.c (rfc2047_encode_word): if e_iconv() returns -1, check that errno != EINVAL - if errno *is* EINVAL, it just means that our convlen wasn't long enough to include the whole sequence. This is fine, we'll just start where we left off next loop thru. Fixes bug #52593 (the buffer was duplicated because state wasn't flushed). (camel_header_encode_string): Fixed a type-o in loop where encoding=0, don't g_string_append_len starting at 'word' inptr-start bytes long - 'word' could be NULL and/or inptr-start could be longer than inptr-word. svn path=/trunk/; revision=24149
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r--camel/camel-mime-utils.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 88a7c2ad9b..83caa8f1d2 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -1250,7 +1250,7 @@ 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 (e_iconv (ic, &inptr, &convlen, &out, &outlen) == (size_t) -1) {
+ if (e_iconv (ic, &inptr, &convlen, &out, &outlen) == (size_t) -1 && errno != EINVAL) {
w(g_warning("Conversion problem: conversion truncated: %s", strerror (errno)));
/* blah, we include it anyway, better than infinite loop ... */
inptr = p + convlen;
@@ -1279,7 +1279,7 @@ rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char *
g_string_append (outstring, ascii);
}
}
-
+
if (ic != (iconv_t) -1)
e_iconv_close (ic);
}
@@ -1334,13 +1334,14 @@ camel_header_encode_string (const unsigned char *in)
if (g_unichar_isspace (c) && !last_was_space) {
/* we've reached the end of a 'word' */
if (word && !(last_was_encoded && encoding)) {
+ /* output lwsp between non-encoded words */
g_string_append_len (out, start, word - start);
start = word;
}
switch (encoding) {
case 0:
- out = g_string_append_len (out, word, inptr - start);
+ g_string_append_len (out, start, inptr - start);
last_was_encoded = FALSE;
break;
case 1:
@@ -1388,7 +1389,7 @@ camel_header_encode_string (const unsigned char *in)
switch (encoding) {
case 0:
- out = g_string_append_len (out, start, inptr - start);
+ g_string_append_len (out, start, inptr - start);
break;
case 1:
if (last_was_encoded)