From 5b3661aabf8b7a88d7f040df244feaf586fb2240 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 258cb63446a..600dcbd291b 100644 --- a/src/filed/compression.c +++ b/src/filed/compression.c @@ -102,12 +102,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.deflate_buffer + OFFSET_FADDR_SIZE; - bctx.cbuf = (Bytef *)bctx.jcr->compress.deflate_buffer + OFFSET_FADDR_SIZE + sizeof(comp_stream_header); + bctx.chead = (uint8_t *)bctx.jcr->compress.deflate_buffer + OFFSET_FADDR_SIZE; + bctx.cbuf = (uint8_t *)bctx.jcr->compress.deflate_buffer + OFFSET_FADDR_SIZE + sizeof(comp_stream_header); bctx.max_compress_len = bctx.jcr->compress.deflate_buffer_size - (sizeof(comp_stream_header) + OFFSET_FADDR_SIZE); } else { - bctx.chead = (Bytef *)bctx.jcr->compress.deflate_buffer; - bctx.cbuf = (Bytef *)bctx.jcr->compress.deflate_buffer + sizeof(comp_stream_header); + bctx.chead = (uint8_t *)bctx.jcr->compress.deflate_buffer; + bctx.cbuf = (uint8_t *)bctx.jcr->compress.deflate_buffer + sizeof(comp_stream_header); bctx.max_compress_len = bctx.jcr->compress.deflate_buffer_size - sizeof(comp_stream_header); } @@ -122,10 +122,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.deflate_buffer + OFFSET_FADDR_SIZE; + bctx.cbuf = (uint8_t *)bctx.jcr->compress.deflate_buffer + OFFSET_FADDR_SIZE; bctx.max_compress_len = bctx.jcr->compress.deflate_buffer_size - OFFSET_FADDR_SIZE; } else { - bctx.cbuf = (Bytef *)bctx.jcr->compress.deflate_buffer; + bctx.cbuf = (uint8_t *)bctx.jcr->compress.deflate_buffer; bctx.max_compress_len = bctx.jcr->compress.deflate_buffer_size; } bctx.wbuf = bctx.jcr->compress.deflate_buffer; /* compressed output here */ diff --git a/src/lib/compression.c b/src/lib/compression.c index 80847acbc6e..0002de4437e 100644 --- a/src/lib/compression.c +++ b/src/lib/compression.c @@ -784,12 +784,17 @@ bool decompress_data(JCR *jcr, break; } default: +#ifdef HAVE_LIBZ switch (stream) { case STREAM_SPARSE_GZIP_DATA: return decompress_with_zlib(jcr, last_fname, data, length, true, false, want_data_stream); default: return decompress_with_zlib(jcr, last_fname, data, length, false, false, want_data_stream); } +#else + Qmsg(jcr, M_ERROR, 0, _("Compression algorithm GZIP found, but not supported!\n")); + return false; +#endif } }