in _warc_read(). Also kick __archive_read_consume() because the writer
will consume the bytes for us. So for the EOF case, set unconsumed to 0,
for the non-EOF case set unconsumed to the minimum of the number of bytes
read and the content length.
const char *rab;
ssize_t nrd;
- if (w->unconsumed) {
- __archive_read_consume(a, w->unconsumed);
- w->unconsumed = 0U;
- }
-
if (w->cntoff >= w->cntlen) {
eof:
/* it's our lucky day, no work, we can leave early */
*buf = NULL;
*bsz = 0U;
- *off = w->cntoff;
+ *off = w->cntoff + 4U/*for \r\n\r\n separator*/;
+ w->unconsumed = 0U;
return (ARCHIVE_EOF);
}