first check _both_ bounds, then compare ...

This commit is contained in:
Oswald Buddenhagen 2004-09-08 14:52:22 +00:00
parent acabdc43b1
commit 86d9a3140d

View File

@ -822,11 +822,28 @@ maildir_rescan( maildir_store_t *ctx )
for (msgapp = &ctx->gen.msgs, i = 0; for (msgapp = &ctx->gen.msgs, i = 0;
(msg = (maildir_message_t *)*msgapp) || i < msglist.nents; ) (msg = (maildir_message_t *)*msgapp) || i < msglist.nents; )
{ {
if (!msg || msglist.ents[i].uid < msg->gen.uid) { if (!msg) {
#if 0
debug( "adding new message %d\n", msglist.ents[i].uid );
maildir_app_msg( ctx, &msgapp, msglist.ents + i );
#else
debug( "ignoring new message %d\n", msglist.ents[i].uid ); debug( "ignoring new message %d\n", msglist.ents[i].uid );
/* maildir_app_msg( ctx, &msgapp, msglist.ents + i ); */ #endif
i++; i++;
} else if (i >= msglist.nents || msglist.ents[i].uid > msg->gen.uid) { } else if (i >= msglist.nents) {
debug( "purging deleted message %d\n", msg->gen.uid );
msg->gen.status = M_DEAD;
msgapp = &msg->gen.next;
} else if (msglist.ents[i].uid < msg->gen.uid) {
/* this should not happen, actually */
#if 0
debug( "adding new message %d\n", msglist.ents[i].uid );
maildir_app_msg( ctx, &msgapp, msglist.ents + i );
#else
debug( "ignoring new message %d\n", msglist.ents[i].uid );
#endif
i++;
} else if (msglist.ents[i].uid > msg->gen.uid) {
debug( "purging deleted message %d\n", msg->gen.uid ); debug( "purging deleted message %d\n", msg->gen.uid );
msg->gen.status = M_DEAD; msg->gen.status = M_DEAD;
msgapp = &msg->gen.next; msgapp = &msg->gen.next;