From a814cf0795ed097fab01261e081aabbea5c4ca28 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sun, 1 Oct 2017 17:10:13 +0200 Subject: [*] constness for sock_sendAll params --- src/shared/sockhelper.c | 4 ++-- src/shared/sockhelper.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/shared') diff --git a/src/shared/sockhelper.c b/src/shared/sockhelper.c index 4a4563e..e511f0f 100644 --- a/src/shared/sockhelper.c +++ b/src/shared/sockhelper.c @@ -294,13 +294,13 @@ bool sock_append(poll_list_t *list, const int sock, bool wantRead, bool wantWrit return true; } -ssize_t sock_sendAll(const int sock, void *buffer, const size_t len, int maxtries) +ssize_t sock_sendAll(const int sock, const void *buffer, const size_t len, int maxtries) { size_t done = 0; ssize_t ret = 0; while ( done < len ) { if ( maxtries >= 0 && --maxtries == -1 ) break; - ret = send( sock, (char*)buffer + done, len - done, MSG_NOSIGNAL ); + ret = send( sock, (const uint8_t*)buffer + done, len - done, MSG_NOSIGNAL ); if ( ret == -1 ) { if ( errno == EINTR ) continue; if ( errno == EAGAIN || errno == EWOULDBLOCK ) { diff --git a/src/shared/sockhelper.h b/src/shared/sockhelper.h index 86c3b3e..62603c5 100644 --- a/src/shared/sockhelper.h +++ b/src/shared/sockhelper.h @@ -92,7 +92,7 @@ bool sock_append(poll_list_t *list, const int sock, bool wantRead, bool wantWrit * Give up after calling write() maxtries times. * Set maxtries < 0 to try infinitely. */ -ssize_t sock_sendAll(const int sock, void *buffer, const size_t len, int maxtries); +ssize_t sock_sendAll(const int sock, const void *buffer, const size_t len, int maxtries); /** * Send given buffer, repeatedly calling recv on partial send or EINTR. -- cgit v1.2.3-55-g7522