]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/ipdbg-la/protocol.c
Consistently use the _WIN32 #define.
[libsigrok.git] / src / hardware / ipdbg-la / protocol.c
index 367483fa04079e34af7cfbc939ba9dde423d6091..4c8f33b41725514a8a174d41f128e8f71a543e82 100644 (file)
 #define _WIN32_WINNT 0x0501
 #include <winsock2.h>
 #include <ws2tcpip.h>
-#endif
-
-#include <string.h>
-#include <unistd.h>
-
-#ifndef _WIN32
+#else
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
 #include <sys/ioctl.h>
 #endif
-
+#include <string.h>
+#include <unistd.h>
 #include <errno.h>
 #include "protocol.h"
 
@@ -69,7 +65,7 @@
 
 static gboolean data_available(struct ipdbg_la_tcp *tcp)
 {
-#ifdef __WIN32__
+#ifdef _WIN32
        u_long bytes_available;
        ioctlsocket(tcp->socket, FIONREAD, &bytes_available);
        return (bytes_available > 0);
@@ -160,7 +156,7 @@ SR_PRIV int ipdbg_la_tcp_close(struct ipdbg_la_tcp *tcp)
 static int tcp_send(struct ipdbg_la_tcp *tcp, const uint8_t *buf, size_t len)
 {
        int out;
-       out = send(tcp->socket, buf, len, 0);
+       out = send(tcp->socket, (const char *)buf, len, 0);
 
        if (out < 0) {
                sr_err("Send error: %s", g_strerror(errno));
@@ -200,7 +196,7 @@ SR_PRIV int ipdbg_la_tcp_receive(struct ipdbg_la_tcp *tcp,
 
        if (data_available(tcp)) {
                while (received < 1) {
-                       int len = recv(tcp->socket, buf, 1, 0);
+                       int len = recv(tcp->socket, (char *)buf, 1, 0);
 
                        if (len < 0) {
                                sr_err("Receive error: %s", g_strerror(errno));