From: Timo Sirainen Date: Sun, 16 May 2004 01:29:49 +0000 (+0300) Subject: fixes X-Git-Tag: 1.1.alpha1~4088 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b982ef57dca741bc0df3737203a27834070a6e8;p=thirdparty%2Fdovecot%2Fcore.git fixes --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-transaction-util.c b/src/lib-index/mail-transaction-util.c index a1c3ec6e80..83794f98aa 100644 --- a/src/lib-index/mail-transaction-util.c +++ b/src/lib-index/mail-transaction-util.c @@ -142,6 +142,9 @@ mail_transaction_log_sort_expunges(buffer_t *expunges_buf, cur_seq = prev_seq = 1; expunges_before = 0; for (i = 0; src != src_end; src++) { + /* src[] must be sorted. */ + i_assert(src+1 == src_end || src->seq1 < src[1].seq1); + for (; i < dest_count; i++) { count = dest[i].seq1 - prev_seq; if (cur_seq + count > src->seq1) @@ -165,7 +168,7 @@ mail_transaction_log_sort_expunges(buffer_t *expunges_buf, count = dest[i].seq2 - dest[i].seq1 + 1; expunges_before += count; new_exp.seq2 += count; - new_exp.seq2 = dest[i].uid2; + new_exp.uid2 = dest[i].uid2; i++; } @@ -192,7 +195,7 @@ mail_transaction_log_sort_expunges(buffer_t *expunges_buf, dest = buffer_get_modifyable_data(expunges_buf, NULL); dest_count -= i - first; - i = first + 1; + i = first; } } }