LibTMJ 1.4.0
A library for loading JSON Tiled maps
|
Encoding/decoding routines. More...
Functions | |
uint8_t * | tmj_zstd_decompress (const uint8_t *data, size_t data_size, size_t *decompressed_size) |
Decompresses a zstd-compressed buffer of bytes. | |
uint8_t * | tmj_zlib_decompress (const uint8_t *data, size_t data_size, size_t *decompressed_size) |
Decompresses a zlib/gzip-compressed buffer of bytes. | |
uint8_t * | tmj_zlib_compress (const uint8_t *data, size_t data_size, int level, size_t *compressed_size) |
Compresses a buffer of bytes with zlib. | |
char * | tmj_b64_encode (uint8_t *data, size_t size) |
Encodes a base64 string. | |
uint8_t * | tmj_b64_decode (const char *data, size_t *decoded_size) |
Decodes a base64 string. | |
Encoding/decoding routines.
uint8_t * tmj_zstd_decompress | ( | const uint8_t * | data, |
size_t | data_size, | ||
size_t * | decompressed_size | ||
) |
Decompresses a zstd-compressed buffer of bytes.
This routine does not use streaming decompression, so the given buffer must have a frame header that includes the content size. See https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#frame_header for detail.
data | A zstd-compressed buffer of unsigned bytes. The zstd frame header for this buffer must include the content size. | |
data_size | The length of the buffer. | |
[out] | decompressed_size | The length of the returned decompressed buffer. |
Definition at line 10 of file decode.c.
uint8_t * tmj_zlib_decompress | ( | const uint8_t * | data, |
size_t | data_size, | ||
size_t * | decompressed_size | ||
) |
Decompresses a zlib/gzip-compressed buffer of bytes.
data | A zlib/gzip-compressed buffer of unsigned bytes. | |
data_size | The length of the buffer. | |
[out] | decompressed_size | The length of the returned decompressed buffer. |
Definition at line 62 of file decode.c.
uint8_t * tmj_zlib_compress | ( | const uint8_t * | data, |
size_t | data_size, | ||
int | level, | ||
size_t * | compressed_size | ||
) |
Compresses a buffer of bytes with zlib.
data | A buffer of unsigned bytes. | |
data_size | The length of the buffer. | |
level | The desired level of zlib compression (0-9). | |
[out] | compressed_size | The length of the returned compressed buffer. |
Definition at line 210 of file decode.c.
char * tmj_b64_encode | ( | uint8_t * | data, |
size_t | size | ||
) |
Encodes a base64 string.
data | An array of unsigned bytes. |
size | The length of the array. |
Definition at line 479 of file decode.c.
uint8_t * tmj_b64_decode | ( | const char * | data, |
size_t * | decoded_size | ||
) |
Decodes a base64 string.
data | A null-terminated base64 string. | |
[out] | decoded_size | The length of the returned decoded buffer. |
Definition at line 410 of file decode.c.