Next attepmt for NetBSD
This commit is contained in:
parent
4d5bed01be
commit
5e2e05c03d
@ -108,11 +108,11 @@ struct timeval rxtvend; /* Receiver end time */
|
|||||||
|
|
||||||
#if defined(HAVE_ZLIB_H) || defined(HAVE_BZLIB_H)
|
#if defined(HAVE_ZLIB_H) || defined(HAVE_BZLIB_H)
|
||||||
|
|
||||||
int compress_init(int type, void **data);
|
int compress_init(int type);
|
||||||
int do_compress(int type, char *dst, int *dst_len, char *src, int *src_len, int finish, void *data);
|
int do_compress(int type, char *dst, int *dst_len, char *src, int *src_len, int finish, void *data);
|
||||||
void compress_deinit(int type, void *data);
|
void compress_deinit(int type, void *data);
|
||||||
void compress_abort(int type, void *data);
|
void compress_abort(int type, void *data);
|
||||||
int decompress_init(int type, void **data);
|
int decompress_init(int type);
|
||||||
int do_decompress(int type, char *dst, int *dst_len, char *src, int *src_len, void *data);
|
int do_decompress(int type, char *dst, int *dst_len, char *src, int *src_len, void *data);
|
||||||
int decompress_deinit(int type, void *data);
|
int decompress_deinit(int type, void *data);
|
||||||
int decompress_abort(int type, void *data);
|
int decompress_abort(int type, void *data);
|
||||||
@ -1271,7 +1271,7 @@ Syslog('b', "enter receive stream");
|
|||||||
|
|
||||||
if (z_idata == NULL) {
|
if (z_idata == NULL) {
|
||||||
Syslog('b', "decompress_init begins");
|
Syslog('b', "decompress_init begins");
|
||||||
if (decompress_init(bp.rmode, z_idata)) {
|
if (decompress_init(bp.rmode)) {
|
||||||
Syslog('+', "Binkp: can't init decompress");
|
Syslog('+', "Binkp: can't init decompress");
|
||||||
bp.RxState = RxDone;
|
bp.RxState = RxDone;
|
||||||
return Failure;
|
return Failure;
|
||||||
@ -1485,7 +1485,7 @@ TrType binkp_transmitter(void)
|
|||||||
|
|
||||||
if ((tmp->compress == CompGZ) || (tmp->compress == CompBZ2)) {
|
if ((tmp->compress == CompGZ) || (tmp->compress == CompBZ2)) {
|
||||||
bp.tmode = tmp->compress;
|
bp.tmode = tmp->compress;
|
||||||
if ((rc1 = compress_init(bp.tmode, z_odata))) {
|
if ((rc1 = compress_init(bp.tmode))) {
|
||||||
Syslog('+', "Binkp: compress_init failed (rc=%d)", rc1);
|
Syslog('+', "Binkp: compress_init failed (rc=%d)", rc1);
|
||||||
tmp->compress = CompNone;
|
tmp->compress = CompNone;
|
||||||
bp.tmode = CompNone;
|
bp.tmode = CompNone;
|
||||||
@ -2721,32 +2721,32 @@ void binkp_clear_filelist(int rc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
int compress_init(int type, void **data)
|
int compress_init(int type)
|
||||||
{
|
{
|
||||||
int lvl;
|
int lvl;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
#ifdef HAVE_BZLIB_H
|
#ifdef HAVE_BZLIB_H
|
||||||
case CompBZ2: {
|
case CompBZ2: {
|
||||||
*data = calloc(1, sizeof(bz_stream));
|
z_odata = calloc(1, sizeof(bz_stream));
|
||||||
if (*data == NULL) {
|
if (z_odata == NULL) {
|
||||||
Syslog('+', "Binkp: compress_init: not enough memory (%lu needed)", sizeof(bz_stream));
|
Syslog('+', "Binkp: compress_init: not enough memory (%lu needed)", sizeof(bz_stream));
|
||||||
return BZ_MEM_ERROR;
|
return BZ_MEM_ERROR;
|
||||||
}
|
}
|
||||||
lvl = 1; /* default is small (100K) buffer */
|
lvl = 1; /* default is small (100K) buffer */
|
||||||
return BZ2_bzCompressInit((bz_stream *)*data, lvl, 0, 0);
|
return BZ2_bzCompressInit((bz_stream *)z_odata, lvl, 0, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_ZLIB_H
|
#ifdef HAVE_ZLIB_H
|
||||||
case CompGZ: {
|
case CompGZ: {
|
||||||
*data = calloc(1, sizeof(z_stream));
|
z_odata = calloc(1, sizeof(z_stream));
|
||||||
if (*data == NULL) {
|
if (z_odata == NULL) {
|
||||||
Syslog('+', "Binkp: compress_init: not enough memory (%lu needed)", sizeof(z_stream));
|
Syslog('+', "Binkp: compress_init: not enough memory (%lu needed)", sizeof(z_stream));
|
||||||
return Z_MEM_ERROR;
|
return Z_MEM_ERROR;
|
||||||
}
|
}
|
||||||
lvl = 9; /* Maximum compression */
|
lvl = 9; /* Maximum compression */
|
||||||
if (lvl <= 0) lvl = Z_DEFAULT_COMPRESSION;
|
if (lvl <= 0) lvl = Z_DEFAULT_COMPRESSION;
|
||||||
return deflateInit((z_stream *)*data, lvl);
|
return deflateInit((z_stream *)z_odata, lvl);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
@ -2847,30 +2847,30 @@ void compress_abort(int type, void *data)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int decompress_init(int type, void **data)
|
int decompress_init(int type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
#ifdef HAVE_BZLIB_H
|
#ifdef HAVE_BZLIB_H
|
||||||
case CompBZ2: {
|
case CompBZ2: {
|
||||||
*data = calloc(1, sizeof(bz_stream));
|
z_idata = calloc(1, sizeof(bz_stream));
|
||||||
if (*data == NULL) {
|
if (z_idata == NULL) {
|
||||||
Syslog('+', "Binkp: decompress_init: not enough memory (%lu needed)", sizeof(bz_stream));
|
Syslog('+', "Binkp: decompress_init: not enough memory (%lu needed)", sizeof(bz_stream));
|
||||||
return BZ_MEM_ERROR;
|
return BZ_MEM_ERROR;
|
||||||
}
|
}
|
||||||
return BZ2_bzDecompressInit((bz_stream *)*data, 0, 0);
|
return BZ2_bzDecompressInit((bz_stream *)z_idata, 0, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_ZLIB_H
|
#ifdef HAVE_ZLIB_H
|
||||||
case CompGZ: {
|
case CompGZ: {
|
||||||
Syslog('b', "init start %d", sizeof(z_stream));
|
Syslog('b', "init start %d", sizeof(z_stream));
|
||||||
*data = calloc(1, sizeof(z_stream));
|
z_idata = calloc(1, sizeof(z_stream));
|
||||||
Syslog('b', "data calloc done");
|
Syslog('b', "data calloc done");
|
||||||
if (*data == NULL) {
|
if (z_idata == NULL) {
|
||||||
Syslog('+', "Binkp: decompress_init: not enough memory (%lu needed)", sizeof(z_stream));
|
Syslog('+', "Binkp: decompress_init: not enough memory (%lu needed)", sizeof(z_stream));
|
||||||
return Z_MEM_ERROR;
|
return Z_MEM_ERROR;
|
||||||
}
|
}
|
||||||
Syslog('b', "begin inflateInit");
|
Syslog('b', "begin inflateInit");
|
||||||
return inflateInit((z_stream *)*data);
|
return inflateInit((z_stream *)z_idata);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user