dovecot-2.2: lib-index: Create ext-intro records using the lates...

dovecot at dovecot.org dovecot at dovecot.org
Mon May 27 20:45:15 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/a8bc96640cf0
changeset: 16400:a8bc96640cf0
user:      Timo Sirainen <tss at iki.fi>
date:      Mon May 27 20:44:05 2013 +0300
description:
lib-index: Create ext-intro records using the latest sizes, not initial sizes.

diffstat:

 src/lib-index/mail-index-transaction-export.c |  18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r 360fd0ccd3dd -r a8bc96640cf0 src/lib-index/mail-index-transaction-export.c
--- a/src/lib-index/mail-index-transaction-export.c	Mon May 27 20:18:35 2013 +0300
+++ b/src/lib-index/mail-index-transaction-export.c	Mon May 27 20:44:05 2013 +0300
@@ -86,6 +86,7 @@
 {
 	struct mail_index_transaction *t = ctx->trans;
 	const struct mail_index_registered_ext *rext;
+	const struct mail_index_ext *ext;
         struct mail_transaction_ext_intro *intro, *resizes;
 	buffer_t *buf;
 	uint32_t idx;
@@ -120,12 +121,19 @@
 		/* generate a new intro structure */
 		intro = buffer_append_space_unsafe(buf, sizeof(*intro));
 		intro->ext_id = idx;
-		intro->hdr_size = rext->hdr_size;
-		intro->record_size = rext->record_size;
-		intro->record_align = rext->record_align;
+		if (idx == (uint32_t)-1) {
+			intro->hdr_size = rext->hdr_size;
+			intro->record_size = rext->record_size;
+			intro->record_align = rext->record_align;
+			intro->name_size = strlen(rext->name);
+		} else {
+			ext = array_idx(&t->view->index->map->extensions, idx);
+			intro->hdr_size = ext->hdr_size;
+			intro->record_size = ext->record_size;
+			intro->record_align = ext->record_align;
+			intro->name_size = 0;
+		}
 		intro->flags = MAIL_TRANSACTION_EXT_INTRO_FLAG_NO_SHRINK;
-		intro->name_size = idx != (uint32_t)-1 ? 0 :
-			strlen(rext->name);
 	}
 	if (reset_id != 0) {
 		/* we're going to reset this extension in this transaction */


More information about the dovecot-cvs mailing list