]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/ipdbg-la/protocol.c
ipdbg-la: Drop some unneeded casts.
[libsigrok.git] / src / hardware / ipdbg-la / protocol.c
index 0ba2d6d6bb9725d16cc0d7abfa37dba95771f86a..36bd7624515b522c7fc12bff098727c5ac955c9c 100644 (file)
@@ -68,7 +68,7 @@
 /* LA subfunction command opcodes */
 #define CMD_LA_DELAY               0x1F
 
-SR_PRIV int data_available(struct ipdbg_la_tcp *tcp)
+SR_PRIV gboolean data_available(struct ipdbg_la_tcp *tcp)
 {
 #ifdef __WIN32__
        ioctlsocket(tcp->socket, FIONREAD, &bytes_available);
@@ -77,10 +77,10 @@ SR_PRIV int data_available(struct ipdbg_la_tcp *tcp)
 
        if (ioctl(tcp->socket, FIONREAD, &status) < 0) {        // TIOCMGET
                sr_err("FIONREAD failed: %s\n", g_strerror(errno));
-               return 0;
+               return FALSE;
        }
 
-       return (status < 1) ? 0 : 1;
+       return (status < 1) ? FALSE : TRUE;
 #endif  // __WIN32__
 }
 
@@ -160,7 +160,7 @@ SR_PRIV int ipdbg_la_tcp_send(struct ipdbg_la_tcp *tcp,
        const uint8_t *buf, size_t len)
 {
        int out;
-       out = send(tcp->socket, (char*)buf, len, 0);
+       out = send(tcp->socket, buf, len, 0);
 
        if (out < 0) {
                sr_err("Send error: %s", g_strerror(errno));
@@ -292,7 +292,7 @@ SR_PRIV int ipdbg_la_receive_data(int fd, int revents, void *cb_data)
        (void)fd;
        (void)revents;
 
-       sdi = (const struct sr_dev_inst *)cb_data;
+       sdi = cb_data;
        if (!sdi)
                return FALSE;
 
@@ -456,11 +456,11 @@ SR_PRIV int send_escaping(struct ipdbg_la_tcp *tcp, uint8_t *dataToSend,
        while (length--) {
                uint8_t payload = *dataToSend++;
 
-               if (payload == (uint8_t) CMD_RESET)
+               if (payload == CMD_RESET)
                        if (ipdbg_la_tcp_send(tcp, &escape, 1) != SR_OK)
                                sr_warn("Couldn't send escape");
 
-               if (payload == (uint8_t) CMD_ESCAPE)
+               if (payload == CMD_ESCAPE)
                        if (ipdbg_la_tcp_send(tcp, &escape, 1) != SR_OK)
                                sr_warn("Couldn't send escape");