diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 2000-05-16 19:00:15 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 2000-05-16 19:00:15 +0000 |
commit | ac9a1e53eebd564083b134e016f488a10afba44c (patch) | |
tree | c7aee202af3e80d48e0fb41d94e70b8933b08d6f /compose.c | |
parent | 0b924a9e172fb48c89b01e4c8202a3113c57eb63 (diff) |
Some fixes to the size calculation code.
Diffstat (limited to 'compose.c')
-rw-r--r-- | compose.c | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -417,9 +417,10 @@ static int change_attachment_charset (BODY *b) /* * cum_attachs_size: Cumulative Attachments Size * - * * Returns the total number of bytes used by the attachments in the - * attachment list. + * attachment list _after_ content-transfer-encodings have been + * applied. + * */ static unsigned long cum_attachs_size (MUTTMENU *menu) @@ -428,21 +429,27 @@ static unsigned long cum_attachs_size (MUTTMENU *menu) unsigned short i; ATTACHPTR **idx = menu->data; CONTENT *info; + BODY *b; for (i = 0, s = 0; i < menu->max; i++) { - if ((info = idx[i]->content->content)) + b = idx[i]->content; + + if (!b->content) + b->content = mutt_get_content_info (b->filename, b); + + if ((info = b->content)) { - switch (idx[i]->content->encoding) + switch (b->encoding) { case ENCQUOTEDPRINTABLE: - s += 3 * (info->lobin + info->hibin) + info->ascii; + s += 3 * (info->lobin + info->hibin) + info->ascii + info->crlf; break; case ENCBASE64: - s += (4 * (info->lobin + info->hibin + info->ascii)) / 3; + s += (4 * (info->lobin + info->hibin + info->ascii + info->crlf)) / 3; break; default: - s += info->lobin + info->hibin + info->ascii; + s += info->lobin + info->hibin + info->ascii + info->crlf; break; } } |