aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-filter-charset.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-11-08 17:13:52 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-11-08 17:13:52 +0800
commit2b97bd935b8d4becffb4df667a2ee6162c706465 (patch)
treedd75b0c2f60651e8910fda93a5910d6699f94ef7 /camel/camel-mime-filter-charset.c
parent18c2d259b26f9a6d3d86e1b0a183750d4f482d72 (diff)
downloadgsoc2013-evolution-2b97bd935b8d4becffb4df667a2ee6162c706465.tar
gsoc2013-evolution-2b97bd935b8d4becffb4df667a2ee6162c706465.tar.gz
gsoc2013-evolution-2b97bd935b8d4becffb4df667a2ee6162c706465.tar.bz2
gsoc2013-evolution-2b97bd935b8d4becffb4df667a2ee6162c706465.tar.lz
gsoc2013-evolution-2b97bd935b8d4becffb4df667a2ee6162c706465.tar.xz
gsoc2013-evolution-2b97bd935b8d4becffb4df667a2ee6162c706465.tar.zst
gsoc2013-evolution-2b97bd935b8d4becffb4df667a2ee6162c706465.zip
Keep track of the caller bestenc flags that make sense.
2000-11-08 Not Zed <NotZed@HelixCode.com> * camel-mime-message.c (find_best_encoding): Keep track of the caller bestenc flags that make sense. * camel-mime-filter-bestenc.c (filter): Added code to detect when we have "^From " lines in the sequence of text. (camel_mime_filter_bestenc_get_best_encoding): Added a new flag CAMEL_BESTENC_NO_FROM: if set, it will not allow any lines matching "^From " to appear in the output - currently forcing base64 encoding to achieve this. * camel-mime-parser.c (folder_scan_step): Call camel_mime-filter_complete() once we're done, rather than filter_filter(). (folder_scan_content): Some fixes for state changing; so that when we do find another boundary it is properly flagged. Since we strip the last \n off all data, we must take that into account too. Sigh. Fixes a rather nasty set of bugs where multipart messages could start including following messages as parts, etc. (struct _header_scan_stack): Added new parameter, boundarylenfinal, which holds the length of the final boundary, if it is different (e.g. for From lines, whihc aren't) (folder_scan_step): Setup teh boundarylenfinal value when creating a new boundary. (folder_scan_content): Hmm, if we hit the end-of-buffer sentinal, reset the scanner back to leave 'atleast' chars in the buffer still, dump that content, and retry again. Stops us losing a check for a boundary on some data we haven't really looked at yet! (folder_scan_content): Use boundarylenfinal to calculate 'atleast'. (folder_scan_header): And here too. (folder_boundary_check): Use the atleast value directly, dont truncate it. Use the boundarylen/boundarylenfinal values directly too. (struct _header_scan_stack): Add an atleast parameter to cache the atleast info. (folder_push_part): Determine/set 'atleast', every time we add a new part. (folder_scan_header): Get the cached atleast info from the current part. (folder_scan_content): And here too. (folder_scan_header): Fix a problem where a part starting with " text" would be interpreted as a followon header wrongly. * camel-mime-filter-charset.c (complete): Add some assertions to find a bug. svn path=/trunk/; revision=6500
Diffstat (limited to 'camel/camel-mime-filter-charset.c')
-rw-r--r--camel/camel-mime-filter-charset.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/camel/camel-mime-filter-charset.c b/camel/camel-mime-filter-charset.c
index c91c7f061f..1fc10a1aff 100644
--- a/camel/camel-mime-filter-charset.c
+++ b/camel/camel-mime-filter-charset.c
@@ -26,6 +26,7 @@
#include "camel-mime-filter-charset.h"
+#define d(x)
static void camel_mime_filter_charset_class_init (CamelMimeFilterCharsetClass *klass);
static void camel_mime_filter_charset_init (CamelMimeFilterCharset *obj);
@@ -101,6 +102,9 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
outbuf = mf->outbuf;
outlen = mf->outsize;
+ /* temporary fix to find another bug somewhere */
+ d(memset(outbuf, 0, outlen));
+
if (inlen>0) {
converted = unicode_iconv(f->ic, &inbuf, &inlen, &outbuf, &outlen);
if (converted == -1) {
@@ -122,6 +126,15 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
g_warning("Conversion failed to complete: %s", strerror(errno));
}
+ /* debugging assertion - check for NUL's in output */
+ d({
+ int i;
+
+ for (i=0;i<(mf->outsize - outlen);i++) {
+ g_assert(mf->outbuf[i]);
+ }
+ });
+
*out = mf->outbuf;
*outlenptr = mf->outsize - outlen;
*outprespace = mf->outpre;