]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix build failure on Visutal Studio on Win32.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 3 Dec 2012 11:02:52 +0000 (20:02 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 3 Dec 2012 11:02:52 +0000 (20:02 +0900)
libarchive/archive_read_support_format_zip.c

index fd06b0bed29a711c00f76483ae66290ad3746112..450a6f7da51908d6894a0b3b909df087051b40c8 100644 (file)
@@ -283,7 +283,7 @@ archive_read_format_zip_seekable_bid(struct archive_read *a, int best_bid)
                }
                if (filesize < 0)
                        return 0;
-               if ((p = __archive_read_ahead(a, tail, NULL)) == NULL)
+               if ((p = __archive_read_ahead(a, (size_t)tail, NULL)) == NULL)
                        return 0;
                for (found = 0, i = 0;!found && i < tail - 22;) {
                        switch (p[i]) {
@@ -581,7 +581,7 @@ zip_read_mac_metadata(struct archive_read *a, struct archive_entry *entry,
                return (ARCHIVE_WARN);
        }
 
-       metadata = malloc(rsrc->uncompressed_size);
+       metadata = malloc((size_t)rsrc->uncompressed_size);
        if (metadata == NULL) {
                archive_set_error(&a->archive, ENOMEM,
                    "Can't allocate memory for Mac metadata");
@@ -598,8 +598,8 @@ zip_read_mac_metadata(struct archive_read *a, struct archive_entry *entry,
        hsize = zip_get_local_file_header_size(a, 0);
        zip_read_consume(a, hsize);
 
-       remaining_bytes = rsrc->compressed_size;
-       metadata_bytes = rsrc->uncompressed_size;
+       remaining_bytes = (size_t)rsrc->compressed_size;
+       metadata_bytes = (size_t)rsrc->uncompressed_size;
        mp = metadata;
        eof = 0;
        while (!eof && remaining_bytes) {
@@ -675,7 +675,7 @@ zip_read_mac_metadata(struct archive_read *a, struct archive_entry *entry,
                remaining_bytes -= bytes_used;
        }
        archive_entry_copy_mac_metadata(entry, metadata,
-           rsrc->uncompressed_size - metadata_bytes);
+           (size_t)rsrc->uncompressed_size - metadata_bytes);
 
        __archive_read_seek(a, offset, SEEK_SET);
        zip->offset = offset;