From: Michihiro NAKAJIMA Date: Thu, 4 Oct 2012 01:07:30 +0000 (+0900) Subject: Fix build failure on mingw32 for x86-64. X-Git-Tag: v3.1.0~40^2~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73d2b6ece0c86eef29fe3ca406b40b582ca4839f;p=thirdparty%2Flibarchive.git Fix build failure on mingw32 for x86-64. --- diff --git a/libarchive/archive_read_support_format_cab.c b/libarchive/archive_read_support_format_cab.c index e383f408a..f8a197f2b 100644 --- a/libarchive/archive_read_support_format_cab.c +++ b/libarchive/archive_read_support_format_cab.c @@ -2748,8 +2748,8 @@ lzx_decode_blocks(struct lzx_stream *strm, int last) struct lzx_br bre = ds->br; struct huffman *at = &(ds->at), *lt = &(ds->lt), *mt = &(ds->mt); const struct lzx_pos_tbl *pos_tbl = ds->pos_tbl; - unsigned char *outp = strm->next_out; - unsigned char *endp = outp + strm->avail_out; + unsigned char *noutp = strm->next_out; + unsigned char *endp = noutp + strm->avail_out; unsigned char *w_buff = ds->w_buff; unsigned char *at_bitlen = at->bitlen; unsigned char *lt_bitlen = lt->bitlen; @@ -2783,10 +2783,10 @@ lzx_decode_blocks(struct lzx_stream *strm, int last) ds->position_slot = position_slot; ds->r0 = r0; ds->r1 = r1; ds->r2 = r2; ds->w_pos = w_pos; - strm->avail_out = endp - outp; + strm->avail_out = endp - noutp; return (ARCHIVE_EOF); } - if (outp >= endp) + if (noutp >= endp) /* Output buffer is empty. */ goto next_data; @@ -2820,7 +2820,7 @@ lzx_decode_blocks(struct lzx_stream *strm, int last) w_buff[w_pos] = c; w_pos = (w_pos + 1) & w_mask; /* Store the decoded code to output buffer. */ - *outp++ = c; + *noutp++ = c; block_bytes_avail--; } /* @@ -2965,22 +2965,22 @@ lzx_decode_blocks(struct lzx_stream *strm, int last) if (l > w_size - w_pos) l = w_size - w_pos; } - if (outp + l >= endp) - l = endp - outp; + if (noutp + l >= endp) + l = endp - noutp; s = w_buff + copy_pos; if (l >= 8 && ((copy_pos + l < w_pos) || (w_pos + l < copy_pos))) { memcpy(w_buff + w_pos, s, l); - memcpy(outp, s, l); + memcpy(noutp, s, l); } else { unsigned char *d; int li; d = w_buff + w_pos; for (li = 0; li < l; li++) - outp[li] = d[li] = s[li]; + noutp[li] = d[li] = s[li]; } - outp += l; + noutp += l; copy_pos = (copy_pos + l) & w_mask; w_pos = (w_pos + l) & w_mask; block_bytes_avail -= l; @@ -2988,7 +2988,7 @@ lzx_decode_blocks(struct lzx_stream *strm, int last) /* A copy of current pattern ended. */ break; copy_len -= l; - if (outp >= endp) { + if (noutp >= endp) { /* Output buffer is empty. */ state = ST_COPY; goto next_data; @@ -3011,7 +3011,7 @@ next_data: ds->r0 = r0; ds->r1 = r1; ds->r2 = r2; ds->state = state; ds->w_pos = w_pos; - strm->avail_out = endp - outp; + strm->avail_out = endp - noutp; return (ARCHIVE_OK); } diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index 92f9404d4..92ae14566 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -1997,7 +1997,7 @@ static int iconv_strncat_in_locale(struct archive_string *as, const void *_p, size_t length, struct archive_string_conv *sc) { - ICONV_CONST char *inp; + ICONV_CONST char *itp; size_t remaining; iconv_t cd; char *outp; @@ -2018,12 +2018,12 @@ iconv_strncat_in_locale(struct archive_string *as, const void *_p, return (-1); cd = sc->cd; - inp = (char *)(uintptr_t)_p; + itp = (char *)(uintptr_t)_p; remaining = length; outp = as->s + as->length; avail = as->buffer_length - as->length - to_size; while (remaining >= (size_t)from_size) { - size_t result = iconv(cd, &inp, &remaining, &outp, &avail); + size_t result = iconv(cd, &itp, &remaining, &outp, &avail); if (result != (size_t)-1) break; /* Conversion completed. */ @@ -2065,7 +2065,7 @@ iconv_strncat_in_locale(struct archive_string *as, const void *_p, *outp++ = '?'; avail--; } - inp += from_size; + itp += from_size; remaining -= from_size; return_value = -1; /* failure */ } else { @@ -2202,8 +2202,8 @@ best_effort_strncat_in_locale(struct archive_string *as, const void *_p, size_t length, struct archive_string_conv *sc) { size_t remaining; - char *outp; - const uint8_t *inp; + char *otp; + const uint8_t *itp; size_t avail; int return_value = 0; /* success */ @@ -2227,41 +2227,41 @@ best_effort_strncat_in_locale(struct archive_string *as, const void *_p, return (-1); remaining = length; - inp = (const uint8_t *)_p; - outp = as->s + as->length; + itp = (const uint8_t *)_p; + otp = as->s + as->length; avail = as->buffer_length - as->length -1; - while (*inp && remaining > 0) { - if (*inp > 127 && (sc->flag & SCONV_TO_UTF8)) { + while (*itp && remaining > 0) { + if (*itp > 127 && (sc->flag & SCONV_TO_UTF8)) { if (avail < UTF8_R_CHAR_SIZE) { - as->length = outp - as->s; + as->length = otp - as->s; if (NULL == archive_string_ensure(as, as->buffer_length + remaining + UTF8_R_CHAR_SIZE)) return (-1); - outp = as->s + as->length; + otp = as->s + as->length; avail = as->buffer_length - as->length -1; } /* * When coping a string in UTF-8, unknown character * should be U+FFFD (replacement character). */ - UTF8_SET_R_CHAR(outp); - outp += UTF8_R_CHAR_SIZE; + UTF8_SET_R_CHAR(otp); + otp += UTF8_R_CHAR_SIZE; avail -= UTF8_R_CHAR_SIZE; - inp++; + itp++; remaining--; return_value = -1; - } else if (*inp > 127) { - *outp++ = '?'; - inp++; + } else if (*itp > 127) { + *otp++ = '?'; + itp++; remaining--; return_value = -1; } else { - *outp++ = (char)*inp++; + *otp++ = (char)*itp++; remaining--; } } - as->length = outp - as->s; + as->length = otp - as->s; as->s[as->length] = '\0'; return (return_value); } diff --git a/libarchive/archive_write_set_format_iso9660.c b/libarchive/archive_write_set_format_iso9660.c index c6a4c2d5b..0fac55d8d 100644 --- a/libarchive/archive_write_set_format_iso9660.c +++ b/libarchive/archive_write_set_format_iso9660.c @@ -7391,7 +7391,7 @@ zisofs_init(struct archive_write *a, struct isofile *file) struct iso9660 *iso9660 = a->format_data; #ifdef HAVE_ZLIB_H uint64_t tsize; - size_t ceil, bpsize; + size_t _ceil, bpsize; int r; #endif @@ -7430,9 +7430,9 @@ zisofs_init(struct archive_write *a, struct isofile *file) (uint32_t)archive_entry_size(file->entry); /* Calculate a size of Block Pointers of zisofs. */ - ceil = (file->zisofs.uncompressed_size + ZF_BLOCK_SIZE -1) + _ceil = (file->zisofs.uncompressed_size + ZF_BLOCK_SIZE -1) >> file->zisofs.log2_bs; - iso9660->zisofs.block_pointers_cnt = ceil + 1; + iso9660->zisofs.block_pointers_cnt = _ceil + 1; iso9660->zisofs.block_pointers_idx = 0; /* Ensure a buffer size used for Block Pointers */ @@ -7484,7 +7484,7 @@ zisofs_detect_magic(struct archive_write *a, const void *buff, size_t s) uint32_t uncompressed_size; unsigned char header_size; unsigned char log2_bs; - size_t ceil, doff; + size_t _ceil, doff; uint32_t bst, bed; int magic_max; int64_t entry_size; @@ -7532,16 +7532,16 @@ zisofs_detect_magic(struct archive_write *a, const void *buff, size_t s) return;/* Invalid or not supported header. */ /* Calculate a size of Block Pointers of zisofs. */ - ceil = (uncompressed_size + + _ceil = (uncompressed_size + (ARCHIVE_LITERAL_LL(1) << log2_bs) -1) >> log2_bs; - doff = (ceil + 1) * 4 + 16; + doff = (_ceil + 1) * 4 + 16; if (entry_size < (int64_t)doff) return;/* Invalid data. */ /* Check every Block Pointer has valid value. */ p = magic_buff + 16; endp = magic_buff + magic_max; - while (ceil && p + 8 <= endp) { + while (_ceil && p + 8 <= endp) { bst = archive_le32dec(p); if (bst != doff) return;/* Invalid data. */ @@ -7550,7 +7550,7 @@ zisofs_detect_magic(struct archive_write *a, const void *buff, size_t s) if (bed < bst || bed > entry_size) return;/* Invalid data. */ doff += bed - bst; - ceil--; + _ceil--; } file->zisofs.uncompressed_size = uncompressed_size; @@ -7793,13 +7793,13 @@ zisofs_extract_init(struct archive_write *a, struct zisofs_extract *zisofs, const unsigned char *p, size_t bytes) { size_t avail = bytes; - size_t ceil, xsize; + size_t _ceil, xsize; /* Allocate block pointers buffer. */ - ceil = (size_t)((zisofs->pz_uncompressed_size + + _ceil = (size_t)((zisofs->pz_uncompressed_size + (((int64_t)1) << zisofs->pz_log2_bs) - 1) >> zisofs->pz_log2_bs); - xsize = (ceil + 1) * 4; + xsize = (_ceil + 1) * 4; if (zisofs->block_pointers == NULL) { size_t alloc = ((xsize >> 10) + 1) << 10; zisofs->block_pointers = malloc(alloc);