97 G_fatal_error(
_(
"GRASS needs to be compiled with BZIP2 for BZIP2 compression"));
112 if (src_sz <= 0 || dst_sz <= 0) {
114 G_warning(
_(
"Invalid source buffer size %d"), src_sz);
116 G_warning(
_(
"Invalid destination buffer size %d"), dst_sz);
123 if (buf_sz > dst_sz) {
124 G_warning(
"G_bz2_compress(): programmer error, destination is too small");
125 if (
NULL == (buf = (
unsigned char *)
126 G_calloc(buf_sz,
sizeof(
unsigned char))))
134 err = BZ2_bzBuffToBuffCompress((
char *)buf, &nbytes,
141 G_warning(
_(
"BZIP2 version %s compression error %d"),
142 BZ2_bzlibVersion(), err);
149 if (nbytes >= (
unsigned int)src_sz) {
158 for (i = 0; i < nbytes; i++)
176 G_fatal_error(
_(
"GRASS needs to be compiled with BZIP2 for BZIP2 compression"));
191 if (src_sz <= 0 || dst_sz <= 0) {
193 G_warning(
_(
"Invalid source buffer size %d"), src_sz);
195 G_warning(
_(
"Invalid destination buffer size %d"), dst_sz);
202 err = BZ2_bzBuffToBuffDecompress((
char *)dst, &nbytes,
208 G_warning(
_(
"BZIP2 version %s decompression error %d"),
209 BZ2_bzlibVersion(), err);
217 if (nbytes != dst_sz) {
219 G_warning(
_(
"Got uncompressed size %d, expected %d"), (
int)nbytes, dst_sz);
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int G_bz2_compress_bound(int src_sz)
void G_free(void *)
Free allocated memory.
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)
int G_bz2_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
void G_warning(const char *,...) __attribute__((format(printf
int G_bz2_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)