[dovecot-cvs] dovecot/src/lib-storage/index index-mail.c,1.3,1.4

cras at procontrol.fi cras at procontrol.fi
Tue Feb 11 14:31:37 EET 2003


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

Modified Files:
	index-mail.c 
Log Message:
get_size() was buggy



Index: index-mail.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-mail.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- index-mail.c	27 Jan 2003 02:05:32 -0000	1.3
+++ index-mail.c	11 Feb 2003 12:31:35 -0000	1.4
@@ -403,7 +403,7 @@
 {
 	struct index_mail *mail = (struct index_mail *) _mail;
 	struct index_mail_data *data = &mail->data;
-	uoff_t hdr_size, body_size;
+	uoff_t hdr_size, body_size, hdr_phys_size;
 
 	if (data->size != (uoff_t)-1)
 		return data->size;
@@ -442,10 +442,12 @@
 	}
 
 	/* have to parse, slow.. */
-	if (!open_stream(mail, hdr_size != (uoff_t)-1 ? hdr_size : 0))
+	hdr_phys_size = hdr_size != (uoff_t)-1 && data->hdr_size_set ?
+		data->hdr_size.physical_size : (uoff_t)-1;
+	if (!open_stream(mail, hdr_phys_size != (uoff_t)-1 ? hdr_phys_size : 0))
 		return (uoff_t)-1;
 
-	if (hdr_size == (uoff_t)-1) {
+	if (hdr_phys_size == (uoff_t)-1) {
 		message_get_header_size(data->stream, &data->hdr_size);
 		hdr_size = data->hdr_size.virtual_size;
 		data->hdr_size_set = TRUE;




More information about the dovecot-cvs mailing list