]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix build failure on Win64.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Wed, 7 Nov 2012 06:25:47 +0000 (15:25 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Wed, 7 Nov 2012 06:25:47 +0000 (15:25 +0900)
35 files changed:
cpio/cpio.c
cpio/test/main.c
libarchive/archive_crypto.c
libarchive/archive_match.c
libarchive/archive_read_disk_windows.c
libarchive/archive_read_extract.c
libarchive/archive_read_support_filter_gzip.c
libarchive/archive_read_support_filter_lrzip.c
libarchive/archive_read_support_filter_lzop.c
libarchive/archive_read_support_filter_uu.c
libarchive/archive_read_support_format_7zip.c
libarchive/archive_read_support_format_cab.c
libarchive/archive_read_support_format_lha.c
libarchive/archive_read_support_format_mtree.c
libarchive/archive_read_support_format_rar.c
libarchive/archive_read_support_format_raw.c
libarchive/archive_read_support_format_tar.c
libarchive/archive_string.c
libarchive/archive_util.c
libarchive/archive_write_add_filter_gzip.c
libarchive/archive_write_add_filter_uuencode.c
libarchive/archive_write_set_format_7zip.c
libarchive/archive_write_set_format_iso9660.c
libarchive/archive_write_set_format_mtree.c
libarchive/archive_write_set_format_pax.c
libarchive/filter_fork_windows.c
libarchive/test/main.c
libarchive/test/test_fuzz.c
libarchive/test/test_sparse_basic.c
libarchive/test/test_write_format_tar_sparse.c
tar/test/main.c
tar/test/test_copy.c
tar/test/test_option_r.c
tar/test/test_stdio.c
tar/test/test_windows.c

index 95e8e0806ce70f999dd3d8ea9ac370dbf4945796..6f57d95d616ec821388d418e29b85e5ad0d26850 100644 (file)
@@ -840,18 +840,21 @@ entry_to_archive(struct cpio *cpio, struct archive_entry *entry)
                exit(1);
 
        if (r >= ARCHIVE_WARN && archive_entry_size(entry) > 0 && fd >= 0) {
-               bytes_read = read(fd, cpio->buff, cpio->buff_size);
+               bytes_read = read(fd, cpio->buff, (unsigned)cpio->buff_size);
                while (bytes_read > 0) {
-                       r = archive_write_data(cpio->archive,
+                       ssize_t bytes_write;
+                       bytes_write = archive_write_data(cpio->archive,
                            cpio->buff, bytes_read);
-                       if (r < 0)
+                       if (bytes_write < 0)
                                lafe_errc(1, archive_errno(cpio->archive),
                                    "%s", archive_error_string(cpio->archive));
-                       if (r < bytes_read) {
+                       if (bytes_write < bytes_read) {
                                lafe_warnc(0,
-                                   "Truncated write; file may have grown while being archived.");
+                                   "Truncated write; file may have "
+                                   "grown while being archived.");
                        }
-                       bytes_read = read(fd, cpio->buff, cpio->buff_size);
+                       bytes_read = read(fd, cpio->buff,
+                           (unsigned)cpio->buff_size);
                }
        }
 
@@ -1023,7 +1026,7 @@ extract_data(struct archive *ar, struct archive *aw)
                            "%s", archive_error_string(ar));
                        exit(1);
                }
