/* we simply try to use the extensions with largest alignment
requirement first. FIXME: if the extension sizes don't match
alignment, this may not give the minimal layout. */
- offset = sizeof(struct mail_index_record);
+ offset = MAIL_INDEX_RECORD_MIN_SIZE;
max_align = sizeof(uint32_t);
for (;;) {
min_align = (uint16_t)-1;
offset += max_align - (offset % max_align);
}
new_record_size = offset;
+ i_assert(new_record_size >= sizeof(struct mail_index_record));
/* copy the records to new buffer */
new_buffer_size = map->rec_map->records_count * new_record_size;
i_assert(data_offset < ext->record_size);
data_offset += ext->record_offset;
- i_assert(data_offset >= sizeof(struct mail_index_record));
+ i_assert(data_offset >= MAIL_INDEX_RECORD_MIN_SIZE);
switch (type) {
case MODIFY_ADD:
uint32_t day_first_uid[8];
};
+#define MAIL_INDEX_RECORD_MIN_SIZE (sizeof(uint32_t) + sizeof(uint8_t))
struct mail_index_record {
uint32_t uid;
uint8_t flags; /* enum mail_flags | enum mail_index_mail_flags */