[dovecot-cvs] dovecot/src/lib-index mail-index-sync-update.c, 1.37, 1.38 mail-transaction-log-view.c, 1.21, 1.22 mail-transaction-log.c, 1.49, 1.50 mail-transaction-log.h, 1.15, 1.16 mail-transaction-util.c, 1.15, 1.16

cras at dovecot.org cras at dovecot.org
Sat Jul 31 07:35:08 EEST 2004


Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv10838/lib-index

Modified Files:
	mail-index-sync-update.c mail-transaction-log-view.c 
	mail-transaction-log.c mail-transaction-log.h 
	mail-transaction-util.c 
Log Message:
Small cleanups.



Index: mail-index-sync-update.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- mail-index-sync-update.c	30 Jul 2004 23:24:48 -0000	1.37
+++ mail-index-sync-update.c	31 Jul 2004 04:35:06 -0000	1.38
@@ -262,7 +262,7 @@
 	void *data;
 
 	data = PTR_OFFSET(&ctx->view->map->hdr_copy, u->offset);
-	memcpy(data, u->data, u->size);
+	memcpy(data, u + 1, u->size);
 	return 1;
 }
 
@@ -283,11 +283,11 @@
 		return -1;
 
 	if (seq != 0) {
-		offset = view->index->extra_records[hdr->idx].offset;
-		size = view->index->extra_records[hdr->idx].size;
+		offset = view->index->extra_records[hdr->data_id].offset;
+		size = view->index->extra_records[hdr->data_id].size;
 
 		rec = MAIL_INDEX_MAP_IDX(view->map, seq-1);
-		memcpy(PTR_OFFSET(rec, offset), u->data, size);
+		memcpy(PTR_OFFSET(rec, offset), u + 1, size);
 	}
 	return 1;
 }

Index: mail-transaction-log-view.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-transaction-log-view.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- mail-transaction-log-view.c	31 Jul 2004 03:06:48 -0000	1.21
+++ mail-transaction-log-view.c	31 Jul 2004 04:35:06 -0000	1.22
@@ -311,10 +311,10 @@
 	} else if (hdr->type == MAIL_TRANSACTION_EXTRA_REC_UPDATE) {
 		const struct mail_transaction_extra_rec_header *ehdr = data;
 
-		if (ehdr->idx >= view->log->index->extra_records_count) {
+		if (ehdr->data_id >= view->log->index->extra_records_count) {
 			mail_transaction_log_file_set_corrupted(file,
 				"extra record update out of range (%u > %u)",
-				ehdr->idx,
+				ehdr->data_id,
 				view->log->index->extra_records_count);
 			return -1;
 		}

Index: mail-transaction-log.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-transaction-log.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- mail-transaction-log.c	31 Jul 2004 03:12:37 -0000	1.49
+++ mail-transaction-log.c	31 Jul 2004 04:35:06 -0000	1.50
@@ -1218,7 +1218,7 @@
 			continue;
 
 		/* FIXME: do data_id mapping conversion */
-		extra_rec_hdr.idx = i;
+		extra_rec_hdr.data_id = i;
 		ret = log_append_buffer(file, t->extra_rec_updates[i], hdr_buf,
 					MAIL_TRANSACTION_EXTRA_REC_UPDATE,
 					view->external);

Index: mail-transaction-log.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-transaction-log.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- mail-transaction-log.h	31 Jul 2004 03:06:48 -0000	1.15
+++ mail-transaction-log.h	31 Jul 2004 04:35:06 -0000	1.16
@@ -62,16 +62,16 @@
 struct mail_transaction_header_update {
 	uint16_t offset;
 	uint16_t size;
-	unsigned char data[1]; /* variable size */
+	/* unsigned char data[]; */
 };
 
 struct mail_transaction_extra_rec_header {
-	uint32_t idx;
+	uint32_t data_id;
 };
 
 struct mail_transaction_extra_rec_update {
 	uint32_t uid;
-	unsigned char data[1]; /* variable size */
+	/* unsigned char data[]; */
 };
 
 struct mail_transaction_append_header {

Index: mail-transaction-util.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-transaction-util.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- mail-transaction-util.c	3 Jul 2004 17:21:26 -0000	1.15
+++ mail-transaction-util.c	31 Jul 2004 04:35:06 -0000	1.16
@@ -143,22 +143,21 @@
 			if (ret <= 0)
 				break;
 
-			i += sizeof(uint16_t)*2 + rec->size;
+			i += sizeof(*rec) + rec->size;
 		}
 		break;
 	}
 	case MAIL_TRANSACTION_EXTRA_REC_UPDATE: {
-		const struct mail_transaction_extra_rec_header *ehdr;
+		const struct mail_transaction_extra_rec_header *ehdr = data;
 		const struct mail_transaction_extra_rec_update *rec, *end;
 		unsigned int record_size;
 
 		if (map->extra_rec_update == NULL)
 			break;
 
-		ehdr = data;
-		i_assert(ehdr->idx < index->extra_records_count);
-		record_size = sizeof(uint32_t) +
-			index->extra_records[ehdr->idx].size;
+		i_assert(ehdr->data_id < index->extra_records_count);
+		record_size = sizeof(*ehdr) +
+			index->extra_records[ehdr->data_id].size;
 
 		rec = CONST_PTR_OFFSET(data, sizeof(*ehdr));
 		end = CONST_PTR_OFFSET(data, hdr->size);



More information about the dovecot-cvs mailing list