LibTMJ  1.0.0
A library for loading JSON Tiled maps
Functions
Decode

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. More...
 
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. More...
 
uint8_t * tmj_b64_decode (const char *data, size_t *decoded_size)
 Decodes a base64 string. More...
 

Detailed Description

Encoding/decoding routines.

Function Documentation

◆ tmj_zstd_decompress()

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.

Parameters
dataA zstd-compressed buffer of unsigned bytes. The zstd frame header for this buffer must include the content size.
data_sizeThe length of the buffer.
[out]decompressed_sizeThe length of the returned decompressed buffer.
Returns
On success, returns a dynamically-allocated (and decompressed) buffer of unsigned bytes. The returned buffer must be freed by the caller.

Definition at line 10 of file decode.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tmj_zlib_decompress()

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.

Parameters
dataA zlib/gzip-compressed buffer of unsigned bytes.
data_sizeThe length of the buffer.
[out]decompressed_sizeThe length of the returned decompressed buffer.
Returns
On success, returns a dynamically-allocated (and decompressed) buffer of unsigned bytes. The returned buffer must be freed by the caller.

Definition at line 62 of file decode.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tmj_b64_decode()

uint8_t* tmj_b64_decode ( const char *  data,
size_t *  decoded_size 
)

Decodes a base64 string.

Parameters
dataA null-terminated base64 string.
[out]decoded_sizeThe length of the returned decoded buffer.
Returns
On success, returns a dynamically-allocated array of unsigned bytes. The returned array must be freed by the caller.

Definition at line 287 of file decode.c.

Here is the call graph for this function:
Here is the caller graph for this function: