dovecot-2.2: lib-index: Fixed sorting appended messages when som...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jan 21 18:12:28 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/df2e46c38c92
changeset: 15663:df2e46c38c92
user: Timo Sirainen <tss at iki.fi>
date: Mon Jan 21 18:12:12 2013 +0200
description:
lib-index: Fixed sorting appended messages when some were assigned new UIDs.
diffstat:
src/lib-index/mail-index-transaction-sort-appends.c | 11 ++++++++++-
src/lib-index/mail-index-transaction-update.c | 9 +++------
2 files changed, 13 insertions(+), 7 deletions(-)
diffs (51 lines):
diff -r fc5c3281d6d3 -r df2e46c38c92 src/lib-index/mail-index-transaction-sort-appends.c
--- a/src/lib-index/mail-index-transaction-sort-appends.c Mon Jan 21 17:57:18 2013 +0200
+++ b/src/lib-index/mail-index-transaction-sort-appends.c Mon Jan 21 18:12:12 2013 +0200
@@ -130,8 +130,17 @@
uint32_t *old_to_newseq_map;
unsigned int i, count;
- if (!t->appends_nonsorted || !array_is_created(&t->appends))
+ if (!array_is_created(&t->appends))
return;
+ if (!t->appends_nonsorted) {
+#ifdef DEBUG
+ recs = array_get_modifiable(&t->appends, &count);
+ i_assert(count > 0);
+ for (i = 1; i < count; i++)
+ i_assert(recs[i-1].uid < recs[i].uid);
+#endif
+ return;
+ }
/* first make a copy of the UIDs and map them to sequences */
recs = array_get_modifiable(&t->appends, &count);
diff -r fc5c3281d6d3 -r df2e46c38c92 src/lib-index/mail-index-transaction-update.c
--- a/src/lib-index/mail-index-transaction-update.c Mon Jan 21 17:57:18 2013 +0200
+++ b/src/lib-index/mail-index-transaction-update.c Mon Jan 21 18:12:12 2013 +0200
@@ -201,7 +201,6 @@
unsigned int i, count;
struct seq_range *range;
uint32_t next_uid;
- bool used_existing_uids;
if (!array_is_created(&t->appends))
return;
@@ -217,14 +216,12 @@
}
/* assign missing uids */
- used_existing_uids = FALSE;
for (i = 0; i < count; i++) {
- if (recs[i].uid == 0 || recs[i].uid < first_uid) {
+ if (recs[i].uid == 0 || recs[i].uid < first_uid)
recs[i].uid = next_uid++;
- if (used_existing_uids)
+ else {
+ if (next_uid != first_uid)
t->appends_nonsorted = TRUE;
- } else {
- used_existing_uids = TRUE;
}
}
More information about the dovecot-cvs
mailing list