]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox: Fixed looking up physical size when it wasn't in metadata.
authorTimo Sirainen <tss@iki.fi>
Fri, 19 Feb 2010 12:11:21 +0000 (14:11 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 19 Feb 2010 12:11:21 +0000 (14:11 +0200)
--HG--
branch : HEAD

src/lib-storage/index/dbox-common/dbox-mail.c

index e0441c7b513c542fb6ff9bdcfe1c464b1ce971ea..938da26e1166d9acbffa253b3b472ecd16b1248b 100644 (file)
@@ -75,23 +75,22 @@ int dbox_mail_get_physical_size(struct mail *_mail, uoff_t *size_r)
 {
        struct dbox_mail *mail = (struct dbox_mail *)_mail;
        struct index_mail_data *data = &mail->imail.data;
-       struct istream *input;
+       struct dbox_file *file;
        const char *value;
 
        if (index_mail_get_physical_size(_mail, size_r) == 0)
                return 0;
 
        /* see if we have it in metadata */
-       if (dbox_mail_metadata_get(mail, DBOX_METADATA_PHYSICAL_SIZE,
-                                  &value) < 0)
+       if (dbox_mail_metadata_read(mail, &file) < 0)
                return -1;
 
+       value = dbox_file_metadata_get(file, DBOX_METADATA_PHYSICAL_SIZE);
        if (value != NULL)
                data->physical_size = strtoul(value, NULL, 16);
        else {
-               if (mail_get_stream(_mail, NULL, NULL, &input) < 0)
-                       return -1;
-               i_assert(data->physical_size != (uoff_t)-1);
+               /* no. that means we can use the size in the header */
+               data->physical_size = file->cur_physical_size;
        }
        *size_r = data->physical_size;
        return 0;