[dovecot-cvs] dovecot/src/lib-index mail-index-data.h,1.11,1.12 mail-index-util.h,1.8,1.9 mail-index.c,1.76,1.77 mail-tree.h,1.6,1.7

cras at procontrol.fi cras at procontrol.fi
Sun Dec 22 00:39:17 EET 2002


Update of /home/cvs/dovecot/src/lib-index
In directory danu:/tmp/cvs-serv11359/src/lib-index

Modified Files:
	mail-index-data.h mail-index-util.h mail-index.c mail-tree.h 
Log Message:
Added some missing format attribute declarations. And fixed one more bug
found found with them.



Index: mail-index-data.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-data.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mail-index-data.h	27 Oct 2002 06:37:18 -0000	1.11
+++ mail-index-data.h	21 Dec 2002 22:39:15 -0000	1.12
@@ -53,6 +53,7 @@
 
 /* "Error in index data file %s: ...". Also marks the index file as
    corrupted. */
-int index_data_set_corrupted(MailIndexData *data, const char *fmt, ...);
+int index_data_set_corrupted(MailIndexData *data, const char *fmt, ...)
+	__attr_format__(2, 3);
 
 #endif

Index: mail-index-util.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-util.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- mail-index-util.h	25 Nov 2002 19:02:49 -0000	1.8
+++ mail-index-util.h	21 Dec 2002 22:39:15 -0000	1.9
@@ -20,7 +20,8 @@
 	__attr_format__(2, 3);
 
 /* "Error in index file %s: ...". Also marks the index file as corrupted. */
-int index_set_corrupted(MailIndex *index, const char *fmt, ...);
+int index_set_corrupted(MailIndex *index, const char *fmt, ...)
+	__attr_format__(2, 3);
 
 /* "%s failed with index file %s: %m" */
 int index_set_syscall_error(MailIndex *index, const char *function);

Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- mail-index.c	18 Dec 2002 01:52:14 -0000	1.76
+++ mail-index.c	21 Dec 2002 22:39:15 -0000	1.77
@@ -499,7 +499,7 @@
 {
 	MailIndexHeader *hdr;
 	MailIndexRecord *rec;
-	const char *format;
+	const char *error;
 	unsigned int idx;
 
 	i_assert(seq > 0);
@@ -517,13 +517,15 @@
 	idx = seq-1;
 	if (hdr->first_hole_records == 0 || hdr->first_hole_index > idx) {
 		/* easy, it's just at the expected index */
-		format = "Invalid first_hole_index in header: %"PRIuUOFF_T;
+		error = t_strdup_printf("Invalid first_hole_index in header: "
+					"%u", idx);
 	} else if (hdr->first_hole_records ==
 		   MAIL_INDEX_RECORD_COUNT(index) - hdr->messages_count) {
 		/* only one hole in file, skip it and we're at
 		   correct position */
 		idx += hdr->first_hole_records;
-		format = "Invalid hole locations in header: %"PRIuUOFF_T;
+		error = t_strdup_printf("Invalid hole locations in header: %u",
+					idx);
 	} else {
 		/* find from binary tree */
 		idx = mail_tree_lookup_sequence(index->tree, seq);
@@ -534,18 +536,20 @@
 				seq, hdr->messages_count);
 			return NULL;
 		}
-		format = "Invalid offset returned by binary tree: %"PRIuUOFF_T;
+
+		error = t_strdup_printf("Invalid offset returned by "
+					"binary tree: %u", idx);
 	}
 
 	if (idx >= MAIL_INDEX_RECORD_COUNT(index)) {
-		index_set_corrupted(index, format, idx);
+		index_set_corrupted(index, "%s", error);
 		return NULL;
 	}
 
 	rec = (MailIndexRecord *) ((char *) index->mmap_base +
 				   sizeof(MailIndexHeader)) + idx;
 	if (rec->uid == 0) {
-		index_set_corrupted(index, format, idx);
+		index_set_corrupted(index, "%s", error);
 		return NULL;
 	}
 

Index: mail-tree.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-tree.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- mail-tree.h	28 Oct 2002 07:53:55 -0000	1.6
+++ mail-tree.h	21 Dec 2002 22:39:15 -0000	1.7
@@ -71,7 +71,8 @@
 void mail_tree_delete(MailTree *tree, unsigned int uid);
 
 /* private: */
-int _mail_tree_set_corrupted(MailTree *tree, const char *fmt, ...);
+int _mail_tree_set_corrupted(MailTree *tree, const char *fmt, ...)
+	__attr_format__(2, 3);
 int _mail_tree_mmap_update(MailTree *tree, int forced);
 int _mail_tree_grow(MailTree *tree);
 void _mail_tree_truncate(MailTree *tree);




More information about the dovecot-cvs mailing list