From 7da53555c284e896baabdaef441e883bf5245f11 Mon Sep 17 00:00:00 2001 From: bradh352 Date: Mon, 22 May 2023 07:37:38 -0400 Subject: [PATCH] windows MSVC compiler fix on 32bit Conflict: NA Reference: https://github.com/c-ares/c-ares/commit/7da53555c284e896baabdaef441e883bf5245f11 --- src/lib/ares_rand.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/ares_rand.c b/src/lib/ares_rand.c index a55a90bf..766c1e6e 100644 --- a/src/lib/ares_rand.c +++ b/src/lib/ares_rand.c @@ -58,10 +58,16 @@ BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG RandomBufferLength); #define ARES_RC4_KEY_LEN 32 /* 256 bits */ +#ifdef _MSC_VER +typedef unsigned __int64 cares_u64; +#else +typedef unsigned long long cares_u64; +#endif + static unsigned int ares_u32_from_ptr(void *addr) { if (sizeof(void *) == 8) { - return (unsigned int)((((size_t)addr >> 32) & 0xFFFFFFFF) | ((size_t)addr & 0xFFFFFFFF)); + return (unsigned int)((((cares_u64)addr >> 32) & 0xFFFFFFFF) | ((cares_u64)addr & 0xFFFFFFFF)); } return (unsigned int)((size_t)addr & 0xFFFFFFFF); }