dovecot-2.2: lib-index: Added asserts.

dovecot at dovecot.org dovecot at dovecot.org
Mon Jan 14 18:24:29 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/970dc6b0760b
changeset: 15645:970dc6b0760b
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jan 14 18:24:19 2013 +0200
description:
lib-index: Added asserts.

diffstat:

 src/lib-index/mail-index-transaction-finish.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (37 lines):

diff -r 6f62a31bf0d4 -r 970dc6b0760b src/lib-index/mail-index-transaction-finish.c
--- a/src/lib-index/mail-index-transaction-finish.c	Mon Jan 14 17:58:09 2013 +0200
+++ b/src/lib-index/mail-index-transaction-finish.c	Mon Jan 14 18:24:19 2013 +0200
@@ -224,7 +224,7 @@
 {
 	struct seq_range *range, *new_range;
 	unsigned int i, count;
-	uint32_t uid1, uid2;
+	uint32_t uid1, uid2, prev_uid = 0;
 
 	if (!array_is_created(array))
 		return;
@@ -235,10 +235,12 @@
 
 		uid1 = mail_index_transaction_get_uid(t, range->seq1);
 		uid2 = mail_index_transaction_get_uid(t, range->seq2);
+		i_assert(uid1 > prev_uid);
 		if (uid2 - uid1 == range->seq2 - range->seq1) {
 			/* simple conversion */
 			range->seq1 = uid1;
 			range->seq2 = uid2;
+			prev_uid = uid2;
 		} else {
 			/* remove expunged UIDs */
 			new_range = array_insert_space(array, i);
@@ -249,9 +251,11 @@
 			new_range->seq1 = uid1;
 			new_range->seq2 = get_nonexpunged_uid2(t, uid1,
 							       range->seq1);
+			i_assert(new_range->seq2 < uid2);
 
 			/* continue the range without the inserted seqs */
 			range->seq1 += new_range->seq2 - new_range->seq1 + 1;
+			prev_uid = new_range->seq2;
 		}
 	}
 }


More information about the dovecot-cvs mailing list