From c142e73142e377f9bcd75fed0a558ce30323e98c Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Sat, 19 Mar 2016 17:15:53 +0000 Subject: ftp/imap/pop3/smtp: Fixed compilation warning when /Wall enabled warning C4706: assignment within conditional expression --- lib/curl_sasl.c | 15 +++++++++------ lib/ftp.c | 5 +++-- lib/imap.c | 4 ++-- lib/pop3.c | 4 ++-- lib/smtp.c | 4 ++-- 5 files changed, 18 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c index aac2bcd29..945d75232 100644 --- a/lib/curl_sasl.c +++ b/lib/curl_sasl.c @@ -1300,11 +1300,13 @@ CURLcode Curl_sasl_parse_url_auth_option(struct SASL *sasl, if(strnequal(value, "*", len)) sasl->prefmech = SASL_AUTH_DEFAULT; - else if((mechbit = Curl_sasl_decode_mech(value, len, &mechlen)) && - mechlen == len) - sasl->prefmech |= mechbit; - else - result = CURLE_URL_MALFORMAT; + else { + mechbit = Curl_sasl_decode_mech(value, len, &mechlen); + if(mechbit && mechlen == len) + sasl->prefmech |= mechbit; + else + result = CURLE_URL_MALFORMAT; + } return result; } @@ -1600,7 +1602,8 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn, newstate = SASL_DIGESTMD5_RESP; break; case SASL_DIGESTMD5_RESP: - if(!(resp = strdup(""))) + resp = strdup(""); + if(!resp) result = CURLE_OUT_OF_MEMORY; break; #endif diff --git a/lib/ftp.c b/lib/ftp.c index 40c51ead5..9b728cc98 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -155,8 +155,9 @@ static CURLcode ftp_dophase_done(struct connectdata *conn, bool connected); /* easy-to-use macro: */ -#define PPSENDF(x,y,z) if((result = Curl_pp_sendf(x,y,z))) \ - return result +#define PPSENDF(x,y,z) result = Curl_pp_sendf(x,y,z); \ + if(result) \ + return result /* diff --git a/lib/imap.c b/lib/imap.c index a3d2cad22..ff25e54e0 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -910,8 +910,8 @@ static CURLcode imap_state_capability_resp(struct connectdata *conn, wordlen -= 5; /* Test the word for a matching authentication mechanism */ - if((mechbit = Curl_sasl_decode_mech(line, wordlen, &llen)) && - llen == wordlen) + mechbit = Curl_sasl_decode_mech(line, wordlen, &llen); + if(mechbit && llen == wordlen) imapc->sasl.authmechs |= mechbit; } diff --git a/lib/pop3.c b/lib/pop3.c index cb53b7445..823761d2e 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -753,8 +753,8 @@ static CURLcode pop3_state_capa_resp(struct connectdata *conn, int pop3code, wordlen++; /* Test the word for a matching authentication mechanism */ - if((mechbit = Curl_sasl_decode_mech(line, wordlen, &llen)) && - llen == wordlen) + mechbit = Curl_sasl_decode_mech(line, wordlen, &llen); + if(mechbit && llen == wordlen) pop3c->sasl.authmechs |= mechbit; line += wordlen; diff --git a/lib/smtp.c b/lib/smtp.c index 2a87c6eae..83e51bf80 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -770,8 +770,8 @@ static CURLcode smtp_state_ehlo_resp(struct connectdata *conn, int smtpcode, wordlen++; /* Test the word for a matching authentication mechanism */ - if((mechbit = Curl_sasl_decode_mech(line, wordlen, &llen)) && - llen == wordlen) + mechbit = Curl_sasl_decode_mech(line, wordlen, &llen); + if(mechbit && llen == wordlen) smtpc->sasl.authmechs |= mechbit; line += wordlen; -- cgit v1.2.3