changeset 3105:f58ff8ec50c4 HEAD

Added asserts
author Timo Sirainen <tss@iki.fi>
date Sun, 16 Jan 2005 20:41:58 +0200
parents 82e025ea6989
children 9c4aa309dbac
files src/lib-index/mail-index-sync-ext.c src/lib-index/mail-index.c
diffstat 2 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync-ext.c	Sun Jan 16 20:34:33 2005 +0200
+++ b/src/lib-index/mail-index-sync-ext.c	Sun Jan 16 20:41:58 2005 +0200
@@ -306,6 +306,7 @@
 		modified = TRUE;
 
 	if (modified) {
+		i_assert((map->hdr_copy_buf->used % sizeof(uint64_t)) == 0);
 		map->hdr_base = map->hdr_copy_buf->data;
 		map->hdr.header_size = map->hdr_copy_buf->used;
 
@@ -412,6 +413,7 @@
 		MAIL_INDEX_HEADER_SIZE_ALIGN(ext->hdr_size));
 	i_assert(hdr_buf->used ==
 		 hdr_offset + MAIL_INDEX_HEADER_SIZE_ALIGN(ext->hdr_size));
+	i_assert((hdr_buf->used % sizeof(uint64_t)) == 0);
 
 	map->hdr.header_size = hdr_buf->used;
 	map->hdr_base = map->hdr_copy_buf->data;
--- a/src/lib-index/mail-index.c	Sun Jan 16 20:34:33 2005 +0200
+++ b/src/lib-index/mail-index.c	Sun Jan 16 20:41:58 2005 +0200
@@ -1162,6 +1162,8 @@
 {
 	time_t now = time(NULL);
 
+	i_assert((sizeof(*hdr) % sizeof(uint64_t)) == 0);
+
 	memset(hdr, 0, sizeof(*hdr));
 
 	hdr->major_version = MAIL_INDEX_MAJOR_VERSION;