zlib-streams 1.0.7 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Makefile +23 -8
- package/dist/zlib-streams-dev.wasm +0 -0
- package/dist/zlib-streams.js +145 -75
- package/dist/zlib-streams.wasm +0 -0
- package/package.json +2 -2
- package/src/README.md +61 -1
- package/src/chunkcopy.h +565 -0
- package/src/compare256.h +56 -0
- package/src/cpu_features.h +22 -0
- package/src/deflate.c +2349 -0
- package/src/deflate.h +420 -0
- package/src/deflate_crc32.c +22 -0
- package/src/inffast.h +26 -0
- package/src/{inffast.c → inffast_chunk.c} +127 -71
- package/src/inffast_chunk.h +42 -0
- package/src/inflate.c +69 -33
- package/src/insert_string.h +80 -0
- package/src/wasm/api/zlib-streams.js +145 -75
- package/src/wasm/wasm_stream_common.c +8 -4
- package/build/debug/src/inffast.d +0 -8
- package/build/debug/src/inffast.o +0 -0
- package/build/debug/src/inflate.d +0 -8
- package/build/debug/src/inflate.o +0 -0
- package/build/debug/src/inftrees.d +0 -6
- package/build/debug/src/inftrees.o +0 -0
- package/build/debug/src/zlib/adler32.d +0 -5
- package/build/debug/src/zlib/adler32.o +0 -0
- package/build/debug/src/zlib/contrib/infback9/infback9.d +0 -13
- package/build/debug/src/zlib/contrib/infback9/infback9.o +0 -0
- package/build/debug/src/zlib/contrib/infback9/inftree9.d +0 -7
- package/build/debug/src/zlib/contrib/infback9/inftree9.o +0 -0
- package/build/debug/src/zlib/crc32.d +0 -6
- package/build/debug/src/zlib/crc32.o +0 -0
- package/build/debug/src/zlib/trees.d +0 -7
- package/build/debug/src/zlib/trees.o +0 -0
- package/build/debug/src/zlib/zutil.d +0 -6
- package/build/debug/src/zlib/zutil.o +0 -0
- package/tmp/all_runs/payload_decompress_nowindow_debug__100k_lines.deflate64.log +0 -34
- package/tmp/all_runs/payload_decompress_nowindow_debug__100k_lines.deflate64.out +0 -100000
- package/tmp/all_runs/payload_decompress_nowindow_debug__10k_lines.deflate64.log +0 -2
- package/tmp/all_runs/payload_decompress_nowindow_debug__10k_lines.deflate64.out +0 -10000
- package/tmp/all_runs/payload_decompress_nowindow_debug__payload_63k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_nowindow_debug__payload_63k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_nowindow_debug__payload_64k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_nowindow_debug__payload_64k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_nowindow_debug__payload_65k.deflate64.log +0 -2
- package/tmp/all_runs/payload_decompress_nowindow_debug__payload_65k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_nowindow_debug__rand_block_gap.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_nowindow_debug__rand_block_gap.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_nowindow_debug__repeat_63k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_nowindow_debug__repeat_63k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_nowindow_debug__repeat_64k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_nowindow_debug__repeat_64k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_nowindow_debug__repeat_65k.deflate64.log +0 -2
- package/tmp/all_runs/payload_decompress_nowindow_debug__repeat_65k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_nowindow_debug__zeros_100k.deflate64.log +0 -2
- package/tmp/all_runs/payload_decompress_nowindow_debug__zeros_100k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_ref_debug__100k_lines.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_ref_debug__100k_lines.deflate64.out +0 -100000
- package/tmp/all_runs/payload_decompress_ref_debug__10k_lines.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_ref_debug__10k_lines.deflate64.out +0 -10000
- package/tmp/all_runs/payload_decompress_ref_debug__payload_63k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_ref_debug__payload_63k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_ref_debug__payload_64k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_ref_debug__payload_64k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_ref_debug__payload_65k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_ref_debug__payload_65k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_ref_debug__rand_block_gap.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_ref_debug__rand_block_gap.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_ref_debug__repeat_63k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_ref_debug__repeat_63k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_ref_debug__repeat_64k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_ref_debug__repeat_64k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_ref_debug__repeat_65k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_ref_debug__repeat_65k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_ref_debug__zeros_100k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_ref_debug__zeros_100k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_test_debug__100k_lines.deflate64.log +0 -34
- package/tmp/all_runs/payload_decompress_test_debug__100k_lines.deflate64.out +0 -100000
- package/tmp/all_runs/payload_decompress_test_debug__10k_lines.deflate64.log +0 -2
- package/tmp/all_runs/payload_decompress_test_debug__10k_lines.deflate64.out +0 -10000
- package/tmp/all_runs/payload_decompress_test_debug__payload_63k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_test_debug__payload_63k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_test_debug__payload_64k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_test_debug__payload_64k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_test_debug__payload_65k.deflate64.log +0 -2
- package/tmp/all_runs/payload_decompress_test_debug__payload_65k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_test_debug__rand_block_gap.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_test_debug__rand_block_gap.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_test_debug__repeat_63k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_test_debug__repeat_63k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_test_debug__repeat_64k.deflate64.log +0 -1
- package/tmp/all_runs/payload_decompress_test_debug__repeat_64k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_test_debug__repeat_65k.deflate64.log +0 -2
- package/tmp/all_runs/payload_decompress_test_debug__repeat_65k.deflate64.out +0 -0
- package/tmp/all_runs/payload_decompress_test_debug__zeros_100k.deflate64.log +0 -2
- package/tmp/all_runs/payload_decompress_test_debug__zeros_100k.deflate64.out +0 -0
- package/tmp/all_runs/wasm__100k_lines.deflate64.out +0 -100000
- package/tmp/all_runs/wasm__10k_lines.deflate64.out +0 -10000
- package/tmp/all_runs/wasm__payload_63k.deflate64.out +0 -0
- package/tmp/all_runs/wasm__payload_64k.deflate64.out +0 -0
- package/tmp/all_runs/wasm__payload_65k.deflate64.out +0 -0
- package/tmp/all_runs/wasm__rand_block_gap.deflate64.out +0 -0
- package/tmp/all_runs/wasm__repeat_63k.deflate64.out +0 -0
- package/tmp/all_runs/wasm__repeat_64k.deflate64.out +0 -0
- package/tmp/all_runs/wasm__repeat_65k.deflate64.out +0 -0
- package/tmp/all_runs/wasm__zeros_100k.deflate64.out +0 -0
- package/tmp/diagnose/diagnose_stream_mem.json +0 -4202
|
@@ -34,17 +34,22 @@ unsigned wasm_stream_last_consumed(unsigned zptr) {
|
|
|
34
34
|
return c->last_consumed;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/* the process functions pack the produced byte count and the zlib status code into one int, so
|
|
38
|
+
every return path has to use this shape: a bare negative code decodes as a huge byte count */
|
|
39
|
+
#define WASM_STREAM_RESULT(produced, code) \
|
|
40
|
+
(((produced) & 0x00ffffff) | (((code) & 0xff) << 24))
|
|
41
|
+
|
|
37
42
|
int wasm_stream_process_common(unsigned zptr, unsigned in_ptr, unsigned in_len,
|
|
38
43
|
unsigned out_ptr, unsigned out_len, int flush,
|
|
39
44
|
int (*process_func)(z_streamp, int)) {
|
|
40
45
|
struct wasm_stream_ctx *c = (struct wasm_stream_ctx *)(uintptr_t)zptr;
|
|
41
46
|
if (!c)
|
|
42
|
-
return Z_STREAM_ERROR;
|
|
47
|
+
return WASM_STREAM_RESULT(0, Z_STREAM_ERROR);
|
|
43
48
|
|
|
44
49
|
if (in_len > c->inbuf_sz) {
|
|
45
50
|
unsigned char *nb = (unsigned char *)realloc(c->inbuf, in_len);
|
|
46
51
|
if (!nb)
|
|
47
|
-
return Z_MEM_ERROR;
|
|
52
|
+
return WASM_STREAM_RESULT(0, Z_MEM_ERROR);
|
|
48
53
|
c->inbuf = nb;
|
|
49
54
|
c->inbuf_sz = in_len;
|
|
50
55
|
}
|
|
@@ -58,6 +63,5 @@ int wasm_stream_process_common(unsigned zptr, unsigned in_ptr, unsigned in_len,
|
|
|
58
63
|
int ret = process_func(&c->strm, flush);
|
|
59
64
|
int produced = (int)(out_len - c->strm.avail_out);
|
|
60
65
|
c->last_consumed = (unsigned)(in_len - c->strm.avail_in);
|
|
61
|
-
|
|
62
|
-
return (produced & 0x00ffffff) | ((code & 0xff) << 24);
|
|
66
|
+
return WASM_STREAM_RESULT(produced, ret);
|
|
63
67
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
build/debug/src/zlib/contrib/infback9/infback9.o: \
|
|
2
|
-
src/zlib/contrib/infback9/infback9.c src/zlib/zutil.h src/zlib/zlib.h \
|
|
3
|
-
src/zlib/zconf.h src/zlib/contrib/infback9/infback9.h \
|
|
4
|
-
src/zlib/contrib/infback9/inftree9.h \
|
|
5
|
-
src/zlib/contrib/infback9/inflate9.h \
|
|
6
|
-
src/zlib/contrib/infback9/inffix9.h
|
|
7
|
-
src/zlib/zutil.h:
|
|
8
|
-
src/zlib/zlib.h:
|
|
9
|
-
src/zlib/zconf.h:
|
|
10
|
-
src/zlib/contrib/infback9/infback9.h:
|
|
11
|
-
src/zlib/contrib/infback9/inftree9.h:
|
|
12
|
-
src/zlib/contrib/infback9/inflate9.h:
|
|
13
|
-
src/zlib/contrib/infback9/inffix9.h:
|
|
Binary file
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
build/debug/src/zlib/contrib/infback9/inftree9.o: \
|
|
2
|
-
src/zlib/contrib/infback9/inftree9.c src/zlib/zutil.h src/zlib/zlib.h \
|
|
3
|
-
src/zlib/zconf.h src/zlib/contrib/infback9/inftree9.h
|
|
4
|
-
src/zlib/zutil.h:
|
|
5
|
-
src/zlib/zlib.h:
|
|
6
|
-
src/zlib/zconf.h:
|
|
7
|
-
src/zlib/contrib/infback9/inftree9.h:
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
inflate nowindow loop ret=0 produced=65536
|
|
2
|
-
inflate nowindow loop ret=0 produced=65536
|
|
3
|
-
inflate nowindow loop ret=0 produced=65536
|
|
4
|
-
inflate nowindow loop ret=0 produced=65536
|
|
5
|
-
inflate nowindow loop ret=0 produced=65536
|
|
6
|
-
inflate nowindow loop ret=0 produced=65536
|
|
7
|
-
inflate nowindow loop ret=0 produced=65536
|
|
8
|
-
inflate nowindow loop ret=0 produced=65536
|
|
9
|
-
inflate nowindow loop ret=0 produced=65536
|
|
10
|
-
inflate nowindow loop ret=0 produced=65536
|
|
11
|
-
inflate nowindow loop ret=0 produced=65536
|
|
12
|
-
inflate nowindow loop ret=0 produced=65536
|
|
13
|
-
inflate nowindow loop ret=0 produced=65536
|
|
14
|
-
inflate nowindow loop ret=0 produced=65536
|
|
15
|
-
inflate nowindow loop ret=0 produced=65536
|
|
16
|
-
inflate nowindow loop ret=0 produced=65536
|
|
17
|
-
inflate nowindow loop ret=0 produced=65536
|
|
18
|
-
inflate nowindow loop ret=0 produced=65536
|
|
19
|
-
inflate nowindow loop ret=0 produced=65536
|
|
20
|
-
inflate nowindow loop ret=0 produced=65536
|
|
21
|
-
inflate nowindow loop ret=0 produced=65536
|
|
22
|
-
inflate nowindow loop ret=0 produced=65536
|
|
23
|
-
inflate nowindow loop ret=0 produced=65536
|
|
24
|
-
inflate nowindow loop ret=0 produced=65536
|
|
25
|
-
inflate nowindow loop ret=0 produced=65536
|
|
26
|
-
inflate nowindow loop ret=0 produced=65536
|
|
27
|
-
inflate nowindow loop ret=0 produced=65536
|
|
28
|
-
inflate nowindow loop ret=0 produced=65536
|
|
29
|
-
inflate nowindow loop ret=0 produced=65536
|
|
30
|
-
inflate nowindow loop ret=0 produced=65536
|
|
31
|
-
inflate nowindow loop ret=0 produced=65536
|
|
32
|
-
inflate nowindow loop ret=0 produced=65536
|
|
33
|
-
inflate nowindow loop ret=0 produced=65536
|
|
34
|
-
inflate nowindow loop ret=1 produced=26202
|