]> wimlib.net Git - wimlib/commitdiff
streamifier_cb(): Adjust cur_stream_offset even if ->consume_chunk() fails
authorEric Biggers <ebiggers3@gmail.com>
Wed, 21 May 2014 20:09:13 +0000 (15:09 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 22 May 2014 01:38:50 +0000 (20:38 -0500)
This ensures that ->end_stream() gets called.

src/resource.c

index ea2ff5fec573a4b4f5f7630e9db4c24cf0dcb174..7631dd492309283bb7d8fa72a569004f64ae619d 100644 (file)
@@ -1002,9 +1002,9 @@ streamifier_cb(const void *chunk, size_t size, void *_ctx)
        /* Consume the chunk.  */
        ret = (*ctx->cbs.consume_chunk)(chunk, size,
                                        ctx->cbs.consume_chunk_ctx);
+       ctx->cur_stream_offset += size;
        if (ret)
                return ret;
-       ctx->cur_stream_offset += size;
 
        if (ctx->cur_stream_offset == ctx->cur_stream->size) {
                /* Finished reading all the data for a stream.  */