From: Michihiro NAKAJIMA Date: Wed, 7 Nov 2012 11:32:26 +0000 (+0900) Subject: Fix build failure without zlib and liblzo. X-Git-Tag: v3.1.0~39^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=225ae392e80cb728c9f1e87e59930ea58e397bda;p=thirdparty%2Flibarchive.git Fix build failure without zlib and liblzo. --- diff --git a/libarchive/archive_read_support_filter_lzop.c b/libarchive/archive_read_support_filter_lzop.c index 321130a8e..713af31e9 100644 --- a/libarchive/archive_read_support_filter_lzop.c +++ b/libarchive/archive_read_support_filter_lzop.c @@ -54,7 +54,8 @@ __FBSDID("$FreeBSD$"); #endif #include "archive.h" -#ifndef HAVE_ZLIB_H +#if !defined(HAVE_ZLIB_H) &&\ + defined(HAVE_LZO_LZOCONF_H) && defined(HAVE_LZO_LZO1X_H) #include "archive_crc32.h" #endif #include "archive_endian.h" diff --git a/libarchive/archive_read_support_format_7zip.c b/libarchive/archive_read_support_format_7zip.c index 6a0a29d35..194b8d51c 100644 --- a/libarchive/archive_read_support_format_7zip.c +++ b/libarchive/archive_read_support_format_7zip.c @@ -736,7 +736,8 @@ archive_read_format_7zip_read_data(struct archive_read *a, /* Update checksum */ if ((zip->entry->flg & CRC32_IS_SET) && bytes) - zip->entry_crc32 = crc32(zip->entry_crc32, *buff, (uInt)bytes); + zip->entry_crc32 = crc32(zip->entry_crc32, *buff, + (unsigned)bytes); /* If we hit the end, swallow any end-of-data marker. */ if (zip->end_of_entry) { @@ -2688,7 +2689,7 @@ header_bytes(struct archive_read *a, size_t rbytes) } /* Update checksum */ - zip->header_crc32 = crc32(zip->header_crc32, p, (uInt)rbytes); + zip->header_crc32 = crc32(zip->header_crc32, p, (unsigned)rbytes); return (p); } diff --git a/libarchive/archive_read_support_format_rar.c b/libarchive/archive_read_support_format_rar.c index 888949890..2f4020e89 100644 --- a/libarchive/archive_read_support_format_rar.c +++ b/libarchive/archive_read_support_format_rar.c @@ -862,7 +862,7 @@ archive_read_format_rar_read_header(struct archive_read *a, return (ARCHIVE_FATAL); } - crc32_val = crc32(0, (const unsigned char *)p + 2, (uInt)skip - 2); + crc32_val = crc32(0, (const unsigned char *)p + 2, (unsigned)skip - 2); if ((crc32_val & 0xffff) != archive_le16dec(p)) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Header CRC error"); @@ -905,7 +905,7 @@ archive_read_format_rar_read_header(struct archive_read *a, p = h; } - crc32_val = crc32(0, (const unsigned char *)p + 2, (uInt)skip - 2); + crc32_val = crc32(0, (const unsigned char *)p + 2, (unsigned)skip - 2); if ((crc32_val & 0xffff) != archive_le16dec(p)) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Header CRC error"); @@ -1701,7 +1701,8 @@ read_data_stored(struct archive_read *a, const void **buff, size_t *size, rar->bytes_remaining -= bytes_avail; rar->bytes_unconsumed = bytes_avail; /* Calculate File CRC. */ - rar->crc_calculated = crc32(rar->crc_calculated, *buff, (uInt)bytes_avail); + rar->crc_calculated = crc32(rar->crc_calculated, *buff, + (unsigned)bytes_avail); return (ARCHIVE_OK); } @@ -1731,7 +1732,8 @@ read_data_compressed(struct archive_read *a, const void **buff, size_t *size, *offset = rar->offset_outgoing; rar->offset_outgoing += *size; /* Calculate File CRC. */ - rar->crc_calculated = crc32(rar->crc_calculated, *buff, (uInt)*size); + rar->crc_calculated = crc32(rar->crc_calculated, *buff, + (unsigned)*size); rar->unp_offset = 0; return (ARCHIVE_OK); } @@ -1764,7 +1766,8 @@ read_data_compressed(struct archive_read *a, const void **buff, size_t *size, *offset = rar->offset_outgoing; rar->offset_outgoing += *size; /* Calculate File CRC. */ - rar->crc_calculated = crc32(rar->crc_calculated, *buff, (uInt)*size); + rar->crc_calculated = crc32(rar->crc_calculated, *buff, + (unsigned)*size); return (ret); } continue; @@ -1897,7 +1900,7 @@ read_data_compressed(struct archive_read *a, const void **buff, size_t *size, *offset = rar->offset_outgoing; rar->offset_outgoing += *size; /* Calculate File CRC. */ - rar->crc_calculated = crc32(rar->crc_calculated, *buff, (uInt)*size); + rar->crc_calculated = crc32(rar->crc_calculated, *buff, (unsigned)*size); return ret; } diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c index b23c84db4..b730a7001 100644 --- a/libarchive/archive_read_support_format_zip.c +++ b/libarchive/archive_read_support_format_zip.c @@ -919,7 +919,8 @@ archive_read_format_zip_read_data(struct archive_read *a, return (r); /* Update checksum */ if (*size) - zip->entry_crc32 = crc32(zip->entry_crc32, *buff, (uInt)*size); + zip->entry_crc32 = crc32(zip->entry_crc32, *buff, + (unsigned)*size); /* If we hit the end, swallow any end-of-data marker. */ if (zip->end_of_entry) { /* Check file size, CRC against these values. */ diff --git a/libarchive/archive_write_set_format_7zip.c b/libarchive/archive_write_set_format_7zip.c index ef8cb959e..3b20d3083 100644 --- a/libarchive/archive_write_set_format_7zip.c +++ b/libarchive/archive_write_set_format_7zip.c @@ -504,7 +504,7 @@ _7z_write_header(struct archive_write *a, struct archive_entry *entry) bytes = compress_out(a, p, (size_t)file->size, ARCHIVE_Z_RUN); if (bytes < 0) return ((int)bytes); - zip->entry_crc32 = crc32(zip->entry_crc32, p, (uInt)bytes); + zip->entry_crc32 = crc32(zip->entry_crc32, p, (unsigned)bytes); zip->entry_bytes_remaining -= bytes; } @@ -562,7 +562,8 @@ compress_out(struct archive_write *a, const void *buff, size_t s, return (0); if ((zip->crc32flg & PRECODE_CRC32) && s) - zip->precode_crc32 = crc32(zip->precode_crc32, buff, (uInt)s); + zip->precode_crc32 = crc32(zip->precode_crc32, buff, + (unsigned)s); zip->stream.next_in = (const unsigned char *)buff; zip->stream.avail_in = s; do { @@ -608,7 +609,7 @@ _7z_write_data(struct archive_write *a, const void *buff, size_t s) bytes = compress_out(a, buff, s, ARCHIVE_Z_RUN); if (bytes < 0) return (bytes); - zip->entry_crc32 = crc32(zip->entry_crc32, buff, (uInt)bytes); + zip->entry_crc32 = crc32(zip->entry_crc32, buff, (unsigned)bytes); zip->entry_bytes_remaining -= bytes; return (bytes); } diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c index d7ec326e7..6ec5c1997 100644 --- a/libarchive/archive_write_set_format_zip.c +++ b/libarchive/archive_write_set_format_zip.c @@ -648,7 +648,7 @@ archive_write_zip_data(struct archive_write *a, const void *buff, size_t s) zip->written_bytes += s; zip->remaining_data_bytes -= s; l->compressed_size += s; - l->crc32 = crc32(l->crc32, buff, (uInt)s); + l->crc32 = crc32(l->crc32, buff, (unsigned)s); return (s); #if HAVE_ZLIB_H case COMPRESSION_DEFLATE: