Commit 2f0b8355f43c589990934bdf1127e36278feaa1a

Authored by Tobias Doerffel
Committed by Stéphane Raimbault
1 parent 3f10ef1d

Fix compiler warning on Win32 when calling send()/recv()

On Win32 the second argument to recv() and send() is not a void pointer
but a char pointer, therefore cast the buffer from uint8_t to char.

Signed-off-by: Stéphane Raimbault <stephane.raimbault@gmail.com>
Showing 1 changed file with 2 additions and 2 deletions
src/modbus-tcp.c
@@ -129,11 +129,11 @@ ssize_t _modbus_tcp_send(modbus_t *ctx, const uint8_t *req, int req_length) @@ -129,11 +129,11 @@ ssize_t _modbus_tcp_send(modbus_t *ctx, const uint8_t *req, int req_length)
129 Requests not to send SIGPIPE on errors on stream oriented 129 Requests not to send SIGPIPE on errors on stream oriented
130 sockets when the other end breaks the connection. The EPIPE 130 sockets when the other end breaks the connection. The EPIPE
131 error is still returned. */ 131 error is still returned. */
132 - return send(ctx->s, req, req_length, MSG_NOSIGNAL); 132 + return send(ctx->s, (const char*)req, req_length, MSG_NOSIGNAL);
133 } 133 }
134 134
135 ssize_t _modbus_tcp_recv(modbus_t *ctx, uint8_t *rsp, int rsp_length) { 135 ssize_t _modbus_tcp_recv(modbus_t *ctx, uint8_t *rsp, int rsp_length) {
136 - return recv(ctx->s, rsp, rsp_length, 0); 136 + return recv(ctx->s, (char *)rsp, rsp_length, 0);
137 } 137 }
138 138
139 int _modbus_tcp_check_integrity(modbus_t *ctx, uint8_t *msg, const int msg_length) 139 int _modbus_tcp_check_integrity(modbus_t *ctx, uint8_t *msg, const int msg_length)