[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync.c, 1.48,
1.49
cras at procontrol.fi
cras at procontrol.fi
Sun Jun 20 23:34:00 EEST 2004
Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv18806/lib-storage/index/mbox
Modified Files:
mbox-sync.c
Log Message:
and more fixes..
Index: mbox-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- mbox-sync.c 20 Jun 2004 20:25:56 -0000 1.48
+++ mbox-sync.c 20 Jun 2004 20:33:57 -0000 1.49
@@ -323,9 +323,9 @@
int ret = 0;
messages_count = mail_index_view_get_message_count(sync_ctx->sync_view);
- while (sync_ctx->idx_seq < messages_count) {
+ while (sync_ctx->idx_seq <= messages_count) {
ret = mail_index_lookup(sync_ctx->sync_view,
- ++sync_ctx->idx_seq, &rec);
+ sync_ctx->idx_seq, &rec);
if (ret < 0) {
mail_storage_set_index_error(sync_ctx->ibox);
return -1;
@@ -336,6 +336,7 @@
/* externally expunged message, remove from index */
mail_index_expunge(sync_ctx->t, sync_ctx->idx_seq);
+ sync_ctx->idx_seq++;
rec = NULL;
}
@@ -668,8 +669,9 @@
if (mbox_sync_get_from_offset(sync_ctx, seq1, &offset) < 0)
return -1;
- /* set to -1, since they're always increased later */
- sync_ctx->seq = sync_ctx->idx_seq = seq1-1;
+ /* set to -1, since it's always increased later */
+ sync_ctx->seq = seq1-1;
+ sync_ctx->idx_seq = seq1;
sync_ctx->dest_first_mail = sync_ctx->seq == 0;
if (istream_raw_mbox_seek(sync_ctx->input, offset) < 0) {
mail_storage_set_critical(sync_ctx->ibox->box.storage,
@@ -755,14 +757,10 @@
if (uid == 0) {
/* missing/broken X-UID. all the rest of the mails
need new UIDs. */
- if (sync_ctx->idx_seq > 0) {
+ while (sync_ctx->idx_seq <= messages_count) {
mail_index_expunge(sync_ctx->t,
sync_ctx->idx_seq++);
}
- while (sync_ctx->idx_seq < messages_count) {
- mail_index_expunge(sync_ctx->t,
- ++sync_ctx->idx_seq);
- }
mail_ctx->need_rewrite = TRUE;
mail_ctx->mail.uid = sync_ctx->next_uid++;
sync_ctx->prev_msg_uid = mail_ctx->mail.uid;
@@ -785,6 +783,7 @@
rec) < 0)
return -1;
}
+ sync_ctx->idx_seq++;
istream_raw_mbox_next(sync_ctx->input,
mail_ctx->mail.body_size);
@@ -826,8 +825,8 @@
if (istream_raw_mbox_is_eof(sync_ctx->input)) {
/* rest of the messages in index don't exist -> expunge them */
- while (sync_ctx->idx_seq < messages_count)
- mail_index_expunge(sync_ctx->t, ++sync_ctx->idx_seq);
+ while (sync_ctx->idx_seq <= messages_count)
+ mail_index_expunge(sync_ctx->t, sync_ctx->idx_seq++);
}
return 0;
@@ -967,7 +966,8 @@
sync_ctx->next_uid = sync_ctx->hdr->next_uid;
sync_ctx->prev_msg_uid = 0;
- sync_ctx->seq = sync_ctx->idx_seq = 0;
+ sync_ctx->seq = 0;
+ sync_ctx->idx_seq = 1;
sync_ctx->dest_first_mail = TRUE;
sync_ctx->seen_first_mail = FALSE;
More information about the dovecot-cvs
mailing list