summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_write_set_compression_gzip.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libarchive/archive_write_set_compression_gzip.c')
-rw-r--r--lib/libarchive/archive_write_set_compression_gzip.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/libarchive/archive_write_set_compression_gzip.c b/lib/libarchive/archive_write_set_compression_gzip.c
index 3229507..3137501 100644
--- a/lib/libarchive/archive_write_set_compression_gzip.c
+++ b/lib/libarchive/archive_write_set_compression_gzip.c
@@ -31,11 +31,19 @@
__FBSDID("$FreeBSD$");
+#ifdef HAVE_ERRNO_H
#include <errno.h>
+#endif
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
#include <string.h>
+#endif
#include <time.h>
+#ifdef HAVE_ZLIB_H
#include <zlib.h>
+#endif
#include "archive.h"
#include "archive_private.h"
@@ -54,7 +62,7 @@ struct private_data {
* of ugly hackery to convert a const * pointer to a non-const pointer.
*/
#define SET_NEXT_IN(st,src) \
- (st)->stream.next_in = (void *)(uintptr_t)(const void *)(src)
+ (st)->stream.next_in = (Bytef *)(uintptr_t)(const void *)(src)
static int archive_compressor_gzip_finish(struct archive *);
static int archive_compressor_gzip_init(struct archive *);
@@ -105,7 +113,7 @@ archive_compressor_gzip_init(struct archive *a)
memset(state, 0, sizeof(*state));
state->compressed_buffer_size = a->bytes_per_block;
- state->compressed = malloc(state->compressed_buffer_size);
+ state->compressed = (unsigned char *)malloc(state->compressed_buffer_size);
state->crc = crc32(0L, NULL, 0);
if (state->compressed == NULL) {
@@ -186,7 +194,7 @@ archive_compressor_gzip_write(struct archive *a, const void *buff,
struct private_data *state;
int ret;
- state = a->compression_data;
+ state = (struct private_data *)a->compression_data;
if (a->client_writer == NULL) {
archive_set_error(a, ARCHIVE_ERRNO_PROGRAMMER,
"No write callback is registered? "
@@ -195,7 +203,7 @@ archive_compressor_gzip_write(struct archive *a, const void *buff,
}
/* Update statistics */
- state->crc = crc32(state->crc, buff, length);
+ state->crc = crc32(state->crc, (const Bytef *)buff, length);
state->total_in += length;
/* Compress input data to output buffer */
@@ -221,7 +229,7 @@ archive_compressor_gzip_finish(struct archive *a)
unsigned tocopy;
unsigned char trailer[8];
- state = a->compression_data;
+ state = (struct private_data *)a->compression_data;
ret = 0;
if (a->client_writer == NULL) {
archive_set_error(a, ARCHIVE_ERRNO_PROGRAMMER,
OpenPOWER on IntegriCloud