]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix MSVC warnings on x64 (#1956)
authorJarred Sumner <jarred@jarredsumner.com>
Mon, 4 Sep 2023 09:09:50 +0000 (01:09 -0800)
committerGitHub <noreply@github.com>
Mon, 4 Sep 2023 09:09:50 +0000 (11:09 +0200)
On Windows x64, `long` & `ulong` are 4 bytes instead of 8 bytes like
everywhere else

Co-authored-by: Jarred Sumner
libarchive/archive_digest.c
libarchive/archive_random.c

index 08a9aeb023209be7e84aaf17967229613a3da0c5..3776831b21c9eed5287a39d10d94e08d857f855d 100644 (file)
@@ -110,7 +110,7 @@ win_crypto_Update(Digest_CTX *ctx, const unsigned char *buf, size_t len)
 #if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
        BCryptHashData(ctx->hHash,
                      (PUCHAR)(uintptr_t)buf,
-                     len, 0);
+                     (ULONG)len, 0);
 #else
        CryptHashData(ctx->hash,
                      (unsigned char *)(uintptr_t)buf,
index 301765acd830bbf0fa53acb57a32c6a766e0952f..a410dc089f4a1d6e6f182655edbc858672b28471 100644 (file)
@@ -93,7 +93,7 @@ archive_random(void *buf, size_t nbytes)
        status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_RNG_ALGORITHM, NULL, 0);
        if (!BCRYPT_SUCCESS(status))
                return ARCHIVE_FAILED;
-       status = BCryptGenRandom(hAlg, buf, nbytes, 0);
+       status = BCryptGenRandom(hAlg, buf, (ULONG)nbytes, 0);
        BCryptCloseAlgorithmProvider(hAlg, 0);
        if (!BCRYPT_SUCCESS(status))
                return ARCHIVE_FAILED;