diff options
| author | ruki <[email protected]> | 2023-01-21 10:36:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-01-21 10:36:06 +0800 |
| commit | 4aeed729c422af3f5f31c2a52f10bca76411f279 (patch) | |
| tree | e0ec05cc01b11c0018cdc0c294146874c81c602a /core/src | |
| parent | 842176a2da54a5ca1f68c177cdfb0cda939df8bc (diff) | |
fix lz4
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/xmake/lz4/block_decompress.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/core/src/xmake/lz4/block_decompress.c b/core/src/xmake/lz4/block_decompress.c index 294cb3648..d4c656280 100644 --- a/core/src/xmake/lz4/block_decompress.c +++ b/core/src/xmake/lz4/block_decompress.c @@ -65,20 +65,10 @@ tb_int_t xm_lz4_block_decompress(lua_State* lua) tb_byte_t buffer[8192]; do { - tb_int_t buffer_maxn; - if (real <= sizeof(buffer)) - { - output_data = buffer; - buffer_maxn = sizeof(buffer); - } - else - { - buffer_maxn = real << 1; - output_data = (tb_byte_t*)tb_malloc(buffer_maxn); - } + output_data = real <= sizeof(buffer)? buffer : (tb_byte_t*)tb_malloc(buffer_maxn); tb_assert_and_check_break(output_data); - tb_int_t r = LZ4_decompress_safe((tb_char_t const*)data, (tb_char_t*)output_data, real, buffer_maxn); + tb_int_t r = LZ4_decompress_safe((tb_char_t const*)data, (tb_char_t*)output_data, real, real); tb_assert_and_check_break(r > 0); lua_pushlstring(lua, (tb_char_t const*)output_data, real); |
