Update libarchive's dist to latest changes in release branch
Git branch: release Git commit: c477edc817b4382a1d0b2ff8c7b619af13bd349e Obtained from: https://github.com/libarchive/libarchive.git
This commit is contained in:
parent
17993d47e9
commit
bfd7accf01
@ -2505,25 +2505,25 @@ main(int argc, char **argv)
|
||||
} else {
|
||||
while (*(argv) != NULL) {
|
||||
if (**argv >= '0' && **argv <= '9') {
|
||||
char *p = *argv;
|
||||
char *vp = *argv;
|
||||
start = 0;
|
||||
while (*p >= '0' && *p <= '9') {
|
||||
while (*vp >= '0' && *vp <= '9') {
|
||||
start *= 10;
|
||||
start += *p - '0';
|
||||
++p;
|
||||
start += *vp - '0';
|
||||
++vp;
|
||||
}
|
||||
if (*p == '\0') {
|
||||
if (*vp == '\0') {
|
||||
end = start;
|
||||
} else if (*p == '-') {
|
||||
++p;
|
||||
if (*p == '\0') {
|
||||
} else if (*vp == '-') {
|
||||
++vp;
|
||||
if (*vp == '\0') {
|
||||
end = limit - 1;
|
||||
} else {
|
||||
end = 0;
|
||||
while (*p >= '0' && *p <= '9') {
|
||||
while (*vp >= '0' && *vp <= '9') {
|
||||
end *= 10;
|
||||
end += *p - '0';
|
||||
++p;
|
||||
end += *vp - '0';
|
||||
++vp;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -52,6 +52,9 @@ static int acl_special(struct archive_acl *acl,
|
||||
int type, int permset, int tag);
|
||||
static struct archive_acl_entry *acl_new_entry(struct archive_acl *acl,
|
||||
int type, int permset, int tag, int id);
|
||||
static int archive_acl_add_entry_len_l(struct archive_acl *acl,
|
||||
int type, int permset, int tag, int id, const char *name,
|
||||
size_t len, struct archive_string_conv *sc);
|
||||
static int isint_w(const wchar_t *start, const wchar_t *end, int *result);
|
||||
static int ismode_w(const wchar_t *start, const wchar_t *end, int *result);
|
||||
static void next_field_w(const wchar_t **wp, const wchar_t **start,
|
||||
@ -65,7 +68,7 @@ static int isint(const char *start, const char *end, int *result);
|
||||
static int ismode(const char *start, const char *end, int *result);
|
||||
static void next_field(const char **p, const char **start,
|
||||
const char **end, char *sep);
|
||||
static int prefix(const char *start, const char *end,
|
||||
static int prefix_c(const char *start, const char *end,
|
||||
const char *test);
|
||||
static void append_entry(char **p, const char *prefix, int tag,
|
||||
const char *name, int perm, int id);
|
||||
@ -152,7 +155,7 @@ archive_acl_add_entry_w_len(struct archive_acl *acl,
|
||||
return ARCHIVE_OK;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
archive_acl_add_entry_len_l(struct archive_acl *acl,
|
||||
int type, int permset, int tag, int id, const char *name, size_t len,
|
||||
struct archive_string_conv *sc)
|
||||
@ -1088,7 +1091,7 @@ archive_acl_parse_l(struct archive_acl *acl,
|
||||
type = default_type;
|
||||
|
||||
name.start = name.end = NULL;
|
||||
if (prefix(field[0].start, field[0].end, "user")) {
|
||||
if (prefix_c(field[0].start, field[0].end, "user")) {
|
||||
if (!ismode(field[2].start, field[2].end, &permset))
|
||||
return (ARCHIVE_WARN);
|
||||
if (id != -1 || field[1].start < field[1].end) {
|
||||
@ -1096,7 +1099,7 @@ archive_acl_parse_l(struct archive_acl *acl,
|
||||
name = field[1];
|
||||
} else
|
||||
tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
|
||||
} else if (prefix(field[0].start, field[0].end, "group")) {
|
||||
} else if (prefix_c(field[0].start, field[0].end, "group")) {
|
||||
if (!ismode(field[2].start, field[2].end, &permset))
|
||||
return (ARCHIVE_WARN);
|
||||
if (id != -1 || field[1].start < field[1].end) {
|
||||
@ -1104,7 +1107,7 @@ archive_acl_parse_l(struct archive_acl *acl,
|
||||
name = field[1];
|
||||
} else
|
||||
tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
|
||||
} else if (prefix(field[0].start, field[0].end, "other")) {
|
||||
} else if (prefix_c(field[0].start, field[0].end, "other")) {
|
||||
if (fields == 2
|
||||
&& field[1].start < field[1].end
|
||||
&& ismode(field[1].start, field[1].end, &permset)) {
|
||||
@ -1117,7 +1120,7 @@ archive_acl_parse_l(struct archive_acl *acl,
|
||||
} else
|
||||
return (ARCHIVE_WARN);
|
||||
tag = ARCHIVE_ENTRY_ACL_OTHER;
|
||||
} else if (prefix(field[0].start, field[0].end, "mask")) {
|
||||
} else if (prefix_c(field[0].start, field[0].end, "mask")) {
|
||||
if (fields == 2
|
||||
&& field[1].start < field[1].end
|
||||
&& ismode(field[1].start, field[1].end, &permset)) {
|
||||
@ -1246,7 +1249,7 @@ next_field(const char **p, const char **start,
|
||||
* This makes it easy to handle the obvious abbreviations: 'u' for 'user', etc.
|
||||
*/
|
||||
static int
|
||||
prefix(const char *start, const char *end, const char *test)
|
||||
prefix_c(const char *start, const char *end, const char *test)
|
||||
{
|
||||
if (start == end)
|
||||
return (0);
|
||||
|
@ -152,7 +152,7 @@ typedef
|
||||
CPpmd_Byte_Ref;
|
||||
|
||||
#define PPMD_SetAllBitsIn256Bytes(p) \
|
||||
{ unsigned i; for (i = 0; i < 256 / sizeof(p[0]); i += 8) { \
|
||||
p[i+7] = p[i+6] = p[i+5] = p[i+4] = p[i+3] = p[i+2] = p[i+1] = p[i+0] = ~(size_t)0; }}
|
||||
{ unsigned j; for (j = 0; j < 256 / sizeof(p[0]); j += 8) { \
|
||||
p[j+7] = p[j+6] = p[j+5] = p[j+4] = p[j+3] = p[j+2] = p[j+1] = p[j+0] = ~(size_t)0; }}
|
||||
|
||||
#endif
|
||||
|
@ -149,6 +149,7 @@ memory_read_seek(struct archive *a, void *client_data, int64_t offset, int whenc
|
||||
{
|
||||
struct read_memory_data *mine = (struct read_memory_data *)client_data;
|
||||
|
||||
(void)a; /* UNUSED */
|
||||
switch (whence) {
|
||||
case SEEK_SET:
|
||||
mine->p = mine->start + offset;
|
||||
|
@ -481,7 +481,7 @@ check_7zip_header_in_sfx(const char *p)
|
||||
* Magic Code, so we should do this in order not to
|
||||
* make a mis-detection.
|
||||
*/
|
||||
if (crc32(0, (unsigned char *)p + 12, 20)
|
||||
if (crc32(0, (const unsigned char *)p + 12, 20)
|
||||
!= archive_le32dec(p + 8))
|
||||
return (6);
|
||||
/* Hit the header! */
|
||||
@ -630,7 +630,7 @@ archive_read_format_7zip_read_header(struct archive_read *a,
|
||||
if (zip_entry->flg & ATIME_IS_SET)
|
||||
archive_entry_set_atime(entry, zip_entry->atime,
|
||||
zip_entry->atime_ns);
|
||||
if (zip_entry->ssIndex != -1) {
|
||||
if (zip_entry->ssIndex != (uint32_t)-1) {
|
||||
zip->entry_bytes_remaining =
|
||||
zip->si.ss.unpackSizes[zip_entry->ssIndex];
|
||||
archive_entry_set_size(entry, zip->entry_bytes_remaining);
|
||||
@ -646,7 +646,6 @@ archive_read_format_7zip_read_header(struct archive_read *a,
|
||||
if ((zip_entry->mode & AE_IFMT) == AE_IFLNK) {
|
||||
unsigned char *symname = NULL;
|
||||
size_t symsize = 0;
|
||||
int r;
|
||||
|
||||
/*
|
||||
* Symbolic-name is recorded as its contents. We have to
|
||||
@ -1985,7 +1984,7 @@ folder_uncompressed_size(struct _7z_folder *f)
|
||||
while (--n >= 0) {
|
||||
unsigned i;
|
||||
for (i = 0; i < pairs; i++) {
|
||||
if (f->bindPairs[i].outIndex == n)
|
||||
if (f->bindPairs[i].outIndex == (uint64_t)n)
|
||||
break;
|
||||
}
|
||||
if (i >= pairs)
|
||||
@ -2517,17 +2516,17 @@ read_Header(struct archive_read *a, struct _7z_header_info *h,
|
||||
|
||||
#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
|
||||
static void
|
||||
fileTimeToUtc(uint64_t fileTime, time_t *time, long *ns)
|
||||
fileTimeToUtc(uint64_t fileTime, time_t *timep, long *ns)
|
||||
{
|
||||
|
||||
if (fileTime >= EPOC_TIME) {
|
||||
fileTime -= EPOC_TIME;
|
||||
/* milli seconds base */
|
||||
*time = (time_t)(fileTime / 10000000);
|
||||
*timep = (time_t)(fileTime / 10000000);
|
||||
/* nano seconds base */
|
||||
*ns = (long)(fileTime % 10000000) * 100;
|
||||
} else {
|
||||
*time = 0;
|
||||
*timep = 0;
|
||||
*ns = 0;
|
||||
}
|
||||
}
|
||||
@ -2695,7 +2694,8 @@ slurp_central_directory(struct archive_read *a, struct _7zip *zip,
|
||||
}
|
||||
|
||||
/* CRC check. */
|
||||
if (crc32(0, (unsigned char *)p + 12, 20) != archive_le32dec(p + 8)) {
|
||||
if (crc32(0, (const unsigned char *)p + 12, 20)
|
||||
!= archive_le32dec(p + 8)) {
|
||||
archive_set_error(&a->archive, -1, "Header CRC error");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
@ -2714,7 +2714,7 @@ slurp_central_directory(struct archive_read *a, struct _7zip *zip,
|
||||
}
|
||||
__archive_read_consume(a, 32);
|
||||
if (next_header_offset != 0) {
|
||||
if (bytes_avail >= next_header_offset)
|
||||
if (bytes_avail >= (ssize_t)next_header_offset)
|
||||
__archive_read_consume(a, next_header_offset);
|
||||
else if (__archive_read_seek(a,
|
||||
next_header_offset + zip->seek_base, SEEK_SET) < 0)
|
||||
@ -2827,7 +2827,7 @@ get_uncompressed_data(struct archive_read *a, const void **buff, size_t size,
|
||||
struct _7zip *zip = (struct _7zip *)a->format->data;
|
||||
ssize_t bytes_avail;
|
||||
|
||||
if (zip->codec == _7Z_COPY && zip->codec2 == -1) {
|
||||
if (zip->codec == _7Z_COPY && zip->codec2 == (unsigned long)-1) {
|
||||
/* Copy mode. */
|
||||
|
||||
/*
|
||||
@ -2886,7 +2886,7 @@ extract_pack_stream(struct archive_read *a, size_t minimum)
|
||||
ssize_t bytes_avail;
|
||||
int r;
|
||||
|
||||
if (zip->codec == _7Z_COPY && zip->codec2 == -1) {
|
||||
if (zip->codec == _7Z_COPY && zip->codec2 == (unsigned long)-1) {
|
||||
if (minimum == 0)
|
||||
minimum = 1;
|
||||
if (__archive_read_ahead(a, minimum, &bytes_avail) == NULL
|
||||
@ -2896,10 +2896,10 @@ extract_pack_stream(struct archive_read *a, size_t minimum)
|
||||
"Truncated 7-Zip file body");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
if (bytes_avail > zip->pack_stream_inbytes_remaining)
|
||||
if (bytes_avail > (ssize_t)zip->pack_stream_inbytes_remaining)
|
||||
bytes_avail = zip->pack_stream_inbytes_remaining;
|
||||
zip->pack_stream_inbytes_remaining -= bytes_avail;
|
||||
if (bytes_avail > zip->folder_outbytes_remaining)
|
||||
if (bytes_avail > (ssize_t)zip->folder_outbytes_remaining)
|
||||
bytes_avail = zip->folder_outbytes_remaining;
|
||||
zip->folder_outbytes_remaining -= bytes_avail;
|
||||
zip->uncompressed_buffer_bytes_remaining = bytes_avail;
|
||||
@ -3041,7 +3041,7 @@ static int
|
||||
seek_pack(struct archive_read *a)
|
||||
{
|
||||
struct _7zip *zip = (struct _7zip *)a->format->data;
|
||||
uint64_t pack_offset;
|
||||
int64_t pack_offset;
|
||||
|
||||
if (zip->pack_stream_remaining <= 0) {
|
||||
archive_set_error(&(a->archive),
|
||||
@ -3321,7 +3321,7 @@ setup_decode_folder(struct archive_read *a, struct _7z_folder *folder,
|
||||
if ((r = seek_pack(a)) < 0)
|
||||
return (r);
|
||||
|
||||
if (sunpack[i] == -1)
|
||||
if (sunpack[i] == (uint64_t)-1)
|
||||
zip->folder_outbytes_remaining =
|
||||
zip->pack_stream_inbytes_remaining;
|
||||
else
|
||||
@ -3506,16 +3506,16 @@ x86_Convert(struct _7zip *zip, uint8_t *data, size_t size)
|
||||
uint32_t dest;
|
||||
for (;;) {
|
||||
uint8_t b;
|
||||
int index;
|
||||
int b_index;
|
||||
|
||||
dest = src - (ip + (uint32_t)bufferPos);
|
||||
if (prevMask == 0)
|
||||
break;
|
||||
index = kMaskToBitNumber[prevMask] * 8;
|
||||
b = (uint8_t)(dest >> (24 - index));
|
||||
b_index = kMaskToBitNumber[prevMask] * 8;
|
||||
b = (uint8_t)(dest >> (24 - b_index));
|
||||
if (!Test86MSByte(b))
|
||||
break;
|
||||
src = dest ^ ((1 << (32 - index)) - 1);
|
||||
src = dest ^ ((1 << (32 - b_index)) - 1);
|
||||
}
|
||||
p[4] = (uint8_t)(~(((dest >> 24) & 1) - 1));
|
||||
p[3] = (uint8_t)(dest >> 16);
|
||||
@ -3556,7 +3556,7 @@ x86_Convert(struct _7zip *zip, uint8_t *data, size_t size)
|
||||
#define RC_READ_BYTE (*buffer++)
|
||||
#define RC_TEST { if (buffer == bufferLim) return SZ_ERROR_DATA; }
|
||||
#define RC_INIT2 zip->bcj2_code = 0; zip->bcj2_range = 0xFFFFFFFF; \
|
||||
{ int i; for (i = 0; i < 5; i++) { RC_TEST; zip->bcj2_code = (zip->bcj2_code << 8) | RC_READ_BYTE; }}
|
||||
{ int ii; for (ii = 0; ii < 5; ii++) { RC_TEST; zip->bcj2_code = (zip->bcj2_code << 8) | RC_READ_BYTE; }}
|
||||
|
||||
#define NORMALIZE if (zip->bcj2_range < kTopValue) { RC_TEST; zip->bcj2_range <<= 8; zip->bcj2_code = (zip->bcj2_code << 8) | RC_READ_BYTE; }
|
||||
|
||||
@ -3622,14 +3622,14 @@ Bcj2_Decode(struct _7zip *zip, uint8_t *outBuf, size_t outSize)
|
||||
|
||||
if (zip->bcj_state == 1) {
|
||||
while (limit != 0) {
|
||||
uint8_t b = buf0[inPos];
|
||||
outBuf[outPos++] = b;
|
||||
if (IsJ(zip->bcj2_prevByte, b)) {
|
||||
uint8_t bb = buf0[inPos];
|
||||
outBuf[outPos++] = bb;
|
||||
if (IsJ(zip->bcj2_prevByte, bb)) {
|
||||
zip->bcj_state = 2;
|
||||
break;
|
||||
}
|
||||
inPos++;
|
||||
zip->bcj2_prevByte = b;
|
||||
zip->bcj2_prevByte = bb;
|
||||
limit--;
|
||||
}
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ static int lzx_read_bitlen(struct lzx_stream *, struct huffman *, int);
|
||||
static int lzx_huffman_init(struct huffman *, size_t, int);
|
||||
static void lzx_huffman_free(struct huffman *);
|
||||
static int lzx_make_huffman_table(struct huffman *);
|
||||
static int inline lzx_decode_huffman(struct huffman *, unsigned);
|
||||
static inline int lzx_decode_huffman(struct huffman *, unsigned);
|
||||
static int lzx_decode_huffman_tree(struct huffman *, unsigned, int);
|
||||
|
||||
|
||||
|
@ -1756,7 +1756,8 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
|
||||
*/
|
||||
if (location > 0 &&
|
||||
(location + ((fsize + iso9660->logical_block_size -1)
|
||||
/ iso9660->logical_block_size)) > iso9660->volume_block) {
|
||||
/ iso9660->logical_block_size))
|
||||
> (uint32_t)iso9660->volume_block) {
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||
"Invalid location of extent of file");
|
||||
return (NULL);
|
||||
@ -2254,7 +2255,7 @@ register_CE(struct archive_read *a, int32_t location,
|
||||
offset >= file->offset) ||
|
||||
offset < iso9660->current_position ||
|
||||
(((uint64_t)file->ce_offset) + file->ce_size)
|
||||
> iso9660->logical_block_size ||
|
||||
> (uint64_t)iso9660->logical_block_size ||
|
||||
offset + file->ce_offset + file->ce_size
|
||||
> iso9660->volume_size) {
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||
|
@ -289,7 +289,7 @@ static void lzh_huffman_free(struct huffman *);
|
||||
static int lzh_read_pt_bitlen(struct lzh_stream *, int start, int end);
|
||||
static int lzh_make_fake_table(struct huffman *, uint16_t);
|
||||
static int lzh_make_huffman_table(struct huffman *);
|
||||
static int inline lzh_decode_huffman(struct huffman *, unsigned);
|
||||
static inline int lzh_decode_huffman(struct huffman *, unsigned);
|
||||
static int lzh_decode_huffman_tree(struct huffman *, unsigned, int);
|
||||
|
||||
|
||||
|
@ -101,6 +101,7 @@ struct mtree {
|
||||
int64_t cur_size;
|
||||
};
|
||||
|
||||
static int bid_keycmp(const char *, const char *, ssize_t);
|
||||
static int cleanup(struct archive_read *);
|
||||
static int mtree_bid(struct archive_read *, int);
|
||||
static int parse_file(struct archive_read *, struct archive_entry *,
|
||||
@ -317,7 +318,7 @@ next_line(struct archive_read *a,
|
||||
* Returns the length of a mtree keyword if matched.
|
||||
* Returns 0 if not matched.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
bid_keycmp(const char *p, const char *key, ssize_t len)
|
||||
{
|
||||
int match_len = 0;
|
||||
|
@ -1021,7 +1021,7 @@ read_header(struct archive_read *a, struct archive_entry *entry,
|
||||
char *strp;
|
||||
char packed_size[8];
|
||||
char unp_size[8];
|
||||
int time;
|
||||
int ttime;
|
||||
struct archive_string_conv *sconv, *fn_sconv;
|
||||
unsigned long crc32_val;
|
||||
int ret = (ARCHIVE_OK), ret2;
|
||||
@ -1100,8 +1100,8 @@ read_header(struct archive_read *a, struct archive_entry *entry,
|
||||
|
||||
rar->compression_method = file_header.method;
|
||||
|
||||
time = archive_le32dec(file_header.file_time);
|
||||
rar->mtime = get_time(time);
|
||||
ttime = archive_le32dec(file_header.file_time);
|
||||
rar->mtime = get_time(ttime);
|
||||
|
||||
rar->file_crc = archive_le32dec(file_header.file_crc);
|
||||
|
||||
@ -1381,15 +1381,15 @@ read_header(struct archive_read *a, struct archive_entry *entry,
|
||||
}
|
||||
|
||||
static time_t
|
||||
get_time(int time)
|
||||
get_time(int ttime)
|
||||
{
|
||||
struct tm tm;
|
||||
tm.tm_sec = 2 * (time & 0x1f);
|
||||
tm.tm_min = (time >> 5) & 0x3f;
|
||||
tm.tm_hour = (time >> 11) & 0x1f;
|
||||
tm.tm_mday = (time >> 16) & 0x1f;
|
||||
tm.tm_mon = ((time >> 21) & 0x0f) - 1;
|
||||
tm.tm_year = ((time >> 25) & 0x7f) + 80;
|
||||
tm.tm_sec = 2 * (ttime & 0x1f);
|
||||
tm.tm_min = (ttime >> 5) & 0x3f;
|
||||
tm.tm_hour = (ttime >> 11) & 0x1f;
|
||||
tm.tm_mday = (ttime >> 16) & 0x1f;
|
||||
tm.tm_mon = ((ttime >> 21) & 0x0f) - 1;
|
||||
tm.tm_year = ((ttime >> 25) & 0x7f) + 80;
|
||||
tm.tm_isdst = -1;
|
||||
return mktime(&tm);
|
||||
}
|
||||
@ -1398,7 +1398,7 @@ static int
|
||||
read_exttime(const char *p, struct rar *rar, const char *endp)
|
||||
{
|
||||
unsigned rmode, flags, rem, j, count;
|
||||
int time, i;
|
||||
int ttime, i;
|
||||
struct tm *tm;
|
||||
time_t t;
|
||||
long nsec;
|
||||
@ -1420,8 +1420,8 @@ read_exttime(const char *p, struct rar *rar, const char *endp)
|
||||
{
|
||||
if (p + 4 > endp)
|
||||
return (-1);
|
||||
time = archive_le32dec(p);
|
||||
t = get_time(time);
|
||||
ttime = archive_le32dec(p);
|
||||
t = get_time(ttime);
|
||||
p += 4;
|
||||
}
|
||||
rem = 0;
|
||||
@ -2408,9 +2408,9 @@ expand(struct archive_read *a, int64_t end)
|
||||
|
||||
if ((lensymbol = read_next_symbol(a, &rar->lengthcode)) < 0)
|
||||
goto bad_data;
|
||||
if (lensymbol > sizeof(lengthbases)/sizeof(lengthbases[0]))
|
||||
if (lensymbol > (int)(sizeof(lengthbases)/sizeof(lengthbases[0])))
|
||||
goto bad_data;
|
||||
if (lensymbol > sizeof(lengthbits)/sizeof(lengthbits[0]))
|
||||
if (lensymbol > (int)(sizeof(lengthbits)/sizeof(lengthbits[0])))
|
||||
goto bad_data;
|
||||
len = lengthbases[lensymbol] + 2;
|
||||
if (lengthbits[lensymbol] > 0) {
|
||||
@ -2442,9 +2442,9 @@ expand(struct archive_read *a, int64_t end)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (symbol-271 > sizeof(lengthbases)/sizeof(lengthbases[0]))
|
||||
if (symbol-271 > (int)(sizeof(lengthbases)/sizeof(lengthbases[0])))
|
||||
goto bad_data;
|
||||
if (symbol-271 > sizeof(lengthbits)/sizeof(lengthbits[0]))
|
||||
if (symbol-271 > (int)(sizeof(lengthbits)/sizeof(lengthbits[0])))
|
||||
goto bad_data;
|
||||
len = lengthbases[symbol-271]+3;
|
||||
if(lengthbits[symbol-271] > 0) {
|
||||
@ -2456,9 +2456,9 @@ expand(struct archive_read *a, int64_t end)
|
||||
|
||||
if ((offssymbol = read_next_symbol(a, &rar->offsetcode)) < 0)
|
||||
goto bad_data;
|
||||
if (offssymbol > sizeof(offsetbases)/sizeof(offsetbases[0]))
|
||||
if (offssymbol > (int)(sizeof(offsetbases)/sizeof(offsetbases[0])))
|
||||
goto bad_data;
|
||||
if (offssymbol > sizeof(offsetbits)/sizeof(offsetbits[0]))
|
||||
if (offssymbol > (int)(sizeof(offsetbits)/sizeof(offsetbits[0])))
|
||||
goto bad_data;
|
||||
offs = offsetbases[offssymbol]+1;
|
||||
if(offsetbits[offssymbol] > 0)
|
||||
|
@ -2333,6 +2333,8 @@ solaris_sparse_parse(struct archive_read *a, struct tar *tar,
|
||||
int64_t start, end;
|
||||
int hole = 1;
|
||||
|
||||
(void)entry; /* UNUSED */
|
||||
|
||||
end = 0;
|
||||
if (*p == ' ')
|
||||
p++;
|
||||
|
@ -2624,6 +2624,7 @@ strappend_base64(struct xar *xar,
|
||||
const unsigned char *b;
|
||||
size_t len;
|
||||
|
||||
(void)xar; /* UNUSED */
|
||||
len = 0;
|
||||
out = buff;
|
||||
b = (const unsigned char *)s;
|
||||
|
@ -140,6 +140,9 @@ static time_t zip_time(const char *);
|
||||
static const char *compression_name(int compression);
|
||||
static void process_extra(const char *, size_t, struct zip_entry *);
|
||||
|
||||
int archive_read_support_format_zip_streamable(struct archive *);
|
||||
int archive_read_support_format_zip_seekable(struct archive *);
|
||||
|
||||
int
|
||||
archive_read_support_format_zip_streamable(struct archive *_a)
|
||||
{
|
||||
@ -716,8 +719,8 @@ compression_name(int compression)
|
||||
"deflation"
|
||||
};
|
||||
|
||||
if (compression <
|
||||
sizeof(compression_names)/sizeof(compression_names[0]))
|
||||
if (0 <= compression && compression <
|
||||
(int)(sizeof(compression_names)/sizeof(compression_names[0])))
|
||||
return compression_names[compression];
|
||||
else
|
||||
return "??";
|
||||
@ -860,6 +863,8 @@ zip_read_data_none(struct archive_read *a, const void **_buff,
|
||||
const char *buff;
|
||||
ssize_t bytes_avail;
|
||||
|
||||
(void)offset; /* UNUSED */
|
||||
|
||||
zip = (struct zip *)(a->format->data);
|
||||
|
||||
if (zip->entry->flags & ZIP_LENGTH_AT_END) {
|
||||
@ -940,6 +945,8 @@ zip_read_data_deflate(struct archive_read *a, const void **buff,
|
||||
const void *compressed_buff;
|
||||
int r;
|
||||
|
||||
(void)offset; /* UNUSED */
|
||||
|
||||
zip = (struct zip *)(a->format->data);
|
||||
|
||||
/* If the buffer hasn't been allocated, allocate it now. */
|
||||
|
@ -1286,7 +1286,7 @@ create_sconv_object(const char *fc, const char *tc,
|
||||
* Check if "from charset" and "to charset" are the same.
|
||||
*/
|
||||
if (strcmp(fc, tc) == 0 ||
|
||||
(sc->from_cp != -1 && sc->from_cp == sc->to_cp))
|
||||
(sc->from_cp != (unsigned)-1 && sc->from_cp == sc->to_cp))
|
||||
sc->same = 1;
|
||||
else
|
||||
sc->same = 0;
|
||||
|
@ -2068,7 +2068,7 @@ set_times(struct archive_write_disk *a,
|
||||
time_t atime, long atime_nanos,
|
||||
time_t birthtime, long birthtime_nanos,
|
||||
time_t mtime, long mtime_nanos,
|
||||
time_t ctime, long ctime_nanos)
|
||||
time_t cctime, long ctime_nanos)
|
||||
{
|
||||
/* Note: set_time doesn't use libarchive return conventions!
|
||||
* It uses syscall conventions. So 0 here instead of ARCHIVE_OK. */
|
||||
@ -2083,9 +2083,12 @@ set_times(struct archive_write_disk *a,
|
||||
if (a->user_uid == 0 &&
|
||||
set_time_tru64(fd, mode, name,
|
||||
atime, atime_nanos, mtime,
|
||||
mtime_nanos, ctime, ctime_nanos) == 0) {
|
||||
mtime_nanos, cctime, ctime_nanos) == 0) {
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
#else /* Tru64 */
|
||||
(void)cctime; /* UNUSED */
|
||||
(void)ctime_nanos; /* UNUSED */
|
||||
#endif /* Tru64 */
|
||||
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME
|
||||
@ -2117,11 +2120,11 @@ set_times(struct archive_write_disk *a,
|
||||
static int
|
||||
set_times_from_entry(struct archive_write_disk *a)
|
||||
{
|
||||
time_t atime, birthtime, mtime, ctime;
|
||||
time_t atime, birthtime, mtime, cctime;
|
||||
long atime_nsec, birthtime_nsec, mtime_nsec, ctime_nsec;
|
||||
|
||||
/* Suitable defaults. */
|
||||
atime = birthtime = mtime = ctime = a->start_time;
|
||||
atime = birthtime = mtime = cctime = a->start_time;
|
||||
atime_nsec = birthtime_nsec = mtime_nsec = ctime_nsec = 0;
|
||||
|
||||
/* If no time was provided, we're done. */
|
||||
@ -2145,7 +2148,7 @@ set_times_from_entry(struct archive_write_disk *a)
|
||||
mtime_nsec = archive_entry_mtime_nsec(a->entry);
|
||||
}
|
||||
if (archive_entry_ctime_is_set(a->entry)) {
|
||||
ctime = archive_entry_ctime(a->entry);
|
||||
cctime = archive_entry_ctime(a->entry);
|
||||
ctime_nsec = archive_entry_ctime_nsec(a->entry);
|
||||
}
|
||||
|
||||
@ -2153,7 +2156,7 @@ set_times_from_entry(struct archive_write_disk *a)
|
||||
atime, atime_nsec,
|
||||
birthtime, birthtime_nsec,
|
||||
mtime, mtime_nsec,
|
||||
ctime, ctime_nsec);
|
||||
cctime, ctime_nsec);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -512,7 +512,7 @@ static int
|
||||
write_to_temp(struct archive_write *a, const void *buff, size_t s)
|
||||
{
|
||||
struct _7zip *zip;
|
||||
unsigned char *p;
|
||||
const unsigned char *p;
|
||||
ssize_t ws;
|
||||
|
||||
zip = (struct _7zip *)a->format_data;
|
||||
@ -530,7 +530,7 @@ write_to_temp(struct archive_write *a, const void *buff, size_t s)
|
||||
}
|
||||
}
|
||||
|
||||
p = (unsigned char *)buff;
|
||||
p = (const unsigned char *)buff;
|
||||
while (s) {
|
||||
ws = write(zip->temp_fd, p, s);
|
||||
if (ws < 0) {
|
||||
@ -846,7 +846,7 @@ enc_uint64(struct archive_write *a, uint64_t val)
|
||||
int i;
|
||||
|
||||
numdata[0] = 0;
|
||||
for (i = 1; i < sizeof(numdata); i++) {
|
||||
for (i = 1; i < (int)sizeof(numdata); i++) {
|
||||
if (val < mask) {
|
||||
numdata[0] |= (uint8_t)val;
|
||||
break;
|
||||
@ -1130,11 +1130,11 @@ make_streamsInfo(struct archive_write *a, uint64_t offset, uint64_t pack_size,
|
||||
|
||||
#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
|
||||
static uint64_t
|
||||
utcToFiletime(time_t time, long ns)
|
||||
utcToFiletime(time_t t, long ns)
|
||||
{
|
||||
uint64_t fileTime;
|
||||
|
||||
fileTime = time;
|
||||
fileTime = t;
|
||||
fileTime *= 10000000;
|
||||
fileTime += ns / 100;
|
||||
fileTime += EPOC_TIME;
|
||||
@ -1451,8 +1451,8 @@ static int
|
||||
file_cmp_node(const struct archive_rb_node *n1,
|
||||
const struct archive_rb_node *n2)
|
||||
{
|
||||
struct file *f1 = (struct file *)n1;
|
||||
struct file *f2 = (struct file *)n2;
|
||||
const struct file *f1 = (const struct file *)n1;
|
||||
const struct file *f2 = (const struct file *)n2;
|
||||
|
||||
if (f1->name_len == f2->name_len)
|
||||
return (memcmp(f1->utf16name, f2->utf16name, f1->name_len));
|
||||
@ -1462,7 +1462,7 @@ file_cmp_node(const struct archive_rb_node *n1,
|
||||
static int
|
||||
file_cmp_key(const struct archive_rb_node *n, const void *key)
|
||||
{
|
||||
struct file *f = (struct file *)n;
|
||||
const struct file *f = (const struct file *)n;
|
||||
|
||||
return (f->name_len - *(const char *)key);
|
||||
}
|
||||
@ -2179,6 +2179,8 @@ compression_code_ppmd(struct archive *a,
|
||||
{
|
||||
struct ppmd_stream *strm;
|
||||
|
||||
(void)a; /* UNUSED */
|
||||
|
||||
strm = (struct ppmd_stream *)lastrm->real_stream;
|
||||
|
||||
/* Copy encoded data if there are remaining bytes from previous call. */
|
||||
@ -2219,6 +2221,8 @@ compression_end_ppmd(struct archive *a, struct la_zstream *lastrm)
|
||||
{
|
||||
struct ppmd_stream *strm;
|
||||
|
||||
(void)a; /* UNUSED */
|
||||
|
||||
strm = (struct ppmd_stream *)lastrm->real_stream;
|
||||
__archive_ppmd7_functions.Ppmd7_Free(&strm->ppmd7_context, &g_szalloc);
|
||||
free(strm->buff);
|
||||
|
@ -4508,8 +4508,7 @@ write_file_descriptors(struct archive_write *a)
|
||||
|
||||
/* Write the boot file contents. */
|
||||
if (iso9660->el_torito.boot != NULL) {
|
||||
struct isofile *file = iso9660->el_torito.boot->file;
|
||||
|
||||
file = iso9660->el_torito.boot->file;
|
||||
blocks = file->content.blocks;
|
||||
offset = file->content.offset_of_temp;
|
||||
if (offset != 0) {
|
||||
|
@ -101,6 +101,8 @@ archive_write_set_format_xar(struct archive *_a)
|
||||
|
||||
/*#define DEBUG_PRINT_TOC 1 */
|
||||
|
||||
#define BAD_CAST_CONST (const xmlChar *)
|
||||
|
||||
#define HEADER_MAGIC 0x78617221
|
||||
#define HEADER_SIZE 28
|
||||
#define HEADER_VERSION 1
|
||||
@ -625,11 +627,11 @@ static int
|
||||
write_to_temp(struct archive_write *a, const void *buff, size_t s)
|
||||
{
|
||||
struct xar *xar;
|
||||
unsigned char *p;
|
||||
const unsigned char *p;
|
||||
ssize_t ws;
|
||||
|
||||
xar = (struct xar *)a->format_data;
|
||||
p = (unsigned char *)buff;
|
||||
p = (const unsigned char *)buff;
|
||||
while (s) {
|
||||
ws = write(xar->temp_fd, p, s);
|
||||
if (ws < 0) {
|
||||
@ -680,7 +682,7 @@ xar_write_data(struct archive_write *a, const void *buff, size_t s)
|
||||
}
|
||||
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||
if (xar->bytes_remaining ==
|
||||
archive_entry_size(xar->cur_file->entry)) {
|
||||
(uint64_t)archive_entry_size(xar->cur_file->entry)) {
|
||||
/*
|
||||
* Get the path of a shell script if so.
|
||||
*/
|
||||
@ -760,7 +762,7 @@ xmlwrite_string_attr(struct archive_write *a, xmlTextWriterPtr writer,
|
||||
{
|
||||
int r;
|
||||
|
||||
r = xmlTextWriterStartElement(writer, BAD_CAST(key));
|
||||
r = xmlTextWriterStartElement(writer, BAD_CAST_CONST(key));
|
||||
if (r < 0) {
|
||||
archive_set_error(&a->archive,
|
||||
ARCHIVE_ERRNO_MISC,
|
||||
@ -769,7 +771,7 @@ xmlwrite_string_attr(struct archive_write *a, xmlTextWriterPtr writer,
|
||||
}
|
||||
if (attrkey != NULL && attrvalue != NULL) {
|
||||
r = xmlTextWriterWriteAttribute(writer,
|
||||
BAD_CAST(attrkey), BAD_CAST(attrvalue));
|
||||
BAD_CAST_CONST(attrkey), BAD_CAST_CONST(attrvalue));
|
||||
if (r < 0) {
|
||||
archive_set_error(&a->archive,
|
||||
ARCHIVE_ERRNO_MISC,
|
||||
@ -778,7 +780,7 @@ xmlwrite_string_attr(struct archive_write *a, xmlTextWriterPtr writer,
|
||||
}
|
||||
}
|
||||
if (value != NULL) {
|
||||
r = xmlTextWriterWriteString(writer, BAD_CAST(value));
|
||||
r = xmlTextWriterWriteString(writer, BAD_CAST_CONST(value));
|
||||
if (r < 0) {
|
||||
archive_set_error(&a->archive,
|
||||
ARCHIVE_ERRNO_MISC,
|
||||
@ -805,7 +807,7 @@ xmlwrite_string(struct archive_write *a, xmlTextWriterPtr writer,
|
||||
if (value == NULL)
|
||||
return (ARCHIVE_OK);
|
||||
|
||||
r = xmlTextWriterStartElement(writer, BAD_CAST(key));
|
||||
r = xmlTextWriterStartElement(writer, BAD_CAST_CONST(key));
|
||||
if (r < 0) {
|
||||
archive_set_error(&a->archive,
|
||||
ARCHIVE_ERRNO_MISC,
|
||||
@ -813,7 +815,7 @@ xmlwrite_string(struct archive_write *a, xmlTextWriterPtr writer,
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
if (value != NULL) {
|
||||
r = xmlTextWriterWriteString(writer, BAD_CAST(value));
|
||||
r = xmlTextWriterWriteString(writer, BAD_CAST_CONST(value));
|
||||
if (r < 0) {
|
||||
archive_set_error(&a->archive,
|
||||
ARCHIVE_ERRNO_MISC,
|
||||
@ -1066,7 +1068,7 @@ make_fflags_entry(struct archive_write *a, xmlTextWriterPtr writer,
|
||||
} while (p != NULL);
|
||||
|
||||
if (n > 0) {
|
||||
r = xmlTextWriterStartElement(writer, BAD_CAST(element));
|
||||
r = xmlTextWriterStartElement(writer, BAD_CAST_CONST(element));
|
||||
if (r < 0) {
|
||||
archive_set_error(&a->archive,
|
||||
ARCHIVE_ERRNO_MISC,
|
||||
@ -1561,7 +1563,7 @@ make_toc(struct archive_write *a)
|
||||
goto exit_toc;
|
||||
}
|
||||
r = xmlTextWriterWriteAttribute(writer, BAD_CAST("style"),
|
||||
BAD_CAST(getalgname(xar->opt_toc_sumalg)));
|
||||
BAD_CAST_CONST(getalgname(xar->opt_toc_sumalg)));
|
||||
if (r < 0) {
|
||||
archive_set_error(&a->archive,
|
||||
ARCHIVE_ERRNO_MISC,
|
||||
@ -1869,8 +1871,8 @@ static int
|
||||
file_cmp_node(const struct archive_rb_node *n1,
|
||||
const struct archive_rb_node *n2)
|
||||
{
|
||||
struct file *f1 = (struct file *)n1;
|
||||
struct file *f2 = (struct file *)n2;
|
||||
const struct file *f1 = (const struct file *)n1;
|
||||
const struct file *f2 = (const struct file *)n2;
|
||||
|
||||
return (strcmp(f1->basename.s, f2->basename.s));
|
||||
}
|
||||
@ -1878,7 +1880,7 @@ file_cmp_node(const struct archive_rb_node *n1,
|
||||
static int
|
||||
file_cmp_key(const struct archive_rb_node *n, const void *key)
|
||||
{
|
||||
struct file *f = (struct file *)n;
|
||||
const struct file *f = (const struct file *)n;
|
||||
|
||||
return (strcmp(f->basename.s, (const char *)key));
|
||||
}
|
||||
@ -1942,6 +1944,8 @@ file_create_virtual_dir(struct archive_write *a, struct xar *xar,
|
||||
{
|
||||
struct file *file;
|
||||
|
||||
(void)xar; /* UNUSED */
|
||||
|
||||
file = file_new(a, NULL);
|
||||
if (file == NULL)
|
||||
return (NULL);
|
||||
@ -2468,8 +2472,8 @@ static int
|
||||
file_hd_cmp_node(const struct archive_rb_node *n1,
|
||||
const struct archive_rb_node *n2)
|
||||
{
|
||||
struct hardlink *h1 = (struct hardlink *)n1;
|
||||
struct hardlink *h2 = (struct hardlink *)n2;
|
||||
const struct hardlink *h1 = (const struct hardlink *)n1;
|
||||
const struct hardlink *h2 = (const struct hardlink *)n2;
|
||||
|
||||
return (strcmp(archive_entry_pathname(h1->file_list.first->entry),
|
||||
archive_entry_pathname(h2->file_list.first->entry)));
|
||||
@ -2478,7 +2482,7 @@ file_hd_cmp_node(const struct archive_rb_node *n1,
|
||||
static int
|
||||
file_hd_cmp_key(const struct archive_rb_node *n, const void *key)
|
||||
{
|
||||
struct hardlink *h = (struct hardlink *)n;
|
||||
const struct hardlink *h = (const struct hardlink *)n;
|
||||
|
||||
return (strcmp(archive_entry_pathname(h->file_list.first->entry),
|
||||
(const char *)key));
|
||||
|
@ -2503,25 +2503,25 @@ main(int argc, char **argv)
|
||||
} else {
|
||||
while (*(argv) != NULL) {
|
||||
if (**argv >= '0' && **argv <= '9') {
|
||||
char *p = *argv;
|
||||
char *vp = *argv;
|
||||
start = 0;
|
||||
while (*p >= '0' && *p <= '9') {
|
||||
while (*vp >= '0' && *vp <= '9') {
|
||||
start *= 10;
|
||||
start += *p - '0';
|
||||
++p;
|
||||
start += *vp - '0';
|
||||
++vp;
|
||||
}
|
||||
if (*p == '\0') {
|
||||
if (*vp == '\0') {
|
||||
end = start;
|
||||
} else if (*p == '-') {
|
||||
++p;
|
||||
if (*p == '\0') {
|
||||
} else if (*vp == '-') {
|
||||
++vp;
|
||||
if (*vp == '\0') {
|
||||
end = limit - 1;
|
||||
} else {
|
||||
end = 0;
|
||||
while (*p >= '0' && *p <= '9') {
|
||||
while (*vp >= '0' && *vp <= '9') {
|
||||
end *= 10;
|
||||
end += *p - '0';
|
||||
++p;
|
||||
end += *vp - '0';
|
||||
++vp;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -276,7 +276,7 @@ DEFINE_TEST(test_acl_nfs4)
|
||||
* fail when added to existing NFS4 ACLs.
|
||||
*/
|
||||
set_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]));
|
||||
for (i = 0; i < sizeof(acls_bad)/sizeof(acls_bad[0]); ++i) {
|
||||
for (i = 0; i < (int)(sizeof(acls_bad)/sizeof(acls_bad[0])); ++i) {
|
||||
struct acl_t *p = &acls_bad[i];
|
||||
failure("Malformed ACL test #%d", i);
|
||||
assertEqualInt(ARCHIVE_FAILED,
|
||||
|
@ -263,7 +263,7 @@ DEFINE_TEST(test_acl_posix1e)
|
||||
* fail when added to existing POSIX.1e ACLs.
|
||||
*/
|
||||
set_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]));
|
||||
for (i = 0; i < sizeof(acls_nfs4)/sizeof(acls_nfs4[0]); ++i) {
|
||||
for (i = 0; i < (int)(sizeof(acls_nfs4)/sizeof(acls_nfs4[0])); ++i) {
|
||||
struct acl_t *p = &acls_nfs4[i];
|
||||
failure("Malformed ACL test #%d", i);
|
||||
assertEqualInt(ARCHIVE_FAILED,
|
||||
|
@ -40,8 +40,8 @@ test(int skip_explicitely)
|
||||
assertEqualInt(0, archive_errno(a));
|
||||
assertEqualString(NULL, archive_error_string(a));
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_open_memory(a, (void*) data,
|
||||
sizeof(data)));
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_open_memory(a,
|
||||
(void *)(uintptr_t) data, sizeof(data)));
|
||||
assertEqualString(NULL, archive_error_string(a));
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &e));
|
||||
|
@ -34,11 +34,15 @@ __FBSDID("$FreeBSD$");
|
||||
"abcdefghijklmnopqrstuvwxyz/" \
|
||||
"abcdefghijklmnopqrstuvwxyz/"
|
||||
|
||||
static void test_compat_mac_1(void);
|
||||
static void test_compat_mac_2(void);
|
||||
|
||||
/*
|
||||
* Apple shipped an extended version of GNU tar with Mac OS X 10.5
|
||||
* and earlier.
|
||||
*/
|
||||
void test_compat_mac_1()
|
||||
static void
|
||||
test_compat_mac_1(void)
|
||||
{
|
||||
char name[] = "test_compat_mac-1.tar.Z";
|
||||
struct archive_entry *ae;
|
||||
@ -133,7 +137,8 @@ void test_compat_mac_1()
|
||||
/*
|
||||
* Apple shipped a customized version of bsdtar starting with MacOS 10.6.
|
||||
*/
|
||||
void test_compat_mac_2()
|
||||
static void
|
||||
test_compat_mac_2(void)
|
||||
{
|
||||
char name[] = "test_compat_mac-2.tar.Z";
|
||||
struct archive_entry *ae;
|
||||
|
@ -359,12 +359,16 @@ compat_zip_6_verify(struct archive *a)
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualString("New Folder/New Folder/", archive_entry_pathname(ae));
|
||||
assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
|
||||
assertEqualInt(1327314468, archive_entry_mtime(ae));
|
||||
/* Zip timestamps are local time, so vary by time zone. */
|
||||
/* TODO: A more complex assert would work here; we could
|
||||
verify that it's within +/- 24 hours of a particular value. */
|
||||
/* assertEqualInt(1327314468, archive_entry_mtime(ae)); */
|
||||
assertEqualInt(0, archive_entry_size(ae));
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualString("New Folder/New Folder/New Text Document.txt", archive_entry_pathname(ae));
|
||||
assertEqualInt(AE_IFREG, archive_entry_filetype(ae));
|
||||
assertEqualInt(1327314476, archive_entry_mtime(ae));
|
||||
/* Zip timestamps are local time, so vary by time zone. */
|
||||
/* assertEqualInt(1327314476, archive_entry_mtime(ae)); */
|
||||
assertEqualInt(11, archive_entry_size(ae));
|
||||
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
|
||||
}
|
||||
|
@ -25,7 +25,10 @@
|
||||
#include "test.h"
|
||||
__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_file_nonexistent.c 189473 2009-03-07 02:09:21Z kientzle $");
|
||||
|
||||
void
|
||||
static void read_test(const char *name);
|
||||
static void write_test(void);
|
||||
|
||||
static void
|
||||
read_test(const char *name)
|
||||
{
|
||||
struct archive* a = archive_read_new();
|
||||
@ -44,7 +47,7 @@ read_test(const char *name)
|
||||
archive_read_free(a);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
write_test(void)
|
||||
{
|
||||
char buff[4096];
|
||||
|
@ -36,7 +36,7 @@ test_read_format_mtree1(void)
|
||||
/* Compute max 64-bit signed twos-complement value
|
||||
* without relying on overflow. This assumes that long long
|
||||
* is at least 64 bits. */
|
||||
const static long long max_int64 = ((((long long)1) << 62) - 1) + (((long long)1) << 62);
|
||||
static const long long max_int64 = ((((long long)1) << 62) - 1) + (((long long)1) << 62);
|
||||
time_t min_time, t;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
|
@ -30,7 +30,9 @@ static unsigned char tmp[1000];
|
||||
static unsigned char buff[10000];
|
||||
size_t data_sizes[] = {0, 5, 511, 512, 513};
|
||||
|
||||
void
|
||||
static void verify_read_positions(struct archive *a);
|
||||
|
||||
static void
|
||||
verify_read_positions(struct archive *a)
|
||||
{
|
||||
struct archive_entry *ae;
|
||||
|
@ -95,9 +95,9 @@ test_read_uu_sub(const char *uudata, size_t uusize, int no_nl)
|
||||
if (buff == NULL)
|
||||
return;
|
||||
for (extra = 0; extra <= 64; extra = extra==0?1:extra*2) {
|
||||
size_t size = extra * 1024;
|
||||
char *p = buff;
|
||||
|
||||
size = extra * 1024;
|
||||
/* Add extra text size of which is from 1K bytes to
|
||||
* 64Kbytes before uuencoded data. */
|
||||
while (size) {
|
||||
|
@ -37,6 +37,9 @@ static int64_t
|
||||
group_lookup(void *d, const char *name, int64_t g)
|
||||
{
|
||||
int *mp = d;
|
||||
|
||||
(void)g; /* UNUSED */
|
||||
|
||||
assertEqualInt(*mp, 0x13579);
|
||||
if (strcmp(name, "FOOGROUP"))
|
||||
return (1);
|
||||
@ -55,6 +58,9 @@ static int64_t
|
||||
user_lookup(void *d, const char *name, int64_t u)
|
||||
{
|
||||
int *mp = d;
|
||||
|
||||
(void)u; /* UNUSED */
|
||||
|
||||
assertEqualInt(*mp, 0x1234);
|
||||
if (strcmp("FOO", name) == 0)
|
||||
return (2);
|
||||
|
@ -98,13 +98,13 @@ verify_file(struct archive *a, enum vtype type, struct fns *fns)
|
||||
for (i = 0; i < fns->cnt; i++) {
|
||||
const char *p;
|
||||
const char *pathname = archive_entry_pathname(ae);
|
||||
const char *symlink = archive_entry_symlink(ae);
|
||||
const char *symlinkname = archive_entry_symlink(ae);
|
||||
size_t length;
|
||||
|
||||
if (symlink != NULL) {
|
||||
length = strlen(symlink);
|
||||
if (symlinkname != NULL) {
|
||||
length = strlen(symlinkname);
|
||||
assert(length == 1 || length == 128 || length == 255);
|
||||
assertEqualInt(symlink[length-1], 'x');
|
||||
assertEqualInt(symlinkname[length-1], 'x');
|
||||
}
|
||||
failure("Found duplicate for %s", pathname);
|
||||
assert(strcmp(fns->names[i], pathname) != 0);
|
||||
@ -228,11 +228,11 @@ create_iso_image(unsigned char *buff, size_t buffsize, size_t *used,
|
||||
|
||||
sym1[0] = 'x';
|
||||
sym1[1] = '\0';
|
||||
for (i = 0; i < sizeof(sym128)-2; i++)
|
||||
for (i = 0; i < (int)sizeof(sym128)-2; i++)
|
||||
sym128[i] = 'a';
|
||||
sym128[sizeof(sym128)-2] = 'x';
|
||||
sym128[sizeof(sym128)-1] = '\0';
|
||||
for (i = 0; i < sizeof(sym255)-2; i++)
|
||||
for (i = 0; i < (int)sizeof(sym255)-2; i++)
|
||||
sym255[i] = 'a';
|
||||
sym255[sizeof(sym255)-2] = 'x';
|
||||
sym255[sizeof(sym255)-1] = '\0';
|
||||
|
@ -365,10 +365,10 @@ test_write_format_iso9660_zisofs_2(void)
|
||||
for (i = 0; i < 256; i++) {
|
||||
int j;
|
||||
if (i == 0) {
|
||||
for (j = 0; j < sizeof(data); j++)
|
||||
for (j = 0; j < (int)sizeof(data); j++)
|
||||
data[j] = (i^j) & 0xff;
|
||||
} else {
|
||||
for (j = 0; j < sizeof(data); j++)
|
||||
for (j = 0; j < (int)sizeof(data); j++)
|
||||
data[j] ^= i+j;
|
||||
}
|
||||
assertEqualIntA(a, 1024, archive_write_data(a, data, 1024));
|
||||
|
@ -2505,25 +2505,25 @@ main(int argc, char **argv)
|
||||
} else {
|
||||
while (*(argv) != NULL) {
|
||||
if (**argv >= '0' && **argv <= '9') {
|
||||
char *p = *argv;
|
||||
char *vp = *argv;
|
||||
start = 0;
|
||||
while (*p >= '0' && *p <= '9') {
|
||||
while (*vp >= '0' && *vp <= '9') {
|
||||
start *= 10;
|
||||
start += *p - '0';
|
||||
++p;
|
||||
start += *vp - '0';
|
||||
++vp;
|
||||
}
|
||||
if (*p == '\0') {
|
||||
if (*vp == '\0') {
|
||||
end = start;
|
||||
} else if (*p == '-') {
|
||||
++p;
|
||||
if (*p == '\0') {
|
||||
} else if (*vp == '-') {
|
||||
++vp;
|
||||
if (*vp == '\0') {
|
||||
end = limit - 1;
|
||||
} else {
|
||||
end = 0;
|
||||
while (*p >= '0' && *p <= '9') {
|
||||
while (*vp >= '0' && *vp <= '9') {
|
||||
end *= 10;
|
||||
end += *p - '0';
|
||||
++p;
|
||||
end += *vp - '0';
|
||||
++vp;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user