summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Raad <Marcel.Raad@teamviewer.com>2017-10-27 10:10:30 +0200
committerMarcel Raad <Marcel.Raad@teamviewer.com>2017-10-30 21:27:59 +0100
commit52d9a11c1c166d248fa09e834cf0171eb07cf23f (patch)
tree4209927f1288664fdff02569f09c3db701a13e3b
parent6089aa53e44ff5171a5aec457b6746f653440ced (diff)
downloadcurl-52d9a11c1c166d248fa09e834cf0171eb07cf23f.tar.gz
memdebug: use send/recv signature for curl_dosend/curl_dorecv
This avoids build errors and warnings caused by implicit casts. Closes https://github.com/curl/curl/pull/2031
-rw-r--r--lib/memdebug.c23
-rw-r--r--lib/memdebug.h13
2 files changed, 22 insertions, 14 deletions
diff --git a/lib/memdebug.c b/lib/memdebug.c
index 8e61aba71..2b81c26a6 100644
--- a/lib/memdebug.c
+++ b/lib/memdebug.c
@@ -356,29 +356,32 @@ curl_socket_t curl_socket(int domain, int type, int protocol,
return sockfd;
}
-ssize_t curl_dosend(int sockfd, const void *buf, size_t len, int flags,
- int line, const char *source)
+SEND_TYPE_RETV curl_dosend(SEND_TYPE_ARG1 sockfd,
+ SEND_QUAL_ARG2 SEND_TYPE_ARG2 buf,
+ SEND_TYPE_ARG3 len, SEND_TYPE_ARG4 flags, int line,
+ const char *source)
{
- ssize_t rc;
+ SEND_TYPE_RETV rc;
if(countcheck("send", line, source))
return -1;
rc = send(sockfd, buf, len, flags);
if(source)
- curl_memlog("SEND %s:%d send(%zu) = %zd\n",
- source, line, len, rc);
+ curl_memlog("SEND %s:%d send(%lu) = %ld\n",
+ source, line, (unsigned long)len, (long)rc);
return rc;
}
-ssize_t curl_dorecv(int sockfd, void *buf, size_t len, int flags,
- int line, const char *source)
+RECV_TYPE_RETV curl_dorecv(RECV_TYPE_ARG1 sockfd, RECV_TYPE_ARG2 buf,
+ RECV_TYPE_ARG3 len, RECV_TYPE_ARG4 flags, int line,
+ const char *source)
{
- ssize_t rc;
+ RECV_TYPE_RETV rc;
if(countcheck("recv", line, source))
return -1;
rc = recv(sockfd, buf, len, flags);
if(source)
- curl_memlog("RECV %s:%d recv(%zu) = %zd\n",
- source, line, len, rc);
+ curl_memlog("RECV %s:%d recv(%lu) = %ld\n",
+ source, line, (unsigned long)len, (long)rc);
return rc;
}
diff --git a/lib/memdebug.h b/lib/memdebug.h
index c6b9225f4..6fb8b6851 100644
--- a/lib/memdebug.h
+++ b/lib/memdebug.h
@@ -67,10 +67,15 @@ CURL_EXTERN int curl_socketpair(int domain, int type, int protocol,
#endif
/* send/receive sockets */
-CURL_EXTERN ssize_t curl_dosend(int sockfd, const void *buf, size_t len,
- int flags, int line, const char *source);
-CURL_EXTERN ssize_t curl_dorecv(int sockfd, void *buf, size_t len, int flags,
- int line, const char *source);
+CURL_EXTERN SEND_TYPE_RETV curl_dosend(SEND_TYPE_ARG1 sockfd,
+ SEND_QUAL_ARG2 SEND_TYPE_ARG2 buf,
+ SEND_TYPE_ARG3 len,
+ SEND_TYPE_ARG4 flags, int line,
+ const char *source);
+CURL_EXTERN RECV_TYPE_RETV curl_dorecv(RECV_TYPE_ARG1 sockfd,
+ RECV_TYPE_ARG2 buf, RECV_TYPE_ARG3 len,
+ RECV_TYPE_ARG4 flags, int line,
+ const char *source);
/* FILE functions */
CURL_EXTERN FILE *curl_fopen(const char *file, const char *mode, int line,