From b40d1ff79b5c13ce9b4a1e09fd2baecc919b20fc Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Tue, 22 Oct 2013 20:18:01 +0200 Subject: [PATCH] Fix compile problems when compiling without libz support. Don't depend on Bytef as datatype which is a libz invention. --- src/filed/compression.c | 12 ++++++------ src/lib/compression.c | 5 +++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/filed/compression.c b/src/filed/compression.c index 9ff793d68db..54f8c7a94d4 100644 --- a/src/filed/compression.c +++ b/src/filed/compression.c @@ -101,12 +101,12 @@ bool setup_compression_context(b_ctx &bctx) */ if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) { - bctx.chead = (Bytef *)bctx.jcr->compress.buffer + OFFSET_FADDR_SIZE; - bctx.cbuf = (Bytef *)bctx.jcr->compress.buffer + OFFSET_FADDR_SIZE + sizeof(comp_stream_header); + bctx.chead = (uint8_t *)bctx.jcr->compress.buffer + OFFSET_FADDR_SIZE; + bctx.cbuf = (uint8_t *)bctx.jcr->compress.buffer + OFFSET_FADDR_SIZE + sizeof(comp_stream_header); bctx.max_compress_len = bctx.jcr->compress.buffer_size - (sizeof(comp_stream_header) + OFFSET_FADDR_SIZE); } else { - bctx.chead = (Bytef *)bctx.jcr->compress.buffer; - bctx.cbuf = (Bytef *)bctx.jcr->compress.buffer + sizeof(comp_stream_header); + bctx.chead = (uint8_t *)bctx.jcr->compress.buffer; + bctx.cbuf = (uint8_t *)bctx.jcr->compress.buffer + sizeof(comp_stream_header); bctx.max_compress_len = bctx.jcr->compress.buffer_size - sizeof(comp_stream_header); } @@ -121,10 +121,10 @@ bool setup_compression_context(b_ctx &bctx) bctx.chead = NULL; if ((bctx.ff_pkt->flags & FO_SPARSE) || (bctx.ff_pkt->flags & FO_OFFSETS)) { - bctx.cbuf = (Bytef *)bctx.jcr->compress.buffer + OFFSET_FADDR_SIZE; + bctx.cbuf = (uint8_t *)bctx.jcr->compress.buffer + OFFSET_FADDR_SIZE; bctx.max_compress_len = bctx.jcr->compress.buffer_size - OFFSET_FADDR_SIZE; } else { - bctx.cbuf = (Bytef *)bctx.jcr->compress.buffer; + bctx.cbuf = (uint8_t *)bctx.jcr->compress.buffer; bctx.max_compress_len = bctx.jcr->compress.buffer_size; } bctx.wbuf = bctx.jcr->compress.buffer; /* compressed output here */ diff --git a/src/lib/compression.c b/src/lib/compression.c index 7875629137c..daf637f35e6 100644 --- a/src/lib/compression.c +++ b/src/lib/compression.c @@ -687,7 +687,12 @@ bool decompress_data(JCR *jcr, const char *last_fname, int32_t stream, char **da break; } default: +#ifdef HAVE_LIBZ return decompress_with_zlib(jcr, last_fname, data, length, false); +#else + Qmsg(jcr, M_ERROR, 0, _("Compression algorithm GZIP found, but not supported!\n")); + return false; +#endif } }