Commit 0afaf751 0afaf751acae5094328080656dd294206aba38e8 by Alain Magloire

header.c mbx_mbox.c : bug fixes.

1 parent e9cbb752
......@@ -679,7 +679,15 @@ header_size (header_t header, size_t *psize)
}
if (psize)
{
*psize = header->blurb_len;
if (property_is_set (header->property, "RFC822"))
{
size_t lines = 0;
header_lines (header, &lines);
*psize += lines;
}
}
return 0;
}
......@@ -896,7 +904,7 @@ header_read (stream_t is, char *buf, size_t buflen, off_t off, size_t *pnread)
char *s = header->blurb;
char *e = header->blurb + header->blurb_len;
/* Get to the offset. */
for (j = 0; j < (size_t)off && s <= e; j++, s++)
for (j = 0; j < (size_t)off && s < e; j++, s++)
{
if (*s == '\n')
{
......@@ -910,7 +918,7 @@ header_read (stream_t is, char *buf, size_t buflen, off_t off, size_t *pnread)
if (residue)
buf[0] = '\r';
/* Copy. */
for (j = residue ; j < buflen && s <= e; j++, s++)
for (j = residue ; j < buflen && s < e; j++, s++)
{
if (*s == '\n')
{
......
......@@ -1164,10 +1164,6 @@ mbox_header_fill (header_t header, char *buffer, size_t len,
mum->fhdr[j] = NULL;
}
}
if (mum->mud->mailbox->properties[PROP_RFC822].value)
return mbox_readstream_rfc822 (mum, buffer, len, off, pnread, 0,
mum->header_from_end, mum->body);
else
return mbox_readstream (mum, buffer, len, off, pnread, 0,
mum->header_from_end, mum->body);
}
......@@ -1238,8 +1234,10 @@ mbox_header_size (header_t header, size_t *psize)
if (psize)
{
*psize = mum->body - mum->header_from_end;
#if 1
if (mum->mud->mailbox->properties[PROP_RFC822].value)
*psize += mum->header_lines;
#endif
}
return 0;
}
......@@ -1266,8 +1264,10 @@ mbox_body_size (body_t body, size_t *psize)
if (psize)
{
*psize = mum->body_end - mum->body + 1;
#if 1
if (mum->mud->mailbox->properties[PROP_RFC822].value)
*psize += mum->body_lines;
#endif
}
return 0;
}
......