]> www.infradead.org Git - users/borneoa/openocd-next.git/commitdiff
vdebug: Fix socket comparison warning on Windows
authorMarek Vrbka <marek.vrbka@codasip.com>
Mon, 13 Jan 2025 09:28:15 +0000 (10:28 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 25 Jan 2025 10:33:23 +0000 (10:33 +0000)
On GCC version 13.2,
the previous code emitted the following warning on Windows:

openocd/src/jtag/drivers/vdebug.c:254:19: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
  254 |         if (hsock == INVALID_SOCKET)

This patch fixes it and brings it in line with other socket handling code.

Change-Id: I7e05f83c6905cfaf66b68e8988c783e80cee4a48
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8717
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
src/jtag/drivers/vdebug.c

index 691e576e53b43e725c251ac1ceaaf4d8ecbf71fd..20819f70bd1c739b4fe40c13210ef9857558bb98 100644 (file)
@@ -252,7 +252,7 @@ static int vdebug_socket_open(char *server_addr, uint32_t port)
 
 #ifdef _WIN32
        hsock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
-       if (hsock == INVALID_SOCKET)
+       if (hsock < 0)
                rc = vdebug_socket_error();
 #elif defined __CYGWIN__
        /* SO_RCVLOWAT unsupported on CYGWIN */