dovecot-1.0: Use a less optimal, but safer, way to get mail's ph...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Feb 17 13:45:29 EET 2008
details: http://hg.dovecot.org/dovecot-1.0/rev/75060c30fbd6
changeset: 5518:75060c30fbd6
user: Timo Sirainen <tss at iki.fi>
date: Sun Feb 17 13:46:09 2008 +0200
description:
Use a less optimal, but safer, way to get mail's physical size.
diffstat:
1 file changed, 1 insertion(+), 23 deletions(-)
src/lib-storage/index/mbox/mbox-mail.c | 24 +-----------------------
diffs (44 lines):
diff -r e72aea9fc807 -r 75060c30fbd6 src/lib-storage/index/mbox/mbox-mail.c
--- a/src/lib-storage/index/mbox/mbox-mail.c Sat Feb 16 16:24:35 2008 +0200
+++ b/src/lib-storage/index/mbox/mbox-mail.c Sun Feb 17 13:46:09 2008 +0200
@@ -172,39 +172,17 @@ static uoff_t mbox_mail_get_physical_siz
input = mail_get_stream(_mail, &hdr_size, NULL);
if (input == NULL)
return (uoff_t)-1;
- i_stream_sync(mbox->mbox_stream);
/* our header size varies, so don't do any caching */
body_offset = istream_raw_mbox_get_body_offset(mbox->mbox_stream);
if (body_offset == (uoff_t)-1)
return (uoff_t)-1;
- /* use the next message's offset to avoid reading through the entire
- message body to find out its size */
- hdr = mail_index_get_header(mail->trans->trans_view);
- if (_mail->seq == hdr->messages_count) {
- /* last message, use the synced mbox size */
- int trailer_size;
-
- trailer_size = (STORAGE(mbox->storage)->flags &
- MAIL_STORAGE_FLAG_SAVE_CRLF) != 0 ? 2 : 1;
-
- body_size = hdr->sync_size - body_offset - trailer_size;
- } else if (mbox_file_lookup_offset(mbox, mail->trans->trans_view,
- _mail->seq + 1, &next_offset,
- &deleted) > 0) {
- body_size = next_offset - body_offset;
- } else {
- body_size = (uoff_t)-1;
- }
-
/* verify that the calculated body size is correct */
body_size = istream_raw_mbox_get_body_size(mbox->mbox_stream,
- body_size);
+ (uoff_t)-1);
data->physical_size = hdr_size.physical_size + body_size;
- i_stream_seek(data->stream, old_offset);
- i_stream_sync(mbox->mbox_stream);
return data->physical_size;
}
More information about the dovecot-cvs
mailing list