to 'type2', possible lose of data.
{
unsigned char *p = (unsigned char *)pp;
- archive_be32enc(p, u >> 32);
- archive_be32enc(p + 4, u & 0xffffffff);
+ archive_be32enc(p, (uint32_t)(u >> 32));
+ archive_be32enc(p + 4, (uint32_t)(u & 0xffffffff));
}
static inline void
{
unsigned char *p = (unsigned char *)pp;
- archive_le32enc(p, u & 0xffffffff);
- archive_le32enc(p + 4, u >> 32);
+ archive_le32enc(p, (uint32_t)(u & 0xffffffff));
+ archive_le32enc(p + 4, (uint32_t)(u >> 32));
}
#endif
if (res->number_entries > res->number_buckets * 2)
grow_hash(res);
- hash = archive_entry_dev(entry) ^ archive_entry_ino64(entry);
+ hash = (size_t)(archive_entry_dev(entry) ^ archive_entry_ino64(entry));
bucket = hash & (res->number_buckets - 1);
/* If we could allocate the entry, record it. */
st->st_ctime = archive_entry_ctime(entry);
st->st_mtime = archive_entry_mtime(entry);
st->st_dev = archive_entry_dev(entry);
- st->st_gid = archive_entry_gid(entry);
- st->st_uid = archive_entry_uid(entry);
- st->st_ino = archive_entry_ino64(entry);
+ st->st_gid = (gid_t)archive_entry_gid(entry);
+ st->st_uid = (uid_t)archive_entry_uid(entry);
+ st->st_ino = (ino_t)archive_entry_ino64(entry);
st->st_nlink = archive_entry_nlink(entry);
st->st_rdev = archive_entry_rdev(entry);
- st->st_size = archive_entry_size(entry);
+ st->st_size = (off_t)archive_entry_size(entry);
st->st_mode = archive_entry_mode(entry);
/*
len = s;
} else if (a->read_data_output_offset <
a->read_data_offset) {
- len = a->read_data_offset -
- a->read_data_output_offset;
+ len = (size_t)(a->read_data_offset -
+ a->read_data_output_offset);
} else
len = 0;
/* Use up the copy buffer first. */
if (filter->avail > 0) {
- min = minimum(request, (int64_t)filter->avail);
+ min = (size_t)minimum(request, (int64_t)filter->avail);
filter->next += min;
filter->avail -= min;
request -= min;
/* Then use up the client buffer. */
if (filter->client_avail > 0) {
- min = minimum(request, (int64_t)filter->client_avail);
+ min = (size_t)minimum(request, (int64_t)filter->client_avail);
filter->client_next += min;
filter->client_avail -= min;
request -= min;
if (bytes_read >= request) {
filter->client_next =
((const char *)filter->client_buff) + request;
- filter->client_avail = bytes_read - request;
+ filter->client_avail = (size_t)(bytes_read - request);
filter->client_total = bytes_read;
total_bytes_skipped += request;
filter->position += request;
static int64_t
align_num_per_sector(struct tree *t, int64_t size)
{
- int surplus;
+ int64_t surplus;
size += t->current_filesystem->bytesPerSector -1;
surplus = size % t->current_filesystem->bytesPerSector;
buffbytes = olp->buff_size;
if (buffbytes > t->current_sparse->length)
- buffbytes = t->current_sparse->length;
+ buffbytes = (DWORD)t->current_sparse->length;
/* Skip hole. */
if (t->current_sparse->offset > t->ol_total) {
olp->bytes_expected = buffbytes;
t->ol_remaining_bytes -= buffbytes;
} else {
- olp->bytes_expected = t->ol_remaining_bytes;
+ olp->bytes_expected = (size_t)t->ol_remaining_bytes;
t->ol_remaining_bytes = 0;
}
olp->bytes_transferred = 0;
file_skip(struct archive *a, void *client_data, int64_t request)
{
struct read_fd_data *mine = (struct read_fd_data *)client_data;
- off_t skip = (off_t)request;
- off_t old_offset, new_offset;
+ int64_t skip = request;
+ int64_t old_offset, new_offset;
int skip_bits = sizeof(skip) * 8 - 1; /* off_t is a signed type. */
if (!mine->use_lseek)
file_seek(struct archive *a, void *client_data, int64_t request, int whence)
{
struct read_file_data *mine = (struct read_file_data *)client_data;
- off_t r;
+ int64_t r;
/* We use off_t here because lseek() is declared that way. */
/* See above for notes about when off_t is less than 64 bits. */
/* Dev/ino of the archive being read/written. */
int skip_file_set;
- dev_t skip_file_dev;
- ino_t skip_file_ino;
+ int64_t skip_file_dev;
+ int64_t skip_file_ino;
/*
* Used by archive_read_data() to track blocks and copy
if (rpm->total_in + avail_in < RPM_LEAD_SIZE)
used += avail_in;
else {
- n = RPM_LEAD_SIZE - rpm->total_in;
+ n = (size_t)(RPM_LEAD_SIZE - rpm->total_in);
used += n;
b += n;
rpm->state = ST_HEADER;
free_Header(&header);
if (r != ARCHIVE_OK)
return (r);
- zip->entries_remaining = zip->numFiles;
+ zip->entries_remaining = (size_t)zip->numFiles;
zip->entry = zip->entries;
} else {
++zip->entry;
return (ARCHIVE_EOF);
}
- bytes = read_stream(a, buff, zip->entry_bytes_remaining, 0);
+ bytes = read_stream(a, buff,
+ (size_t)zip->entry_bytes_remaining, 0);
if (bytes < 0)
return ((int)bytes);
if (bytes == 0) {
* If the length is at the beginning, we can skip the
* compressed data much more quickly.
*/
- bytes_skipped = skip_stream(a, zip->entry_bytes_remaining);
+ bytes_skipped = skip_stream(a, (size_t)zip->entry_bytes_remaining);
if (bytes_skipped < 0)
return (ARCHIVE_FATAL);
zip->entry_bytes_remaining = 0;
ff = &filters[fi];
#endif
r = lzma_properties_decode(&filters[fi], NULL,
- coder1->properties, coder1->propertiesSize);
+ coder1->properties, (size_t)coder1->propertiesSize);
if (r != LZMA_OK) {
set_error(a, r);
return (ARCHIVE_FAILED);
} while (zip->ppstream.avail_out &&
(zip->ppstream.avail_in || flush_bytes));
- t_avail_in = zip->ppstream.avail_in;
- t_avail_out = zip->ppstream.avail_out;
+ t_avail_in = (size_t)zip->ppstream.avail_in;
+ t_avail_out = (size_t)zip->ppstream.avail_out;
break;
}
default:
return (0);
if (*p != kSize)
return (-1);
- pi->sizes = calloc(pi->numPackStreams, sizeof(uint64_t));
- pi->positions = calloc(pi->numPackStreams, sizeof(uint64_t));
+ pi->sizes = calloc((size_t)pi->numPackStreams, sizeof(uint64_t));
+ pi->positions = calloc((size_t)pi->numPackStreams, sizeof(uint64_t));
if (pi->sizes == NULL || pi->positions == NULL)
return (-1);
if (*p == kEnd) {
/* PackStreamDigests[num] are not present. */
pi->digest.defineds =
- calloc(pi->numPackStreams, sizeof(*pi->digest.defineds));
+ calloc((size_t)pi->numPackStreams, sizeof(*pi->digest.defineds));
pi->digest.digests =
- calloc(pi->numPackStreams, sizeof(*pi->digest.digests));
+ calloc((size_t)pi->numPackStreams, sizeof(*pi->digest.digests));
if (pi->digest.defineds == NULL || pi->digest.digests == NULL)
return (-1);
return (0);
if (*p != kSize)
return (-1);
- if (read_Digests(a, &(pi->digest), pi->numPackStreams) < 0)
+ if (read_Digests(a, &(pi->digest), (size_t)pi->numPackStreams) < 0)
return (-1);
/*
/* Too many coders. */
return (-1);
- f->coders = calloc(f->numCoders, sizeof(*f->coders));
+ f->coders = calloc((size_t)f->numCoders, sizeof(*f->coders));
if (f->coders == NULL)
return (-1);
for (i = 0; i< f->numCoders; i++) {
a, &(f->coders[i].propertiesSize)) < 0)
return (-1);
if ((p = header_bytes(
- a, f->coders[i].propertiesSize)) == NULL)
+ a, (size_t)f->coders[i].propertiesSize)) == NULL)
return (-1);
f->coders[i].properties =
- malloc(f->coders[i].propertiesSize);
+ malloc((size_t)f->coders[i].propertiesSize);
if (f->coders[i].properties == NULL)
return (-1);
memcpy(f->coders[i].properties, p,
- f->coders[i].propertiesSize);
+ (size_t)f->coders[i].propertiesSize);
}
numInStreamsTotal += f->coders[i].numInStreams;
if (zip->header_bytes_remaining < f->numBindPairs)
return (-1);
if (f->numBindPairs > 0) {
- f->bindPairs = calloc(f->numBindPairs, sizeof(*f->bindPairs));
+ f->bindPairs =
+ calloc((size_t)f->numBindPairs, sizeof(*f->bindPairs));
if (f->bindPairs == NULL)
return (-1);
} else
f->numPackedStreams = numInStreamsTotal - f->numBindPairs;
f->packedStreams =
- calloc(f->numPackedStreams, sizeof(*f->packedStreams));
+ calloc((size_t)f->numPackedStreams, sizeof(*f->packedStreams));
if (f->packedStreams == NULL)
return (-1);
if (f->numPackedStreams == 1) {
goto failed;
switch (*p) {
case 0:
- ci->folders = calloc(ci->numFolders, sizeof(*ci->folders));
+ ci->folders =
+ calloc((size_t)ci->numFolders, sizeof(*ci->folders));
if (ci->folders == NULL)
return (-1);
for (i = 0; i < ci->numFolders; i++) {
unsigned j;
folder->unPackSize =
- calloc(folder->numOutStreams, sizeof(*folder->unPackSize));
+ calloc((size_t)folder->numOutStreams, sizeof(*folder->unPackSize));
if (folder->unPackSize == NULL)
goto failed;
for (j = 0; j < folder->numOutStreams; j++) {
return (0);
if (*p != kCRC)
goto failed;
- if (read_Digests(a, &digest, ci->numFolders) < 0)
+ if (read_Digests(a, &digest, (size_t)ci->numFolders) < 0)
goto failed;
for (i = 0; i < ci->numFolders; i++) {
ci->folders[i].digest_defined = digest.defineds[i];
static uint64_t
folder_uncompressed_size(struct _7z_folder *f)
{
- int n = f->numOutStreams;
- unsigned pairs = f->numBindPairs;
+ int n = (int)f->numOutStreams;
+ unsigned pairs = (unsigned)f->numBindPairs;
while (--n >= 0) {
unsigned i;
return (-1);
if (1000000 < f[i].numUnpackStreams)
return (-1);
- unpack_streams += f[i].numUnpackStreams;
+ unpack_streams += (size_t)f[i].numUnpackStreams;
}
if ((p = header_bytes(a, 1)) == NULL)
return (-1);
numDigests = 0;
for (i = 0; i < numFolders; i++) {
if (f[i].numUnpackStreams != 1 || !f[i].digest_defined)
- numDigests += f[i].numUnpackStreams;
+ numDigests += (uint32_t)f[i].numUnpackStreams;
}
if (type == kCRC) {
f = si->ci.folders;
for (i = 0; i < si->ci.numFolders; i++) {
f[i].packIndex = packIndex;
- packIndex += f[i].numPackedStreams;
+ packIndex += (uint32_t)f[i].numPackedStreams;
if (packIndex > si->pi.numPackStreams)
return (-1);
}
if (*p == kSubStreamsInfo) {
if (read_SubStreamsInfo(a, &(si->ss),
- si->ci.folders, si->ci.numFolders) < 0)
+ si->ci.folders, (size_t)si->ci.numFolders) < 0)
return (-1);
if ((p = header_bytes(a, 1)) == NULL)
return (-1);
if (1000000 < zip->numFiles)
return (-1);
- zip->entries = calloc(zip->numFiles, sizeof(*zip->entries));
+ zip->entries = calloc((size_t)zip->numFiles, sizeof(*zip->entries));
if (zip->entries == NULL)
return (-1);
entries = zip->entries;
switch (type) {
case kEmptyStream:
- h->emptyStreamBools = calloc(zip->numFiles,
+ h->emptyStreamBools = calloc((size_t)zip->numFiles,
sizeof(*h->emptyStreamBools));
if (h->emptyStreamBools == NULL)
return (-1);
if (read_Bools(
- a, h->emptyStreamBools, zip->numFiles) < 0)
+ a, h->emptyStreamBools, (size_t)zip->numFiles) < 0)
return (-1);
empty_streams = 0;
for (i = 0; i < zip->numFiles; i++) {
if ((p = header_bytes(a, 2)) == NULL)
return (-1);
allAreDefined = *p;
- h->attrBools = calloc(zip->numFiles,
+ h->attrBools = calloc((size_t)zip->numFiles,
sizeof(*h->attrBools));
if (h->attrBools == NULL)
return (-1);
if (allAreDefined)
- memset(h->attrBools, 1, zip->numFiles);
+ memset(h->attrBools, 1, (size_t)zip->numFiles);
else {
if (read_Bools(a, h->attrBools,
- zip->numFiles) < 0)
+ (size_t)zip->numFiles) < 0)
return (-1);
}
for (i = 0; i < zip->numFiles; i++) {
int allAreDefined;
unsigned i;
- timeBools = calloc(zip->numFiles, sizeof(*timeBools));
+ timeBools = calloc((size_t)zip->numFiles, sizeof(*timeBools));
if (timeBools == NULL)
return (-1);
goto failed;
allAreDefined = *p;
if (allAreDefined)
- memset(timeBools, 1, zip->numFiles);
+ memset(timeBools, 1, (size_t)zip->numFiles);
else {
- if (read_Bools(a, timeBools, zip->numFiles) < 0)
+ if (read_Bools(a, timeBools, (size_t)zip->numFiles) < 0)
goto failed;
}
return (ARCHIVE_FATAL);
}
if (bytes_avail > (ssize_t)zip->pack_stream_inbytes_remaining)
- bytes_avail = zip->pack_stream_inbytes_remaining;
+ bytes_avail = (ssize_t)zip->pack_stream_inbytes_remaining;
zip->pack_stream_inbytes_remaining -= bytes_avail;
if (bytes_avail > (ssize_t)zip->folder_outbytes_remaining)
- bytes_avail = zip->folder_outbytes_remaining;
+ bytes_avail = (ssize_t)zip->folder_outbytes_remaining;
zip->folder_outbytes_remaining -= bytes_avail;
zip->uncompressed_buffer_bytes_remaining = bytes_avail;
return (ARCHIVE_OK);
- zip->uncompressed_buffer_bytes_remaining;
bytes_in = bytes_avail;
if (bytes_in > zip->pack_stream_inbytes_remaining)
- bytes_in = zip->pack_stream_inbytes_remaining;
+ bytes_in = (size_t)zip->pack_stream_inbytes_remaining;
/* Drive decompression. */
r = decompress(a, zip, buff_out, &bytes_out,
buff_in, &bytes_in);
}
zip->pack_stream_inbytes_remaining -= bytes_in;
if (bytes_out > zip->folder_outbytes_remaining)
- bytes_out = zip->folder_outbytes_remaining;
+ bytes_out = (size_t)zip->folder_outbytes_remaining;
zip->folder_outbytes_remaining -= bytes_out;
zip->uncompressed_buffer_bytes_remaining += bytes_out;
zip->pack_stream_bytes_unconsumed = bytes_in;
return (ARCHIVE_FATAL);
}
}
- skipped = get_uncompressed_data(a, buff, skip_bytes, 0);
+ skipped = get_uncompressed_data(
+ a, buff, (size_t)skip_bytes, 0);
if (skipped < 0)
return (skipped);
skip_bytes -= skipped;
}
coder2 = &(fc[3]);
zip->main_stream_bytes_remaining =
- folder->unPackSize[2];
+ (size_t)folder->unPackSize[2];
} else if (coder2 != NULL && coder2->codec == _7Z_X86_BCJ2 &&
zip->pack_stream_remaining == 4 &&
folder->numInStreams == 5 && folder->numOutStreams == 2) {
/* Source type 0 made by 7z */
zip->main_stream_bytes_remaining =
- folder->unPackSize[0];
+ (size_t)folder->unPackSize[0];
} else {
/* We got an unexpected form. */
archive_set_error(&(a->archive),
if ((r = seek_pack(a)) < 0)
return (r);
zip->pack_stream_bytes_unconsumed =
- zip->pack_stream_inbytes_remaining;
+ (size_t)zip->pack_stream_inbytes_remaining;
read_consume(a);
/* Read following three sub streams. */
/* Allocate memory for the decorded data of a sub
* stream. */
- b[i] = malloc(zip->folder_outbytes_remaining);
+ b[i] = malloc((size_t)zip->folder_outbytes_remaining);
if (b[i] == NULL) {
archive_set_error(&a->archive, ENOMEM,
"No memory for 7-Zip decompression");
"Truncated 7-Zip file body");
return (ARCHIVE_FATAL);
}
- bytes -= skipped_bytes;
+ bytes -= (size_t)skipped_bytes;
if (zip->pack_stream_bytes_unconsumed)
read_consume(a);
}
file->offset = archive_le32dec(p + CFFILE_uoffFolderStart);
file->folder = archive_le16dec(p + CFFILE_iFolder);
file->mtime = cab_dos_time(p + CFFILE_date_time);
- file->attr = archive_le16dec(p + CFFILE_attribs);
+ file->attr = (uint8_t)archive_le16dec(p + CFFILE_attribs);
__archive_read_consume(a, 16);
cab->cab_offset += 16;
}
if (cab->entry_unconsumed) {
/* Consume as much as the compressor actually used. */
- r = cab_consume_cfdata(a, cab->entry_unconsumed);
+ r = (int)cab_consume_cfdata(a, cab->entry_unconsumed);
cab->entry_unconsumed = 0;
if (r < 0)
return (r);
/* we've already skipped some bytes before really read. */
skipped_bytes = cfdata->read_offset;
cfdata->read_offset = 0;
- cfdata->uncompressed_bytes_remaining += skipped_bytes;
+ cfdata->uncompressed_bytes_remaining +=
+ (uint16_t)skipped_bytes;
} else
skipped_bytes = 0;
do {
return (NULL);
}
}
- uavail = cab->stream.total_out;
+ uavail = (uint16_t)cab->stream.total_out;
if (uavail < cfdata->uncompressed_size) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
}
}
- uavail = cab->xstrm.total_out;
+ uavail = (uint16_t)cab->xstrm.total_out;
/*
* Make sure a read pointer advances to next CFDATA.
*/
}
continue;
}
- cfdata->read_offset += cbytes;
- cfdata->uncompressed_bytes_remaining -= cbytes;
+ cfdata->read_offset += (uint16_t)cbytes;
+ cfdata->uncompressed_bytes_remaining -= (uint16_t)cbytes;
break;
} else if (cbytes == 0) {
err = cab_next_cfdata(a);
if (avail <= 0)
return (ARCHIVE_FATAL);
if (avail > cbytes)
- avail = cbytes;
+ avail = (ssize_t)cbytes;
if (cab_minimum_consume_cfdata(a, avail) < 0)
return (ARCHIVE_FATAL);
cbytes -= avail;
else
cbytes = cfdata->unconsumed;
rbytes -= cbytes;
- cfdata->read_offset += cbytes;
- cfdata->uncompressed_bytes_remaining -= cbytes;
+ cfdata->read_offset += (uint16_t)cbytes;
+ cfdata->uncompressed_bytes_remaining -= (uint16_t)cbytes;
cfdata->unconsumed -= cbytes;
} else {
cbytes = cfdata->uncompressed_avail - cfdata->read_offset;
if (consumed_bytes < cbytes)
cbytes = consumed_bytes;
rbytes -= cbytes;
- cfdata->read_offset += cbytes;
- cfdata->uncompressed_bytes_remaining -= cbytes;
+ cfdata->read_offset += (uint16_t)cbytes;
+ cfdata->uncompressed_bytes_remaining -= (uint16_t)cbytes;
}
if (cfdata->unconsumed) {
}
if (cbytes) {
/* Compute the sum. */
- cab_checksum_update(a, cbytes);
+ cab_checksum_update(a, (size_t)cbytes);
/* Consume as much as the compressor actually used. */
__archive_read_consume(a, cbytes);
cab->cab_offset += cbytes;
- cfdata->compressed_bytes_remaining -= cbytes;
+ cfdata->compressed_bytes_remaining -= (uint16_t)cbytes;
if (cfdata->compressed_bytes_remaining == 0) {
err = cab_checksum_finish(a);
if (err < 0)
return (bytes_avail);
}
if (bytes_avail > cab->entry_bytes_remaining)
- bytes_avail = cab->entry_bytes_remaining;
+ bytes_avail = (ssize_t)cab->entry_bytes_remaining;
*size = bytes_avail;
*offset = cab->entry_offset;
if (cab->entry_unconsumed) {
/* Consume as much as the compressor actually used. */
- r = cab_consume_cfdata(a, cab->entry_unconsumed);
+ r = (int)cab_consume_cfdata(a, cab->entry_unconsumed);
cab->entry_unconsumed = 0;
if (r < 0)
return (r);
/* If this is a symlink, read the link contents. */
if (archive_entry_filetype(entry) == AE_IFLNK) {
- h = __archive_read_ahead(a, cpio->entry_bytes_remaining, NULL);
+ h = __archive_read_ahead(a,
+ (size_t)cpio->entry_bytes_remaining, NULL);
if (h == NULL)
return (ARCHIVE_FATAL);
if (archive_entry_copy_symlink_l(entry, (const char *)h,
- cpio->entry_bytes_remaining, sconv) != 0) {
+ (size_t)cpio->entry_bytes_remaining, sconv) != 0) {
if (errno == ENOMEM) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate memory for Linkname");
if (bytes_read <= 0)
return (ARCHIVE_FATAL);
if (bytes_read > cpio->entry_bytes_remaining)
- bytes_read = cpio->entry_bytes_remaining;
+ bytes_read = (ssize_t)cpio->entry_bytes_remaining;
*size = bytes_read;
cpio->entry_bytes_unconsumed = bytes_read;
*offset = cpio->entry_offset;
/* TODO: Abort here? */
}
- archive_entry_set_devmajor(entry, atol16(header + newc_devmajor_offset, newc_devmajor_size));
- archive_entry_set_devminor(entry, atol16(header + newc_devminor_offset, newc_devminor_size));
+ archive_entry_set_devmajor(entry,
+ (dev_t)atol16(header + newc_devmajor_offset, newc_devmajor_size));
+ archive_entry_set_devminor(entry,
+ (dev_t)atol16(header + newc_devminor_offset, newc_devminor_size));
archive_entry_set_ino(entry, atol16(header + newc_ino_offset, newc_ino_size));
- archive_entry_set_mode(entry, atol16(header + newc_mode_offset, newc_mode_size));
+ archive_entry_set_mode(entry,
+ (mode_t)atol16(header + newc_mode_offset, newc_mode_size));
archive_entry_set_uid(entry, atol16(header + newc_uid_offset, newc_uid_size));
archive_entry_set_gid(entry, atol16(header + newc_gid_offset, newc_gid_size));
- archive_entry_set_nlink(entry, atol16(header + newc_nlink_offset, newc_nlink_size));
- archive_entry_set_rdevmajor(entry, atol16(header + newc_rdevmajor_offset, newc_rdevmajor_size));
- archive_entry_set_rdevminor(entry, atol16(header + newc_rdevminor_offset, newc_rdevminor_size));
+ archive_entry_set_nlink(entry,
+ (unsigned int)atol16(header + newc_nlink_offset, newc_nlink_size));
+ archive_entry_set_rdevmajor(entry,
+ (dev_t)atol16(header + newc_rdevmajor_offset, newc_rdevmajor_size));
+ archive_entry_set_rdevminor(entry,
+ (dev_t)atol16(header + newc_rdevminor_offset, newc_rdevminor_size));
archive_entry_set_mtime(entry, atol16(header + newc_mtime_offset, newc_mtime_size), 0);
- *namelength = atol16(header + newc_namesize_offset, newc_namesize_size);
+ *namelength = (size_t)atol16(header + newc_namesize_offset, newc_namesize_size);
/* Pad name to 2 more than a multiple of 4. */
*name_pad = (2 - *namelength) & 3;
/* Parse out octal fields. */
header = (const char *)h;
- archive_entry_set_dev(entry, atol8(header + odc_dev_offset, odc_dev_size));
+ archive_entry_set_dev(entry,
+ (dev_t)atol8(header + odc_dev_offset, odc_dev_size));
archive_entry_set_ino(entry, atol8(header + odc_ino_offset, odc_ino_size));
- archive_entry_set_mode(entry, atol8(header + odc_mode_offset, odc_mode_size));
+ archive_entry_set_mode(entry,
+ (mode_t)atol8(header + odc_mode_offset, odc_mode_size));
archive_entry_set_uid(entry, atol8(header + odc_uid_offset, odc_uid_size));
archive_entry_set_gid(entry, atol8(header + odc_gid_offset, odc_gid_size));
- archive_entry_set_nlink(entry, atol8(header + odc_nlink_offset, odc_nlink_size));
- archive_entry_set_rdev(entry, atol8(header + odc_rdev_offset, odc_rdev_size));
+ archive_entry_set_nlink(entry,
+ (unsigned int)atol8(header + odc_nlink_offset, odc_nlink_size));
+ archive_entry_set_rdev(entry,
+ (dev_t)atol8(header + odc_rdev_offset, odc_rdev_size));
archive_entry_set_mtime(entry, atol8(header + odc_mtime_offset, odc_mtime_size), 0);
- *namelength = atol8(header + odc_namesize_offset, odc_namesize_size);
+ *namelength = (size_t)atol8(header + odc_namesize_offset, odc_namesize_size);
*name_pad = 0; /* No padding of filename. */
/*
/* Parse out octal fields. */
header = (const char *)h;
- archive_entry_set_dev(entry, atol16(header + afiol_dev_offset, afiol_dev_size));
+ archive_entry_set_dev(entry,
+ (dev_t)atol16(header + afiol_dev_offset, afiol_dev_size));
archive_entry_set_ino(entry, atol16(header + afiol_ino_offset, afiol_ino_size));
- archive_entry_set_mode(entry, atol8(header + afiol_mode_offset, afiol_mode_size));
+ archive_entry_set_mode(entry,
+ (mode_t)atol8(header + afiol_mode_offset, afiol_mode_size));
archive_entry_set_uid(entry, atol16(header + afiol_uid_offset, afiol_uid_size));
archive_entry_set_gid(entry, atol16(header + afiol_gid_offset, afiol_gid_size));
- archive_entry_set_nlink(entry, atol16(header + afiol_nlink_offset, afiol_nlink_size));
- archive_entry_set_rdev(entry, atol16(header + afiol_rdev_offset, afiol_rdev_size));
+ archive_entry_set_nlink(entry,
+ (unsigned int)atol16(header + afiol_nlink_offset, afiol_nlink_size));
+ archive_entry_set_rdev(entry,
+ (dev_t)atol16(header + afiol_rdev_offset, afiol_rdev_size));
archive_entry_set_mtime(entry, atol16(header + afiol_mtime_offset, afiol_mtime_size), 0);
- *namelength = atol16(header + afiol_namesize_offset, afiol_namesize_size);
+ *namelength = (size_t)atol16(header + afiol_namesize_offset, afiol_namesize_size);
*name_pad = 0; /* No padding of filename. */
cpio->entry_bytes_remaining =
iso9660->current_position = parent->offset;
}
- step = ((parent->size + iso9660->logical_block_size -1) /
- iso9660->logical_block_size) * iso9660->logical_block_size;
+ step = (size_t)(((parent->size + iso9660->logical_block_size -1) /
+ iso9660->logical_block_size) * iso9660->logical_block_size);
b = __archive_read_ahead(a, step, NULL);
if (b == NULL) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
return (ARCHIVE_FATAL);
}
if (bytes_read > iso9660->entry_bytes_remaining)
- bytes_read = iso9660->entry_bytes_remaining;
+ bytes_read = (ssize_t)iso9660->entry_bytes_remaining;
avail = bytes_read;
uncompressed_size = 0;
size_t ceil, xsize;
/* Allocate block pointers buffer. */
- ceil = (zisofs->pz_uncompressed_size +
+ ceil = (size_t)((zisofs->pz_uncompressed_size +
(((int64_t)1) << zisofs->pz_log2_bs) - 1)
- >> zisofs->pz_log2_bs;
+ >> zisofs->pz_log2_bs);
xsize = (ceil + 1) * 4;
if (zisofs->block_pointers_alloc < xsize) {
size_t alloc;
if (*buff == NULL)
return (ARCHIVE_FATAL);
if (bytes_read > iso9660->entry_bytes_remaining)
- bytes_read = iso9660->entry_bytes_remaining;
+ bytes_read = (ssize_t)iso9660->entry_bytes_remaining;
*size = bytes_read;
*offset = iso9660->entry_sparse_offset;
iso9660->entry_sparse_offset += bytes_read;
/* Read extended headers */
err2 = lha_read_file_extended_header(a, lha, NULL, 2,
- lha->compsize + 2, &extdsize);
+ (size_t)(lha->compsize + 2), &extdsize);
if (err2 < ARCHIVE_WARN)
return (err2);
if (err2 < err)
return (ARCHIVE_FATAL);
}
if (bytes_avail > lha->entry_bytes_remaining)
- bytes_avail = lha->entry_bytes_remaining;
+ bytes_avail = (ssize_t)lha->entry_bytes_remaining;
lha->entry_crc_calculated =
lha_crc16(lha->entry_crc_calculated, *buff, bytes_avail);
*size = bytes_avail;
return (ARCHIVE_FATAL);
}
if (bytes_avail > lha->entry_bytes_remaining)
- bytes_avail = lha->entry_bytes_remaining;
+ bytes_avail = (ssize_t)lha->entry_bytes_remaining;
lha->strm.avail_in = bytes_avail;
lha->strm.total_in = 0;
archive_read_format_lha_read_data_skip(struct archive_read *a)
{
struct lha *lha;
- off_t bytes_skipped;
+ int64_t bytes_skipped;
lha = (struct lha *)(a->format->data);
if (ds->w_pos - ds->copy_pos <= strm->avail_out)
copy_bytes = ds->w_pos - ds->copy_pos;
else
- copy_bytes = strm->avail_out;
+ copy_bytes = (size_t)strm->avail_out;
memcpy(strm->next_out,
ds->w_buff + ds->copy_pos, copy_bytes);
ds->copy_pos += copy_bytes;
if (ds->w_remaining <= strm->avail_out)
copy_bytes = ds->w_remaining;
else
- copy_bytes = strm->avail_out;
+ 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;
comma1 = strchr(val, ',');
if (comma1 == NULL) {
- archive_entry_set_dev(entry, mtree_atol10(&val));
+ archive_entry_set_dev(entry, (dev_t)mtree_atol10(&val));
return (ARCHIVE_OK);
}
++comma1;
return (ARCHIVE_WARN);
}
++comma2;
- archive_entry_set_rdevmajor(entry, mtree_atol(&comma1));
- archive_entry_set_rdevminor(entry, mtree_atol(&comma2));
+ archive_entry_set_rdevmajor(entry, (dev_t)mtree_atol(&comma1));
+ archive_entry_set_rdevminor(entry, (dev_t)mtree_atol(&comma2));
return (ARCHIVE_OK);
}
if (val[0] >= '0' && val[0] <= '9') {
*parsed_kws |= MTREE_HAS_PERM;
archive_entry_set_perm(entry,
- mtree_atol8(&val));
+ (mode_t)mtree_atol8(&val));
} else {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_FILE_FORMAT,
case 'n':
if (strcmp(key, "nlink") == 0) {
*parsed_kws |= MTREE_HAS_NLINK;
- archive_entry_set_nlink(entry, mtree_atol10(&val));
+ archive_entry_set_nlink(entry,
+ (unsigned int)mtree_atol10(&val));
break;
}
case 'r':
*buff = mtree->buff;
*offset = mtree->offset;
if ((int64_t)mtree->buffsize > mtree->cur_size - mtree->offset)
- bytes_to_read = mtree->cur_size - mtree->offset;
+ bytes_to_read = (size_t)(mtree->cur_size - mtree->offset);
else
bytes_to_read = mtree->buffsize;
bytes_read = read(mtree->fd, mtree->buff, bytes_to_read);
if (br->next_in == NULL)
return (0);
if (br->avail_in > rar->bytes_remaining)
- br->avail_in = rar->bytes_remaining;
+ br->avail_in = (ssize_t)rar->bytes_remaining;
if (br->avail_in == 0)
return (0);
}
return (ARCHIVE_FATAL);
}
if (br->avail_in > rar->bytes_remaining)
- br->avail_in = rar->bytes_remaining;
+ br->avail_in = (ssize_t)rar->bytes_remaining;
if (br->cache_avail == 0)
(void)rar_br_fillup(a, br);
}
static inline int
lzss_offset_for_position(struct lzss *lzss, int64_t pos)
{
- return pos & lzss->mask;
+ return (int)(pos & lzss->mask);
}
static inline unsigned char *
return (ARCHIVE_FATAL);
}
- if ((h = __archive_read_ahead(a, header_size - 7, NULL)) == NULL)
+ if ((h = __archive_read_ahead(a, (size_t)header_size - 7, NULL)) == NULL)
return (ARCHIVE_FATAL);
/* File Header CRC check. */
- crc32_val = crc32(crc32_val, h, header_size - 7);
+ crc32_val = crc32(crc32_val, h, (unsigned)(header_size - 7));
if ((crc32_val & 0xffff) != archive_le16dec(rar_header.crc)) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Header CRC error");
size_t distance = p - (const char *)h;
header_size += rar->packed_size;
/* Make sure we have the extended data. */
- if ((h = __archive_read_ahead(a, header_size - 7, NULL)) == NULL)
+ if ((h = __archive_read_ahead(a, (size_t)header_size - 7, NULL)) == NULL)
return (ARCHIVE_FATAL);
p = h;
endp = p + header_size - 7;
rar->bytes_remaining = rar->packed_size;
rar->bytes_uncopied = rar->bytes_unconsumed = 0;
- rar->lzss.position = rar->dictionary_size = rar->offset = 0;
+ rar->lzss.position = rar->offset = 0;
+ rar->dictionary_size = 0;
rar->offset_outgoing = 0;
rar->br.cache_avail = 0;
rar->br.avail_in = 0;
int ret = (ARCHIVE_OK);
rar = (struct rar *)(a->format->data);
- if ((h = __archive_read_ahead(a, rar->packed_size, NULL)) == NULL)
+ if ((h = __archive_read_ahead(a, (size_t)rar->packed_size, NULL)) == NULL)
return (ARCHIVE_FATAL);
p = h;
- if (archive_entry_copy_symlink_l(entry, p, rar->packed_size, sconv))
+ if (archive_entry_copy_symlink_l(entry,
+ p, (size_t)rar->packed_size, sconv))
{
if (errno == ENOMEM)
{
return (ARCHIVE_FATAL);
}
if (bytes_avail > rar->bytes_remaining)
- bytes_avail = rar->bytes_remaining;
+ bytes_avail = (ssize_t)rar->bytes_remaining;
*size = bytes_avail;
*offset = rar->offset;
if (rar->bytes_uncopied > (rar->unp_buffer_size - rar->unp_offset))
bs = rar->unp_buffer_size - rar->unp_offset;
else
- bs = rar->bytes_uncopied;
+ bs = (size_t)rar->bytes_uncopied;
ret = copy_from_lzss_window(a, buff, rar->offset, bs);
if (ret != ARCHIVE_OK)
return (ret);
if (rar->bytes_uncopied > (rar->unp_buffer_size - rar->unp_offset))
bs = rar->unp_buffer_size - rar->unp_offset;
else
- bs = rar->bytes_uncopied;
+ bs = (size_t)rar->bytes_uncopied;
ret = copy_from_lzss_window(a, buff, rar->offset, bs);
if (ret != ARCHIVE_OK)
return (ret);
if (rar->unp_size >= DICTIONARY_MAX_SIZE)
rar->dictionary_size = DICTIONARY_MAX_SIZE;
else
- rar->dictionary_size = rar_fls(rar->unp_size) << 1;
+ rar->dictionary_size = rar_fls((unsigned int)rar->unp_size) << 1;
rar->lzss.window = (unsigned char *)realloc(rar->lzss.window,
rar->dictionary_size);
if (rar->lzss.window == NULL) {
return (ARCHIVE_FATAL);
}
if (bytes_read > tar->entry_bytes_remaining)
- bytes_read = tar->entry_bytes_remaining;
+ bytes_read = (ssize_t)tar->entry_bytes_remaining;
/* Don't read more than is available in the
* current sparse block. */
if (tar->sparse_list->remaining < bytes_read)
- bytes_read = tar->sparse_list->remaining;
+ bytes_read = (ssize_t)tar->sparse_list->remaining;
*size = bytes_read;
*offset = tar->sparse_list->offset;
tar->sparse_list->remaining -= bytes_read;
* Test the checksum. Note that POSIX specifies _unsigned_
* bytes for this calculation.
*/
- sum = tar_atol(header->checksum, sizeof(header->checksum));
+ sum = (int)tar_atol(header->checksum, sizeof(header->checksum));
check = 0;
for (i = 0; i < 148; i++)
check += (unsigned char)bytes[i];
* more to make sure that we don't overrun acl_text later.
*/
header = (const struct archive_entry_header_ustar *)h;
- size = tar_atol(header->size, sizeof(header->size));
+ size = (size_t)tar_atol(header->size, sizeof(header->size));
err = read_body_to_string(a, tar, &(tar->acl_text), h, unconsumed);
if (err != ARCHIVE_OK)
return (err);
}
/* Fail if we can't make our buffer big enough. */
- if (archive_string_ensure(as, size+1) == NULL) {
+ if (archive_string_ensure(as, (size_t)size+1) == NULL) {
archive_set_error(&a->archive, ENOMEM,
"No memory");
return (ARCHIVE_FATAL);
tar_flush_unconsumed(a, unconsumed);
/* Read the body into the string. */
- *unconsumed = (size + 511) & ~ 511;
+ *unconsumed = (size_t)((size + 511) & ~ 511);
src = __archive_read_ahead(a, *unconsumed, NULL);
if (src == NULL) {
*unconsumed = 0;
return (ARCHIVE_FATAL);
}
- memcpy(as->s, src, size);
+ memcpy(as->s, src, (size_t)size);
as->s[size] = '\0';
- as->length = size;
+ as->length = (size_t)size;
return (ARCHIVE_OK);
}
archive_string_empty(&(tar->entry_linkpath));
/* Parse out the numeric fields (all are octal) */
- archive_entry_set_mode(entry, tar_atol(header->mode, sizeof(header->mode)));
+ archive_entry_set_mode(entry,
+ (mode_t)tar_atol(header->mode, sizeof(header->mode)));
archive_entry_set_uid(entry, tar_atol(header->uid, sizeof(header->uid)));
archive_entry_set_gid(entry, tar_atol(header->gid, sizeof(header->gid)));
tar->entry_bytes_remaining = tar_atol(header->size, sizeof(header->size));
* Q: Is the above idea really possible? Even
* when there are GNU or pax extension entries?
*/
- data = __archive_read_ahead(a, size, NULL);
+ data = __archive_read_ahead(a, (size_t)size, NULL);
if (data == NULL) {
*unconsumed = 0;
return (ARCHIVE_FATAL);
}
- archive_entry_copy_mac_metadata(entry, data, size);
- *unconsumed = (size + 511) & ~ 511;
+ archive_entry_copy_mac_metadata(entry, data, (size_t)size);
+ *unconsumed = (size_t)((size + 511) & ~ 511);
tar_flush_unconsumed(a, unconsumed);
return (tar_read_header(a, tar, entry, unconsumed));
}
/* Parse out device numbers only for char and block specials. */
if (header->typeflag[0] == '3' || header->typeflag[0] == '4') {
- archive_entry_set_rdevmajor(entry,
+ archive_entry_set_rdevmajor(entry, (dev_t)
tar_atol(header->rdevmajor, sizeof(header->rdevmajor)));
- archive_entry_set_rdevminor(entry,
+ archive_entry_set_rdevminor(entry, (dev_t)
tar_atol(header->rdevminor, sizeof(header->rdevminor)));
}
/* GNU "1.0" sparse pax format */
if (strcmp(key, "GNU.sparse.major") == 0) {
- tar->sparse_gnu_major = tar_atol10(value, strlen(value));
+ tar->sparse_gnu_major = (int)tar_atol10(value, strlen(value));
tar->sparse_gnu_pending = 1;
}
if (strcmp(key, "GNU.sparse.minor") == 0) {
- tar->sparse_gnu_minor = tar_atol10(value, strlen(value));
+ tar->sparse_gnu_minor = (int)tar_atol10(value, strlen(value));
tar->sparse_gnu_pending = 1;
}
if (strcmp(key, "GNU.sparse.name") == 0) {
}
} else if (strcmp(key, "SCHILY.devmajor") == 0) {
archive_entry_set_rdevmajor(entry,
- tar_atol10(value, strlen(value)));
+ (dev_t)tar_atol10(value, strlen(value)));
} else if (strcmp(key, "SCHILY.devminor") == 0) {
archive_entry_set_rdevminor(entry,
- tar_atol10(value, strlen(value)));
+ (dev_t)tar_atol10(value, strlen(value)));
} else if (strcmp(key, "SCHILY.fflags") == 0) {
archive_entry_copy_fflags_text(entry, value);
} else if (strcmp(key, "SCHILY.dev") == 0) {
archive_entry_set_dev(entry,
- tar_atol10(value, strlen(value)));
+ (dev_t)tar_atol10(value, strlen(value)));
} else if (strcmp(key, "SCHILY.ino") == 0) {
archive_entry_set_ino(entry,
tar_atol10(value, strlen(value)));
} else if (strcmp(key, "SCHILY.nlink") == 0) {
- archive_entry_set_nlink(entry,
+ archive_entry_set_nlink(entry, (unsigned)
tar_atol10(value, strlen(value)));
} else if (strcmp(key, "SCHILY.realsize") == 0) {
tar->realsize = tar_atol10(value, strlen(value));
/* Parse out device numbers only for char and block specials */
if (header->typeflag[0] == '3' || header->typeflag[0] == '4') {
- archive_entry_set_rdevmajor(entry,
+ archive_entry_set_rdevmajor(entry, (dev_t)
tar_atol(header->rdevmajor, sizeof(header->rdevmajor)));
- archive_entry_set_rdevminor(entry,
+ archive_entry_set_rdevminor(entry, (dev_t)
tar_atol(header->rdevminor, sizeof(header->rdevminor)));
} else
archive_entry_set_rdev(entry, 0);
* don't require this, but they should.
*/
do {
- bytes_read = readline(a, tar, &p, tar_min(*remaining, 100), unconsumed);
+ bytes_read = readline(a, tar, &p,
+ (ssize_t)tar_min(*remaining, 100), unconsumed);
if (bytes_read <= 0)
return (ARCHIVE_FATAL);
*remaining -= bytes_read;
remaining = tar->entry_bytes_remaining;
/* Parse entries. */
- entries = gnu_sparse_10_atol(a, tar, &remaining, unconsumed);
+ entries = (int)gnu_sparse_10_atol(a, tar, &remaining, unconsumed);
if (entries < 0)
return (ARCHIVE_FATAL);
/* Parse the individual entries. */
}
/* Skip rest of block... */
tar_flush_unconsumed(a, unconsumed);
- bytes_read = tar->entry_bytes_remaining - remaining;
+ bytes_read = (ssize_t)(tar->entry_bytes_remaining - remaining);
to_skip = 0x1ff & -bytes_read;
if (to_skip != __archive_read_consume(a, to_skip))
return (ARCHIVE_FATAL);
- return (bytes_read + to_skip);
+ return ((ssize_t)(bytes_read + to_skip));
}
/*
time_t mtime;
time_t atime;
struct archive_string uname;
- uid_t uid;
+ int64_t uid;
struct archive_string gname;
- gid_t gid;
+ int64_t gid;
mode_t mode;
dev_t dev;
dev_t devmajor;
r = move_reading_point(a, xar->toc_chksum_offset);
if (r != ARCHIVE_OK)
return (r);
- b = __archive_read_ahead(a, xar->toc_chksum_size, &bytes);
+ b = __archive_read_ahead(a,
+ (size_t)xar->toc_chksum_size, &bytes);
if (bytes < 0)
return ((int)bytes);
if ((uint64_t)bytes < xar->toc_chksum_size) {
"Truncated archive file");
return (ARCHIVE_FATAL);
}
- r = checksum_final(a, b, xar->toc_chksum_size, NULL, 0);
+ r = checksum_final(a, b,
+ (size_t)xar->toc_chksum_size, NULL, 0);
__archive_read_consume(a, xar->toc_chksum_size);
xar->offset += xar->toc_chksum_size;
if (r != ARCHIVE_OK)
xar->file->hdnext = xar->hdlink_orgs;
xar->hdlink_orgs = xar->file;
} else {
- xar->file->link = atol10(attr->value,
+ xar->file->link = (unsigned)atol10(attr->value,
strlen(attr->value));
if (xar->file->link > 0)
if (add_link(a, xar, xar->file) != ARCHIVE_OK) {
xar->file->has |= HAS_MODE;
xar->file->mode =
(xar->file->mode & AE_IFMT) |
- (atol8(s, len) & ~AE_IFMT);
+ ((mode_t)(atol8(s, len)) & ~AE_IFMT);
break;
case FILE_GROUP:
xar->file->has |= HAS_GID;
zip_entry->system = p[5];
/* version_required = archive_le16dec(p + 6); */
zip_entry->flags = archive_le16dec(p + 8);
- zip_entry->compression = archive_le16dec(p + 10);
+ zip_entry->compression = (char)archive_le16dec(p + 10);
zip_entry->mtime = zip_time(p + 12);
zip_entry->crc32 = archive_le32dec(p + 16);
zip_entry->compressed_size = archive_le32dec(p + 20);
if ((zip->entry->mode & AE_IFMT) == AE_IFLNK) {
const void *p;
struct archive_string_conv *sconv;
- size_t linkname_length = archive_entry_size(entry);
+ size_t linkname_length = (size_t)archive_entry_size(entry);
archive_entry_set_size(entry, 0);
p = __archive_read_ahead(a, linkname_length, NULL);
version = p[4];
zip_entry->system = p[5];
zip_entry->flags = archive_le16dec(p + 6);
- zip_entry->compression = archive_le16dec(p + 8);
+ zip_entry->compression = (char)archive_le16dec(p + 8);
zip_entry->mtime = zip_time(p + 10);
local_crc32 = archive_le32dec(p + 14);
compressed_size = archive_le32dec(p + 18);
return (ARCHIVE_FATAL);
}
if (bytes_avail > zip->entry_bytes_remaining)
- bytes_avail = zip->entry_bytes_remaining;
+ bytes_avail = (ssize_t)zip->entry_bytes_remaining;
}
*size = bytes_avail;
zip->entry_bytes_remaining -= bytes_avail;
compressed_buff = __archive_read_ahead(a, 1, &bytes_avail);
if (0 == (zip->entry->flags & ZIP_LENGTH_AT_END)
&& bytes_avail > zip->entry_bytes_remaining) {
- bytes_avail = zip->entry_bytes_remaining;
+ bytes_avail = (ssize_t)zip->entry_bytes_remaining;
}
if (bytes_avail <= 0) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
break;
case 'c':
s = va_arg(ap, int);
- archive_strappend_char(as, s);
+ archive_strappend_char(as, (char)s);
break;
case 'd':
switch(long_flag) {
ULARGE_INTEGER ino64;
ino64.QuadPart = ub->st_ino;
/* I don't know this hashing is correct way */
- return (ino64.LowPart ^ (ino64.LowPart >> INOSIZE));
+ return ((ino_t)(ino64.LowPart ^ (ino64.LowPart >> INOSIZE)));
}
/*
st->st_ino = getino(us);
st->st_mode = us->st_mode;
st->st_nlink = us->st_nlink;
- st->st_size = us->st_size;
+ st->st_size = (off_t)us->st_size;
st->st_uid = us->st_uid;
st->st_dev = us->st_dev;
st->st_rdev = us->st_rdev;
#include <windows.h>
//#define EFTYPE 7
-#if defined(_MSC_VER)
-/* TODO: Fix the code, don't suppress the warnings. */
-#pragma warning(disable:4244) /* 'conversion' conversion from 'type1' to 'type2', possible loss of data */
-#endif
#if defined(__BORLANDC__)
#pragma warn -8068 /* Constant out of range in comparison. */
#pragma warn -8072 /* Suspicious pointer arithmetic. */
if (a->skip_file_set &&
archive_entry_dev_is_set(entry) &&
archive_entry_ino_is_set(entry) &&
- archive_entry_dev(entry) == a->skip_file_dev &&
+ archive_entry_dev(entry) == (dev_t)a->skip_file_dev &&
archive_entry_ino64(entry) == a->skip_file_ino) {
archive_set_error(&a->archive, 0,
"Can't add archive to itself");
state->checkpoint = state->in_count + CHECK_GAP;
if (state->in_count <= 0x007fffff)
- ratio = state->in_count * 256 / state->out_count;
- else if ((ratio = state->out_count / 256) == 0)
+ ratio = (int)(state->in_count * 256 / state->out_count);
+ else if ((ratio = (int)(state->out_count / 256)) == 0)
ratio = 0x7fffffff;
else
- ratio = state->in_count / ratio;
+ ratio = (int)(state->in_count / ratio);
if (ratio > state->compress_ratio)
state->compress_ratio = ratio;
data->compressed[1] = 0x8b;
data->compressed[2] = 0x08; /* "Deflate" compression */
data->compressed[3] = 0; /* No options */
- data->compressed[4] = (t)&0xff; /* Timestamp */
- data->compressed[5] = (t>>8)&0xff;
- data->compressed[6] = (t>>16)&0xff;
- data->compressed[7] = (t>>24)&0xff;
+ data->compressed[4] = (uint8_t)(t)&0xff; /* Timestamp */
+ data->compressed[5] = (uint8_t)(t>>8)&0xff;
+ data->compressed[6] = (uint8_t)(t>>16)&0xff;
+ data->compressed[7] = (uint8_t)(t>>24)&0xff;
data->compressed[8] = 0; /* No deflate options */
data->compressed[9] = 3; /* OS=Unix */
data->stream.next_out += 10;
}
if (ret == ARCHIVE_OK) {
/* Build and write out 8-byte trailer. */
- trailer[0] = (data->crc)&0xff;
- trailer[1] = (data->crc >> 8)&0xff;
- trailer[2] = (data->crc >> 16)&0xff;
- trailer[3] = (data->crc >> 24)&0xff;
- trailer[4] = (data->total_in)&0xff;
- trailer[5] = (data->total_in >> 8)&0xff;
- trailer[6] = (data->total_in >> 16)&0xff;
- trailer[7] = (data->total_in >> 24)&0xff;
+ trailer[0] = (uint8_t)(data->crc)&0xff;
+ trailer[1] = (uint8_t)(data->crc >> 8)&0xff;
+ trailer[2] = (uint8_t)(data->crc >> 16)&0xff;
+ trailer[3] = (uint8_t)(data->crc >> 24)&0xff;
+ trailer[4] = (uint8_t)(data->total_in)&0xff;
+ trailer[5] = (uint8_t)(data->total_in >> 8)&0xff;
+ trailer[6] = (uint8_t)(data->total_in >> 16)&0xff;
+ trailer[7] = (uint8_t)(data->total_in >> 24)&0xff;
ret = __archive_write_filter(f->next_filter, trailer, 8);
}
struct fixup_entry *current_fixup;
int64_t user_uid;
int skip_file_set;
- dev_t skip_file_dev;
- ino_t skip_file_ino;
+ int64_t skip_file_dev;
+ int64_t skip_file_ino;
time_t start_time;
int64_t (*lookup_gid)(void *private, const char *gname, int64_t gid);
/* If it's our archive, we're done. */
if (a->skip_file_set &&
- a->st.st_dev == a->skip_file_dev &&
- a->st.st_ino == a->skip_file_ino) {
- archive_set_error(&a->archive, 0, "Refusing to overwrite archive");
+ a->st.st_dev == (dev_t)a->skip_file_dev &&
+ a->st.st_ino == (ino_t)a->skip_file_ino) {
+ archive_set_error(&a->archive, 0,
+ "Refusing to overwrite archive");
return (ARCHIVE_FAILED);
}
#else
#error No way to perform gid lookups on this platform
#endif
- b->id = gid;
+ b->id = (gid_t)gid;
return (gid);
}
#else
#error No way to look up uids on this platform
#endif
- b->id = uid;
+ b->id = (uid_t)uid;
return (uid);
}
struct fixup_entry *current_fixup;
int64_t user_uid;
int skip_file_set;
- dev_t skip_file_dev;
- ino_t skip_file_ino;
+ int64_t skip_file_dev;
+ int64_t skip_file_ino;
time_t start_time;
int64_t (*lookup_gid)(void *private, const char *gname, int64_t gid);
* truncate it to the block boundary. */
bytes_to_write = size;
if (a->offset + bytes_to_write > block_end)
- bytes_to_write = block_end - a->offset;
+ bytes_to_write = (DWORD)(block_end - a->offset);
}
memset(&ol, 0, sizeof(ol));
ol.Offset = (DWORD)(a->offset & 0xFFFFFFFF);
a->offset += bytes_written;
a->fd_offset = a->offset;
}
- return (start_size - size);
+ return ((ssize_t)(start_size - size));
}
static ssize_t
/* Dev/ino of the archive being written. */
int skip_file_set;
- dev_t skip_file_dev;
+ int64_t skip_file_dev;
int64_t skip_file_ino;
/* Utility: Pointer to a block of nulls. */
if (archive_entry_filetype(entry) == AE_IFLNK) {
ssize_t bytes;
const void *p = (const void *)archive_entry_symlink(entry);
- bytes = compress_out(a, p, file->size, ARCHIVE_Z_RUN);
+ bytes = compress_out(a, p, (size_t)file->size, ARCHIVE_Z_RUN);
if (bytes < 0)
return ((int)bytes);
zip->entry_crc32 = crc32(zip->entry_crc32, p, bytes);
} while (zip->stream.avail_in);
if (run == ARCHIVE_Z_FINISH) {
uint64_t bytes = sizeof(zip->wbuff) - zip->stream.avail_out;
- if (write_to_temp(a, zip->wbuff, bytes) != ARCHIVE_OK)
+ if (write_to_temp(a, zip->wbuff, (size_t)bytes) != ARCHIVE_OK)
return (ARCHIVE_FATAL);
if ((zip->crc32flg & ENCODED_CRC32) && bytes)
zip->encoded_crc32 = crc32(zip->encoded_crc32,
- zip->wbuff, bytes);
+ zip->wbuff, (unsigned)bytes);
}
return (s);
zip = (struct _7zip *)a->format_data;
if (s > zip->entry_bytes_remaining)
- s = zip->entry_bytes_remaining;
+ s = (size_t)zip->entry_bytes_remaining;
if (s == 0 || zip->cur_file == NULL)
return (0);
bytes = compress_out(a, buff, s, ARCHIVE_Z_RUN);
return (ARCHIVE_OK);
while (zip->entry_bytes_remaining > 0) {
- s = zip->entry_bytes_remaining;
+ s = (size_t)zip->entry_bytes_remaining;
if (s > a->null_length)
s = a->null_length;
r = _7z_write_data(a, a->nulls, s);
* a non-const pointer. */
strm->next_in = (Bytef *)(uintptr_t)(const void *)lastrm->next_in;
strm->avail_in = lastrm->avail_in;
- strm->total_in = lastrm->total_in;
+ strm->total_in = (uLong)lastrm->total_in;
strm->next_out = lastrm->next_out;
strm->avail_out = lastrm->avail_out;
- strm->total_out = lastrm->total_out;
+ strm->total_out = (uLong)lastrm->total_out;
if (deflateInit2(strm, level, Z_DEFLATED,
(withheader)?15:-15,
8, Z_DEFAULT_STRATEGY) != Z_OK) {
* a non-const pointer. */
strm->next_in = (Bytef *)(uintptr_t)(const void *)lastrm->next_in;
strm->avail_in = lastrm->avail_in;
- strm->total_in = lastrm->total_in;
+ strm->total_in = (uLong)lastrm->total_in;
strm->next_out = lastrm->next_out;
strm->avail_out = lastrm->avail_out;
- strm->total_out = lastrm->total_out;
+ strm->total_out = (uLong)lastrm->total_out;
r = deflate(strm,
(action == ARCHIVE_Z_FINISH)? Z_FINISH: Z_NO_FLUSH);
lastrm->next_in = strm->next_in;
ar = (struct ar_w *)a->format_data;
if (s > ar->entry_bytes_remaining)
- s = ar->entry_bytes_remaining;
+ s = (size_t)ar->entry_bytes_remaining;
if (ar->is_strtab > 0) {
if (ar->has_strtab > 0) {
/* Don't store a mapping if we don't need to. */
if (archive_entry_nlink(entry) < 2) {
- return ++cpio->ino_next;
+ return (int)(++cpio->ino_next);
}
/* Look up old ino; if we have it, this is a hardlink
}
/* Assign a new index number. */
- ino_new = ++cpio->ino_next;
+ ino_new = (int)(++cpio->ino_next);
/* Ensure space for the new mapping. */
if (cpio->ino_list_size <= cpio->ino_list_next) {
cpio = (struct cpio *)a->format_data;
if (s > cpio->entry_bytes_remaining)
- s = cpio->entry_bytes_remaining;
+ s = (size_t)cpio->entry_bytes_remaining;
ret = __archive_write_output(a, buff, s);
cpio->entry_bytes_remaining -= s;
if (s == 0)
return (v);
v = format_octal_recursive(v, p+1, s-1);
- *p = '0' + (v & 7);
+ *p = '0' + ((char)v & 7);
return (v >> 3);
}
struct cpio *cpio;
cpio = (struct cpio *)a->format_data;
- return (__archive_write_nulls(a, cpio->entry_bytes_remaining));
+ return (__archive_write_nulls(a,
+ (size_t)cpio->entry_bytes_remaining));
}
}
cpio->entry_bytes_remaining = archive_entry_size(entry);
- cpio->padding = PAD4(cpio->entry_bytes_remaining);
+ cpio->padding = (int)PAD4(cpio->entry_bytes_remaining);
/* Write the symlink now. */
if (p != NULL && *p != '\0') {
cpio = (struct cpio *)a->format_data;
if (s > cpio->entry_bytes_remaining)
- s = cpio->entry_bytes_remaining;
+ s = (size_t)cpio->entry_bytes_remaining;
ret = __archive_write_output(a, buff, s);
cpio->entry_bytes_remaining -= s;
struct cpio *cpio;
cpio = (struct cpio *)a->format_data;
- return (__archive_write_nulls(a, cpio->entry_bytes_remaining + cpio->padding));
+ return (__archive_write_nulls(a,
+ (size_t)cpio->entry_bytes_remaining + cpio->padding));
}
int ret;
gnutar = (struct gnutar *)a->format_data;
- ret = __archive_write_nulls(a,
- gnutar->entry_bytes_remaining + gnutar->entry_padding);
+ ret = __archive_write_nulls(a, (size_t)
+ (gnutar->entry_bytes_remaining + gnutar->entry_padding));
gnutar->entry_bytes_remaining = gnutar->entry_padding = 0;
return (ret);
}
gnutar = (struct gnutar *)a->format_data;
if (s > gnutar->entry_bytes_remaining)
- s = gnutar->entry_bytes_remaining;
+ s = (size_t)gnutar->entry_bytes_remaining;
ret = __archive_write_output(a, buff, s);
gnutar->entry_bytes_remaining -= s;
if (ret != ARCHIVE_OK)
size_t ns;
int ret;
- ns = csize % LOGICAL_BLOCK_SIZE;
+ ns = (size_t)(csize % LOGICAL_BLOCK_SIZE);
if (ns != 0)
ret = write_null(a, LOGICAL_BLOCK_SIZE - ns);
else
struct content *con;
size_t ts;
- ts = MULTI_EXTENT_SIZE - LOGICAL_BLOCK_SIZE -
- iso9660->cur_file->cur_content->size;
+ ts = (size_t)(MULTI_EXTENT_SIZE - LOGICAL_BLOCK_SIZE -
+ iso9660->cur_file->cur_content->size);
if (iso9660->zisofs.detect_magic)
zisofs_detect_magic(a, buff, ts);
return (ARCHIVE_FATAL);
/* Compute the logical block number. */
- iso9660->cur_file->cur_content->blocks =
- (iso9660->cur_file->cur_content->size
- + LOGICAL_BLOCK_SIZE -1) >> LOGICAL_BLOCK_BITS;
+ iso9660->cur_file->cur_content->blocks = (int)
+ ((iso9660->cur_file->cur_content->size
+ + LOGICAL_BLOCK_SIZE -1) >> LOGICAL_BLOCK_BITS);
/*
* Make next extent.
if (archive_entry_filetype(iso9660->cur_file->entry) != AE_IFREG)
return (0);
if (s > iso9660->bytes_remaining)
- s = iso9660->bytes_remaining;
+ s = (size_t)iso9660->bytes_remaining;
if (s == 0)
return (0);
return (ARCHIVE_FATAL);
/* Compute the logical block number. */
- iso9660->cur_file->cur_content->blocks =
- (iso9660->cur_file->cur_content->size
- + LOGICAL_BLOCK_SIZE -1) >> LOGICAL_BLOCK_BITS;
+ iso9660->cur_file->cur_content->blocks = (int)
+ ((iso9660->cur_file->cur_content->size
+ + LOGICAL_BLOCK_SIZE -1) >> LOGICAL_BLOCK_BITS);
/* Add the current file to data file list. */
isofile_add_data_file(iso9660, iso9660->cur_file);
set_digit(p+10, 2, tm.tm_min);
set_digit(p+12, 2, tm.tm_sec);
set_digit(p+14, 2, 0);
- set_num_712(p+16, get_gmoffset(&tm)/(60*15));
+ set_num_712(p+16, (char)(get_gmoffset(&tm)/(60*15)));
}
static void
set_num_711(p+3, tm.tm_hour);
set_num_711(p+4, tm.tm_min);
set_num_711(p+5, tm.tm_sec);
- set_num_712(p+6, get_gmoffset(&tm)/(60*15));
+ set_num_712(p+6, (char)(get_gmoffset(&tm)/(60*15)));
}
bp = extra_next_record(&ctl, length);
if (bp != NULL) {
mode_t mode;
- uid_t uid;
- gid_t gid;
+ int64_t uid;
+ int64_t gid;
mode = archive_entry_mode(file->entry);
uid = archive_entry_uid(file->entry);
/* file links (stat.st_nlink) */
set_num_733(bp+13,
archive_entry_nlink(file->entry));
- set_num_733(bp+21, uid);
- set_num_733(bp+29, gid);
+ set_num_733(bp+21, (uint32_t)uid);
+ set_num_733(bp+29, (uint32_t)gid);
/* File Serial Number */
if (pxent->dir)
set_num_733(bp+37, pxent->dir_location);
bp[3] = length;
bp[4] = 1; /* version */
dev = (uint64_t)archive_entry_rdev(file->entry);
- set_num_733(bp + 5, dev >> 32);
- set_num_733(bp + 13, dev & 0xFFFFFFFF);
+ set_num_733(bp + 5, (uint32_t)(dev >> 32));
+ set_num_733(bp + 13, (uint32_t)(dev & 0xFFFFFFFF));
bp += length;
}
extra_tell_used_size(&ctl, length);
set_num_733(bp+11,
xisoent->dir_block * LOGICAL_BLOCK_SIZE);
else
- set_num_733(bp+11, file->cur_content->size);
+ set_num_733(bp+11, (uint32_t)file->cur_content->size);
/* Recording Date and Time */
/* NOTE:
* If a file type is symbolic link, you are seeing this
iso9660->wbuff_tail = iso9660->wbuff_offset + used;
if (iso9660->wbuff_offset < iso9660->wbuff_written) {
if (used > 0 &&
- write_to_temp(a, iso9660->wbuff, used) != ARCHIVE_OK)
+ write_to_temp(a, iso9660->wbuff, (size_t)used) != ARCHIVE_OK)
return (ARCHIVE_FATAL);
iso9660->wbuff_offset = iso9660->wbuff_written;
lseek(iso9660->temp_fd, iso9660->wbuff_offset, SEEK_SET);
iso9660->wbuff_offset = off;
iso9660->wbuff_remaining = sizeof(iso9660->wbuff);
} else if (off <= iso9660->wbuff_tail) {
- iso9660->wbuff_remaining =
- sizeof(iso9660->wbuff) - (off - iso9660->wbuff_offset);
+ iso9660->wbuff_remaining = (size_t)
+ (sizeof(iso9660->wbuff) - (off - iso9660->wbuff_offset));
} else {
ext_bytes = off - iso9660->wbuff_tail;
- iso9660->wbuff_remaining = sizeof(iso9660->wbuff)
- - (iso9660->wbuff_tail - iso9660->wbuff_offset);
+ iso9660->wbuff_remaining = (size_t)(sizeof(iso9660->wbuff)
+ - (iso9660->wbuff_tail - iso9660->wbuff_offset));
while (ext_bytes >= (int64_t)iso9660->wbuff_remaining) {
if (write_null(a, (size_t)iso9660->wbuff_remaining)
!= ARCHIVE_OK)
iso9660->total_file_block = 0;
if ((isoent = iso9660->el_torito.catalog) != NULL) {
isoent->file->content.location = location;
- block = (archive_entry_size(isoent->file->entry) +
- LOGICAL_BLOCK_SIZE -1) >> LOGICAL_BLOCK_BITS;
+ block = (int)((archive_entry_size(isoent->file->entry) +
+ LOGICAL_BLOCK_SIZE -1) >> LOGICAL_BLOCK_BITS);
location += block;
iso9660->total_file_block += block;
}
isoent->file->content.location = location;
size = fd_boot_image_size(iso9660->el_torito.media_type);
if (size == 0)
- size = archive_entry_size(isoent->file->entry);
+ size = (size_t)archive_entry_size(isoent->file->entry);
block = (size + LOGICAL_BLOCK_SIZE -1) >> LOGICAL_BLOCK_BITS;
location += block;
iso9660->total_file_block += block;
/* Mark file->zisofs to create RRIP 'ZF' Use Entry. */
file->zisofs.header_size = ZF_HEADER_SIZE >> 2;
file->zisofs.log2_bs = ZF_LOG2_BS;
- file->zisofs.uncompressed_size = archive_entry_size(file->entry);
+ file->zisofs.uncompressed_size =
+ (uint32_t)archive_entry_size(file->entry);
/* Calculate a size of Block Pointers of zisofs. */
ceil = (file->zisofs.uncompressed_size + ZF_BLOCK_SIZE -1)
* file.
*/
tsize = ZF_HEADER_SIZE + bpsize;
- if (write_null(a, tsize) != ARCHIVE_OK)
+ if (write_null(a, (size_t)tsize) != ARCHIVE_OK)
return (ARCHIVE_FATAL);
/*
* Initialize some variables to make zisofs.
*/
- archive_le32enc(&(iso9660->zisofs.block_pointers[0]), tsize);
+ archive_le32enc(&(iso9660->zisofs.block_pointers[0]),
+ (uint32_t)tsize);
iso9660->zisofs.remaining = file->zisofs.uncompressed_size;
iso9660->zisofs.making = 1;
iso9660->zisofs.allzero = 1;
entry_size = archive_entry_size(file->entry);
if ((int64_t)sizeof(iso9660->zisofs.magic_buffer) > entry_size)
- magic_max = entry_size;
+ magic_max = (int)entry_size;
else
magic_max = sizeof(iso9660->zisofs.magic_buffer);
iso9660->zisofs.block_pointers_idx ++;
archive_le32enc(&(iso9660->zisofs.block_pointers[
iso9660->zisofs.block_pointers_idx]),
- iso9660->zisofs.total_size);
+ (uint32_t)iso9660->zisofs.total_size);
r = zisofs_init_zstream(a);
if (r != ARCHIVE_OK)
return (ARCHIVE_FATAL);
size_t ceil, xsize;
/* Allocate block pointers buffer. */
- ceil = (zisofs->pz_uncompressed_size +
+ ceil = (size_t)((zisofs->pz_uncompressed_size +
(((int64_t)1) << zisofs->pz_log2_bs) - 1)
- >> zisofs->pz_log2_bs;
+ >> zisofs->pz_log2_bs);
xsize = (ceil + 1) * 4;
if (zisofs->block_pointers == NULL) {
size_t alloc = ((xsize >> 10) + 1) << 10;
fd = iso9660->temp_fd;
new_offset = wb_offset(a);
read_offset = file->content.offset_of_temp;
- remaining = file->content.size;
+ remaining = (size_t)file->content.size;
if (remaining > 1024 * 32)
rbuff_size = 1024 * 32;
else
struct mtree_writer *mtree= a->format_data;
if (n > mtree->entry_bytes_remaining)
- n = mtree->entry_bytes_remaining;
+ n = (size_t)mtree->entry_bytes_remaining;
mtree->entry_bytes_remaining -= n;
/* We don't need to compute a regular file sum */
return (ARCHIVE_FATAL);
}
/* Pad out the end of the entry. */
- r = __archive_write_nulls(a, pax->entry_padding);
+ r = __archive_write_nulls(a, (size_t)pax->entry_padding);
if (r != ARCHIVE_OK) {
/* If a write fails, we're pretty much toast. */
return (ARCHIVE_FATAL);
pax->sparse_list = sb;
}
}
- ret = __archive_write_nulls(a, remaining + pax->entry_padding);
+ ret = __archive_write_nulls(a, (size_t)(remaining + pax->entry_padding));
pax->entry_bytes_remaining = pax->entry_padding = 0;
return (ret);
}
p = ((const unsigned char *)buff) + total;
ws = s - total;
if (ws > pax->sparse_list->remaining)
- ws = pax->sparse_list->remaining;
+ ws = (size_t)pax->sparse_list->remaining;
if (pax->sparse_list->is_hole) {
/* Current block is hole thus we do not write
ustar = (struct ustar *)a->format_data;
ret = __archive_write_nulls(a,
- ustar->entry_bytes_remaining + ustar->entry_padding);
+ (size_t)(ustar->entry_bytes_remaining + ustar->entry_padding));
ustar->entry_bytes_remaining = ustar->entry_padding = 0;
return (ret);
}
ustar = (struct ustar *)a->format_data;
if (s > ustar->entry_bytes_remaining)
- s = ustar->entry_bytes_remaining;
+ s = (size_t)ustar->entry_bytes_remaining;
ret = __archive_write_output(a, buff, s);
ustar->entry_bytes_remaining -= s;
if (ret != ARCHIVE_OK)
xar = (struct xar *)a->format_data;
if (s > xar->bytes_remaining)
- s = xar->bytes_remaining;
+ s = (size_t)xar->bytes_remaining;
if (s == 0 || xar->cur_file == NULL)
return (0);
if (xar->cur_file->data.compression == NONE) {
return (ARCHIVE_OK);
while (xar->bytes_remaining > 0) {
- s = xar->bytes_remaining;
+ s = (size_t)xar->bytes_remaining;
if (s > a->null_length)
s = a->null_length;
w = xar_write_data(a, a->nulls, s);
* a non-const pointer. */
strm->next_in = (Bytef *)(uintptr_t)(const void *)lastrm->next_in;
strm->avail_in = lastrm->avail_in;
- strm->total_in = lastrm->total_in;
+ strm->total_in = (uLong)lastrm->total_in;
strm->next_out = lastrm->next_out;
strm->avail_out = lastrm->avail_out;
- strm->total_out = lastrm->total_out;
+ strm->total_out = (uLong)lastrm->total_out;
if (deflateInit2(strm, level, Z_DEFLATED,
(withheader)?15:-15,
8, Z_DEFAULT_STRATEGY) != Z_OK) {
* a non-const pointer. */
strm->next_in = (Bytef *)(uintptr_t)(const void *)lastrm->next_in;
strm->avail_in = lastrm->avail_in;
- strm->total_in = lastrm->total_in;
+ strm->total_in = (uLong)lastrm->total_in;
strm->next_out = lastrm->next_out;
strm->avail_out = lastrm->avail_out;
- strm->total_out = lastrm->total_out;
+ strm->total_out = (uLong)lastrm->total_out;
r = deflate(strm,
(action == ARCHIVE_Z_FINISH)? Z_FINISH: Z_NO_FLUSH);
lastrm->next_in = strm->next_in;
* specification says to set to zero when using data
* descriptors. Otherwise the end of the data for an
* entry is rather difficult to find. */
- archive_le32enc(&h[LOCAL_FILE_HEADER_COMPRESSED_SIZE], size);
- archive_le32enc(&h[LOCAL_FILE_HEADER_UNCOMPRESSED_SIZE], size);
+ archive_le32enc(&h[LOCAL_FILE_HEADER_COMPRESSED_SIZE],
+ (uint32_t)size);
+ archive_le32enc(&h[LOCAL_FILE_HEADER_UNCOMPRESSED_SIZE],
+ (uint32_t)size);
break;
#ifdef HAVE_ZLIB_H
case COMPRESSION_DEFLATE:
- archive_le32enc(&h[LOCAL_FILE_HEADER_UNCOMPRESSED_SIZE], size);
+ archive_le32enc(&h[LOCAL_FILE_HEADER_UNCOMPRESSED_SIZE],
+ (uint32_t)size);
zip->stream.zalloc = Z_NULL;
zip->stream.zfree = Z_NULL;
ZIP_SIGNATURE_EXTRA_TIMESTAMP);
archive_le16enc(&e[EXTRA_DATA_LOCAL_TIME_SIZE], 1 + 4 * 3);
e[EXTRA_DATA_LOCAL_TIME_FLAG] = 0x07;
- archive_le32enc(&e[EXTRA_DATA_LOCAL_MTIME], archive_entry_mtime(entry));
- archive_le32enc(&e[EXTRA_DATA_LOCAL_ATIME], archive_entry_atime(entry));
- archive_le32enc(&e[EXTRA_DATA_LOCAL_CTIME], archive_entry_ctime(entry));
+ archive_le32enc(&e[EXTRA_DATA_LOCAL_MTIME],
+ (uint32_t)archive_entry_mtime(entry));
+ archive_le32enc(&e[EXTRA_DATA_LOCAL_ATIME],
+ (uint32_t)archive_entry_atime(entry));
+ archive_le32enc(&e[EXTRA_DATA_LOCAL_CTIME],
+ (uint32_t)archive_entry_ctime(entry));
archive_le16enc(&e[EXTRA_DATA_LOCAL_UNIX_ID],
ZIP_SIGNATURE_EXTRA_NEW_UNIX);
e[EXTRA_DATA_LOCAL_UNIX_VERSION] = 1;
e[EXTRA_DATA_LOCAL_UNIX_UID_SIZE] = 4;
archive_le32enc(&e[EXTRA_DATA_LOCAL_UNIX_UID],
- archive_entry_uid(entry));
+ (uint32_t)archive_entry_uid(entry));
e[EXTRA_DATA_LOCAL_UNIX_GID_SIZE] = 4;
archive_le32enc(&e[EXTRA_DATA_LOCAL_UNIX_GID],
- archive_entry_gid(entry));
+ (uint32_t)archive_entry_gid(entry));
- archive_le32enc(&d[DATA_DESCRIPTOR_UNCOMPRESSED_SIZE], size);
+ archive_le32enc(&d[DATA_DESCRIPTOR_UNCOMPRESSED_SIZE],
+ (uint32_t)size);
ret = __archive_write_output(a, h, sizeof(h));
if (ret != ARCHIVE_OK)
const unsigned char *p;
p = (const unsigned char *)archive_entry_symlink(l->entry);
- ret = __archive_write_output(a, p, size);
+ ret = __archive_write_output(a, p, (size_t)size);
if (ret != ARCHIVE_OK)
return (ARCHIVE_FATAL);
zip->written_bytes += size;
- l->crc32 = crc32(l->crc32, p, size);
+ l->crc32 = crc32(l->crc32, p, (unsigned)size);
}
if (ret2 != ARCHIVE_OK)
archive_le32enc(&d[DATA_DESCRIPTOR_CRC32], l->crc32);
archive_le32enc(&d[DATA_DESCRIPTOR_COMPRESSED_SIZE],
- l->compressed_size);
+ (uint32_t)l->compressed_size);
ret = __archive_write_output(a, d, SIZE_DATA_DESCRIPTOR);
if (ret != ARCHIVE_OK)
return (ARCHIVE_FATAL);
dos_time(archive_entry_mtime(l->entry)));
archive_le32enc(&h[FILE_HEADER_CRC32], l->crc32);
archive_le32enc(&h[FILE_HEADER_COMPRESSED_SIZE],
- l->compressed_size);
+ (uint32_t)l->compressed_size);
archive_le32enc(&h[FILE_HEADER_UNCOMPRESSED_SIZE],
- archive_entry_size(l->entry));
+ (uint32_t)archive_entry_size(l->entry));
archive_le16enc(&h[FILE_HEADER_FILENAME_LENGTH],
(uint16_t)path_length(l->entry));
archive_le16enc(&h[FILE_HEADER_EXTRA_LENGTH], sizeof(e));
archive_le16enc(&h[FILE_HEADER_ATTRIBUTES_EXTERNAL+2],
archive_entry_mode(l->entry));
- archive_le32enc(&h[FILE_HEADER_OFFSET], l->offset);
+ archive_le32enc(&h[FILE_HEADER_OFFSET], (uint32_t)l->offset);
/* Formatting extra data. */
archive_le16enc(&e[EXTRA_DATA_CENTRAL_TIME_ID],
archive_le16enc(&e[EXTRA_DATA_CENTRAL_TIME_SIZE], 1 + 4);
e[EXTRA_DATA_CENTRAL_TIME_FLAG] = 0x07;
archive_le32enc(&e[EXTRA_DATA_CENTRAL_MTIME],
- archive_entry_mtime(l->entry));
+ (uint32_t)archive_entry_mtime(l->entry));
archive_le16enc(&e[EXTRA_DATA_CENTRAL_UNIX_ID],
ZIP_SIGNATURE_EXTRA_NEW_UNIX);
archive_le16enc(&e[EXTRA_DATA_CENTRAL_UNIX_SIZE], 0x0000);
archive_le16enc(&end[CENTRAL_DIRECTORY_END_ENTRIES_DISK], entries);
archive_le16enc(&end[CENTRAL_DIRECTORY_END_ENTRIES], entries);
archive_le32enc(&end[CENTRAL_DIRECTORY_END_SIZE],
- offset_end - offset_start);
- archive_le32enc(&end[CENTRAL_DIRECTORY_END_OFFSET], offset_start);
+ (uint32_t)(offset_end - offset_start));
+ archive_le32enc(&end[CENTRAL_DIRECTORY_END_OFFSET],
+ (uint32_t)offset_start);
/* Writing end of central directory. */
ret = __archive_write_output(a, end, sizeof(end));