Corruption problems in r3462



That changeset is causing corruption problems. I'd suggest reverting
it if the fix is not trivial.

-- 
Alberto García González
http://people.igalia.com/berto/
Index: libtinymail-camel/tny-camel-mime-part.c
===================================================================
--- libtinymail-camel/tny-camel-mime-part.c	(revision 3486)
+++ libtinymail-camel/tny-camel-mime-part.c	(working copy)
@@ -27,7 +27,6 @@
 
 #include <string.h>
 #include <errno.h>
-#include <ctype.h>
 
 #include <tny-mime-part.h>
 #include <tny-camel-mime-part.h>
Index: libtinymail-camel/camel-lite/camel/camel-mime-part-utils.c
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-mime-part-utils.c	(revision 3486)
+++ libtinymail-camel/camel-lite/camel/camel-mime-part-utils.c	(working copy)
@@ -60,18 +60,16 @@
 {
 	GByteArray *buffer = NULL;
 	CamelStream *stream;
-	int start = -1, end;
+	off_t start, end;
 	int fd = -1;
 	size_t len;
 	char *buf;
-	gboolean done = FALSE;
-	camel_mime_parser_state_t state;
-
+	
 	d(printf ("simple_data_wrapper_construct_from_parser()\n"));
 	
 	if (!(stream = camel_mime_parser_stream (mp)))
 		fd = camel_mime_parser_fd (mp);
-	else if (!CAMEL_IS_SEEKABLE_STREAM (stream))
+	else if (!CAMEL_IS_SEEKABLE_SUBSTREAM (stream))
 		stream = NULL;
 
 	if ((stream || fd != -1) && (start = camel_mime_parser_tell (mp)) != -1) {
@@ -80,25 +78,17 @@
 		/* need to load content into memory */
 		buffer = g_byte_array_new ();
 	}
-
-	do {
-
-		state = camel_mime_parser_step_hdr (mp, &buf, &len, &start);
-
-		if (state == CAMEL_MIME_PARSER_STATE_BODY) {
-			//start = camel_mime_parser_tell (mp);
-			done = TRUE;
-		}
-
+	
+	while (camel_mime_parser_step (mp, &buf, &len) != CAMEL_MIME_PARSER_STATE_BODY_END) {
 		if (buffer != NULL) {
 			d(printf("appending o/p data: %d: %.*s\n", len, len, buf));
 			g_byte_array_append (buffer, (guint8 *) buf, len);
 		}
-	} while (state != CAMEL_MIME_PARSER_STATE_BODY_END);
-
-
+	}
+	
 	if (buffer == NULL) {
 		end = camel_mime_parser_tell (mp);
+		
 		if (stream != NULL)
 			stream = camel_seekable_substream_new ((CamelSeekableStream *) stream, start, end);
 		else
Index: libtinymail-camel/camel-lite/camel/camel-mime-parser.c
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-mime-parser.c	(revision 3486)
+++ libtinymail-camel/camel-lite/camel/camel-mime-parser.c	(working copy)
@@ -145,7 +145,6 @@
 	CamelMimeFilter *filter;
 };
 
-static void folder_scan_step_hdr(struct _header_scan_state *s, char **databuffer, size_t *datalength, int *hdr_end);
 static void folder_scan_step(struct _header_scan_state *s, char **databuffer, size_t *datalength);
 static void folder_scan_drop_step(struct _header_scan_state *s);
 static int folder_scan_init_with_fd(struct _header_scan_state *s, int fd);
@@ -630,32 +629,6 @@
 	return s->state;
 }
 
-
-camel_mime_parser_state_t
-camel_mime_parser_step_hdr (CamelMimeParser *parser, char **databuffer, size_t *datalength, int *hdr_end)
-{
-	struct _header_scan_state *s = _PRIVATE (parser);
-
-	d(printf("OLD STATE:  '%s' :\n", states[s->state]));
-
-	if (s->unstep <= 0) {
-		char *dummy;
-		size_t dummylength;
-
-		if (databuffer == NULL) {
-			databuffer = &dummy;
-			datalength = &dummylength;
-		}
-
-		folder_scan_step_hdr (s, databuffer, datalength, hdr_end);
-	} else
-		s->unstep--;
-
-	d(printf("NEW STATE:  '%s' :\n", states[s->state]));
-
-	return s->state;
-}
-
 /**
  * camel_mime_parser_read:
  * @parser: MIME parser object
@@ -1545,7 +1518,7 @@
 #define USE_FROM
 
 static void
-folder_scan_step_hdr (struct _header_scan_state *s, char **databuffer, size_t *datalength, int *hdr_end)
+folder_scan_step(struct _header_scan_state *s, char **databuffer, size_t *datalength)
 {
 	struct _header_scan_stack *h, *hb;
 	const char *content;
@@ -1678,7 +1651,6 @@
 
 	case CAMEL_MIME_PARSER_STATE_HEADER:
 		s->state = CAMEL_MIME_PARSER_STATE_BODY;
-		*hdr_end = folder_tell (s);
 
 	case CAMEL_MIME_PARSER_STATE_BODY:
 		h = s->parts;
@@ -1795,13 +1767,6 @@
 	return;
 }
 
-static void
-folder_scan_step (struct _header_scan_state *s, char **databuffer, size_t *datalength)
-{
-	int i;
-	folder_scan_step_hdr (s, databuffer, datalength, &i);
-}
-
 /* drops the current state back one */
 static void
 folder_scan_drop_step(struct _header_scan_state *s)
Index: libtinymail-camel/camel-lite/camel/camel-mime-parser.h
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-mime-parser.h	(revision 3486)
+++ libtinymail-camel/camel-lite/camel/camel-mime-parser.h	(working copy)
@@ -99,7 +99,6 @@
 int camel_mime_parser_set_header_regex (CamelMimeParser *parser, char *matchstr);
 
 /* normal interface */
-camel_mime_parser_state_t camel_mime_parser_step_hdr (CamelMimeParser *parser, char **buf, size_t *buflen, int *hdr_end);
 camel_mime_parser_state_t camel_mime_parser_step (CamelMimeParser *parser, char **buf, size_t *buflen);
 void camel_mime_parser_unstep (CamelMimeParser *parser);
 void camel_mime_parser_drop_step (CamelMimeParser *parser);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 3486)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2008-03-12  Alberto Garcia Gonzalez <agarcia igalia com>
+
+	* Reverted the "Leave on disk, MIME parsing" patch, as it's
+	causing serious problems.
+
 2008-03-11  Jose Dapena Paz  <jdapena igalia com>
 
 	* libtinymail-camel/tny-camel-folder.c:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]