mirror of
https://github.com/curl/curl.git
synced 2026-08-26 14:53:33 +03:00
build: fix -Wconversion/-Wsign-conversion warnings
Fix remaining warnings in examples and tests which are not suppressed
by the pragma in `lib/curl_setup.h`.
Silence a toolchain issue causing warnings in `FD_SET()` calls with
older Cygwin/MSYS2 builds. Likely fixed on 2020-08-03 by:
https://cygwin.com/git/?p=newlib-cygwin.git;a=commitdiff;h=5717262b8ecfed0f7fab63e2c09c78991e36f9dd
Follow-up to 2dbe75bd7f #12492
Closes #12557
This commit is contained in:
parent
2dbe75bd7f
commit
95a882d268
10 changed files with 32 additions and 24 deletions
|
|
@ -44,6 +44,13 @@ static int wait_on_socket(curl_socket_t sockfd, int for_recv, 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__) && defined(__CYGWIN__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#endif
|
||||
FD_SET(sockfd, &errfd); /* always check for error */
|
||||
|
||||
if(for_recv) {
|
||||
|
|
@ -52,6 +59,9 @@ static int wait_on_socket(curl_socket_t sockfd, int for_recv, long timeout_ms)
|
|||
else {
|
||||
FD_SET(sockfd, &outfd);
|
||||
}
|
||||
#if defined(__GNUC__) && defined(__CYGWIN__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
/* select() returns the number of signalled sockets or -1 */
|
||||
res = select((int)sockfd + 1, &infd, &outfd, &errfd, &tv);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue