[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync-rewrite.c, 1.72, 1.73

tss at dovecot.org tss at dovecot.org
Fri Mar 9 22:22:52 EET 2007


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

Modified Files:
	mbox-sync-rewrite.c 
Log Message:
Yet another try at fixing this piece of code. The mbox code is way too
complex and could use better comments..



Index: mbox-sync-rewrite.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-rewrite.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- mbox-sync-rewrite.c	6 Mar 2007 13:45:23 -0000	1.72
+++ mbox-sync-rewrite.c	9 Mar 2007 20:22:50 -0000	1.73
@@ -330,16 +330,13 @@
 		istream_raw_mbox_get_header_offset(sync_ctx->input);
 	mail_ctx->mail.body_size = mails[idx].body_size;
 
-	if (mails[idx].uid_broken || mails[idx].uid == 0) {
-		sync_ctx->next_uid = 1;
-		sync_ctx->prev_msg_uid = 0;
-	} else {
-		/* If we originally thought that the UID was broken, force the
-		   brokeness now also. Otherwise try to make the UID what we
-		   wanted it originally. */
-		sync_ctx->next_uid = mails[idx].uid;
-		sync_ctx->prev_msg_uid = sync_ctx->next_uid - 1;
-	}
+	/* only expunged mails have uid=0 */
+	i_assert(mails[idx].uid != 0);
+
+	/* This will force the UID to be the one that we originally assigned
+	   to it, regardless of whether it's broken or not in the file. */
+	sync_ctx->next_uid = mails[idx].uid;
+	sync_ctx->prev_msg_uid = mails[idx].uid - 1;
 
 	first_mail_expunge_extra = 1 +
 		sync_ctx->first_mail_crlf_expunged ? 1 : 0;



More information about the dovecot-cvs mailing list