Basically... I've been wrapping a C library --specifically FastLZ-- for Python using the ctypes module. This it self hasn't been too problematic, i even managed to wrap fastlz_compress_level(). Now, my "issue" cropped up when started on fastlz_decompress(). I probably don't get it because of my lack of experience with C, but, i simply don't understand the parameters i'm meant to pass with the function call.
From the header file:
- Code: Select all
/**
Decompress a block of compressed data and returns the size of the
decompressed block. If error occurs, e.g. the compressed data is
corrupted or the output buffer is not large enough, then 0 (zero)
will be returned instead.
The input buffer and the output buffer can not overlap.
Decompression is memory safe and guaranteed not to write the output buffer
more than what is specified in maxout.
*/
int fastlz_decompress(const void* input, int length, void* output, int maxout);
Taking into account that i do not know, nor can reliably predict, the size of the end result, how am i meant to know what size to set the output buffer to? I also don't understand the purpose of int maxout. Even reading the comment in the header a few hundred times hasn't help make it any clearer.
If you can shed any light what so ever on the matter, i'd be highly grateful.
I know this is a vague question, but it reflect the vague look on my face when i try to understand what's going on.
