• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 7da53555c284e896baabdaef441e883bf5245f11 Mon Sep 17 00:00:00 2001
2From: bradh352 <brad@brad-house.com>
3Date: Mon, 22 May 2023 07:37:38 -0400
4Subject: [PATCH] windows MSVC compiler fix on 32bit
5
6Conflict: NA
7Reference: https://github.com/c-ares/c-ares/commit/7da53555c284e896baabdaef441e883bf5245f11
8---
9 src/lib/ares_rand.c | 8 +++++++-
10 1 file changed, 7 insertions(+), 1 deletion(-)
11
12diff --git a/src/lib/ares_rand.c b/src/lib/ares_rand.c
13index a55a90bf..766c1e6e 100644
14--- a/src/lib/ares_rand.c
15+++ b/src/lib/ares_rand.c
16@@ -58,10 +58,16 @@ BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG RandomBufferLength);
17
18 #define ARES_RC4_KEY_LEN 32 /* 256 bits */
19
20+#ifdef _MSC_VER
21+typedef unsigned __int64 cares_u64;
22+#else
23+typedef unsigned long long cares_u64;
24+#endif
25+
26 static unsigned int ares_u32_from_ptr(void *addr)
27 {
28     if (sizeof(void *) == 8) {
29-        return (unsigned int)((((size_t)addr >> 32) & 0xFFFFFFFF) | ((size_t)addr & 0xFFFFFFFF));
30+        return (unsigned int)((((cares_u64)addr >> 32) & 0xFFFFFFFF) | ((cares_u64)addr & 0xFFFFFFFF));
31     }
32     return (unsigned int)((size_t)addr & 0xFFFFFFFF);
33 }
34