changeset 379:b319eb0fc181 HEAD

mail_tree_lookup_uid_range() still buggy if first_uid wasn't found.
author Timo Sirainen <tss@iki.fi>
date Mon, 07 Oct 2002 16:07:18 +0300
parents 225d515edaa1
children fb59a15622d0
files src/lib-index/mail-tree-redblack.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-tree-redblack.c	Mon Oct 07 14:50:48 2002 +0300
+++ b/src/lib-index/mail-tree-redblack.c	Mon Oct 07 16:07:18 2002 +0300
@@ -656,11 +656,17 @@
 
 	if (first_uid < last_uid) {
 		/* get the next key, make sure it's in range */
-		x = rb_successor(tree, y);
+		if (node[y].key > first_uid)
+			x = y;
+		else
+			x = rb_successor(tree, y);
+
 		if (node[x].key > last_uid)
 			x = RBNULL;
-		else {
-			/* this is the easiest way to get the sequence right */
+
+		if (x != RBNULL) {
+			/* FIXME: this is the safest way, but slowest
+			   to get the seq right.. */
 			return mail_tree_lookup_uid_range(tree, seq_r,
 							  node[x].key,
 							  node[x].key);