mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compress: add a new module compress.gzip too (#14686)
This commit is contained in:
@@ -9,7 +9,7 @@ fn C.tdefl_compress_mem_to_heap(source_buf voidptr, source_buf_len usize, out_le
|
||||
fn C.tinfl_decompress_mem_to_heap(source_buf voidptr, source_buf_len usize, out_len &usize, flags int) voidptr
|
||||
|
||||
// compresses an array of bytes based on providing flags and returns the compressed bytes in a new array
|
||||
// see `gzip.compress([]u8)` and `zlib.compress([]u8)` for default implementations.
|
||||
// NB: this is a low level api, a high level implementation like zlib/gzip should be preferred
|
||||
[manualfree]
|
||||
pub fn compress(data []u8, flags int) ?[]u8 {
|
||||
if u64(data.len) > compress.max_size {
|
||||
@@ -28,7 +28,7 @@ pub fn compress(data []u8, flags int) ?[]u8 {
|
||||
}
|
||||
|
||||
// decompresses an array of bytes based on providing flags and returns the decompressed bytes in a new array
|
||||
// see `gzip.decompress([]u8)` and `zlib.decompress([]u8)` for default implementations.
|
||||
// NB: this is a low level api, a high level implementation like zlib/gzip should be preferred
|
||||
[manualfree]
|
||||
pub fn decompress(data []u8, flags int) ?[]u8 {
|
||||
mut out_len := usize(0)
|
||||
|
||||
Reference in New Issue
Block a user