[dovecot-cvs] dovecot/src/lib-index mail-index-sync-ext.c, 1.10, 1.11

cras at dovecot.org cras at dovecot.org
Sat Sep 24 13:12:05 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv31840

Modified Files:
	mail-index-sync-ext.c 
Log Message:
Resizing header left header offsets broken and usually assert-crashed while
doing it.



Index: mail-index-sync-ext.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-ext.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mail-index-sync-ext.c	13 Jul 2005 15:55:11 -0000	1.10
+++ mail-index-sync-ext.c	24 Sep 2005 10:12:03 -0000	1.11
@@ -330,13 +330,10 @@
 	if (new_size != old_size) {
 		/* move all hdr_offset of all extensions after this one */
 		unsigned i, count = array_count(&map->extensions);
+		ssize_t diff = (ssize_t)new_size - (ssize_t)old_size;
 
-		ext -= ext_id;
-		for (i = ext_id + 1; i < count; i++) {
-			i_assert(ext[i].hdr_offset > ext[i-1].hdr_offset);
-			ext[i].hdr_offset +=
-				(ssize_t)new_size - (ssize_t)old_size;
-		}
+		for (i = ext_id + 1; i < count; i++)
+			ext[i].hdr_offset += diff;
 	}
 
 	if (old_record_size != u->record_size) {



More information about the dovecot-cvs mailing list