From a8e2dd54c2d3d85ffe7deb0ef3c592531afa31c2 Mon Sep 17 00:00:00 2001 From: Davidson Francis Date: Sat, 8 Feb 2025 16:34:56 -0300 Subject: [PATCH] Update docs/examples/websocket.c Co-authored-by: Viktor Szakats --- docs/examples/websocket.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/docs/examples/websocket.c b/docs/examples/websocket.c index 367eea6bb4..2a7cb45971 100644 --- a/docs/examples/websocket.c +++ b/docs/examples/websocket.c @@ -30,6 +30,14 @@ #include #include +/* Avoid warning in FD_SET() with pre-2020 Cygwin/MSYS releases: + * warning: conversion to 'long unsigned int' from 'curl_socket_t' {aka 'int'} + * may change the sign of the result [-Wsign-conversion] + */ +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wsign-conversion" +#endif + /* Auxiliary function that waits on the socket. */ static int wait_on_socket(curl_socket_t sockfd, long timeout_ms) { @@ -44,19 +52,8 @@ static int wait_on_socket(curl_socket_t sockfd, long timeout_ms) FD_ZERO(&outfd); FD_ZERO(&errfd); -/* Avoid this warning with pre-2020 Cygwin/MSYS releases: - * warning: conversion to 'long unsigned int' from 'curl_socket_t' {aka 'int'} - * may change the sign of the result [-Wsign-conversion] - */ -#if defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" -#endif FD_SET(sockfd, &errfd); /* always check for error */ FD_SET(sockfd, &infd); -#if defined(__GNUC__) -#pragma GCC diagnostic pop -#endif /* select() returns the number of signalled sockets or -1 */ res = select((int)sockfd + 1, &infd, &outfd, &errfd, &tv);