diff options
author | Sebastian Freundt <freundt@ga-group.nl> | 2014-06-10 12:46:32 +0000 |
---|---|---|
committer | Sebastian Freundt <freundt@ga-group.nl> | 2014-06-10 12:53:19 +0000 |
commit | adc91b6969e260908041a1013a01e9da3bfc7966 (patch) | |
tree | 6ffd519f4767a4e949352e9c23174384311a72a4 /libarchive/archive_read_support_format_warc.c | |
parent | 75b78d5c1300c01da6c8fcaf6b9ede6d00a6e5d0 (diff) | |
download | libarchive-adc91b6969e260908041a1013a01e9da3bfc7966.tar.gz |
Hygiene, set unconsumed slot exactly once for each branch
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.
Diffstat (limited to 'libarchive/archive_read_support_format_warc.c')
-rw-r--r-- | libarchive/archive_read_support_format_warc.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/libarchive/archive_read_support_format_warc.c b/libarchive/archive_read_support_format_warc.c index b032e57c..b4875a5f 100644 --- a/libarchive/archive_read_support_format_warc.c +++ b/libarchive/archive_read_support_format_warc.c @@ -326,17 +326,13 @@ _warc_read(struct archive_read *a, const void **buf, size_t *bsz, int64_t *off) 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); } |