aboutsummaryrefslogtreecommitdiff
path: root/lib/warnless.h
diff options
context:
space:
mode:
authorMarcel Raad <Marcel.Raad@teamviewer.com>2018-02-25 21:16:32 +0100
committerMarcel Raad <Marcel.Raad@teamviewer.com>2018-02-28 20:04:48 +0100
commit24753bcd4821ead4b96650b12e6b47efe11181cb (patch)
tree631a279c66144ce2f197ae11b2f73fabd7ec8f8f /lib/warnless.h
parent828187d86b70af3a031b529312b8027b4ece10a5 (diff)
unit1309: fix warning on Windows x64
When targeting x64, MinGW-w64 complains about conversions between 32-bit long and 64-bit pointers. Fix this by reusing the GNUTLS_POINTER_TO_SOCKET_CAST / GNUTLS_SOCKET_TO_POINTER_CAST logic from gtls.c, moving it to warnless.h as CURLX_POINTER_TO_INTEGER_CAST / CURLX_INTEGER_TO_POINTER_CAST. Closes https://github.com/curl/curl/pull/2341
Diffstat (limited to 'lib/warnless.h')
-rw-r--r--lib/warnless.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/warnless.h b/lib/warnless.h
index ab6d29998..efd552a60 100644
--- a/lib/warnless.h
+++ b/lib/warnless.h
@@ -26,6 +26,11 @@
#include <curl/curl.h> /* for curl_socket_t */
#endif
+#define CURLX_POINTER_TO_INTEGER_CAST(p) \
+ ((char *)(p) - (char *)NULL)
+#define CURLX_INTEGER_TO_POINTER_CAST(i) \
+ ((void *)((char *)NULL + (i)))
+
unsigned short curlx_ultous(unsigned long ulnum);
unsigned char curlx_ultouc(unsigned long ulnum);