wolfssl: silence compiler warning (MSVC 2019), simplify existing

Seen with VS2019 and older versions:
```
lib\vtls\wolfssl.c(773): warning C4706: assignment within conditional expression
```
Ref: https://github.com/curl/curl/actions/runs/13190321645/job/36821938202?pr=16217#step:9:30

Also replace pragma suppression with this simpler method, and silence
`checksrc` where it complains about the extra ` != NULL` this needs.

Closes #16230
This commit is contained in:
Viktor Szakats 2025-02-07 01:48:24 +01:00
parent 5c7bf5fe59
commit 0b3afd133a
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
5 changed files with 7 additions and 37 deletions

View file

@ -4107,11 +4107,6 @@ static CURLcode ftp_disconnect(struct Curl_easy *data,
return CURLE_OK;
}
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4706) /* assignment within conditional expression */
#endif
/***********************************************************************
*
* ftp_parse_url_path()
@ -4202,7 +4197,8 @@ CURLcode ftp_parse_url_path(struct Curl_easy *data)
}
/* parse the URL path into separate path components */
while((slashPos = strchr(curPos, '/'))) {
/* !checksrc! disable EQUALSNULL 1 */
while((slashPos = strchr(curPos, '/')) != NULL) {
size_t compLen = slashPos - curPos;
/* path starts with a slash: add that as a directory */
@ -4266,10 +4262,6 @@ CURLcode ftp_parse_url_path(struct Curl_easy *data)
return CURLE_OK;
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
/* call this when the DO phase has completed */
static CURLcode ftp_dophase_done(struct Curl_easy *data, bool connected)
{

View file

@ -777,22 +777,15 @@ static void printsub(struct Curl_easy *data,
}
}
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4706) /* assignment within conditional expression */
#endif
static bool str_is_nonascii(const char *str)
{
char c;
while((c = *str++))
while((c = *str++) != 0)
if(c & 0x80)
return TRUE;
return FALSE;
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
static CURLcode check_telnet_options(struct Curl_easy *data)
{

View file

@ -770,7 +770,7 @@ wssl_add_default_ciphers(bool tls13, struct dynbuf *buf)
int i;
char *str;
for(i = 0; (str = wolfSSL_get_cipher_list(i)); i++) {
for(i = 0; (str = wolfSSL_get_cipher_list(i)) != NULL; i++) {
size_t n;
if((strncmp(str, "TLS13", 5) == 0) != tls13)
continue;