Browse Source

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>
Tobias Doerffel 14 years ago
parent
commit
2f0b8355f4
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/modbus-tcp.c

+ 2 - 2
src/modbus-tcp.c

@@ -129,11 +129,11 @@ ssize_t _modbus_tcp_send(modbus_t *ctx, const uint8_t *req, int req_length)
        Requests not to send SIGPIPE on errors on stream oriented
        Requests not to send SIGPIPE on errors on stream oriented
        sockets when the other end breaks the connection.  The EPIPE
        sockets when the other end breaks the connection.  The EPIPE
        error is still returned. */
        error is still returned. */
-    return send(ctx->s, req, req_length, MSG_NOSIGNAL);
+    return send(ctx->s, (const char*)req, req_length, MSG_NOSIGNAL);
 }
 }
 
 
 ssize_t _modbus_tcp_recv(modbus_t *ctx, uint8_t *rsp, int rsp_length) {
 ssize_t _modbus_tcp_recv(modbus_t *ctx, uint8_t *rsp, int rsp_length) {
-    return recv(ctx->s, rsp, rsp_length, 0);
+    return recv(ctx->s, (char *)rsp, rsp_length, 0);
 }
 }
 
 
 int _modbus_tcp_check_integrity(modbus_t *ctx, uint8_t *msg, const int msg_length)
 int _modbus_tcp_check_integrity(modbus_t *ctx, uint8_t *msg, const int msg_length)