The following is a description of the aPLib decompression functionality.
Decompress compressed data from source to destination.
The destination buffer must be large enough to hold the decompressed data.
Parameters: |
|
---|---|
Returns: | length of decompressed data, or APLIB_ERROR on error |
Note
This function is not included in the libraries, but is available in src/c/depack.c. aP_depack_asm_fast() can be used instead.
Decompress compressed data from source to destination.
This function reads at most srclen bytes from source, and writes at most dstlen bytes to destination. If there is not enough source or destination space, or a decoding error occurs, the function returns APLIB_ERROR.
Parameters: |
|
---|---|
Returns: | length of decompressed data, or APLIB_ERROR on error |
Note
This function is not included in the libraries, but is available in src/c/depacks.c. aP_depack_asm_safe() can be used instead.
Decompress compressed data from source to destination.
The destination buffer must be large enough to hold the decompressed data.
Optimised for size.
Parameters: |
|
---|---|
Returns: | length of decompressed data, or APLIB_ERROR on error |
Decompress compressed data from source to destination.
The destination buffer must be large enough to hold the decompressed data.
Optimised for speed.
Parameters: |
|
---|---|
Returns: | length of decompressed data, or APLIB_ERROR on error |
Decompress compressed data from source to destination.
This function reads at most srclen bytes from source, and writes at most dstlen bytes to destination. If there is not enough source or destination space, or a decoding error occurs, the function returns APLIB_ERROR.
Parameters: |
|
---|---|
Returns: | length of decompressed data, or APLIB_ERROR on error |
See also
Compute CRC32 value of length bytes of data from source.
Parameters: |
|
---|---|
Returns: | CRC32 value |
Compute CRC32 of compressed data in source and check it against value stored in header. Return length of decompressed data stored in header.
Parameters: |
|
---|---|
Returns: | length of decompressed data, or APLIB_ERROR on error |
Return length of decompressed data stored in header of compressed data in source.
Parameters: |
|
---|---|
Returns: | length of decompressed data, or APLIB_ERROR on error |
Wrapper function for aP_depack_asm_safe(), which checks the CRC32 of the compressed data, decompresses, and checks the CRC32 of the decompressed data.
Parameters: |
|
---|---|
Returns: | length of decompressed data, or APLIB_ERROR on error |
See also
/* get original size */
size_t orig_size = aPsafe_get_orig_size(compressed);
/* allocate memory for decompressed data */
char *data = malloc(orig_size);
/* decompress compressed[] to data[] */
size_t outlength = aPsafe_depack(compressed, compressed_size, data, orig_size);
/* check decompressed length */
if (outlength != orig_size) {
printf("An error occured!\n");
}
else {
printf("Decompressed %u bytes\n", outlength);
}