Skip to content

Commit

Permalink
Fix compile problems when compiling without libz support.
Browse files Browse the repository at this point in the history
Don't depend on Bytef as datatype which is a libz invention.
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent 77ad249 commit 5b3661a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/filed/compression.c
Expand Up @@ -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);
}

Expand All @@ -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 */
Expand Down
5 changes: 5 additions & 0 deletions src/lib/compression.c
Expand Up @@ -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
}
}

Expand Down

0 comments on commit 5b3661a

Please sign in to comment.