]> wimlib.net Git - wimlib/blobdiff - src/resource.c
write_stream_list(): Do not allocate chunk buffer if NONE compression
[wimlib] / src / resource.c
index 9061ffb4be81f2144bc2484e106ffb1dd34963b0..e71668d78095a1fcdd8beb30e2470c22775a21d3 100644 (file)
@@ -175,9 +175,9 @@ read_compressed_wim_resource(const struct wim_resource_spec * const rspec,
 
        /* Get the maximum size of uncompressed chunks in this resource, which
         * we require be a power of 2.  */
-       u32 chunk_size;
+       u32 chunk_size = 0;
        u64 cur_read_offset = rspec->offset_in_wim;
-       int ctype;
+       int ctype = WIMLIB_COMPRESSION_TYPE_NONE;
        if (alt_chunk_table) {
                /* Alternate chunk table format.  Its header specifies the chunk
                 * size and compression format.  */
@@ -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;
 }