[dovecot-cvs] dovecot/src/lib-index mail-transaction-log-append.c, 1.17.2.3, 1.17.2.4 mail-transaction-log-view.c, 1.45.2.5, 1.45.2.6
tss at dovecot.org
tss at dovecot.org
Fri Mar 9 23:21:01 EET 2007
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv22009
Modified Files:
Tag: branch_1_0
mail-transaction-log-append.c mail-transaction-log-view.c
Log Message:
cleanups
Index: mail-transaction-log-append.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log-append.c,v
retrieving revision 1.17.2.3
retrieving revision 1.17.2.4
diff -u -d -r1.17.2.3 -r1.17.2.4
--- mail-transaction-log-append.c 7 Mar 2007 00:44:33 -0000 1.17.2.3
+++ mail-transaction-log-append.c 9 Mar 2007 21:20:58 -0000 1.17.2.4
@@ -12,7 +12,7 @@
static int log_append_buffer(struct mail_transaction_log_file *file,
const buffer_t *buf, const buffer_t *hdr_buf,
- enum mail_transaction_type type, int external)
+ enum mail_transaction_type type, bool external)
{
struct mail_transaction_header hdr;
const void *data, *hdr_data;
Index: mail-transaction-log-view.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log-view.c,v
retrieving revision 1.45.2.5
retrieving revision 1.45.2.6
diff -u -d -r1.45.2.5 -r1.45.2.6
--- mail-transaction-log-view.c 26 Jan 2007 13:58:31 -0000 1.45.2.5
+++ mail-transaction-log-view.c 9 Mar 2007 21:20:59 -0000 1.45.2.6
@@ -275,6 +275,7 @@
const struct mail_transaction_type_map *type_rec;
const void *data;
unsigned int record_size;
+ enum mail_transaction_type hdr_type;
uint32_t hdr_size;
size_t file_size;
@@ -321,6 +322,7 @@
hdr = CONST_PTR_OFFSET(data, view->cur_offset - file->buffer_offset);
data = CONST_PTR_OFFSET(hdr, sizeof(*hdr));
+ hdr_type = hdr->type & MAIL_TRANSACTION_TYPE_MASK;
hdr_size = mail_index_offset_to_uint32(hdr->size);
if (hdr_size < sizeof(*hdr)) {
type_rec = NULL;
@@ -331,8 +333,7 @@
record_size = type_rec->record_size;
else {
mail_transaction_log_file_set_corrupted(file,
- "unknown record type 0x%x",
- hdr->type & MAIL_TRANSACTION_TYPE_MASK);
+ "unknown record type 0x%x", hdr_type);
return -1;
}
}
@@ -341,17 +342,16 @@
mail_transaction_log_file_set_corrupted(file,
"record size too small (type=0x%x, "
"offset=%"PRIuUOFF_T", size=%u)",
- hdr->type & MAIL_TRANSACTION_TYPE_MASK,
- view->cur_offset, hdr_size);
+ hdr_type, view->cur_offset, hdr_size);
return -1;
}
- if ((hdr_size - sizeof(*hdr)) % record_size != 0) {
+ if (record_size != 0 &&
+ (hdr_size - sizeof(*hdr)) % record_size != 0) {
mail_transaction_log_file_set_corrupted(file,
"record size wrong (type 0x%x, "
"offset=%"PRIuUOFF_T", size=%"PRIuSIZE_T" %% %u != 0)",
- hdr->type & MAIL_TRANSACTION_TYPE_MASK,
- view->cur_offset, (hdr_size - sizeof(*hdr)),
+ hdr_type, view->cur_offset, (hdr_size - sizeof(*hdr)),
record_size);
return -1;
}
@@ -360,24 +360,22 @@
mail_transaction_log_file_set_corrupted(file,
"record size too large (type=0x%x, "
"offset=%"PRIuUOFF_T", size=%u, end=%"PRIuSIZE_T")",
- hdr->type & MAIL_TRANSACTION_TYPE_MASK,
- view->cur_offset, hdr_size, file_size);
+ hdr_type, view->cur_offset, hdr_size, file_size);
return -1;
}
if ((hdr->type & MAIL_TRANSACTION_EXPUNGE) != 0) {
- if ((hdr->type & MAIL_TRANSACTION_TYPE_MASK) !=
- (MAIL_TRANSACTION_EXPUNGE|MAIL_TRANSACTION_EXPUNGE_PROT)) {
+ if (hdr_type != (MAIL_TRANSACTION_EXPUNGE |
+ MAIL_TRANSACTION_EXPUNGE_PROT)) {
mail_transaction_log_file_set_corrupted(file,
"found expunge without protection mask");
return -1;
}
- } else if ((hdr->type & MAIL_TRANSACTION_TYPE_MASK) != type_rec->type) {
+ } else if (hdr_type != type_rec->type) {
mail_transaction_log_file_set_corrupted(file,
- "extra bits in header type: 0x%x",
- hdr->type & MAIL_TRANSACTION_TYPE_MASK);
+ "extra bits in header type: 0x%x", hdr_type);
return -1;
- } else if (hdr->type == MAIL_TRANSACTION_EXT_INTRO) {
+ } else if (hdr_type == MAIL_TRANSACTION_EXT_INTRO) {
const struct mail_transaction_ext_intro *intro;
uint32_t i;
More information about the dovecot-cvs
mailing list