[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync-parse.c, 1.49, 1.50

cras at dovecot.org cras at dovecot.org
Thu Jun 8 19:59:46 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv22736

Modified Files:
	mbox-sync-parse.c 
Log Message:
Don't cause whitespace offsets to break if some headers before it were
removed (eg. extra X-IMAPbase headers)



Index: mbox-sync-parse.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-parse.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- mbox-sync-parse.c	14 Jan 2006 18:47:52 -0000	1.49
+++ mbox-sync-parse.c	8 Jun 2006 16:59:44 -0000	1.50
@@ -62,7 +62,7 @@
 
 	if ((ssize_t)space > ctx->mail.space) {
 		i_assert(space != 0);
-		ctx->mail.offset = hdr->full_value_offset + i;
+		ctx->mail.offset = ctx->hdr_offset + str_len(ctx->header) + i;
 		ctx->mail.space = space;
 	}
 }
@@ -206,9 +206,11 @@
 		uid_last = uid_last * 10 + (hdr->full_value[i] - '0');
 	}
 
-	if (j != 10) {
+	if (j != 10 ||
+	    hdr->full_value_offset != ctx->hdr_offset + str_len(ctx->header)) {
 		/* uid-last field must be exactly 10 characters to make
-		   rewriting it easier. */
+		   rewriting it easier. also don't try to do this if some
+		   headers have been removed */
 		ctx->imapbase_rewrite = TRUE;
 		ctx->need_rewrite = TRUE;
 	} else {



More information about the dovecot-cvs mailing list