snappy_uncompressed_length - return length of uncompressed output.

bool snappy_uncompressed_length (const char * start, size_t n, size_t * result)

Arguments

start
compressed buffer
n
length of compressed buffer.
result
Write the length of the uncompressed output here.

Description

Returns true when successfull, otherwise false.

snappy_compress - Compress a buffer using the snappy compressor.

int snappy_compress (struct snappy_env * env, const char * input, size_t input_length, char * compressed, size_t * compressed_length)

Arguments

env
Preallocated environment
input
Input buffer
input_length
Length of input_buffer
compressed
Output buffer for compressed data
compressed_length
The real length of the output written here.

Description

Return 0 on success, otherwise an negative error code.

The output buffer must be at least snappy_max_compressed_length(input_length) bytes long.

Requires a preallocated environment from snappy_init_env. The environment does not keep state over individual calls of this function, just preallocates the memory.


snappy_uncompress - Uncompress a snappy compressed buffer

int snappy_uncompress (const char * compressed, size_t n, char * uncompressed)

Arguments

compressed
Input buffer with compressed data
n
length of compressed buffer
uncompressed
buffer for uncompressed data

Description

The uncompressed data buffer must be at least snappy_uncompressed_length(compressed) bytes long.

Return 0 on success, otherwise an negative error code.


snappy_compress - Compress a buffer using the snappy compressor.

int snappy_compress (struct snappy_env * env, const char * input, size_t input_length, char * compressed, size_t * compressed_length)

Arguments

env
Preallocated environment
input
Input buffer
input_length
Length of input_buffer
compressed
Output buffer for compressed data
compressed_length
The real length of the output written here.

Description

Return 0 on success, otherwise an negative error code.

The output buffer must be at least snappy_max_compressed_length(input_length) bytes long.

Requires a preallocated environment from snappy_init_env. The environment does not keep state over individual calls of this function, just preallocates the memory.


snappy_uncompress - Uncompress a snappy compressed buffer

int snappy_uncompress (const char * compressed, size_t n, char * uncompressed)

Arguments

compressed
Input buffer with compressed data
n
length of compressed buffer
uncompressed
buffer for uncompressed data

Description

The uncompressed data buffer must be at least snappy_uncompressed_length(compressed) bytes long.

Return 0 on success, otherwise an negative error code.


snappy_init_env_sg - Allocate snappy compression environment

int snappy_init_env_sg (struct snappy_env * env, bool sg)

Arguments

env
Environment to preallocate
sg
Input environment ever does scather gather

Description

If false is passed to sg then multiple entries in an iovec are not legal. Returns 0 on success, otherwise negative errno. Must run in process context.

snappy_init_env - Allocate snappy compression environment

int snappy_init_env (struct snappy_env * env)

Arguments

env
Environment to preallocate

Description

Passing multiple entries in an iovec is not allowed on the environment allocated here. Returns 0 on success, otherwise negative errno. Must run in process context.

snappy_free_env - Free an snappy compression environment

void snappy_free_env (struct snappy_env * env)

Arguments

env
Environment to free.

Description

Must run in process context.