]> wimlib.net Git - wimlib/blobdiff - src/write.c
Fix reading > 16 bits from bitstream
[wimlib] / src / write.c
index 8554d1ab573fc23af05533c2f9f1cde750e0914e..de59f9518f14f1c842f72037f67f42f5ae1823bc 100644 (file)
@@ -452,10 +452,13 @@ write_wim_resource(struct wim_lookup_table_entry *lte,
                 */
                if (lte->is_pipable == !!(resource_flags &
                                          WIMLIB_WRITE_RESOURCE_FLAG_PIPABLE))
+               {
                        resource_flags |= WIMLIB_READ_RESOURCE_FLAG_RAW_FULL;
-               else
+                       read_size = lte->resource_entry.size;
+               } else {
                        resource_flags |= WIMLIB_READ_RESOURCE_FLAG_RAW_CHUNKS;
-               read_size = lte->resource_entry.size;
+                       read_size = lte->resource_entry.original_size;
+               }
                write_ctx.doing_sha = false;
        } else {
                write_ctx.doing_sha = true;
@@ -475,7 +478,8 @@ write_wim_resource(struct wim_lookup_table_entry *lte,
                if (!(resource_flags & WIMLIB_READ_RESOURCE_FLAG_RAW)) {
                        write_ctx.out_ctype = out_ctype;
                        if (out_ctype == WIMLIB_COMPRESSION_TYPE_LZX) {
-                               ret = wimlib_lzx_alloc_context(NULL, comp_ctx);
+                               ret = wimlib_lzx_alloc_context(out_chunk_size,
+                                                              NULL, comp_ctx);
                                if (ret)
                                        goto out;
                        }
@@ -1584,7 +1588,8 @@ write_stream_list_parallel(struct list_head *stream_list,
                params[i].compressed_res_queue = &compressed_res_queue;
                params[i].out_ctype = out_ctype;
                if (out_ctype == WIMLIB_COMPRESSION_TYPE_LZX) {
-                       ret = wimlib_lzx_alloc_context(NULL, &params[i].comp_ctx);
+                       ret = wimlib_lzx_alloc_context(out_chunk_size,
+                                                      NULL, &params[i].comp_ctx);
                        if (ret)
                                goto out_free_params;
                }