-               r = archive_write_data_block(aw, block, size, offset);
+               r = (int)archive_write_data_block(aw, block, size, offset);
                if (r != ARCHIVE_OK) {
                        lafe_warnc(archive_errno(aw),
                            "%s", archive_error_string(aw));
index 26511fe9a90f9d7e6524247425ae82b49c2225f7..5ea9c0db8aff0cbcc9b12b9d5a238c84e734a79b 100644 (file)
@@ -624,8 +624,8 @@ assertion_equal_string(const char *file, int line,
        if (v1 == v2 || (v1 != NULL && v2 != NULL && strcmp(v1, v2) == 0))
                return (1);
        failure_start(file, line, "%s != %s", e1, e2);
-       l1 = strlen(e1);
-       l2 = strlen(e2);
+       l1 = (int)strlen(e1);
+       l2 = (int)strlen(e2);
        if (l1 < l2)
                l1 = l2;
        strdump(e1, v1, l1, utf8);
@@ -847,8 +847,8 @@ assertion_equal_file(const char *filename, int line, const char *fn1, const char
                return (0);
        }
        for (;;) {
-               n1 = fread(buff1, 1, sizeof(buff1), f1);
-               n2 = fread(buff2, 1, sizeof(buff2), f2);
+               n1 = (int)fread(buff1, 1, sizeof(buff1), f1);
+               n2 = (int)fread(buff2, 1, sizeof(buff2), f2);
                if (n1 != n2)
                        break;
                if (n1 == 0 && n2 == 0) {
@@ -922,7 +922,7 @@ assertion_file_contents(const char *filename, int line, const void *buff, int s,
                return (0);
        }
        contents = malloc(s * 2);
-       n = fread(contents, 1, s * 2, f);
+       n = (int)fread(contents, 1, s * 2, f);
        fclose(f);
        if (n == s && memcmp(buff, contents, s) == 0) {
                free(contents);
@@ -958,9 +958,9 @@ assertion_text_file_contents(const char *filename, int line, const char *buff, c
                failure_finish(NULL);
                return (0);
        }
-       s = strlen(buff);
+       s = (int)strlen(buff);
        contents = malloc(s * 2 + 128);
-       n = fread(contents, 1, s * 2 + 128 - 1, f);
+       n = (int)fread(contents, 1, s * 2 + 128 - 1, f);
        if (n >= 0)
                contents[n] = '\0';
        fclose(f);
index 2caf5716929610bf03461ad189973e827dbfdceb..af9936d7569c53fa2ce7c208c490b2a7dc5d54cb 100644 (file)
@@ -90,7 +90,7 @@ win_crypto_Update(Digest_CTX *ctx, const unsigned char *buf, size_t len)
 static int
 win_crypto_Final(unsigned char *buf, size_t bufsize, Digest_CTX *ctx)
 {
-       DWORD siglen = bufsize;
+       DWORD siglen = (DWORD)bufsize;
 
        if (!ctx->valid)
                return (ARCHIVE_FAILED);
index 6170dc539f977d5e4a75f5b5d85ac205c1ee050a..ba348be5794bbecc8ee20ad18c31b944e6b2e530 100644 (file)
@@ -1712,7 +1712,7 @@ match_owner_id(struct id_array *ids, int64_t id)
        unsigned b, m, t;
 
        t = 0;
-       b = ids->count;
+       b = (unsigned)ids->count;
        while (t < b) {
                m = (t + b)>>1;
                if (ids->ids[m] == id)
index 40a1ca8c3eacad015b2a31d1228965426fc8320b..c117faf69a8acb8f0db0fdc62f9c4f1f86da614e 100644 (file)
@@ -597,7 +597,7 @@ start_next_async_read(struct archive_read_disk *a, struct tree *t)
        } else
                ResetEvent(olp->ol.hEvent);
 
-       buffbytes = olp->buff_size;
+       buffbytes = (DWORD)olp->buff_size;
        if (buffbytes > t->current_sparse->length)
                buffbytes = (DWORD)t->current_sparse->length;
 
@@ -698,7 +698,7 @@ _archive_read_data_block(struct archive *_a, const void **buff,
        olp = &(t->ol[t->ol_idx_done]);
        t->ol_idx_done = (t->ol_idx_done + 1) % MAX_OVERLAPPED;
        if (olp->bytes_transferred)
-               bytes_transferred = olp->bytes_transferred;
+               bytes_transferred = (DWORD)olp->bytes_transferred;
        else if (!GetOverlappedResult(t->entry_fh, &(olp->ol),
            &bytes_transferred, TRUE)) {
                la_dosmaperr(GetLastError());
@@ -1268,7 +1268,7 @@ update_current_filesystem(struct archive_read_disk *a, int64_t dev)
                        return (ARCHIVE_FATAL);
                }
                t->filesystem_table = (struct filesystem *)p;
-               t->allocated_filesytem = s;
+               t->allocated_filesytem = (int)s;
        }
        t->current_filesystem_id = fid;
        t->current_filesystem = &(t->filesystem_table[fid]);
@@ -2236,7 +2236,7 @@ setup_sparse_from_disk(struct archive_read_disk *a,
                        ret = DeviceIoControl(handle,
                            FSCTL_QUERY_ALLOCATED_RANGES,
                            &range, sizeof(range), outranges,
-                           outranges_size, &retbytes, NULL);
+                           (DWORD)outranges_size, &retbytes, NULL);
                        if (ret == 0 && GetLastError() == ERROR_MORE_DATA) {
                                free(outranges);
                                outranges_size *= 2;
index aad8ac5168df37f308833ac109df4a27208062c1..795f2abea8477792d8c9805a474653dd4a585ab1 100644 (file)
@@ -154,7 +154,7 @@ copy_data(struct archive *ar, struct archive *aw)
                        return (ARCHIVE_OK);
                if (r != ARCHIVE_OK)
                        return (r);
-               r = archive_write_data_block(aw, buff, size, offset);
+               r = (int)archive_write_data_block(aw, buff, size, offset);
                if (r < ARCHIVE_WARN)
                        r = ARCHIVE_WARN;
                if (r != ARCHIVE_OK) {
index 50a6a6bf5a7430a28a417f61086156f71251c80b..a2b399781d1c509d3b3d884e84a57a4a6c306de2 100644 (file)
@@ -121,7 +121,7 @@ archive_read_support_filter_gzip(struct archive *_a)
  * number of bytes in header.  If pbits is non-NULL, it receives a
  * count of bits verified, suitable for use by bidder.
  */
-static int
+static ssize_t
 peek_at_header(struct archive_read_filter *filter, int *pbits)
 {
        const unsigned char *p;
index d8ae92113cd7a0b16492f37db75f7bb5ce7bd510..0b2924243207d148652b87c170d11d7fa1e7501c 100644 (file)
@@ -113,7 +113,7 @@ lrzip_bidder_bid(struct archive_read_filter_bidder *self,
        if ((i < 6) || (i > 10))
                return 0;
 
-       return len;
+       return (int)len;
 }
 
 static int
index b3a0ed15416e7771c829a6d134bc209d58d9ac09..321130a8e1fdaee3ffeffbf8e2fe8d3a059a2edd 100644 (file)
@@ -28,7 +28,9 @@
 
 __FBSDID("$FreeBSD$");
 
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
index be27037970a5843471329f1a955a50e3dc243b28..493338d0b5e8d389ad53ce3bd28d4eff0b807d91 100644 (file)
@@ -490,7 +490,7 @@ read_more:
                uudecode->in_cnt = 0;
        }
        for (;used < avail_in; d += llen, used += llen) {
-               int l, body;
+               int64_t l, body;
 
                b = d;
                len = get_line(b, avail_in - used, &nl);
@@ -518,7 +518,7 @@ read_more:
                                return (ARCHIVE_FATAL);
                        if (uudecode->in_buff != b)
                                memmove(uudecode->in_buff, b, len);
-                       uudecode->in_cnt = len;
+                       uudecode->in_cnt = (int)len;
                        if (total == 0) {
                                /* Do not return 0; it means end-of-file.
                                 * We should try to read bytes more. */
index 494028e884d81b899a67da5e61ad8c041c8f523a..9e29d74fb49aa3d2fadf74ebe4533b421f490d29 100644 (file)
@@ -3099,7 +3099,7 @@ read_stream(struct archive_read *a, const void **buff, size_t size,
 {
        struct _7zip *zip = (struct _7zip *)a->format->data;
        uint64_t skip_bytes = 0;
-       int r;
+       ssize_t r;
 
        if (zip->uncompressed_buffer_bytes_remaining == 0) {
                if (zip->pack_stream_inbytes_remaining > 0) {
@@ -3379,7 +3379,7 @@ setup_decode_folder(struct archive_read *a, struct _7z_folder *folder,
 
                        /* Extract a sub stream. */
                        while (zip->pack_stream_inbytes_remaining > 0) {
-                               r = extract_pack_stream(a, 0);
+                               r = (int)extract_pack_stream(a, 0);
                                if (r < 0) {
                                        free(b[0]); free(b[1]); free(b[2]);
                                        return (r);
@@ -3570,7 +3570,7 @@ x86_Convert(struct _7zip *zip, uint8_t *data, size_t size)
        }
        zip->bcj_prevPosT = prevPosT;
        zip->bcj_prevMask = prevMask;
-       zip->bcj_ip += bufferPos;
+       zip->bcj_ip += (uint32_t)bufferPos;
        return (bufferPos);
 }
 
@@ -3714,7 +3714,7 @@ Bcj2_Decode(struct _7zip *zip, uint8_t *outBuf, size_t outSize)
                            ((uint32_t)v[1] << 16) |
                            ((uint32_t)v[2] << 8) |
                            ((uint32_t)v[3])) -
-                           ((uint32_t)zip->bcj2_outPos + outPos + 4);
+                           ((uint32_t)zip->bcj2_outPos + (uint32_t)outPos + 4);
                        out[0] = (uint8_t)dest;
                        out[1] = (uint8_t)(dest >> 8);
                        out[2] = (uint8_t)(dest >> 16);
@@ -3729,7 +3729,7 @@ Bcj2_Decode(struct _7zip *zip, uint8_t *outBuf, size_t outSize)
                                 */
                                zip->odd_bcj_size = 4 -i;
                                for (; i < 4; i++) {
-                                       j = i - 4 + zip->odd_bcj_size;
+                                       j = i - 4 + (unsigned)zip->odd_bcj_size;
                                        zip->odd_bcj[j] = out[i];
                                }
                                break;
index f8a197f2b3abfabd804250666de8c8cfd0ffe305..20bbc5db1d76d05d49dab7e37b7388e3c7123bff 100644 (file)
@@ -540,7 +540,7 @@ truncated_error(struct archive_read *a)
        return (ARCHIVE_FATAL);
 }
 
-static int
+static ssize_t
 cab_strnlen(const unsigned char *p, size_t maxlen)
 {
        size_t i;
@@ -551,7 +551,7 @@ cab_strnlen(const unsigned char *p, size_t maxlen)
        }
        if (i > maxlen)
                return (-1);/* invalid */
-       return (i);
+       return ((ssize_t)i);
 }
 
 /* Read bytes as much as remaining. */
@@ -627,8 +627,9 @@ cab_read_header(struct archive_read *a)
        struct cab *cab;
        struct cfheader *hd;
        size_t bytes, used;
+       ssize_t len;
        int64_t skip;
-       int err, i, len;
+       int err, i;
        int cur_folder, prev_folder;
        uint32_t offset32;
        
@@ -1067,13 +1068,13 @@ static uint32_t
 cab_checksum_cfdata_4(const void *p, size_t bytes, uint32_t seed)
 {
        const unsigned char *b;
-       int u32num;
+       unsigned u32num;
        uint32_t sum;
 
-       u32num = bytes / 4;
+       u32num = (unsigned)bytes / 4;
        sum = seed;
        b = p;
-       while (--u32num >= 0) {
+       for (;u32num > 0; --u32num) {
                sum ^= archive_le32dec(b);
                b += 4;
        }
@@ -1936,7 +1937,7 @@ cab_read_data(struct archive_read *a, const void **buff,
                            ARCHIVE_ERRNO_FILE_FORMAT, "Invalid CFDATA");
                        return (ARCHIVE_FATAL);
                } else
-                       return (bytes_avail);
+                       return ((int)bytes_avail);
        }
        if (bytes_avail > cab->entry_bytes_remaining)
                bytes_avail = (ssize_t)cab->entry_bytes_remaining;
@@ -2200,7 +2201,7 @@ lzx_translation(struct lzx_stream *strm, void *p, size_t size, uint32_t offset)
                size_t i = b - (unsigned char *)p;
                int32_t cp, displacement, value;
 
-               cp = offset + i;
+               cp = (int32_t)(offset + (uint32_t)i);
                value = archive_le32dec(&b[1]);
                if (value >= -cp && value < (int32_t)ds->translation_size) {
                        if (value >= 0)
@@ -2586,7 +2587,7 @@ lzx_read_blocks(struct lzx_stream *strm, int last)
                                                goto failed;
                                        return (ARCHIVE_OK);
                                }
-                               l = ds->block_bytes_avail;
+                               l = (int)ds->block_bytes_avail;
                                if (l > ds->w_size - ds->w_pos)
                                        l = ds->w_size - ds->w_pos;
                                if (l > strm->avail_out)
@@ -2966,7 +2967,7 @@ lzx_decode_blocks(struct lzx_stream *strm, int last)
                                                l = w_size - w_pos;
                                }
                                if (noutp + l >= endp)
-                                       l = endp - noutp;
+                                       l = (int)(endp - noutp);
                                s = w_buff + copy_pos;
                                if (l >= 8 && ((copy_pos + l < w_pos)
                                  || (w_pos + l < copy_pos))) {
@@ -3128,7 +3129,7 @@ lzx_huffman_init(struct huffman *hf, size_t len_size, int tbl_bits)
                hf->bitlen = calloc(len_size,  sizeof(hf->bitlen[0]));
                if (hf->bitlen == NULL)
                        return (ARCHIVE_FATAL);
-               hf->len_size = len_size;
+               hf->len_size = (int)len_size;
        } else
                memset(hf->bitlen, 0, len_size *  sizeof(hf->bitlen[0]));
        if (hf->tbl == NULL) {
@@ -3136,7 +3137,7 @@ lzx_huffman_init(struct huffman *hf, size_t len_size, int tbl_bits)
                        bits = tbl_bits;
                else
                        bits = HTBL_BITS;
-               hf->tbl = malloc((1 << bits) * sizeof(hf->tbl[0]));
+               hf->tbl = malloc(((size_t)1 << bits) * sizeof(hf->tbl[0]));
                if (hf->tbl == NULL)
                        return (ARCHIVE_FATAL);
                hf->tbl_bits = tbl_bits;
index a7c071e1a1ccdd303fca1fe28af04626fb17849f..f702949fb8c1ec593c55b5dda02da37e66961654 100644 (file)
@@ -272,7 +272,7 @@ static int  lha_skip_sfx(struct archive_read *);
 static time_t  lha_dos_time(const unsigned char *);
 static time_t  lha_win_time(uint64_t, long *);
 static unsigned char   lha_calcsum(unsigned char, const void *,
-                   int, int);
+                   int, size_t);
 static int     lha_parse_linkname(struct archive_string *,
                    struct archive_string *);
 static int     lha_read_data_none(struct archive_read *, const void **,
@@ -1635,7 +1635,7 @@ lha_parse_linkname(struct archive_string *linkname,
     struct archive_string *pathname)
 {
        char *  linkptr;
-       int     symlen;
+       size_t  symlen;
 
        linkptr = strchr(pathname->s, '|');
        if (linkptr != NULL) {
@@ -1690,12 +1690,12 @@ lha_win_time(uint64_t wintime, long *ns)
 }
 
 static unsigned char
-lha_calcsum(unsigned char sum, const void *pp, int offset, int size)
+lha_calcsum(unsigned char sum, const void *pp, int offset, size_t size)
 {
        unsigned char const *p = (unsigned char const *)pp;
 
        p += offset;
-       while (--size >= 0)
+       for (;size > 0; --size)
                sum += *p++;
        return (sum);
 }
@@ -2020,7 +2020,7 @@ lzh_copy_from_window(struct lzh_stream *strm, struct lzh_dec *ds)
                        copy_bytes = (size_t)strm->avail_out;
                memcpy(strm->next_out,
                    ds->w_buff + ds->copy_pos, copy_bytes);
-               ds->copy_pos += copy_bytes;
+               ds->copy_pos += (int)copy_bytes;
        } else {
                if (ds->w_remaining <= strm->avail_out)
                        copy_bytes = ds->w_remaining;
@@ -2028,7 +2028,7 @@ lzh_copy_from_window(struct lzh_stream *strm, struct lzh_dec *ds)
                        copy_bytes = (size_t)strm->avail_out;
                memcpy(strm->next_out,
                    ds->w_buff + ds->w_size - ds->w_remaining, copy_bytes);
-               ds->w_remaining -= copy_bytes;
+               ds->w_remaining -= (int)copy_bytes;
        }
        strm->next_out += copy_bytes;
        strm->avail_out -= copy_bytes;
@@ -2482,7 +2482,7 @@ lzh_huffman_init(struct huffman *hf, size_t len_size, int tbl_bits)
                        bits = tbl_bits;
                else
                        bits = HTBL_BITS;
-               hf->tbl = malloc((1 << bits) * sizeof(hf->tbl[0]));
+               hf->tbl = malloc(((size_t)1 << bits) * sizeof(hf->tbl[0]));
                if (hf->tbl == NULL)
                        return (ARCHIVE_FATAL);
        }
@@ -2492,7 +2492,7 @@ lzh_huffman_init(struct huffman *hf, size_t len_size, int tbl_bits)
                if (hf->tree == NULL)
                        return (ARCHIVE_FATAL);
        }
-       hf->len_size = len_size;
+       hf->len_size = (int)len_size;
        hf->tbl_bits = tbl_bits;
        return (ARCHIVE_OK);
 }
index 7fd9e466164b10dab69e1120fdc9a2691b7ecf6c..c4e7021a869bbe9ce5d0ce4df6210f4763810dde 100644 (file)
@@ -354,7 +354,7 @@ bid_keycmp(const char *p, const char *key, ssize_t len)
  * Returns the length of a detected keyword.
  * Returns 0 if any keywords were not found.
  */
-static ssize_t
+static int
 bid_keyword(const char *p,  ssize_t len)
 {
        static const char *keys_c[] = {
@@ -592,8 +592,8 @@ detect_form(struct archive_read *a, int *is_form_d)
 {
        const char *p;
        ssize_t avail, ravail;
-       ssize_t len, nl;
-       int detected_bytes = 0, entry_cnt = 0, multiline = 0;
+       ssize_t detected_bytes = 0, len, nl;
+       int entry_cnt = 0, multiline = 0;
        int form_D = 0;/* The archive is generated by `NetBSD mtree -D'
                        * (In this source we call it `form D') . */
 
@@ -942,7 +942,7 @@ read_mtree(struct archive_read *a, struct mtree *mtree)
                }
                if (len < 0) {
                        free_options(global);
-                       return (len);
+                       return ((int)len);
                }
                /* Leading whitespace is never significant, ignore it. */
                while (*p == ' ' || *p == '\t') {
index 83ea8d85a0347b155eb5b2d234bd13ccc1bcd283..98b998bb19523d764007800838baec372cf8e917 100644 (file)
@@ -1287,13 +1287,13 @@ read_header(struct archive_read *a, struct archive_entry *entry,
   {
     if (filename_size != strlen(filename))
     {
-      unsigned char highbyte, flagbits, flagbyte, offset;
-      unsigned fn_end;
+      unsigned char highbyte, flagbits, flagbyte;
+      unsigned fn_end, offset;
 
       end = filename_size;
       fn_end = filename_size * 2;
       filename_size = 0;
-      offset = strlen(filename) + 1;
+      offset = (unsigned)strlen(filename) + 1;
       highbyte = *(p + offset++);
       flagbits = 0;
       flagbyte = 0;
@@ -1753,7 +1753,7 @@ read_data_compressed(struct archive_read *a, const void **buff, size_t *size,
         bs = rar->unp_buffer_size - rar->unp_offset;
       else
         bs = (size_t)rar->bytes_uncopied;
-      ret = copy_from_lzss_window(a, buff, rar->offset, bs);
+      ret = copy_from_lzss_window(a, buff, rar->offset, (int)bs);
       if (ret != ARCHIVE_OK)
         return (ret);
       rar->offset += bs;
@@ -1881,7 +1881,7 @@ read_data_compressed(struct archive_read *a, const void **buff, size_t *size,
       bs = rar->unp_buffer_size - rar->unp_offset;
     else
       bs = (size_t)rar->bytes_uncopied;
-    ret = copy_from_lzss_window(a, buff, rar->offset, bs);
+    ret = copy_from_lzss_window(a, buff, rar->offset, (int)bs);
     if (ret != ARCHIVE_OK)
       return (ret);
     rar->offset += bs;
@@ -2413,7 +2413,7 @@ make_table(struct archive_read *a, struct huffman_code *code)
 
   code->table =
     (struct huffman_table_entry *)calloc(1, sizeof(*code->table)
-    * (1 << code->tablesize));
+    * ((size_t)1 << code->tablesize));
 
   return make_table_recurse(a, code, 0, code->table, 0, code->tablesize);
 }
index e371ce8150cd6689a726cfc34eb4f6072cb40487..843497878a368cf1574dcc4d2a74d2cbf32a487b 100644 (file)
@@ -158,7 +158,7 @@ archive_read_format_raw_read_data(struct archive_read *a,
                /* Record and return an error. */
                *size = 0;
                *offset = info->offset;
-               return (avail);
+               return ((int)avail);
        }
 }
 
index 7c38125f6d8df09b42cdc4d8cb560ca5f1484092..7ae2e0b5e91bc862c5e1e66cc52c5c0cd78f8216 100644 (file)
@@ -210,10 +210,10 @@ static int        read_body_to_string(struct archive_read *, struct tar *,
                    struct archive_string *, const void *h, size_t *);
 static int     solaris_sparse_parse(struct archive_read *, struct tar *,
                    struct archive_entry *, const char *);
-static int64_t tar_atol(const char *, unsigned);
-static int64_t tar_atol10(const char *, unsigned);
-static int64_t tar_atol256(const char *, unsigned);
-static int64_t tar_atol8(const char *, unsigned);
+static int64_t tar_atol(const char *, size_t);
+static int64_t tar_atol10(const char *, size_t);
+static int64_t tar_atol256(const char *, size_t);
+static int64_t tar_atol8(const char *, size_t);
 static int     tar_read_header(struct archive_read *, struct tar *,
                    struct archive_entry *, size_t *);
 static int     tohex(int c);
@@ -623,7 +623,7 @@ tar_read_header(struct archive_read *a, struct tar *tar,
        /* Read 512-byte header record */
        h = __archive_read_ahead(a, 512, &bytes);
        if (bytes < 0)
-               return (bytes);
+               return ((int)bytes);
        if (bytes == 0) { /* EOF at a block boundary. */
                /* Some writers do omit the block of nulls. <sigh> */
                return (ARCHIVE_EOF);
@@ -753,7 +753,7 @@ tar_read_header(struct archive_read *a, struct tar *tar,
                                bytes_read = gnu_sparse_10_read(a, tar, unconsumed);
                                tar->entry_bytes_remaining -= bytes_read;
                                if (bytes_read < 0)
-                                       return (bytes_read);
+                                       return ((int)bytes_read);
                        } else {
                                archive_set_error(&a->archive,
                                    ARCHIVE_ERRNO_MISC,
@@ -2391,7 +2391,7 @@ solaris_sparse_parse(struct archive_read *a, struct tar *tar,
  * On read, this implementation supports both extensions.
  */
 static int64_t
-tar_atol(const char *p, unsigned char_cnt)
+tar_atol(const char *p, size_t char_cnt)
 {
        /*
         * Technically, GNU tar considers a field to be in base-256
@@ -2408,7 +2408,7 @@ tar_atol(const char *p, unsigned char_cnt)
  * it does obey locale.
  */
 static int64_t
-tar_atol_base_n(const char *p, unsigned char_cnt, int base)
+tar_atol_base_n(const char *p, size_t char_cnt, int base)
 {
        int64_t l, limit, last_digit_limit;
        int digit, sign;
@@ -2448,13 +2448,13 @@ tar_atol_base_n(const char *p, unsigned char_cnt, int base)
 }
 
 static int64_t
-tar_atol8(const char *p, unsigned char_cnt)
+tar_atol8(const char *p, size_t char_cnt)
 {
        return tar_atol_base_n(p, char_cnt, 8);
 }
 
 static int64_t
-tar_atol10(const char *p, unsigned char_cnt)
+tar_atol10(const char *p, size_t char_cnt)
 {
        return tar_atol_base_n(p, char_cnt, 10);
 }
@@ -2465,7 +2465,7 @@ tar_atol10(const char *p, unsigned char_cnt)
  * ignored.
  */
 static int64_t
-tar_atol256(const char *_p, unsigned char_cnt)
+tar_atol256(const char *_p, size_t char_cnt)
 {
        int64_t l, upper_limit, lower_limit;
        const unsigned char *p = (const unsigned char *)_p;
index 92ae14566b3aa2f759717488816274b1a181a490..87f9288f19661a0483e100b8d1068f448e8a619f 100644 (file)
@@ -486,13 +486,13 @@ archive_wstring_append_from_mbs_in_codepage(struct archive_wstring *dest,
                         *  UTF-16BE/LE NFD ===> UTF-16 NFC
                         *  UTF-16BE/LE NFC ===> UTF-16 NFD
                         */
-                       count = utf16nbytes(s, length);
+                       count = (int)utf16nbytes(s, length);
                } else {
                        /*
                         *  UTF-8 NFD ===> UTF-16 NFC
                         *  UTF-8 NFC ===> UTF-16 NFD
                         */
-                       count = mbsnbytes(s, length);
+                       count = (int)mbsnbytes(s, length);
                }
                u16.s = (char *)dest->s;
                u16.length = dest->length << 1;;
@@ -507,7 +507,7 @@ archive_wstring_append_from_mbs_in_codepage(struct archive_wstring *dest,
                sc->flag = saved_flag;/* restore the saved flag. */
                return (ret);
        } else if (sc != NULL && (sc->flag & SCONV_FROM_UTF16)) {
-               count = utf16nbytes(s, length);
+               count = (int)utf16nbytes(s, length);
                count >>= 1; /* to be WCS length */
                /* Allocate memory for WCS. */
                if (NULL == archive_wstring_ensure(dest,
@@ -550,8 +550,8 @@ archive_wstring_append_from_mbs_in_codepage(struct archive_wstring *dest,
                                return (-1);
                        /* Convert MBS to WCS. */
                        count = MultiByteToWideChar(from_cp,
-                           mbflag, s, length, dest->s + dest->length,
-                           (dest->buffer_length >> 1) -1);
+                           mbflag, s, (int)length, dest->s + dest->length,
+                           (int)(dest->buffer_length >> 1) -1);
                        if (count == 0 &&
                            GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
                                /* Expand the WCS buffer. */
@@ -727,7 +727,7 @@ archive_string_append_from_wcs_in_codepage(struct archive_string *as,
                        else
                                dp = &defchar_used;
                        count = WideCharToMultiByte(to_cp, 0, ws, wslen,
-                           as->s + as->length, as->buffer_length-1, NULL, dp);
+                           as->s + as->length, (int)as->buffer_length-1, NULL, dp);
                        if (count == 0 &&
                            GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
                                /* Expand the MBS buffer and retry. */
@@ -2145,7 +2145,7 @@ invalid_mbs(const void *_p, size_t n, struct archive_string_conv *sc)
        if (codepage != CP_UTF8)
                mbflag |= MB_PRECOMPOSED;
 
-       if (MultiByteToWideChar(codepage, mbflag, p, n, NULL, 0) == 0)
+       if (MultiByteToWideChar(codepage, mbflag, p, (int)n, NULL, 0) == 0)
                return (-1); /* Invalid */
        return (0); /* Okay */
 }
@@ -2322,7 +2322,7 @@ _utf8_to_unicode(uint32_t *pwc, const char *s, size_t n)
 
        /* Invalide sequence or there are not plenty bytes. */
        if ((int)n < cnt) {
-               cnt = n;
+               cnt = (int)n;
                for (i = 1; i < cnt; i++) {
                        if ((s[i] & 0xc0) != 0x80) {
                                cnt = i;
@@ -2391,7 +2391,7 @@ _utf8_to_unicode(uint32_t *pwc, const char *s, size_t n)
                else
                        cnt = 1;
                if ((int)n < cnt)
-                       cnt = n;
+                       cnt = (int)n;
                for (i = 1; i < cnt; i++) {
                        if ((s[i] & 0xc0) != 0x80) {
                                cnt = i;
@@ -3478,9 +3478,9 @@ strncat_from_utf8_libarchive2(struct archive_string *as,
                 * Translates the wide-character into the current locale MBS.
                 */
 #if HAVE_WCRTOMB
-               n = wcrtomb(p, wc, &shift_state);
+               n = (int)wcrtomb(p, wc, &shift_state);
 #else
-               n = wctomb(p, wc);
+               n = (int)wctomb(p, wc);
 #endif
                if (n == -1)
                        return (-1);
@@ -3579,13 +3579,13 @@ win_strncat_from_utf16(struct archive_string *as, const void *_p, size_t bytes,
        do {
                defchar = 0;
                ll = WideCharToMultiByte(sc->to_cp, 0,
-                   (LPCWSTR)u16, bytes>>1, mbs, mbs_size,
+                   (LPCWSTR)u16, (int)bytes>>1, mbs, (int)mbs_size,
                        NULL, &defchar);
                if (ll == 0 &&
                    GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
                        /* Need more buffer for MBS. */
                        ll = WideCharToMultiByte(sc->to_cp, 0,
-                           (LPCWSTR)u16, bytes, NULL, 0, NULL, NULL);
+                           (LPCWSTR)u16, (int)bytes, NULL, 0, NULL, NULL);
                        if (archive_string_ensure(as, ll +1) == NULL)
                                return (-1);
                        mbs = as->s + as->length;
@@ -3662,12 +3662,12 @@ win_strncat_to_utf16(struct archive_string *as16, const void *_p,
        }
        do {
                count = MultiByteToWideChar(sc->from_cp,
-                   MB_PRECOMPOSED, s, length, (LPWSTR)u16, (int)avail>>1);
+                   MB_PRECOMPOSED, s, (int)length, (LPWSTR)u16, (int)avail>>1);
                if (count == 0 &&
                    GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
                        /* Need more buffer for UTF-16 string */
                        count = MultiByteToWideChar(sc->from_cp,
-                           MB_PRECOMPOSED, s, length, NULL, 0);
+                           MB_PRECOMPOSED, s, (int)length, NULL, 0);
                        if (archive_string_ensure(as16, (count +1) * 2)
                            == NULL)
                                return (-1);
index ffeaac9c3a6727781f3e21380eb6f714c563e8cd..34d8081cbce921e4217628d8d65668f43e04a34d 100644 (file)
@@ -243,7 +243,7 @@ __archive_mktemp(const char *tmpdir)
                        errno = ENOMEM;
                        goto exit_tmpfile;
                }
-               GetTempPathW(l, tmp);
+               GetTempPathW((DWORD)l, tmp);
                archive_wstrcpy(&temp_name, tmp);
                free(tmp);
        } else {
@@ -297,7 +297,8 @@ __archive_mktemp(const char *tmpdir)
 
                /* Generate a random file name through CryptGenRandom(). */
                p = xp;
-               if (!CryptGenRandom(hProv, (ep - p)*sizeof(wchar_t), (BYTE*)p)) {
+               if (!CryptGenRandom(hProv, (DWORD)(ep - p)*sizeof(wchar_t),
+                   (BYTE*)p)) {
                        la_dosmaperr(GetLastError());
                        goto exit_tmpfile;
                }
index 28fd8ebc9ae585ddbf336c89c90f521dbf406c09..1a7246745fb8cb8d1e3390c2f9d2f89f569424e8 100644 (file)
@@ -430,25 +430,6 @@ archive_compressor_gzip_write(struct archive_write_filter *f, const void *buff,
        return __archive_write_program_write(f, data->pdata, buff, length);
 }
 
-static int
-archive_compressor_gzip_close(struct archive_write_filter *f)
-{
-
-       f->write = archive_compressor_gzip_write;
-       r = __archive_write_program_open(f, data->pdata, as.s);
-       archive_string_free(&as);
-       return (r);
-}
-
-static int
-archive_compressor_gzip_write(struct archive_write_filter *f, const void *buff,
-    size_t length)
-{
-       struct private_data *data = (struct private_data *)f->data;
-
-       return __archive_write_program_write(f, data->pdata, buff, length);
-}
-
 static int
 archive_compressor_gzip_close(struct archive_write_filter *f)
 {
index 6535f1a2d0212592d43d2128dae55dc9230db410..23d9c150d17fc8a11dea961a61e48f1512a1aac7 100644 (file)
@@ -173,7 +173,7 @@ uu_encode(struct archive_string *as, const unsigned char *p, size_t len)
 {
        int c;
 
-       c = len;
+       c = (int)len;
        archive_strappend_char(as, c?c + 0x20:'`');
        for (; len >= 3; p += 3, len -= 3) {
                c = p[0] >> 2;
index e24f71ebeab3052b4a388ff07911f5ee989e06d1..dcb23b970eda1108c8b7d955c128295668d2fe32 100644 (file)
@@ -630,7 +630,7 @@ _7z_finish_entry(struct archive_write *a)
                        s = a->null_length;
                r = _7z_write_data(a, a->nulls, s);
                if (r < 0)
-                       return (r);
+                       return ((int)r);
        }
        zip->total_bytes_compressed += zip->stream.total_in;
        zip->total_bytes_uncompressed += zip->stream.total_out;
@@ -862,7 +862,7 @@ enc_uint64(struct archive_write *a, uint64_t val)
                numdata[0] |= mask;
                mask >>= 1;
        }
-       return (compress_out(a, numdata, i, ARCHIVE_Z_RUN));
+       return ((int)compress_out(a, numdata, i, ARCHIVE_Z_RUN));
 }
 
 static int
@@ -927,7 +927,7 @@ make_substreamsInfo(struct archive_write *a, struct coder *coders)
                if (file->size == 0)
                        break;
                archive_le32enc(crc, file->crc32);
-               r = compress_out(a, crc, 4, ARCHIVE_Z_RUN);
+               r = (int)compress_out(a, crc, 4, ARCHIVE_Z_RUN);
                if (r < 0)
                        return (r);
        }
@@ -951,7 +951,7 @@ make_streamsInfo(struct archive_write *a, uint64_t offset, uint64_t pack_size,
        int i, r;
 
        if (coders->codec == _7Z_COPY)
-               numFolders = zip->total_number_nonempty_entry;
+               numFolders = (int)zip->total_number_nonempty_entry;
        else
                numFolders = 1;
 
@@ -1047,7 +1047,7 @@ make_streamsInfo(struct archive_write *a, uint64_t offset, uint64_t pack_size,
 
                        /* Write Codec ID. */
                        codec_size &= 0x0f;
-                       r = compress_out(a, &codec_buff[8-codec_size],
+                       r = (int)compress_out(a, &codec_buff[8-codec_size],
                                codec_size, ARCHIVE_Z_RUN);
                        if (r < 0)
                                return (r);
@@ -1059,7 +1059,7 @@ make_streamsInfo(struct archive_write *a, uint64_t offset, uint64_t pack_size,
                                        return (r);
 
                                /* Write Codec properties. */
-                               r = compress_out(a, coders[i].props,
+                               r = (int)compress_out(a, coders[i].props,
                                        coders[i].prop_size, ARCHIVE_Z_RUN);
                                if (r < 0)
                                        return (r);
@@ -1105,7 +1105,7 @@ make_streamsInfo(struct archive_write *a, uint64_t offset, uint64_t pack_size,
                if (r < 0)
                        return (r);
                archive_le32enc(crc, header_crc);
-               r = compress_out(a, crc, 4, ARCHIVE_Z_RUN);
+               r = (int)compress_out(a, crc, 4, ARCHIVE_Z_RUN);
                if (r < 0)
                        return (r);
        }
@@ -1199,7 +1199,7 @@ make_time(struct archive_write *a, uint8_t type, unsigned flg, int ti)
                                b |= mask;
                        mask >>= 1;
                        if (mask == 0) {
-                               r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
+                               r = (int)compress_out(a, &b, 1, ARCHIVE_Z_RUN);
                                if (r < 0)
                                        return (r);
                                mask = 0x80;
@@ -1207,7 +1207,7 @@ make_time(struct archive_write *a, uint8_t type, unsigned flg, int ti)
                        }
                }
                if (mask != 0x80) {
-                       r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
+                       r = (int)compress_out(a, &b, 1, ARCHIVE_Z_RUN);
                        if (r < 0)
                                return (r);
                }
@@ -1228,7 +1228,7 @@ make_time(struct archive_write *a, uint8_t type, unsigned flg, int ti)
                        continue;
                archive_le64enc(filetime, utcToFiletime(file->times[ti].time,
                        file->times[ti].time_ns));
-               r = compress_out(a, filetime, 8, ARCHIVE_Z_RUN);
+               r = (int)compress_out(a, filetime, 8, ARCHIVE_Z_RUN);
                if (r < 0)
                        return (r);
        }
@@ -1299,7 +1299,7 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
                                b |= mask;
                        mask >>= 1;
                        if (mask == 0) {
-                               r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
+                               r = (int)compress_out(a, &b, 1, ARCHIVE_Z_RUN);
                                if (r < 0)
                                        return (r);
                                mask = 0x80;
@@ -1307,7 +1307,7 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
                        }
                }
                if (mask != 0x80) {
-                       r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
+                       r = (int)compress_out(a, &b, 1, ARCHIVE_Z_RUN);
                        if (r < 0)
                                return (r);
                }
@@ -1334,7 +1334,7 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
                                b |= mask;
                        mask >>= 1;
                        if (mask == 0) {
-                               r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
+                               r = (int)compress_out(a, &b, 1, ARCHIVE_Z_RUN);
                                if (r < 0)
                                        return (r);
                                mask = 0x80;
@@ -1342,7 +1342,7 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
                        }
                }
                if (mask != 0x80) {
-                       r = compress_out(a, &b, 1, ARCHIVE_Z_RUN);
+                       r = (int)compress_out(a, &b, 1, ARCHIVE_Z_RUN);
                        if (r < 0)
                                return (r);
                }
@@ -1365,7 +1365,7 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
 
        file = zip->file_list.first;
        for (;file != NULL; file = file->next) {
-               r = compress_out(a, file->utf16name, file->name_len+2,
+               r = (int)compress_out(a, file->utf16name, file->name_len+2,
                        ARCHIVE_Z_RUN);
                if (r < 0)
                        return (r);
@@ -1421,7 +1421,7 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
                        attr |= 1;/* Read Only. */
                attr |= ((uint32_t)file->mode) << 16;
                archive_le32enc(&encattr, attr);
-               r = compress_out(a, &encattr, 4, ARCHIVE_Z_RUN);
+               r = (int)compress_out(a, &encattr, 4, ARCHIVE_Z_RUN);
                if (r < 0)
                        return (r);
        }
@@ -1515,7 +1515,7 @@ file_new(struct archive_write *a, struct archive_entry *entry,
        memcpy(file->utf16name, u16, u16len);
        file->utf16name[u16len+0] = 0;
        file->utf16name[u16len+1] = 0;
-       file->name_len = u16len;
+       file->name_len = (unsigned)u16len;
        file->mode = archive_entry_mode(entry);
        if (archive_entry_filetype(entry) == AE_IFREG)
                file->size = archive_entry_size(entry);
index 0fac55d8d3b950f5ffb5838352a4c501eb428942..c1900528a6aabfce2cd6f5bfefc3addc68e484c4 100644 (file)
@@ -994,7 +994,7 @@ static void isoent_remove_child(struct isoent *, struct isoent *);
 static void    isoent_setup_directory_location(struct iso9660 *,
                    int, struct vdd *);
 static void    isoent_setup_file_location(struct iso9660 *, int);
-static int     get_path_component(char *, int, const char *);
+static int     get_path_component(char *, size_t, const char *);
 static int     isoent_tree(struct archive_write *, struct isoent **);
 static struct isoent *isoent_find_child(struct isoent *, const char *);
 static struct isoent *isoent_find_entry(struct isoent *, const char *);
@@ -2889,7 +2889,7 @@ set_directory_record_rr(unsigned char *bp, int dr_len,
                if (nmmax > 0xff)
                        nmmax = 0xff;
                while (nmlen + 5 > nmmax) {
-                       length = nmmax;
+                       length = (int)nmmax;
                        if (bp != NULL) {
                                bp[3] = length;
                                bp[5] = 0x01;/* Alternate Name continues
@@ -2912,7 +2912,7 @@ set_directory_record_rr(unsigned char *bp, int dr_len,
                                bp[4] = 1;    /* version */
                        }
                }
-               length = 5 + nmlen;
+               length = 5 + (int)nmlen;
                if (bp != NULL) {
                        bp[3] = length;
                        bp[5] = 0;
@@ -3511,7 +3511,7 @@ set_directory_record(unsigned char *p, size_t n, struct isoent *isoent,
                /* Volume Sequence Number */
                set_num_723(bp+29, iso9660->volume_sequence_number);
                /* Length of File Identifier */
-               set_num_711(bp+33, fi_len);
+               set_num_711(bp+33, (unsigned char)fi_len);
                /* File Identifier */
                switch (t) {
                case DIR_REC_VD:
@@ -3542,20 +3542,20 @@ set_directory_record(unsigned char *p, size_t n, struct isoent *isoent,
        if (t == DIR_REC_VD) {
                if (p != NULL)
                        /* Length of Directory Record */
-                       set_num_711(p, dr_len);
+                       set_num_711(p, (unsigned char)dr_len);
                else
-                       isoent->dr_len.vd = dr_len;
-               return (dr_len);
+                       isoent->dr_len.vd = (int)dr_len;
+               return ((int)dr_len);
        }
 
        /* Rockridge */
        if (iso9660->opt.rr && vdd_type != VDD_JOLIET)
-               dr_len = set_directory_record_rr(bp, dr_len,
+               dr_len = set_directory_record_rr(bp, (int)dr_len,
                    isoent, iso9660, t);
 
        if (p != NULL)
                /* Length of Directory Record */
-               set_num_711(p, dr_len);
+               set_num_711(p, (unsigned char)dr_len);
        else {
                /*
                 * Save the size which is needed to write this
@@ -3568,15 +3568,15 @@ set_directory_record(unsigned char *p, size_t n, struct isoent *isoent,
                         *  in switch ....  */
                        break;
                case DIR_REC_SELF:
-                       isoent->dr_len.self = dr_len; break;
+                       isoent->dr_len.self = (int)dr_len; break;
                case DIR_REC_PARENT:
-                       isoent->dr_len.parent = dr_len; break;
+                       isoent->dr_len.parent = (int)dr_len; break;
                case DIR_REC_NORMAL:
-                       isoent->dr_len.normal = dr_len; break;
+                       isoent->dr_len.normal = (int)dr_len; break;
                }
        }
 
-       return (dr_len);
+       return ((int)dr_len);
 }
 
 /*
@@ -4255,7 +4255,7 @@ _write_path_table(struct archive_write *a, int type_m, int depth,
                        bp = wb -1;
                }
                /* Length of Directory Identifier */
-               set_num_711(bp+1, len);
+               set_num_711(bp+1, (unsigned char)len);
                /* Extended Attribute Record Length */
                set_num_711(bp+2, 0);
                /* Location of Extent */
@@ -4278,7 +4278,7 @@ _write_path_table(struct archive_write *a, int type_m, int depth,
                        bp[9+len] = 0;
                        len++;
                }
-               wsize += 8 + len;
+               wsize += 8 + (int)len;
                bp += 8 + len;
        }
        if ((bp + 1) > wb) {
@@ -5448,7 +5448,8 @@ isoent_setup_file_location(struct iso9660 *iso9660, int location)
                size = fd_boot_image_size(iso9660->el_torito.media_type);
                if (size == 0)
                        size = (size_t)archive_entry_size(isoent->file->entry);
-               block = (size + LOGICAL_BLOCK_SIZE -1) >> LOGICAL_BLOCK_BITS;
+               block = ((int)size + LOGICAL_BLOCK_SIZE -1)
+                   >> LOGICAL_BLOCK_BITS;
                location += block;
                iso9660->total_file_block += block;
                isoent->file->content.blocks = block;
@@ -5509,10 +5510,10 @@ isoent_setup_file_location(struct iso9660 *iso9660, int location)
 }
 
 static int
-get_path_component(char *name, int n, const char *fn)
+get_path_component(char *name, size_t n, const char *fn)
 {
        char *p;
-       int l;
+       size_t l;
 
        p = strchr(fn, '/');
        if (p == NULL) {
@@ -5525,7 +5526,7 @@ get_path_component(char *name, int n, const char *fn)
        memcpy(name, fn, l);
        name[l] = '\0';
 
-       return (l);
+       return ((int)l);
 }
 
 /*
@@ -6017,7 +6018,7 @@ isoent_gen_iso9660_identifier(struct archive_write *a, struct isoent *isoent,
                char *dot, *xdot;
                int ext_off, noff, weight;
 
-               l = np->file->basename.length;
+               l = (int)np->file->basename.length;
                p = malloc(l+31+2+1);
                if (p == NULL) {
                        archive_set_error(&a->archive, ENOMEM,
@@ -6081,7 +6082,7 @@ isoent_gen_iso9660_identifier(struct archive_write *a, struct isoent *isoent,
                                ext_off = l;
                } else {
                        *dot = '.';
-                       ext_off = dot - p;
+                       ext_off = (int)(dot - p);
 
                        if (iso9660->opt.iso_level == 1) {
                                if (dot - p <= 8) {
@@ -6108,11 +6109,11 @@ isoent_gen_iso9660_identifier(struct archive_write *a, struct isoent *isoent,
                                                ext_off = dnmax;
                                }
                        } else if (l > ffmax) {
-                               int extlen = strlen(dot);
+                               int extlen = (int)strlen(dot);
                                int xdoff;
 
                                if (xdot != NULL)
-                                       xdoff = xdot - p;
+                                       xdoff = (int)(xdot - p);
                                else
                                        xdoff = 0;
 
@@ -6149,7 +6150,7 @@ isoent_gen_iso9660_identifier(struct archive_write *a, struct isoent *isoent,
                }
                /* Save an offset of a file name extension to sort files. */
                np->ext_off = ext_off;
-               np->ext_len = strlen(&p[ext_off]);
+               np->ext_len = (int)strlen(&p[ext_off]);
                np->id_len = l = ext_off + np->ext_len;
 
                /* Make an offset of the number which is used to be set
@@ -6266,10 +6267,10 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
                        p += 2;
                        lt -= 2;
                }
-               ext_off = dot - (unsigned char *)np->identifier;
+               ext_off = (int)(dot - (unsigned char *)np->identifier);
                np->ext_off = ext_off;
-               np->ext_len = l - ext_off;
-               np->id_len = l;
+               np->ext_len = (int)l - ext_off;
+               np->id_len = (int)l;
 
                /*
                 * Get a length of MBS of a full-pathname.
@@ -6283,11 +6284,11 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
                                    "No memory");
                                return (ARCHIVE_FATAL);
                        }
-                       np->mb_len = iso9660->mbs.length;
+                       np->mb_len = (int)iso9660->mbs.length;
                        if (np->mb_len != (int)np->file->basename.length)
                                weight = np->mb_len;
                } else
-                       np->mb_len = np->file->basename.length;
+                       np->mb_len = (int)np->file->basename.length;
 
                /* If a length of full-pathname is longer than 240 bytes,
                 * it violates Joliet extensions regulation. */
@@ -7508,7 +7509,7 @@ zisofs_detect_magic(struct archive_write *a, const void *buff, size_t s)
                                l = s;
                        memcpy(iso9660->zisofs.magic_buffer
                            + iso9660->zisofs.magic_cnt, buff, l);
-                       iso9660->zisofs.magic_cnt += l;
+                       iso9660->zisofs.magic_cnt += (int)l;
                        if (iso9660->zisofs.magic_cnt < magic_max)
                                return;
                }
index 8e984ca8d59b8bfb8d80125edecd345f438eac46..9c0613c9b025668a9bcae983b3fb754ca192ee5d 100644 (file)
@@ -399,7 +399,8 @@ mtree_indent(struct mtree_writer *mtree)
                                for (i = 0; i < (INDENTNAMELEN + 1 + pd); i++)
                                        archive_strappend_char(&mtree->buf, ' ');
                        } else {
-                               for (i = r -s + nd; i < (INDENTNAMELEN + 1); i++)
+                               for (i = (int)(r -s + nd);
+                                   i < (INDENTNAMELEN + 1); i++)
                                        archive_strappend_char(&mtree->buf, ' ');
                        }
                        s = ++r;
@@ -1949,10 +1950,10 @@ mtree_entry_find_child(struct mtree_entry *parent, const char *child_name)
 }
 
 static int
-get_path_component(char *name, int n, const char *fn)
+get_path_component(char *name, size_t n, const char *fn)
 {
        char *p;
-       int l;
+       size_t l;
 
        p = strchr(fn, '/');
        if (p == NULL) {
@@ -1965,7 +1966,7 @@ get_path_component(char *name, int n, const char *fn)
        memcpy(name, fn, l);
        name[l] = '\0';
 
-       return (l);
+       return ((int)l);
 }
 
 /*
index f07dd0dcbc41c1dd80d8d529af9e96857b62070e..754e5f96fe2e548fbe8ac63e7eab2ee70ed457e5 100644 (file)
@@ -691,7 +691,8 @@ archive_write_pax_header(struct archive_write *a,
                        return (r);
                if (r < ret)
                        ret = r;
-               r = archive_write_pax_data(a, mac_metadata, mac_metadata_size);
+               r = (int)archive_write_pax_data(a, mac_metadata,
+                   mac_metadata_size);
                if (r < ARCHIVE_WARN)
                        return (r);
                if (r < ret)
index 43fce771983fc03b6471508708f89aa9fff00c04..fa59cc9e90ce22d12611ff99168c96941c97579e 100644 (file)
@@ -88,7 +88,7 @@ __archive_create_child(const char *cmd, int *child_stdin, int *child_stdout)
        for (l = 0, i = 0;  acmd->argv[i] != NULL; i++) {
                if (i == 0)
                        continue;
-               l += strlen(acmd->argv[i]) + 1;
+               l += (int)strlen(acmd->argv[i]) + 1;
        }
        if (archive_string_ensure(&cmdline, l + 1) == NULL)
                goto fail;
index bb965049086724715652c6d60f90589d70356279..d442da0678ccf3943e056c39c4741bc37f64f5b0 100644 (file)
@@ -622,8 +622,8 @@ assertion_equal_string(const char *file, int line,
        if (v1 == v2 || (v1 != NULL && v2 != NULL && strcmp(v1, v2) == 0))
                return (1);
        failure_start(file, line, "%s != %s", e1, e2);
-       l1 = strlen(e1);
-       l2 = strlen(e2);
+       l1 = (int)strlen(e1);
+       l2 = (int)strlen(e2);
        if (l1 < l2)
                l1 = l2;
        strdump(e1, v1, l1, utf8);
@@ -845,8 +845,8 @@ assertion_equal_file(const char *filename, int line, const char *fn1, const char
                return (0);
        }
        for (;;) {
-               n1 = fread(buff1, 1, sizeof(buff1), f1);
-               n2 = fread(buff2, 1, sizeof(buff2), f2);
+               n1 = (int)fread(buff1, 1, sizeof(buff1), f1);
+               n2 = (int)fread(buff2, 1, sizeof(buff2), f2);
                if (n1 != n2)
                        break;
                if (n1 == 0 && n2 == 0) {
@@ -920,7 +920,7 @@ assertion_file_contents(const char *filename, int line, const void *buff, int s,
                return (0);
        }
        contents = malloc(s * 2);
-       n = fread(contents, 1, s * 2, f);
+       n = (int)fread(contents, 1, s * 2, f);
        fclose(f);
        if (n == s && memcmp(buff, contents, s) == 0) {
                free(contents);
@@ -956,9 +956,9 @@ assertion_text_file_contents(const char *filename, int line, const char *buff, c
                failure_finish(NULL);
                return (0);
        }
-       s = strlen(buff);
+       s = (int)strlen(buff);
        contents = malloc(s * 2 + 128);
-       n = fread(contents, 1, s * 2 + 128 - 1, f);
+       n = (int)fread(contents, 1, s * 2 + 128 - 1, f);
        if (n >= 0)
                contents[n] = '\0';
        fclose(f);
index c437f20a3d51a2306c04b0ae21dc33575e24049a..a03f7517a83202be73852483c345c9abdc56f539 100644 (file)
@@ -321,7 +321,7 @@ DEFINE_TEST(test_fuzz)
 
                        /* Fuzz < 1% of the bytes in the archive. */
                        memcpy(image, rawimage, size);
-                       q = size / 100;
+                       q = (int)size / 100;
                        if (!q) q = 1;
                        numbytes = (int)(rand() % q);
                        for (j = 0; j < numbytes; ++j)
index d564f0c52e5c1019059d2fee62a2fe5e0cfb7d36..67c51dd355c847ab56b82b8e1503c2147567c13e 100644 (file)
@@ -118,14 +118,15 @@ create_sparse_file(const char *path, const struct sparse *s)
                        assert(SetFilePointerEx(handle, distance,
                            NULL, FILE_CURRENT) != 0);
                } else {
-                       DWORD w, wr, size;
+                       DWORD w, wr;
+                       size_t size;
 
                        size = s->size;
                        while (size) {
                                if (size > sizeof(buff))
                                        w = sizeof(buff);
                                else
-                                       w = size;
+                                       w = (DWORD)size;
                                assert(WriteFile(handle, buff, w, &wr, NULL) != 0);
                                size -= wr;
                        }
index e0f1d6fda3dc5fa3fde126a32baf98d1cc6f18fb..c8e0f479779e55970e16d5ed222ca07b0b851a75 100644 (file)
@@ -85,7 +85,7 @@ test_1(void)
                                ws = 0x81000 - i;
                        assertEqualInt(ws,
                                archive_write_data(a, buff2, ws));
-                       i += ws;
+                       i += (long)ws;
                }
 
                /* Close out the archive. */
index 2835901db6def716504336758c1df317a63980f0..14d9b3e642ab227d6137f15b86c5c9625899fba9 100644 (file)
@@ -624,8 +624,8 @@ assertion_equal_string(const char *file, int line,
        if (v1 == v2 || (v1 != NULL && v2 != NULL && strcmp(v1, v2) == 0))
                return (1);
        failure_start(file, line, "%s != %s", e1, e2);
-       l1 = strlen(e1);
-       l2 = strlen(e2);
+       l1 = (int)strlen(e1);
+       l2 = (int)strlen(e2);
        if (l1 < l2)
                l1 = l2;
        strdump(e1, v1, l1, utf8);
@@ -847,8 +847,8 @@ assertion_equal_file(const char *filename, int line, const char *fn1, const char
                return (0);
        }
        for (;;) {
-               n1 = fread(buff1, 1, sizeof(buff1), f1);
-               n2 = fread(buff2, 1, sizeof(buff2), f2);
+               n1 = (int)fread(buff1, 1, sizeof(buff1), f1);
+               n2 = (int)fread(buff2, 1, sizeof(buff2), f2);
                if (n1 != n2)
                        break;
                if (n1 == 0 && n2 == 0) {
@@ -922,7 +922,7 @@ assertion_file_contents(const char *filename, int line, const void *buff, int s,
                return (0);
        }
        contents = malloc(s * 2);
-       n = fread(contents, 1, s * 2, f);
+       n = (int)fread(contents, 1, s * 2, f);
        fclose(f);
        if (n == s && memcmp(buff, contents, s) == 0) {
                free(contents);
@@ -958,9 +958,9 @@ assertion_text_file_contents(const char *filename, int line, const char *buff, c
                failure_finish(NULL);
                return (0);
        }
-       s = strlen(buff);
+       s = (int)strlen(buff);
        contents = malloc(s * 2 + 128);
-       n = fread(contents, 1, s * 2 + 128 - 1, f);
+       n = (int)fread(contents, 1, s * 2 + 128 - 1, f);
        if (n >= 0)
                contents[n] = '\0';
        fclose(f);
index dd49bc410ab56137ab45b5b788b74ccb860b6343..c4c1aa05745dafc178d2117538f209804d4a3638 100644 (file)
@@ -122,7 +122,7 @@ compute_filenames(void)
                if (i > 9) {
                        buff[j--] = '0' + ((i / 10) % 10);
                        if (i > 99)
-                               buff[j--] = '0' + (i / 100);
+                               buff[j--] = '0' + (char)(i / 100);
                }
                buff[j] = '_';
                /* Guard against obvious screwups in the above code. */
@@ -205,7 +205,7 @@ verify_tree(size_t limit)
                sprintf(name1, "f/%s", filenames[i]);
                if (i <= limit) {
                        assertFileExists(name1);
-                       assertFileContents(name1, strlen(name1), name1);
+                       assertFileContents(name1, (int)strlen(name1), name1);
                }
 
                sprintf(name2, "l/%s", filenames[i]);
index 70c2087c9f6ff95559ef0295254a8306e2a1a1af..bfac8ddc30f4641a51f71f8512935d81386f056f 100644 (file)
@@ -126,5 +126,5 @@ DEFINE_TEST(test_option_r)
        assertEmptyFile("extract.err");
 
        /* Verify that the second copy of f1 overwrote the first. */
-       assertFileContents(buff, strlen(buff), "f1");
+       assertFileContents(buff, (int)strlen(buff), "f1");
 }
index b95a4e30542c6718f264f0f2ec6205e9d2fbb66e..bf5dd77443b73ea944294307a0d03bf75acac078 100644 (file)
@@ -113,7 +113,7 @@ DEFINE_TEST(test_stdio)
        assertEqualInt(r, 0);
        /* Verify xvOf.out is the file contents */
        p = slurpfile(&s, "xvOf.out");
-       assert(s = 3);
+       assertEqualInt((int)s, 3);
        assertEqualMem(p, "abc", 3);
        /* TODO: Verify xvf.err */
 
index b3f3546be08fbd4309db6636f8472d69c4339164..1977ec644e6877ba88000c2f734656466d8c574c 100644 (file)
@@ -54,7 +54,7 @@ mkfullpath(char **path1, char **path2, const char *tpath, int type)
        assert(NULL != fp1);
        fp2 = malloc(l*2);
        assert(NULL != fp2);
-       l = GetFullPathNameA(tpath, l, fp1, NULL);
+       l = GetFullPathNameA(tpath, (DWORD)l, fp1, NULL);
        if ((type & 0x01) == 0) {
                for (p1 = fp1; *p1 != '\0'; p1++)
                        if (*p1 == '\\')
@@ -229,7 +229,7 @@ DEFINE_TEST(test_windows)
        assertEqualInt(0,
            systemf("%s -tf ../archive10.tar > ../list10", testprog));
        /* Check drive letters have been stripped. */
-       assertFileContents(fp2, strlen(fp2), "../list10");
+       assertFileContents(fp2, (int)strlen(fp2), "../list10");
        free(fp1);
        free(fp2);
 
@@ -241,7 +241,7 @@ DEFINE_TEST(test_windows)
        assertEqualInt(0,
            systemf("%s -tf ../archive11.tar > ../list11", testprog));
        /* Check drive letters have been stripped. */
-       assertFileContents(fp2, strlen(fp2), "../list11");
+       assertFileContents(fp2, (int)strlen(fp2), "../list11");
        free(fp1);
        free(fp2);
 
@@ -253,7 +253,7 @@ DEFINE_TEST(test_windows)
        assertEqualInt(0,
            systemf("%s -tf ../archive12.tar > ../list12", testprog));
        /* Check drive letters have been stripped. */
-       assertFileContents(fp2, strlen(fp2), "../list12");
+       assertFileContents(fp2, (int)strlen(fp2), "../list12");
        free(fp1);
        free(fp2);
 
@@ -265,7 +265,7 @@ DEFINE_TEST(test_windows)
        assertEqualInt(0,
            systemf("%s -tf ../archive13.tar > ../list13", testprog));
        /* Check drive letters have been stripped. */
-       assertFileContents(fp2, strlen(fp2), "../list13");
+       assertFileContents(fp2, (int)strlen(fp2), "../list13");
        free(fp1);
        free(fp2);
 
@@ -277,7 +277,7 @@ DEFINE_TEST(test_windows)
        assertEqualInt(0,
            systemf("%s -tf ../archive14.tar > ../list14", testprog));
        /* Check drive letters have been stripped. */
-       assertFileContents(fp2, strlen(fp2), "../list14");
+       assertFileContents(fp2, (int)strlen(fp2), "../list14");
        free(fp1);
        free(fp2);
 
@@ -289,7 +289,7 @@ DEFINE_TEST(test_windows)
        assertEqualInt(0,
            systemf("%s -tf ../archive15.tar > ../list15", testprog));
        /* Check drive letters have been stripped. */
-       assertFileContents(fp2, strlen(fp2), "../list15");
+       assertFileContents(fp2, (int)strlen(fp2), "../list15");
        free(fp1);
        free(fp2);
 
@@ -302,7 +302,7 @@ DEFINE_TEST(test_windows)
        assertEqualInt(0,
            systemf("%s -tf ../archive16.tar > ../list16", testprog));
        /* Check drive letters have been stripped. */
-       assertFileContents(fp2, strlen(fp2), "../list16");
+       assertFileContents(fp2, (int)strlen(fp2), "../list16");
        free(fp1);
        free(fp2);
 
@@ -315,7 +315,7 @@ DEFINE_TEST(test_windows)
        assertEqualInt(0,
            systemf("%s -tf ../archive17.tar > ../list17", testprog));
        /* Check drive letters have been stripped. */
-       assertFileContents(fp2, strlen(fp2), "../list17");
+       assertFileContents(fp2, (int)strlen(fp2), "../list17");
        free(fp1);
        free(fp2);
 #else