size_t qlz_compress(const void *source, char *destination, size_t size, qlz_state_compress *state_compress) |
//Compress size amount of bytes of source and write the result to destination.返回的是压缩后的数据大小
size_t qlz_decompress(const char *source, void *destination, qlz_state_decompress *state_decompress) |
//Decompress source and write the result to destination. 返回的是解压后的数据大小
size_t qlz_size_decompressed(const char *source) |
//Takes the first 9 bytes of compressed data as argument (header) and returns its decompressed size.
The function can be used to allocate the correct amount of memory for decompression. 传入压缩数据的相关参数,返回的是解压后的数据大小,以便分配空间
size_t qlz_size_compressed(const char *source) |
Takes the first 9 bytes of compressed data as argument (header) and returns its entire compressed size.
The function can be used to read a block of compressed data from a file or storage device in cases where the size of the block is unknown. 传入压缩数据的相关参数,返回的是压缩数据的大小,以便读压缩数据
038 | typedef struct t_data Data;//每一个节点都对应一个data,但是非叶子节点的data没有意义 |
039 | struct t_data { |
040 | int size;//叶子节点的data->size记录的是属于它的所有Item的大小 |
041 | int used;//已使用的data大小,当used+新加入的item->length>size时就要增大data->size |
042 | int count;//记录属于它的item数目 |
043 | Item head[0];//指向第一个Item的指针 |
044 | }; |
046 | typedef struct t_node Node; |
047 | struct t_node { |
048 | uint16_t is_node:1;//非叶子节点则为1 ,叶子节点为0 |