diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-10-07 07:44:46 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-10-07 07:44:46 +0800 |
commit | 15b182a1fc53900040d5d53e7511637f8f52b922 (patch) | |
tree | a58a755f589b8d2439fb855783a6fc04bec02a14 /camel | |
parent | 2c334b9802814dfef34797089f5f741f3cef580d (diff) | |
download | gsoc2013-evolution-15b182a1fc53900040d5d53e7511637f8f52b922.tar gsoc2013-evolution-15b182a1fc53900040d5d53e7511637f8f52b922.tar.gz gsoc2013-evolution-15b182a1fc53900040d5d53e7511637f8f52b922.tar.bz2 gsoc2013-evolution-15b182a1fc53900040d5d53e7511637f8f52b922.tar.lz gsoc2013-evolution-15b182a1fc53900040d5d53e7511637f8f52b922.tar.xz gsoc2013-evolution-15b182a1fc53900040d5d53e7511637f8f52b922.tar.zst gsoc2013-evolution-15b182a1fc53900040d5d53e7511637f8f52b922.zip |
Fix a slight error in logic. Just because the last word was an encoded
2001-10-06 Jeffrey Stedfast <fejj@ximian.com>
* camel-mime-utils.c (header_decode_text): Fix a slight error in
logic. Just because the last word was an encoded word doesn't mean
we ignore the lwsp padding, we only ignore it if the last word and
*this* word are encoded.
svn path=/trunk/; revision=13490
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 7 | ||||
-rw-r--r-- | camel/camel-mime-utils.c | 26 |
2 files changed, 24 insertions, 9 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index afb97d6b39..a6518015d0 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,12 @@ 2001-10-06 Jeffrey Stedfast <fejj@ximian.com> + * camel-mime-utils.c (header_decode_text): Fix a slight error in + logic. Just because the last word was an encoded word doesn't mean + we ignore the lwsp padding, we only ignore it if the last word and + *this* word are encoded. + +2001-10-06 Jeffrey Stedfast <fejj@ximian.com> + * camel-mime-filter-basic.c (filter): Implemented uuencoding and decoding. (complete): Implemented uuencoding and decoding. diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 57d1b13ed4..2a1a92995b 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -509,7 +509,7 @@ base64_decode_simple (char *data, int len) int uuencode_close (unsigned char *in, int len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save, char *uulen) { - register unsigned char *inptr, *outptr, *bufptr; + register unsigned char *outptr, *bufptr; register guint32 saved; int i; @@ -583,7 +583,7 @@ int uuencode_step (unsigned char *in, int len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save, char *uulen) { register unsigned char *inptr, *outptr, *bufptr; - unsigned char *inend, ch; + unsigned char *inend; register guint32 saved; int i; @@ -1220,7 +1220,7 @@ static char * header_decode_text (const char *in, int inlen, const char *default_charset) { GString *out; - const char *inptr, *inend, *start, *locale_charset; + const char *inptr, *inend, *start, *chunk, *locale_charset; char *dword = NULL; locale_charset = camel_charset_locale_name(); @@ -1228,6 +1228,7 @@ header_decode_text (const char *in, int inlen, const char *default_charset) out = g_string_new(""); inptr = in; inend = inptr + inlen; + chunk = NULL; while (inptr < inend) { start = inptr; @@ -1237,8 +1238,11 @@ header_decode_text (const char *in, int inlen, const char *default_charset) if (inptr == inend) { g_string_append_len(out, start, inptr-start); break; - } else if (dword == NULL) + } else if (dword == NULL) { g_string_append_len(out, start, inptr-start); + } else { + chunk = start; + } start = inptr; while (inptr < inend && !is_lwsp(*inptr)) @@ -1248,12 +1252,16 @@ header_decode_text (const char *in, int inlen, const char *default_charset) if (dword) { g_string_append(out, dword); g_free(dword); - } else if ((default_charset == NULL - || !append_8bit(out, start, inptr-start, default_charset)) - && (locale_charset == NULL - || !append_8bit(out, start, inptr-start, locale_charset))) { - append_latin1(out, start, inptr-start); + } else { + if (!chunk) + chunk = start; + + if ((default_charset == NULL || !append_8bit (out, chunk, inptr-chunk, default_charset)) + && (locale_charset == NULL || !append_8bit(out, chunk, inptr-chunk, locale_charset))) + append_latin1(out, chunk, inptr-chunk); } + + chunk = NULL; } dword = out->str; |