63#include <grass/config.h>
66#include <grass/glocale.h>
81 int err, nbytes, buf_sz;
95 if (src_sz <= 0 || dst_sz <= 0) {
97 G_warning(_(
"Invalid source buffer size %d"), src_sz);
99 G_warning(_(
"Invalid destination buffer size %d"), dst_sz);
106 if (buf_sz > dst_sz) {
108 "G_lz4_compress(): programmer error, destination is too small");
110 (buf = (
unsigned char *)G_calloc(buf_sz,
sizeof(
unsigned char))))
146int G_lz4_expand(
unsigned char *src,
int src_sz,
unsigned char *dst,
int dst_sz)
161 if (src_sz <= 0 || dst_sz <= 0) {
163 G_warning(_(
"Invalid source buffer size %d"), src_sz);
165 G_warning(_(
"Invalid destination buffer size %d"), dst_sz);
181 if (nbytes != dst_sz) {
183 G_warning(_(
"Got uncompressed size %d, expected %d"), (
int)nbytes,
void G_free(void *buf)
Free allocated memory.
int G_lz4_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
int G_lz4_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
int G_lz4_compress_bound(int src_sz)
void G_warning(const char *msg,...)
Print a warning message to stderr.
int LZ4_compressBound(int isize)
int LZ4_compress_default(const char *source, char *dest, int inputSize, int maxOutputSize)
LZ4_FORCE_O2_GCC_PPC64LE int LZ4_decompress_safe(const char *source, char *dest, int compressedSize, int maxDecompressedSize)
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)