dovecot-1.1: Expunge handler calling fixes.

dovecot at dovecot.org dovecot at dovecot.org
Thu Mar 6 13:15:34 EET 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/dc24431136b3
changeset: 7363:dc24431136b3
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Mar 06 13:15:30 2008 +0200
description:
Expunge handler calling fixes.

diffstat:

2 files changed, 7 insertions(+), 5 deletions(-)
src/lib-index/mail-index-sync-ext.c    |    5 +++--
src/lib-index/mail-index-sync-update.c |    7 ++++---

diffs (43 lines):

diff -r 1bbef480786a -r dc24431136b3 src/lib-index/mail-index-sync-ext.c
--- a/src/lib-index/mail-index-sync-ext.c	Thu Mar 06 10:26:52 2008 +0200
+++ b/src/lib-index/mail-index-sync-ext.c	Thu Mar 06 13:15:30 2008 +0200
@@ -35,8 +35,9 @@ void mail_index_sync_init_expunge_handle
 	contexts = array_get_modifiable(&ctx->extra_contexts, &context_count);
 
 	i_assert(id_map_count <= rext_count);
-
-	for (idx_ext_id = 0; idx_ext_id < id_map_count; idx_ext_id++) {
+	i_assert(context_count >= rext_count);
+
+	for (idx_ext_id = 0; idx_ext_id < rext_count; idx_ext_id++) {
 		map_ext_id = id_map[idx_ext_id];
 		if (rext[idx_ext_id].expunge_handler == NULL ||
 		    (map_ext_id == (uint32_t)-1 &&
diff -r 1bbef480786a -r dc24431136b3 src/lib-index/mail-index-sync-update.c
--- a/src/lib-index/mail-index-sync-update.c	Thu Mar 06 10:26:52 2008 +0200
+++ b/src/lib-index/mail-index-sync-update.c	Thu Mar 06 13:15:30 2008 +0200
@@ -199,6 +199,7 @@ sync_expunge_call_handlers(struct mail_i
 	const struct mail_index_expunge_handler *eh;
 	struct mail_index_record *rec;
 	unsigned int i, count;
+	uint32_t seq;
 
 	/* call expunge handlers only when syncing index file */
 	if (ctx->type != MAIL_INDEX_SYNC_HANDLER_FILE)
@@ -212,13 +213,13 @@ sync_expunge_call_handlers(struct mail_i
 
 	eh = array_get(&ctx->expunge_handlers, &count);
 	for (i = 0; i < count; i++, eh++) {
-		for (; seq1 <= seq2; seq1++) {
-			rec = MAIL_INDEX_MAP_IDX(ctx->view->map, seq1-1);
+		for (seq = seq1; seq <= seq2; seq++) {
+			rec = MAIL_INDEX_MAP_IDX(ctx->view->map, seq-1);
 			/* FIXME: does expunge handler's return value matter?
 			   we probably shouldn't disallow expunges if the
 			   handler returns failure.. should it be just changed
 			   to return void? */
-			(void)eh->handler(ctx, seq1,
+			(void)eh->handler(ctx, seq,
 					  PTR_OFFSET(rec, eh->record_offset),
 					  eh->sync_context, eh->context);
 		}


More information about the dovecot-cvs mailing list