66 #error "GRASS requires libz to compile"
84 return compressBound(src_sz);
90 uLong
err, nbytes, buf_sz;
104 if (src_sz <= 0 || dst_sz <= 0) {
106 G_warning(
_(
"Invalid source buffer size %d"), src_sz);
108 G_warning(
_(
"Invalid destination buffer size %d"), dst_sz);
118 if (dst_sz < 0 || buf_sz > (
unsigned int)dst_sz) {
120 "G_zlib_compress(): programmer error, destination is too small");
122 (buf = (
unsigned char *)
G_calloc(buf_sz,
sizeof(
unsigned char))))
135 err = compress2((Bytef *)buf, &nbytes,
136 (
const Bytef *)src, src_sz,
147 if (src_sz < 0 || nbytes >= (
unsigned int)src_sz) {
182 if (src_sz <= 0 || dst_sz <= 0) {
184 G_warning(
_(
"Invalid source buffer size %d"), src_sz);
186 G_warning(
_(
"Invalid destination buffer size %d"), dst_sz);
194 err = uncompress((Bytef *)dst, &nbytes,
195 (
const Bytef *)src, ss);
207 if (dst_sz < 0 || nbytes != (
unsigned int)dst_sz) {
209 G_warning(
_(
"Got uncompressed size %d, expected %d"), (
int)nbytes,
int G_zlib_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
int G_zlib_compress_bound(int src_sz)
int G_zlib_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
void G_free(void *)
Free allocated memory.
void G_warning(const char *,...) __attribute__((format(printf
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)