From: Uwe Hermann Date: Sat, 1 Sep 2018 19:01:43 +0000 (+0200) Subject: ipdbg-la: Fix data_available() implementation on Windows. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3bfdadf6df08ccdc7fcbee8ab2f6789910cc8674;p=libsigrok.git ipdbg-la: Fix data_available() implementation on Windows. [...]/protocol.c: In function 'data_available': [...]/protocol.c:73:38: error: 'bytes_available' undeclared (first use in this function) ioctlsocket(tcp->socket, FIONREAD, &bytes_available); ^ [...]/protocol.c:73:38: note: each undeclared identifier is reported only once for each function it appears in [...]/protocol.c:84:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ --- diff --git a/src/hardware/ipdbg-la/protocol.c b/src/hardware/ipdbg-la/protocol.c index 4c97d0b9..367483fa 100644 --- a/src/hardware/ipdbg-la/protocol.c +++ b/src/hardware/ipdbg-la/protocol.c @@ -70,7 +70,9 @@ static gboolean data_available(struct ipdbg_la_tcp *tcp) { #ifdef __WIN32__ + u_long bytes_available; ioctlsocket(tcp->socket, FIONREAD, &bytes_available); + return (bytes_available > 0); #else int status; @@ -80,7 +82,7 @@ static gboolean data_available(struct ipdbg_la_tcp *tcp) } return (status < 1) ? FALSE : TRUE; -#endif // __WIN32__ +#endif } SR_PRIV struct ipdbg_la_tcp *ipdbg_la_tcp_new(void)