Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7363:dc24431136b3 HEAD
Expunge handler calling fixes.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 06 Mar 2008 13:15:30 +0200 |
parents | 1bbef480786a |
children | 1b160b2cd080 |
files | src/lib-index/mail-index-sync-ext.c src/lib-index/mail-index-sync-update.c |
diffstat | 2 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ contexts = array_get_modifiable(&ctx->extra_contexts, &context_count); i_assert(id_map_count <= rext_count); + i_assert(context_count >= rext_count); - for (idx_ext_id = 0; idx_ext_id < id_map_count; idx_ext_id++) { + 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 &&
--- 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 @@ 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 @@ 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); }