diff options
author | Sverker Eriksson <[email protected]> | 2013-12-17 13:20:31 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2013-12-17 13:20:31 +0100 |
commit | 165846b143c8275350972caaf4c1013cfe5db043 (patch) | |
tree | 8ec4ddea514aa1a0e94249328a77df91d5195ebf /erts/emulator/beam/erl_zlib.c | |
parent | 7d4e5e2458e0627882f49078b9757dd6ae21a6fe (diff) | |
parent | 4b3462665c591dffa05294ce5ea94c6259446a04 (diff) | |
download | otp-165846b143c8275350972caaf4c1013cfe5db043.tar.gz otp-165846b143c8275350972caaf4c1013cfe5db043.tar.bz2 otp-165846b143c8275350972caaf4c1013cfe5db043.zip |
Merge tag 'OTP_R16B03_yielding_binary_to_term'
Yielding binary_to_term.
OTP-11535
* tag 'OTP_R16B03_yielding_binary_to_term':
Increase versions for OTP_R16B03_yielding_binary_to_term
erts: Adjust term_to_binary reduction factors
erts: Yield after trapping term_to_binary if gc has been ordered
erts: Let term_to_binary disable gc while trapping
erts: Improve stress of binary_to_term in binary_SUITE
erts: Fix bug in binary_to_term for compressed on halfword
erts: Fix crash when binary_to_term throws badarg
erts: Trapping memcpy in binary_to_term
erts: Cleanup code for trapping binary_to_term
erts: Add erlang wrappers to binary_to_term
trapping uncompress
trapping size calculation
trapping binary_to_term/2
trapping STRING_EXT
trapping lists and tuples
trapping binary_to_term passing binary_SUITE
Conflicts:
erts/preloaded/ebin/erlang.beam
erts/preloaded/ebin/erts_internal.beam
erts/vsn.mk
lib/kernel/vsn.mk
lib/stdlib/vsn.mk
Diffstat (limited to 'erts/emulator/beam/erl_zlib.c')
-rw-r--r-- | erts/emulator/beam/erl_zlib.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_zlib.c b/erts/emulator/beam/erl_zlib.c index 47fd92988e..8e33144f96 100644 --- a/erts/emulator/beam/erl_zlib.c +++ b/erts/emulator/beam/erl_zlib.c @@ -87,6 +87,46 @@ int ZEXPORT erl_zlib_deflate_finish(z_stream *streamp) return deflateEnd(streamp); } +int ZEXPORT erl_zlib_inflate_start(z_stream *streamp, const Bytef* source, + uLong sourceLen) +{ + streamp->next_in = (Bytef*)source; + streamp->avail_in = (uInt)sourceLen; + streamp->total_out = streamp->avail_out = 0; + streamp->next_out = NULL; + erl_zlib_alloc_init(streamp); + return inflateInit(streamp); +} +/* + * Inflate a chunk, The destination length is the limit. + * Returns Z_OK if more to process, Z_STREAM_END if we are done. + */ +int ZEXPORT erl_zlib_inflate_chunk(z_stream *streamp, Bytef* dest, uLongf* destLen) +{ + int err; + uLongf last_tot = streamp->total_out; + + streamp->next_out = dest; + streamp->avail_out = (uInt)*destLen; + + if ((uLong)streamp->avail_out != *destLen) return Z_BUF_ERROR; + + err = inflate(streamp, Z_NO_FLUSH); + ASSERT(err != Z_STREAM_ERROR); + *destLen = streamp->total_out - last_tot; + return err; +} + +/* + * When we are done, free up the inflate structure + * Retyurns Z_OK or Error + */ +int ZEXPORT erl_zlib_inflate_finish(z_stream *streamp) +{ + return inflateEnd(streamp); +} + + int ZEXPORT erl_zlib_compress2 (Bytef* dest, uLongf* destLen, const Bytef* source, uLong sourceLen, int level) |