Mercurial > dovecot > original-hg > dovecot-1.2
changeset 393:f09e67287f7d HEAD
whops, update tree and modifylog with correct uid instead of 0. added extra
assertions.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 09 Oct 2002 17:03:08 +0300 |
parents | 2f3d3ba129e1 |
children | 24d69bc634d8 |
files | src/lib-index/mail-index.c src/lib-index/mail-tree-redblack.c |
diffstat | 2 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index.c Wed Oct 09 16:56:44 2002 +0300 +++ b/src/lib-index/mail-index.c Wed Oct 09 17:03:08 2002 +0300 @@ -688,7 +688,7 @@ unsigned int seq, int external_change) { MailIndexHeader *hdr; - unsigned int records, idx; + unsigned int records, uid, idx; i_assert(index->lock_type == MAIL_LOCK_EXCLUSIVE); i_assert(seq != 0); @@ -700,6 +700,7 @@ hdr = index->header; /* setting UID to 0 is enough for deleting the mail from index */ + uid = rec->uid; rec->uid = 0; /* update first hole */ @@ -750,7 +751,7 @@ /* expunge() may be called while index is being rebuilt and when tree file hasn't been opened yet */ if (index->tree != NULL) - mail_tree_delete(index->tree, rec->uid); + mail_tree_delete(index->tree, uid); else { /* make sure it also gets updated */ index->header->flags |= MAIL_INDEX_FLAG_REBUILD_TREE; @@ -758,7 +759,7 @@ if (seq != 0 && index->modifylog != NULL) { if (!mail_modifylog_add_expunge(index->modifylog, seq, - rec->uid, external_change)) + uid, external_change)) return FALSE; }
--- a/src/lib-index/mail-tree-redblack.c Wed Oct 09 16:56:44 2002 +0300 +++ b/src/lib-index/mail-tree-redblack.c Wed Oct 09 17:03:08 2002 +0300 @@ -626,6 +626,8 @@ MailTreeNode *node = tree->node_base; unsigned int x, y, seq; + i_assert(first_uid > 0 && last_uid > 0); + i_assert(first_uid <= last_uid); i_assert(tree->index->lock_type != MAIL_LOCK_UNLOCK); rb_check(tree); @@ -654,7 +656,7 @@ } } - if (first_uid < last_uid) { + if (first_uid != last_uid) { /* get the next key, make sure it's in range */ if (node[y].key > first_uid) x = y; @@ -675,6 +677,7 @@ MailTreeNode *node = tree->node_base; unsigned int x, upleft_nodes, left_nodes; + i_assert(seq != 0); i_assert(tree->index->lock_type != MAIL_LOCK_UNLOCK); rb_check(tree); @@ -706,6 +709,7 @@ MailTreeNode *node = tree->node_base; unsigned int x, z; + i_assert(uid != 0); i_assert(tree->index->lock_type == MAIL_LOCK_EXCLUSIVE); tree->modified = TRUE; @@ -759,6 +763,7 @@ MailTreeNode *node = tree->node_base; unsigned int x; + i_assert(uid != 0); i_assert(tree->index->lock_type == MAIL_LOCK_EXCLUSIVE); rb_check(tree); @@ -788,6 +793,7 @@ MailTreeNode *node = tree->node_base; unsigned int x; + i_assert(uid != 0); i_assert(tree->index->lock_type == MAIL_LOCK_EXCLUSIVE); tree->modified = TRUE;