dovecot-1.1: Sort index: Fix to renumbering sort IDs.

dovecot at dovecot.org dovecot at dovecot.org
Thu May 29 18:51:14 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/66e6b61680a5
changeset: 7568:66e6b61680a5
user:      Timo Sirainen <tss at iki.fi>
date:      Thu May 29 18:47:46 2008 +0300
description:
Sort index: Fix to renumbering sort IDs.

diffstat:

1 file changed, 10 insertions(+), 6 deletions(-)
src/lib-storage/index/index-sort-string.c |   16 ++++++++++------

diffs (32 lines):

diff -r 9c0d2413735d -r 66e6b61680a5 src/lib-storage/index/index-sort-string.c
--- a/src/lib-storage/index/index-sort-string.c	Thu May 29 16:29:35 2008 +0300
+++ b/src/lib-storage/index/index-sort-string.c	Thu May 29 18:47:46 2008 +0300
@@ -498,18 +498,22 @@ index_sort_add_ids_range(struct sort_str
 		   renumber some of the existing sort IDs. do this by
 		   widening the area we're giving sort IDs. */
 		if (left_idx > 0) {
-			left_idx--;
-			left_sort_id = left_idx == 0 ? 1 :
-				nodes[left_idx].sort_id;
-			i_assert(left_sort_id != 0);
+			left_sort_id = nodes[--left_idx].sort_id;
+			if (left_sort_id == 0) {
+				i_assert(left_idx == 0);
+				left_sort_id = 1;
+			}
 		}
 
 		while (right_idx < rightmost_idx) {
 			if (nodes[++right_idx].sort_id > 1)
 				break;
 		}
-		right_sort_id = right_idx == rightmost_idx ? (uint32_t)-1 :
-			nodes[right_idx].sort_id;
+		right_sort_id = nodes[right_idx].sort_id;
+		if (right_sort_id == 0) {
+			i_assert(right_idx == rightmost_idx);
+			right_sort_id = (uint32_t)-1;
+		}
 		i_assert(left_sort_id < right_sort_id);
 	}
 


More information about the dovecot-cvs mailing list