Permalink
Browse files

Fix build failure on Win64.

  • Loading branch information...
1 parent 6f00b2a commit 4f54591d05a9b4d593cda12a48cf13cab43bb5db @ggcueroad ggcueroad committed Nov 7, 2012
Showing with 185 additions and 193 deletions.
  1. +10 −7 cpio/cpio.c
  2. +7 −7 cpio/test/main.c
  3. +1 −1 libarchive/archive_crypto.c
  4. +1 −1 libarchive/archive_match.c
  5. +4 −4 libarchive/archive_read_disk_windows.c
  6. +1 −1 libarchive/archive_read_extract.c
  7. +1 −1 libarchive/archive_read_support_filter_gzip.c
  8. +1 −1 libarchive/archive_read_support_filter_lrzip.c
  9. +2 −0 libarchive/archive_read_support_filter_lzop.c
  10. +2 −2 libarchive/archive_read_support_filter_uu.c
  11. +5 −5 libarchive/archive_read_support_format_7zip.c
  12. +13 −12 libarchive/archive_read_support_format_cab.c
  13. +8 −8 libarchive/archive_read_support_format_lha.c
  14. +4 −4 libarchive/archive_read_support_format_mtree.c
  15. +6 −6 libarchive/archive_read_support_format_rar.c
  16. +1 −1 libarchive/archive_read_support_format_raw.c
  17. +11 −11 libarchive/archive_read_support_format_tar.c
  18. +15 −15 libarchive/archive_string.c
  19. +3 −2 libarchive/archive_util.c
  20. +0 −19 libarchive/archive_write_add_filter_gzip.c
  21. +1 −1 libarchive/archive_write_add_filter_uuencode.c
  22. +17 −17 libarchive/archive_write_set_format_7zip.c
  23. +31 −30 libarchive/archive_write_set_format_iso9660.c
  24. +5 −4 libarchive/archive_write_set_format_mtree.c
  25. +2 −1 libarchive/archive_write_set_format_pax.c
  26. +1 −1 libarchive/filter_fork_windows.c
  27. +7 −7 libarchive/test/main.c
  28. +1 −1 libarchive/test/test_fuzz.c
  29. +3 −2 libarchive/test/test_sparse_basic.c
  30. +1 −1 libarchive/test/test_write_format_tar_sparse.c
  31. +7 −7 tar/test/main.c
  32. +2 −2 tar/test/test_copy.c
  33. +1 −1 tar/test/test_option_r.c
  34. +1 −1 tar/test/test_stdio.c
  35. +9 −9 tar/test/test_windows.c
View
@@ -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));
View
@@ -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);
@@ -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);
@@ -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)
@@ -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;
@@ -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) {
@@ -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;
@@ -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
@@ -28,7 +28,9 @@
__FBSDID("$FreeBSD$");
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
@@ -490,7 +490,7 @@ uudecode_filter_read(struct archive_read_filter *self, const void **buff)
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 @@ uudecode_filter_read(struct archive_read_filter *self, const void **buff)
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. */
@@ -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;
@@ -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,15 +3129,15 @@ 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) {
if (tbl_bits < HTBL_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;
Oops, something went wrong.

0 comments on commit 4f54591

Please sign in to comment.