aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream-filter.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-03-03 14:36:44 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-03-03 14:36:44 +0800
commitd6443cd2ca8b523e941d9c184b34a8bcccdc7cc1 (patch)
tree6bf1db2eb68dde7ada301ade040777e5aef4dcb7 /camel/camel-stream-filter.c
parent3181ad6bfa6bc0d5f0049a1fe510ec94f186ebe5 (diff)
downloadgsoc2013-evolution-d6443cd2ca8b523e941d9c184b34a8bcccdc7cc1.tar.gz
gsoc2013-evolution-d6443cd2ca8b523e941d9c184b34a8bcccdc7cc1.tar.zst
gsoc2013-evolution-d6443cd2ca8b523e941d9c184b34a8bcccdc7cc1.zip
fun dun diddley un fun. Since we're writing a const buffer, we need to
2004-03-03 Not Zed <NotZed@Ximian.com> * camel-stream-filter.c (do_write, do_write): fun dun diddley un fun. Since we're writing a const buffer, we need to copy it first. See #54937. 2004-02-27 Not Zed <NotZed@Ximian.com> ** See bug #54755. * camel-vtrash-folder.c (vtrash_append_message) (vtrash_transfer_messages_to): error/fail out if the user tries to copy messages to the trash. (vtrash_transfer_messages_to): use the destination bit not the source bit for moving messages to a vtrash folder. * camel-gpg-context.c (gpg_ctx_parse_status): ignore NODATA response, otherwise we abort in a meaningless way. See #52939. * providers/imap/camel-imap-utils.c: use g_ascii_str[n]casecmp everywhere. * providers/imap/camel-imap-utils.c (imap_body_decode): fix the sense of the nil check for the subtype of a mutlipart. See #53355. 2004-02-26 Not Zed <NotZed@Ximian.com> * camel-session.c (camel_session_check_junk_for_imap) (camel_session_set_check_junk_for_imap): removed. * providers/imap/camel-imap-provider.c: Add filter_junk and filter_junk_inbox options to the receive option page. * providers/imap/camel-imap-store.c (imap_setv, imap_getv): handle FILTER_JUNK and FILTER_JUNK_INBOX parameters. (imap_setv): conver to switch rather than if statement. (construct): handle url args for filter_junk and filter_junk_inbox. * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Set the folder's flags based on the stores junk settings. (imap_update_summary): remove the test for session_check_junk_for_imap, its handled per-store now. * camel-folder.c (folder_changed): only check for FILTER_RECENT or FILTER_JUNK to see if we need to do filtering. * camel-folder.h (CAMEL_FOLDER_FILTER_JUNK): renamed from CAMEL_FOLDER_SUPRESS_JUNK_TEST (and obviously inverted logic). svn path=/trunk/; revision=24942
Diffstat (limited to 'camel/camel-stream-filter.c')
-rw-r--r--camel/camel-stream-filter.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/camel/camel-stream-filter.c b/camel/camel-stream-filter.c
index 059a5198f1..e9c5e69f9c 100644
--- a/camel/camel-stream-filter.c
+++ b/camel/camel-stream-filter.c
@@ -28,7 +28,7 @@
#include <string.h>
#include "camel-stream-filter.h"
-#define d(x)
+#define d(x) x
/* use my malloc debugger? */
/*extern void g_check(void *mp);*/
@@ -287,34 +287,42 @@ do_write (CamelStream *stream, const char *buf, size_t n)
CamelStreamFilter *filter = (CamelStreamFilter *)stream;
struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
struct _filter *f;
- size_t presize;
- char *buffer = (char *)buf;
- size_t len = n;
+ size_t presize, len, left = n;
+ char *buffer, realbuffer[READ_SIZE+READ_PAD];
p->last_was_read = FALSE;
d(printf ("\n\nWriting: Original content (%s): '", ((CamelObject *)filter->source)->klass->name));
- d(fwrite(buffer, sizeof(char), len, stdout));
+ d(fwrite(buf, sizeof(char), n, stdout));
d(printf("'\n"));
g_check(p->realbuffer);
- f = p->filters;
- presize = 0;
- while (f) {
- camel_mime_filter_filter(f->filter, buffer, len, presize, &buffer, &len, &presize);
+ while (left) {
+ /* Sigh, since filters expect non const args, copy the input first, we do this in handy sized chunks */
+ len = MIN(READ_SIZE, left);
+ buffer = realbuffer + READ_PAD;
+ memcpy(buffer, buf, len);
+ buf += len;
+ left -= len;
- g_check(p->realbuffer);
+ f = p->filters;
+ presize = READ_PAD;
+ while (f) {
+ camel_mime_filter_filter(f->filter, buffer, len, presize, &buffer, &len, &presize);
- d(printf ("Filtered content (%s): '", ((CamelObject *)f->filter)->klass->name));
- d(fwrite(buffer, sizeof(char), len, stdout));
- d(printf("'\n"));
+ g_check(p->realbuffer);
- f = f->next;
- }
+ d(printf ("Filtered content (%s): '", ((CamelObject *)f->filter)->klass->name));
+ d(fwrite(buffer, sizeof(char), len, stdout));
+ d(printf("'\n"));
- if (camel_stream_write(filter->source, buffer, len) != len)
- return -1;
+ f = f->next;
+ }
+
+ if (camel_stream_write(filter->source, buffer, len) != len)
+ return -1;
+ }
g_check(p->realbuffer);