1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: change optional to result in most of the libraries (#16123)

This commit is contained in:
yuyi
2022-10-21 03:14:33 +08:00
committed by GitHub
parent 0d368562f4
commit 51f4d99399
75 changed files with 439 additions and 446 deletions

View File

@ -11,7 +11,7 @@ fn C.tinfl_decompress_mem_to_heap(source_buf voidptr, source_buf_len usize, out_
// compresses an array of bytes based on providing flags and returns the compressed bytes in a new array
// 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 {
pub fn compress(data []u8, flags int) ![]u8 {
if u64(data.len) > compress.max_size {
return error('data too large ($data.len > $compress.max_size)')
}
@ -30,7 +30,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
// 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 {
pub fn decompress(data []u8, flags int) ![]u8 {
mut out_len := usize(0)
address := C.tinfl_decompress_mem_to_heap(data.data, data.len, &out_len, flags)