From 53238473bf77147660aa6db9daa68a8a685e9381 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 14 Jun 2004 08:16:10 +0300 Subject: [PATCH] bugfixes --HG-- branch : HEAD --- src/lib-index/mail-index-sync-update.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/lib-index/mail-index-sync-update.c b/src/lib-index/mail-index-sync-update.c index 5c2c7b0118..07b09545ac 100644 --- a/src/lib-index/mail-index-sync-update.c +++ b/src/lib-index/mail-index-sync-update.c @@ -53,9 +53,9 @@ mail_index_header_update_lowwaters(struct mail_index_header *hdr, hdr->first_deleted_uid_lowwater = rec->uid; } -static void mail_index_sync_expunge(struct mail_index_view *view, - const struct mail_transaction_expunge *e) +static int sync_expunge(const struct mail_transaction_expunge *e, void *context) { + struct mail_index_view *view = context; struct mail_index *index = view->index; struct mail_index_map *map = view->map; struct mail_index_header *hdr = &map->hdr_copy; @@ -69,7 +69,7 @@ static void mail_index_sync_expunge(struct mail_index_view *view, i_assert(ret == 0); if (seq1 == 0) - return; + return 1; for (seq = seq1; seq <= seq2; seq++) { rec = MAIL_INDEX_MAP_IDX(index, map, seq-1); @@ -78,9 +78,9 @@ static void mail_index_sync_expunge(struct mail_index_view *view, /* @UNSAFE */ count = seq2 - seq1 + 1; - memcpy(MAIL_INDEX_MAP_IDX(index, map, seq-1), - MAIL_INDEX_MAP_IDX(index, map, seq2), - (map->records_count - seq2) * view->index->record_size); + memmove(MAIL_INDEX_MAP_IDX(index, map, seq1-1), + MAIL_INDEX_MAP_IDX(index, map, seq2), + (map->records_count - seq2) * view->index->record_size); map->records_count -= count; hdr->messages_count -= count; @@ -91,13 +91,6 @@ static void mail_index_sync_expunge(struct mail_index_view *view, view->index->record_size); map->records = buffer_get_modifyable_data(map->buffer, NULL); } -} - -static int sync_expunge(const struct mail_transaction_expunge *e, void *context) -{ - struct mail_index_view *view = context; - - mail_index_sync_expunge(view, e); return 1; } -- 2.47.3