aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-parser.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-11-14 07:17:31 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-11-14 07:17:31 +0800
commit2699c4c41f9bfe08f6b69c982a7014f577ee0786 (patch)
tree306c1cf35b74ba9a5750834ea76ce0767b07ea19 /camel/camel-mime-parser.c
parentcac6efa61f999754fb2832b3600c89b3b5f9d96d (diff)
downloadgsoc2013-evolution-2699c4c41f9bfe08f6b69c982a7014f577ee0786.tar.gz
gsoc2013-evolution-2699c4c41f9bfe08f6b69c982a7014f577ee0786.tar.zst
gsoc2013-evolution-2699c4c41f9bfe08f6b69c982a7014f577ee0786.zip
Remove mempool code, we use the stuff in e-util. (PRESERVE_HEADERS): new
2003-11-13 Not Zed <NotZed@Ximian.com> * camel-mime-parser.c: Remove mempool code, we use the stuff in e-util. (PRESERVE_HEADERS): new compile option, if on, we preserve headers and folding exactly rather than unfolding all input. THIS BREAKS EVERYTHING right now, so don't turn it on. * camel-gpg-context.c (gpg_decrypt): reset the input memstream before passing it to the gpg engine. * tests/smime/pgp-mime.c (main): redirect /dev/null to stdin so it doesn't hang waiting for input. (main): removed from build - this tests multipart/signed explictly, but now the details of this is handled directly by the cipher context. * tests/smime/pgp.c (main): fixes for api changes. (main): redirect /dev/null to stdin so it doesn't hang waiting for input. * tests/message/test1.c (main): update for api changes. * camel-smime-context.c (sm_verify): look at the content object's mime type, not the container's type. svn path=/trunk/; revision=23343
Diffstat (limited to 'camel/camel-mime-parser.c')
-rw-r--r--camel/camel-mime-parser.c146
1 files changed, 14 insertions, 132 deletions
diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c
index 7f2c515b3b..214b48bc33 100644
--- a/camel/camel-mime-parser.c
+++ b/camel/camel-mime-parser.c
@@ -51,6 +51,8 @@
#define c(x)
#define d(x)
+/*#define PRESERVE_HEADERS*/
+
/*#define PURIFY*/
#define MEMPOOL
@@ -62,136 +64,6 @@ int inend_id = -1,
inbuffer_id = -1;
#endif
-#if 0
-extern int strdup_count;
-extern int malloc_count;
-extern int free_count;
-
-#define g_strdup(x) (strdup_count++, g_strdup(x))
-#define g_malloc(x) (malloc_count++, g_malloc(x))
-#define g_free(x) (free_count++, g_free(x))
-#endif
-
-#ifdef MEMPOOL
-typedef struct _MemPoolNode {
- struct _MemPoolNode *next;
-
- int free;
- char data[1];
-} MemPoolNode;
-
-typedef struct _MemPoolThresholdNode {
- struct _MemPoolThresholdNode *next;
- char data[1];
-} MemPoolThresholdNode;
-
-typedef struct _MemPool {
- int blocksize;
- int threshold;
- struct _MemPoolNode *blocks;
- struct _MemPoolThresholdNode *threshold_blocks;
-} MemPool;
-
-MemPool *mempool_new(int blocksize, int threshold);
-void *mempool_alloc(MemPool *pool, int size);
-void mempool_flush(MemPool *pool, int freeall);
-void mempool_free(MemPool *pool);
-
-MemPool *mempool_new(int blocksize, int threshold)
-{
- MemPool *pool;
-
- pool = g_malloc(sizeof(*pool));
- if (threshold >= blocksize)
- threshold = blocksize * 2 / 3;
- pool->blocksize = blocksize;
- pool->threshold = threshold;
- pool->blocks = NULL;
- pool->threshold_blocks = NULL;
- return pool;
-}
-
-void *mempool_alloc(MemPool *pool, int size)
-{
- size = (size + STRUCT_ALIGN) & (~(STRUCT_ALIGN-1));
- if (size>=pool->threshold) {
- MemPoolThresholdNode *n;
-
- n = g_malloc(sizeof(*n) - sizeof(char) + size);
- n->next = pool->threshold_blocks;
- pool->threshold_blocks = n;
- return &n->data[0];
- } else {
- MemPoolNode *n;
-
- n = pool->blocks;
- while (n) {
- if (n->free >= size) {
- n->free -= size;
- return &n->data[n->free];
- }
- n = n->next;
- }
-
- n = g_malloc(sizeof(*n) - sizeof(char) + pool->blocksize);
- n->next = pool->blocks;
- pool->blocks = n;
- n->free = pool->blocksize - size;
- return &n->data[n->free];
- }
-}
-
-void mempool_flush(MemPool *pool, int freeall)
-{
- MemPoolThresholdNode *tn, *tw;
- MemPoolNode *pw, *pn;
-
- tw = pool->threshold_blocks;
- while (tw) {
- tn = tw->next;
- g_free(tw);
- tw = tn;
- }
- pool->threshold_blocks = NULL;
-
- if (freeall) {
- pw = pool->blocks;
- while (pw) {
- pn = pw->next;
- g_free(pw);
- pw = pn;
- }
- pool->blocks = NULL;
- } else {
- pw = pool->blocks;
- while (pw) {
- pw->free = pool->blocksize;
- pw = pw->next;
- }
- }
-}
-
-void mempool_free(MemPool *pool)
-{
- if (pool) {
- mempool_flush(pool, 1);
- g_free(pool);
- }
-}
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
#define SCAN_BUF 4096 /* size of read buffer */
#define SCAN_HEAD 128 /* headroom guaranteed to be before each read buffer */
@@ -1310,8 +1182,11 @@ folder_scan_header(struct _header_scan_state *s, int *lastone)
h(printf("got line part: '%.*s'\n", inptr-1-start, start));
/* got a line, strip and add it, process it */
s->midline = FALSE;
+#ifdef PRESERVE_HEADERS
+ header_append(s, start, inptr);
+#else
header_append(s, start, inptr-1);
-
+#endif
/* check for end of headers */
if (s->outbuf == s->outptr)
goto header_done;
@@ -1319,6 +1194,7 @@ folder_scan_header(struct _header_scan_state *s, int *lastone)
/* check for continuation/compress headers, we have atleast 1 char here to work with */
if (inptr[0] == ' ' || inptr[0] == '\t') {
h(printf("continuation\n"));
+#ifndef PRESERVE_HEADERS
/* TODO: this wont catch multiple space continuation across a read boundary, but
that is assumed rare, and not fatal anyway */
do
@@ -1326,11 +1202,17 @@ folder_scan_header(struct _header_scan_state *s, int *lastone)
while (*inptr == ' ' || *inptr == '\t');
inptr--;
*inptr = ' ';
+#endif
} else {
/* otherwise, complete header, add it */
+#ifdef PRESERVE_HEADERS
+ s->outptr--;
+ if (s->outptr[-1] == '\r')
+ s->outptr--;
+#endif
s->outptr[0] = 0;
- h(printf("header '%.20s' at %d\n", s->outbuf, (int)s->header_start));
+ h(printf("header '%s' at %d\n", s->outbuf, (int)s->header_start));
header_raw_append_parse(&h->headers, s->outbuf, s->header_start);
s->outptr = s->outbuf;
t/gsoc2013-evolution/commit/art?h=GAL_2_2_2&id=4ed362a625f7bec5d7527f4566fe14b46695aa61'>Update.Ettore Perazzoli2002-10-281-0/+5 * New. New.Ettore Perazzoli2002-10-284-0/+7 * Sync for 1.1.2.Ettore Perazzoli2002-10-082-0/+4 * New icon for "Post a Reply" from Jakub.Dan Winship2002-09-283-0/+5 * Sync for 1.1.1.Ettore Perazzoli2002-09-103-0/+4 * New icon from Jakub.Ettore Perazzoli2002-09-042-0/+4 * use a more gnomeish versionJakub Steiner2002-09-032-0/+4 * New artwork from Jakub. Likewise. Likewise.Ettore Perazzoli2002-08-026-69/+11 * New icon for mail (gnome-textfile.png from GNOME 2, byEttore Perazzoli2002-07-273-0/+6 * icon fixesJakub Steiner2002-07-244-0/+5 * add new image22002-07-233-0/+183 * new icon for jpr. -tig-Tuomas Kuosmanen2002-07-181-0/+0 * Added final large versions of the InboxEttore Perazzoli2002-07-173-0/+5 * add folder.png, folder-mini.png, public-folder.png, andDan Winship2002-07-166-0/+14 * (images_DATA): inbox-mini.png instead ofEttore Perazzoli2002-07-106-4/+12 * updated version from JakubRadek Doulik2002-06-061-0/+0 * readdedRadek Doulik2002-05-301-0/+0 * delete to readd with -kbRadek Doulik2002-05-301-0/+0 * added info bulb pictureRadek Doulik2002-05-302-0/+1 * New.Ettore Perazzoli2002-05-213-0/+5 * font.png: Add for the font config prefs.Larry Ewing2002-05-081-0/+1 * font.png: Add for the font config prefs.Larry Ewing2002-04-262-0/+5 * Replace with an antialiased versionDan Winship2002-04-182-0/+4 * it's monkey-16.png not monkey.pngJeffrey Stedfast2002-04-111-1/+1 * add Rupert's seal of approvalDan Winship2002-04-112-0/+1 * Add. (Copied from Unscalable Gorilla because it was handy. Will probablyDan Winship2002-04-113-0/+7 * *** empty log message ***Ettore Perazzoli2002-03-307-59/+72 * Add working-16.png (the GNOME2 stock "wait" icon, from Jakub)Dan Winship2002-03-253-1/+7 * Rename the internal structure to coincide with the filenames.Jeffrey Stedfast2002-03-054-3/+8 * New cool artwork from Jakub.Ettore Perazzoli2002-03-013-0/+4 * Remove meeting_widget.png from the build since it doesn't seem to be inJeffrey Stedfast2002-02-232-1/+5 * Remove stale file.Ettore Perazzoli2002-02-221-0/+0 * summary preferences menu iconJakub Steiner2002-02-213-0/+6 * renamed the icon internallyJeffrey Stedfast2002-02-141-1/+1 * New icons.Jeffrey Stedfast2002-02-145-0/+89 * Install mail-new.xpm, mail-read.xpm and priority-high.xpm in the sameJeffrey Stedfast2002-02-132-0/+9 * new iconJP Rosevear2002-02-094-0/+134 * Fix typo.Jon Trowbridge2001-12-121-1/+1 * A new icon that sucks less. We still need stoem Tuomas-love.Jon Trowbridge2001-12-122-67/+102 * Implements marking messages as "Need Reply".Jon Trowbridge2001-12-103-0/+79 * New, updated icon from Tuomas.Ettore Perazzoli2001-11-072-0/+4 * dist the glade dataJP Rosevear2001-11-062-0/+5 * Fix for #14281 (missing icons in the druids).Ettore Perazzoli2001-11-032-1/+20 * Remove.Ettore Perazzoli2001-10-311-0/+0 * Install `evolution.png', not `evolution-icon.png'.Ettore Perazzoli2001-10-313-1/+8 * new splashJakub Steiner2001-10-312-0/+4 * Remove the "1" from "1.0 Release Candidate 1" so it looks better.Ettore Perazzoli2001-10-302-0/+5 * Version number fix0r on the splash.. -tigert-Tuomas Kuosmanen2001-10-301-0/+0 * oops, the image was too big! this is 48x48 -tig-Tuomas Kuosmanen2001-10-231-0/+0 * this too so the icons gets installed.. -tig-Tuomas Kuosmanen2001-10-232-1/+5 * New app icon, should scale better..Tuomas Kuosmanen2001-10-232-0/+4 * new splashJakub Steiner2001-10-223-0/+1 * update the look a bitJakub Steiner2001-10-222-0/+4 * Add `about-box.png'.Ettore Perazzoli2001-10-20