summaryrefslogtreecommitdiff
path: root/lib/vtls
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/vtls
parent828187d86b70af3a031b529312b8027b4ece10a5 (diff)
downloadcurl-24753bcd4821ead4b96650b12e6b47efe11181cb.tar.gz
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/vtls')
-rw-r--r--lib/vtls/gtls.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
index 30b255b81..078874103 100644
--- a/lib/vtls/gtls.c
+++ b/lib/vtls/gtls.c
@@ -60,15 +60,6 @@
/* The last #include file should be: */
#include "memdebug.h"
-#ifndef GNUTLS_POINTER_TO_SOCKET_CAST
-#define GNUTLS_POINTER_TO_SOCKET_CAST(p) \
- ((curl_socket_t) ((char *)(p) - (char *)NULL))
-#endif
-#ifndef GNUTLS_SOCKET_TO_POINTER_CAST
-#define GNUTLS_SOCKET_TO_POINTER_CAST(s) \
- ((void *) ((char *)NULL + (s)))
-#endif
-
/* Enable GnuTLS debugging by defining GTLSDEBUG */
/*#define GTLSDEBUG */
@@ -161,7 +152,7 @@ static int gtls_mapped_sockerrno(void)
static ssize_t Curl_gtls_push(void *s, const void *buf, size_t len)
{
- ssize_t ret = swrite(GNUTLS_POINTER_TO_SOCKET_CAST(s), buf, len);
+ ssize_t ret = swrite(CURLX_POINTER_TO_INTEGER_CAST(s), buf, len);
#if defined(USE_WINSOCK) && !defined(GNUTLS_MAPS_WINSOCK_ERRORS)
if(ret < 0)
gnutls_transport_set_global_errno(gtls_mapped_sockerrno());
@@ -171,7 +162,7 @@ static ssize_t Curl_gtls_push(void *s, const void *buf, size_t len)
static ssize_t Curl_gtls_pull(void *s, void *buf, size_t len)
{
- ssize_t ret = sread(GNUTLS_POINTER_TO_SOCKET_CAST(s), buf, len);
+ ssize_t ret = sread(CURLX_POINTER_TO_INTEGER_CAST(s), buf, len);
#if defined(USE_WINSOCK) && !defined(GNUTLS_MAPS_WINSOCK_ERRORS)
if(ret < 0)
gnutls_transport_set_global_errno(gtls_mapped_sockerrno());
@@ -857,7 +848,7 @@ gtls_connect_step1(struct connectdata *conn,
}
else {
/* file descriptor for the socket */
- transport_ptr = GNUTLS_SOCKET_TO_POINTER_CAST(conn->sock[sockindex]);
+ transport_ptr = CURLX_INTEGER_TO_POINTER_CAST(conn->sock[sockindex]);
gnutls_transport_push = Curl_gtls_push;
gnutls_transport_pull = Curl_gtls_pull;
}