Go to the source code of this file.
|
#define | DECOMPRESS_LZH5_STATE_SIZE (6096+16) |
| Size of the LZH5 decompression state.
|
|
#define | DECOMPRESS_LZH5_DEFAULT_WINDOW_SIZE (8192) |
| Default window size for LZH5 decompression.
|
|
|
void | decompress_lzh5_init (void *state, FILE *fp, int winsize) |
| Initialize the LZH5 decompressor state.
|
|
ssize_t | decompress_lzh5_read (void *state, void *buf, size_t len) |
| Read decompressed data from the LZH5 stream.
|
|
int | decompress_lzh5_pos (void *state) |
| Get the current position in the decompressed stream.
|
|
void * | decompress_lzh5_full (const char *fn, FILE *fp, size_t cmp_size, size_t size) |
| Decompress a full LZH5 file into a buffer.
|
|
◆ DECOMPRESS_LZH5_STATE_SIZE
#define DECOMPRESS_LZH5_STATE_SIZE (6096+16) |
Size of the LZH5 decompression state.
Note that this can still be allocated on the stack, as the stack size configured by libdragon is 64KB.
◆ decompress_lzh5_init()
void decompress_lzh5_init |
( |
void * |
state, |
|
|
FILE * |
fp, |
|
|
int |
winsize |
|
) |
| |
Initialize the LZH5 decompressor state.
- Parameters
-
state | Pointer to the decompressor state buffer. |
fp | FILE pointer to read compressed data from. |
winsize | Window size for the decompressor. |
◆ decompress_lzh5_read()
ssize_t decompress_lzh5_read |
( |
void * |
state, |
|
|
void * |
buf, |
|
|
size_t |
len |
|
) |
| |
Read decompressed data from the LZH5 stream.
- Parameters
-
state | Pointer to the decompressor state buffer. |
buf | Buffer to store decompressed data. |
len | Number of bytes to read. |
- Returns
- Number of bytes read, or -1 on error.
◆ decompress_lzh5_pos()
int decompress_lzh5_pos |
( |
void * |
state | ) |
|
Get the current position in the decompressed stream.
- Parameters
-
state | Pointer to the decompressor state buffer. |
- Returns
- Current position in the decompressed stream.
◆ decompress_lzh5_full()
void * decompress_lzh5_full |
( |
const char * |
fn, |
|
|
FILE * |
fp, |
|
|
size_t |
cmp_size, |
|
|
size_t |
size |
|
) |
| |
Decompress a full LZH5 file into a buffer.
This function decompresses a full LZH5 file into a memory buffer. The caller should provide a buffer large enough to hold the entire file, or the function will fail.
This function is about 50% faster than using decompress_lzh5_read, as it can assume that the whole decoded file will always be available during decoding.
- Parameters
-
fn | Filename of the file being decompressed, if known |
fp | File pointer to the compressed file |
cmp_size | Length of the compressed file |
size | Length of the file after decompression |
- Returns
- Buffer that contains the decompressed file