]> wimlib.net Git - wimlib/commitdiff
streamifier_cb(): Fix update of cur_stream_offset
authorEric Biggers <ebiggers3@gmail.com>
Thu, 26 Dec 2013 02:50:54 +0000 (20:50 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 26 Dec 2013 02:50:58 +0000 (20:50 -0600)
read_stream_list() expects it to be zeroed to avoid a second call to
end_stream().

src/resource.c

index 9061ffb4be81f2144bc2484e106ffb1dd34963b0..192ffb2e988470252f92fda501a226664ee3f04c 100644 (file)
@@ -947,6 +947,8 @@ streamifier_cb(const void *chunk, size_t size, void *_ctx)
        if (ctx->cur_stream_offset == ctx->cur_stream->size) {
                /* Finished reading all the data for a stream.  */
 
+               ctx->cur_stream_offset = 0;
+
                DEBUG("End stream (size=%"PRIu64").", ctx->cur_stream->size);
                ret = (*ctx->cbs.end_stream)(ctx->cur_stream, 0,
                                             ctx->cbs.end_stream_ctx);
@@ -962,7 +964,6 @@ streamifier_cb(const void *chunk, size_t size, void *_ctx)
                        else
                                ctx->next_stream = NULL;
                }
-               ctx->cur_stream_offset = 0;
        }
        return 0;
 }