FILE *out_fp, compress_func_t compress,
struct chunk_table *chunk_tab)
{
- const u8 *out_chunk;
+ const void *out_chunk;
unsigned out_chunk_size;
if (compress) {
u8 *compressed_chunk = alloca(chunk_size);
if (ctx->doing_sha)
sha1_update(&ctx->sha_ctx, chunk, chunk_size);
-
- if (ctx->compress) {
- return write_wim_resource_chunk(chunk, chunk_size,
- ctx->out_fp, ctx->compress,
- ctx->chunk_tab);
- } else {
- if (fwrite(chunk, 1, chunk_size, ctx->out_fp) != chunk_size) {
- ERROR_WITH_ERRNO("Error writing to output WIM");
- return WIMLIB_ERR_WRITE;
- } else {
- return 0;
- }
- }
+ return write_wim_resource_chunk(chunk, chunk_size,
+ ctx->out_fp, ctx->compress,
+ ctx->chunk_tab);
}
/*
* just skip to the next stream. */
DEBUG("Discarding duplicate stream of length %"PRIu64,
wim_resource_size(lte));
+ lte->no_progress = 0;
goto skip_to_progress;
}
}
* the SHA1 message digest yet. */
wimlib_assert(lte->out_refcnt != 0);
lte->deferred = 0;
+ lte->no_progress = 0;
ret = (*write_stream_cb)(lte, write_stream_ctx);
if (ret)
break;
lte->unhashed = 0;
}
skip_to_progress:
- if (progress_func) {
+ if (!lte->no_progress) {
do_write_streams_progress(progress,
progress_func,
wim_resource_size(lte));
} else {
ret = submit_stream_for_compression(lte, ctx);
}
+ lte->no_progress = 1;
return ret;
}
goto out_join;
ret = do_write_stream_list(stream_list, lookup_table,
main_thread_process_next_stream,
- &ctx, NULL, NULL);
+ &ctx, progress_func, progress);
if (ret)
goto out_destroy_ctx;