]> git.pld-linux.org Git - packages/dovecot.git/blame - dovecot-sort-assert.patch
- up to 1.1.8
[packages/dovecot.git] / dovecot-sort-assert.patch
CommitLineData
982e76b9 1
2--- a/src/lib-storage/index/index-sort.c Tue Oct 16 17:58:03 2007 +0300
3+++ b/src/lib-storage/index/index-sort.c Sun Oct 28 12:37:29 2007 +0200
4@@ -416,7 +416,7 @@ index_sort_add_ids_range(struct mail_sea
5 also between the first and the last messages */
6 skip = (last_id - prev_id) / (idx2 - i + 2);
7 nodes[i].sort_id = prev_id + skip;
8- if (nodes[i].sort_id == prev_id)
9+ if (nodes[i].sort_id == prev_id && prev_id != last_id)
10 nodes[i].sort_id++;
11 if (nodes[i].sort_id == last_id) {
12 /* we ran out of ID space. have to renumber
13@@ -442,12 +442,16 @@ index_sort_renumber_ids(struct mail_sear
14 (struct index_transaction_context *)program->t;
15 struct mail_sort_node *nodes;
16 unsigned int i, count;
17- uint32_t sort_id, prev_sort_id, skip;
18+ uint32_t sort_id = 0, prev_sort_id, skip;
19
20 nodes = array_get_modifiable(&program->all_nodes, &count);
21 prev_sort_id = (uint32_t)-1;
22- sort_id = nodes[idx].sort_id;
23- i_assert(sort_id == nodes[idx + 1].sort_id);
24+ for (; idx < count; idx++) {
25+ sort_id = nodes[idx].sort_id;
26+ if (sort_id == nodes[idx+1].sort_id)
27+ break;
28+ }
29+ i_assert(idx != count);
30
31 if (((uint32_t)-1 - sort_id) / (count - idx + 1) < RENUMBER_SPACE) {
32 /* space is running out, lets just renumber everything */
33@@ -501,7 +505,7 @@ index_sort_add_ids(struct mail_search_so
34 if (index_sort_add_ids_range(program, mail,
35 i == 0 ? 0 : i-1,
36 I_MIN(j, count-1)) == 0)
37- index_sort_renumber_ids(program, i);
38+ index_sort_renumber_ids(program, i-1);
39 }
40 }
41 }
42
43
44
45
This page took 0.07127 seconds and 4 git commands to generate.