changeset 2120:f434ecc6ef83 HEAD

bugfixes
author Timo Sirainen <tss@iki.fi>
date Mon, 14 Jun 2004 08:16:10 +0300
parents 26dd9aca935e
children 0840edf34f37
files src/lib-index/mail-index-sync-update.c
diffstat 1 files changed, 6 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync-update.c	Mon Jun 14 07:54:05 2004 +0300
+++ b/src/lib-index/mail-index-sync-update.c	Mon Jun 14 08:16:10 2004 +0300
@@ -53,9 +53,9 @@
 		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 @@
 	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 @@
 
 	/* @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 @@
 				     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;
 }