]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Make all the implicit cast explicit. 1588/head
authorIohannRabeson <IohannRabeson@users.noreply.github.com>
Sun, 3 Oct 2021 06:07:37 +0000 (02:07 -0400)
committerIohannRabeson <IohannRabeson@users.noreply.github.com>
Sun, 3 Oct 2021 06:09:50 +0000 (02:09 -0400)
To prevent conversion warning preventing to build on Windows.

libarchive/archive_read_support_format_rar5.c
libarchive/archive_read_support_format_zip.c
libarchive/archive_string.c
libarchive/archive_write_disk_windows.c
libarchive/archive_write_set_format_cpio_binary.c

index 5d62d16ee00f54685924c9dff59fa175aadd589a..8857451e2365fd8aa18d86c25c31827aaeb4635b 100644 (file)
@@ -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;
index 21d41cc0f741d030337abda317d436addb598ed9..5d9588584b36e98756a51bb8bb3bc7bbc7e51d8a 100644 (file)
@@ -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)
                        {
index 7460ded00232064105cb85d898e1f0a3f9296ebb..d7f2c46b28fe4eeca20fb5af1b7e655059979db9 100644 (file)
@@ -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. */
index 0c600176cd54325b3c1452f1b84624bb73a1c4a1..fede8ab914709e8d474e4a51e2a5f9ec1e01b2ab 100644 (file)
@@ -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;
index d5051c754088578b97b2043501345e9f6fb7b960..d6ce35a7bc1f1ff2b8d42cf20610921ec61eaf32 100644 (file)
@@ -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);