changeset 12381:29c71b6e354e

istream-attachment: Removed parent stream's size sanity check. It didn't work right with base64 streams.
author Timo Sirainen <tss@iki.fi>
date Thu, 04 Nov 2010 14:07:30 +0000
parents fd44ba1fa729
children af252c044393
files src/lib-storage/index/istream-attachment.c
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/istream-attachment.c	Wed Nov 03 18:00:15 2010 +0000
+++ b/src/lib-storage/index/istream-attachment.c	Thu Nov 04 14:07:30 2010 +0000
@@ -81,24 +81,21 @@
 }
 
 static const struct stat *
-i_stream_attachment_stat(struct istream_private *stream, bool exact)
+i_stream_attachment_stat(struct istream_private *stream, bool exact ATTR_UNUSED)
 {
 	struct attachment_istream *astream =
 		(struct attachment_istream *)stream;
 	const struct stat *st;
 
-	st = i_stream_stat(stream->parent, exact);
+	/* parent stream may be base64-decoder. don't waste time decoding the
+	   entire stream, since we already know what the size is supposed
+	   to be. */
+	st = i_stream_stat(stream->parent, FALSE);
 	if (st == NULL)
 		return NULL;
 
 	stream->statbuf = *st;
 	stream->statbuf.st_size = astream->size;
-	if (st->st_size != 0 && (uoff_t)st->st_size != astream->size) {
-		i_error("Attachment file %s size mismatch: "
-			"%"PRIuUOFF_T" != %"PRIuUOFF_T,
-			i_stream_get_name(stream->parent),
-			st->st_size, astream->size);
-	}
 	return &stream->statbuf;
 }