From: IohannRabeson Date: Sun, 3 Oct 2021 06:07:37 +0000 (-0400) Subject: Make all the implicit cast explicit. X-Git-Tag: v3.6.0~43^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4c29c07bd709587906459963e44523f067020edc;p=thirdparty%2Flibarchive.git Make all the implicit cast explicit. To prevent conversion warning preventing to build on Windows. --- diff --git a/libarchive/archive_read_support_format_rar5.c b/libarchive/archive_read_support_format_rar5.c index 5d62d16ee..8857451e2 100644 --- a/libarchive/archive_read_support_format_rar5.c +++ b/libarchive/archive_read_support_format_rar5.c @@ -632,7 +632,7 @@ static int run_arm_filter(struct rar5* rar, struct filter_info* flt) { /* 0xEB = ARM's BL (branch + link) instruction. */ offset = read_filter_data(rar, (rar->cstate.solid_offset + flt->block_start + i) & - rar->cstate.window_mask) & 0x00ffffff; + (uint32_t)rar->cstate.window_mask) & 0x00ffffff; offset -= (uint32_t) ((i + flt->block_start) / 4); offset = (offset & 0x00ffffff) | 0xeb000000; diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c index 21d41cc0f..5d9588584 100644 --- a/libarchive/archive_read_support_format_zip.c +++ b/libarchive/archive_read_support_format_zip.c @@ -1186,7 +1186,7 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry, { // symlink target string appeared to be compressed int status = ARCHIVE_FATAL; - const void *uncompressed_buffer; + const void *uncompressed_buffer = NULL; switch (zip->entry->compression) { diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index 7460ded00..d7f2c46b2 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -745,7 +745,7 @@ archive_string_append_from_wcs_in_codepage(struct archive_string *as, dp = &defchar_used; count = WideCharToMultiByte(to_cp, 0, ws, wslen, as->s + as->length, - (int)as->buffer_length - as->length - 1, NULL, dp); + (int)as->buffer_length - (int)as->length - 1, NULL, dp); if (count == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { /* Expand the MBS buffer and retry. */ diff --git a/libarchive/archive_write_disk_windows.c b/libarchive/archive_write_disk_windows.c index 0c600176c..fede8ab91 100644 --- a/libarchive/archive_write_disk_windows.c +++ b/libarchive/archive_write_disk_windows.c @@ -628,7 +628,7 @@ la_CreateSymbolicLinkW(const wchar_t *linkname, const wchar_t *target, static BOOLEAN (WINAPI *f)(LPCWSTR, LPCWSTR, DWORD); static int set; wchar_t *ttarget, *p; - int len; + size_t len; DWORD attrs = 0; DWORD flags = 0; DWORD newflags = 0; diff --git a/libarchive/archive_write_set_format_cpio_binary.c b/libarchive/archive_write_set_format_cpio_binary.c index d5051c754..d6ce35a7b 100644 --- a/libarchive/archive_write_set_format_cpio_binary.c +++ b/libarchive/archive_write_set_format_cpio_binary.c @@ -441,7 +441,7 @@ write_header(struct archive_write *a, struct archive_entry *entry) ret_final = ARCHIVE_FATAL; goto exit_write_header; } - h.h_ino = la_swap16(ino); + h.h_ino = la_swap16((uint16_t)ino); h.h_mode = archive_entry_mode(entry); if (((h.h_mode & AE_IFMT) == AE_IFSOCK) || ((h.h_mode & AE_IFMT) == AE_IFIFO)) { @@ -462,9 +462,9 @@ write_header(struct archive_write *a, struct archive_entry *entry) } h.h_mode = la_swap16(h.h_mode); - h.h_uid = la_swap16(archive_entry_uid(entry)); - h.h_gid = la_swap16(archive_entry_gid(entry)); - h.h_nlink = la_swap16(archive_entry_nlink(entry)); + h.h_uid = la_swap16((uint16_t)archive_entry_uid(entry)); + h.h_gid = la_swap16((uint16_t)archive_entry_gid(entry)); + h.h_nlink = la_swap16((uint16_t)archive_entry_nlink(entry)); if (archive_entry_filetype(entry) == AE_IFBLK || archive_entry_filetype(entry) == AE_IFCHR) @@ -472,7 +472,7 @@ write_header(struct archive_write *a, struct archive_entry *entry) else h.h_majmin = 0; - h.h_mtime = la_swap32(archive_entry_mtime(entry)); + h.h_mtime = la_swap32((uint32_t)archive_entry_mtime(entry)); h.h_namesize = la_swap16(pathlength); /* Non-regular files don't store bodies. */ @@ -502,7 +502,7 @@ write_header(struct archive_write *a, struct archive_entry *entry) ret_final = ARCHIVE_FATAL; goto exit_write_header; } - h.h_filesize = la_swap32(strlen(p)); /* symlink */ + h.h_filesize = la_swap32((uint32_t)strlen(p)); /* symlink */ } else { if ((a->archive.archive_format == ARCHIVE_FORMAT_CPIO_PWB) && (archive_entry_size(entry) > 256*256*256-1)) { @@ -516,7 +516,7 @@ write_header(struct archive_write *a, struct archive_entry *entry) ret_final = ARCHIVE_FAILED; goto exit_write_header; } - h.h_filesize = la_swap32(archive_entry_size(entry)); /* file */ + h.h_filesize = la_swap32((uint32_t)archive_entry_size(entry)); /* file */ } ret = __archive_write_output(a, &h, HSIZE);