diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index 2bf1d3c3b5..4d14a632b4 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -130,7 +130,7 @@ static CURLcode async_ares_init(struct Curl_easy *data, int status; struct ares_options options; int optmask = ARES_OPT_SOCK_STATE_CB; - CURLcode rc = CURLE_OK; + CURLcode result = CURLE_OK; /* initial status - failed */ ares->ares_status = ARES_ENOTFOUND; @@ -158,34 +158,34 @@ static CURLcode async_ares_init(struct Curl_easy *data, status = ares_init_options(&ares->channel, &options, optmask); if(status != ARES_SUCCESS) { ares->channel = NULL; - rc = (status == ARES_ENOMEM) ? CURLE_OUT_OF_MEMORY : CURLE_FAILED_INIT; + result = (status == ARES_ENOMEM) ? CURLE_OUT_OF_MEMORY : CURLE_FAILED_INIT; goto out; } - rc = async_ares_set_dns_servers(data, async); - if(rc && rc != CURLE_NOT_BUILT_IN) + result = async_ares_set_dns_servers(data, async); + if(result && result != CURLE_NOT_BUILT_IN) goto out; - rc = async_ares_set_dns_interface(data, async); - if(rc && rc != CURLE_NOT_BUILT_IN) + result = async_ares_set_dns_interface(data, async); + if(result && result != CURLE_NOT_BUILT_IN) goto out; - rc = async_ares_set_dns_local_ip4(data, async); - if(rc && rc != CURLE_NOT_BUILT_IN) + result = async_ares_set_dns_local_ip4(data, async); + if(result && result != CURLE_NOT_BUILT_IN) goto out; - rc = async_ares_set_dns_local_ip6(data, async); - if(rc && rc != CURLE_NOT_BUILT_IN) + result = async_ares_set_dns_local_ip6(data, async); + if(result && result != CURLE_NOT_BUILT_IN) goto out; - rc = CURLE_OK; + result = CURLE_OK; out: - if(rc && ares->channel) { + if(result && ares->channel) { ares_destroy(ares->channel); ares->channel = NULL; } - return rc; + return result; } /* diff --git a/lib/cookie.c b/lib/cookie.c index 1e21d1bf75..0f822ea7cf 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -1471,7 +1471,7 @@ static CURLcode cookie_output(struct Curl_easy *data, FILE *out = NULL; bool use_stdout = FALSE; char *tempstore = NULL; - CURLcode error = CURLE_OK; + CURLcode result = CURLE_OK; if(!ci) /* no cookie engine alive */ @@ -1486,8 +1486,8 @@ static CURLcode cookie_output(struct Curl_easy *data, use_stdout = TRUE; } else { - error = Curl_fopen(data, filename, &out, &tempstore); - if(error) + result = Curl_fopen(data, filename, &out, &tempstore); + if(result) goto error; } @@ -1504,7 +1504,7 @@ static CURLcode cookie_output(struct Curl_easy *data, array = curlx_calloc(1, sizeof(struct Cookie *) * ci->numcookies); if(!array) { - error = CURLE_OUT_OF_MEMORY; + result = CURLE_OUT_OF_MEMORY; goto error; } @@ -1524,7 +1524,7 @@ static CURLcode cookie_output(struct Curl_easy *data, char *format_ptr = get_netscape_format(array[i]); if(!format_ptr) { curlx_free(array); - error = CURLE_OUT_OF_MEMORY; + result = CURLE_OUT_OF_MEMORY; goto error; } curl_mfprintf(out, "%s\n", format_ptr); @@ -1538,7 +1538,7 @@ static CURLcode cookie_output(struct Curl_easy *data, curlx_fclose(out); out = NULL; if(tempstore && curlx_rename(tempstore, filename)) { - error = CURLE_WRITE_ERROR; + result = CURLE_WRITE_ERROR; goto error; } } @@ -1558,7 +1558,7 @@ error: unlink(tempstore); curlx_free(tempstore); } - return error; + return result; } static struct curl_slist *cookie_list(struct Curl_easy *data) diff --git a/lib/curl_sha512_256.c b/lib/curl_sha512_256.c index 5f5a738b3f..73b959c91d 100644 --- a/lib/curl_sha512_256.c +++ b/lib/curl_sha512_256.c @@ -161,26 +161,27 @@ static CURLcode Curl_sha512_256_update(void *context, */ static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *context) { - CURLcode ret; + CURLcode result; Curl_sha512_256_ctx * const ctx = (Curl_sha512_256_ctx *)context; #ifdef NEED_NETBSD_SHA512_256_WORKAROUND /* Use a larger buffer to work around a bug in NetBSD: https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=58039 */ unsigned char tmp_digest[CURL_SHA512_256_DIGEST_SIZE * 2]; - ret = EVP_DigestFinal_ex(*ctx, + result = EVP_DigestFinal_ex(*ctx, tmp_digest, NULL) ? CURLE_OK : CURLE_SSL_CIPHER; - if(ret == CURLE_OK) + if(result == CURLE_OK) memcpy(digest, tmp_digest, CURL_SHA512_256_DIGEST_SIZE); explicit_memset(tmp_digest, 0, sizeof(tmp_digest)); #else /* !NEED_NETBSD_SHA512_256_WORKAROUND */ - ret = EVP_DigestFinal_ex(*ctx, digest, NULL) ? CURLE_OK : CURLE_SSL_CIPHER; + result = EVP_DigestFinal_ex(*ctx, digest, NULL) ? + CURLE_OK : CURLE_SSL_CIPHER; #endif /* NEED_NETBSD_SHA512_256_WORKAROUND */ EVP_MD_CTX_destroy(*ctx); *ctx = NULL; - return ret; + return result; } #elif defined(USE_WOLFSSL_SHA512_256) @@ -792,17 +793,17 @@ CURLcode Curl_sha512_256it(unsigned char *output, const unsigned char *input, size_t input_size) { Curl_sha512_256_ctx ctx; - CURLcode res; + CURLcode result; - res = Curl_sha512_256_init(&ctx); - if(res != CURLE_OK) - return res; + result = Curl_sha512_256_init(&ctx); + if(result != CURLE_OK) + return result; - res = Curl_sha512_256_update(&ctx, (const void *)input, input_size); + result = Curl_sha512_256_update(&ctx, (const void *)input, input_size); - if(res != CURLE_OK) { + if(result != CURLE_OK) { (void)Curl_sha512_256_finish(output, &ctx); - return res; + return result; } return Curl_sha512_256_finish(output, &ctx); diff --git a/lib/formdata.c b/lib/formdata.c index 80759e792c..3619c15bb1 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -691,16 +691,16 @@ void curl_formfree(struct curl_httppost *form) static CURLcode setname(curl_mimepart *part, const char *name, size_t len) { char *zname; - CURLcode res; + CURLcode result; if(!name || !len) return curl_mime_name(part, name); zname = curlx_memdup0(name, len); if(!zname) return CURLE_OUT_OF_MEMORY; - res = curl_mime_name(part, zname); + result = curl_mime_name(part, zname); curlx_free(zname); - return res; + return result; } /* diff --git a/lib/http.c b/lib/http.c index b6c1de0b61..0506d6a43e 100644 --- a/lib/http.c +++ b/lib/http.c @@ -3570,11 +3570,11 @@ static CURLcode http_header_s(struct Curl_easy *data, ) ) ? HD_VAL(hd, hdlen, "Strict-Transport-Security:") : NULL; if(v) { - CURLcode check = + CURLcode result = Curl_hsts_parse(data->hsts, conn->host.name, v); - if(check) { - if(check == CURLE_OUT_OF_MEMORY) - return check; + if(result) { + if(result == CURLE_OUT_OF_MEMORY) + return result; infof(data, "Illegal STS header skipped"); } #ifdef DEBUGBUILD diff --git a/lib/http_ntlm.c b/lib/http_ntlm.c index b2adae48c0..82b050529e 100644 --- a/lib/http_ntlm.c +++ b/lib/http_ntlm.c @@ -176,9 +176,9 @@ CURLcode Curl_output_ntlm(struct Curl_easy *data, bool proxy) #ifdef USE_WINDOWS_SSPI if(!Curl_pSecFn) { /* not thread-safe and leaks - use curl_global_init() to avoid */ - CURLcode err = Curl_sspi_global_init(); + result = Curl_sspi_global_init(); if(!Curl_pSecFn) - return err; + return result; } #ifdef SECPKG_ATTR_ENDPOINT_BINDINGS ntlm->sslContext = conn->sslContext; diff --git a/lib/ldap.c b/lib/ldap.c index f8e7ff6a70..16c93eeca2 100644 --- a/lib/ldap.c +++ b/lib/ldap.c @@ -185,8 +185,8 @@ static ULONG ldap_win_bind_auth(LDAP *server, const char *user, } if(method && user && passwd) { - CURLcode res = Curl_create_sspi_identity(user, passwd, &cred); - if(!res) { + CURLcode result = Curl_create_sspi_identity(user, passwd, &cred); + if(!result) { rc = ldap_bind_s(server, NULL, (TCHAR *)&cred, method); Curl_sspi_free_identity(&cred); } diff --git a/lib/mime.c b/lib/mime.c index e987d0b30e..27a2a85c8b 100644 --- a/lib/mime.c +++ b/lib/mime.c @@ -1681,7 +1681,7 @@ CURLcode Curl_mime_prepare_headers(struct Curl_easy *data, const char *boundary = NULL; char *customct; const char *cte = NULL; - CURLcode ret = CURLE_OK; + CURLcode result = CURLE_OK; /* Get rid of previously prepared headers. */ curl_slist_free_all(part->curlheaders); @@ -1743,35 +1743,35 @@ CURLcode Curl_mime_prepare_headers(struct Curl_easy *data, if(part->name) { name = escape_string(data, part->name, strategy); if(!name) - ret = CURLE_OUT_OF_MEMORY; + result = CURLE_OUT_OF_MEMORY; } - if(!ret && part->filename) { + if(!result && part->filename) { filename = escape_string(data, part->filename, strategy); if(!filename) - ret = CURLE_OUT_OF_MEMORY; + result = CURLE_OUT_OF_MEMORY; } - if(!ret) - ret = Curl_mime_add_header(&part->curlheaders, - "Content-Disposition: %s%s%s%s%s%s%s", - disposition, - name ? "; name=\"" : "", - name ? name : "", - name ? "\"" : "", - filename ? "; filename=\"" : "", - filename ? filename : "", - filename ? "\"" : ""); + if(!result) + result = Curl_mime_add_header(&part->curlheaders, + "Content-Disposition: %s%s%s%s%s%s%s", + disposition, + name ? "; name=\"" : "", + name ? name : "", + name ? "\"" : "", + filename ? "; filename=\"" : "", + filename ? filename : "", + filename ? "\"" : ""); curlx_safefree(name); curlx_safefree(filename); - if(ret) - return ret; + if(result) + return result; } } /* Issue Content-Type header. */ if(contenttype) { - ret = add_content_type(&part->curlheaders, contenttype, boundary); - if(ret) - return ret; + result = add_content_type(&part->curlheaders, contenttype, boundary); + if(result) + return result; } /* Content-Transfer-Encoding header. */ @@ -1783,10 +1783,10 @@ CURLcode Curl_mime_prepare_headers(struct Curl_easy *data, part->kind != MIMEKIND_MULTIPART) cte = "8bit"; if(cte) { - ret = Curl_mime_add_header(&part->curlheaders, - "Content-Transfer-Encoding: %s", cte); - if(ret) - return ret; + result = Curl_mime_add_header(&part->curlheaders, + "Content-Transfer-Encoding: %s", cte); + if(result) + return result; } } @@ -1803,13 +1803,13 @@ CURLcode Curl_mime_prepare_headers(struct Curl_easy *data, if(content_type_match(contenttype, STRCONST("multipart/form-data"))) disposition = "form-data"; for(subpart = mime->firstpart; subpart; subpart = subpart->nextpart) { - ret = Curl_mime_prepare_headers(data, subpart, NULL, - disposition, strategy); - if(ret) - return ret; + result = Curl_mime_prepare_headers(data, subpart, NULL, + disposition, strategy); + if(result) + return result; } } - return ret; + return result; } /* Recursively reset paused status in the given part. */ diff --git a/lib/openldap.c b/lib/openldap.c index 5d6637543f..48bf5b746d 100644 --- a/lib/openldap.c +++ b/lib/openldap.c @@ -444,18 +444,18 @@ static ber_slen_t ldapsb_tls_read(Sockbuf_IO_Desc *sbiod, void *buf, struct connectdata *conn = data->conn; if(conn) { struct ldapconninfo *li = Curl_conn_meta_get(conn, CURL_META_LDAP_CONN); - CURLcode err = CURLE_RECV_ERROR; + CURLcode result = CURLE_RECV_ERROR; size_t nread; if(!li) { SET_SOCKERRNO(SOCKEINVAL); return -1; } - err = (li->recv)(data, FIRSTSOCKET, buf, len, &nread); - if(err == CURLE_AGAIN) { + result = (li->recv)(data, FIRSTSOCKET, buf, len, &nread); + if(result == CURLE_AGAIN) { SET_SOCKERRNO(SOCKEWOULDBLOCK); } - ret = err ? -1 : (ber_slen_t)nread; + ret = result ? -1 : (ber_slen_t)nread; } } return ret; @@ -470,18 +470,18 @@ static ber_slen_t ldapsb_tls_write(Sockbuf_IO_Desc *sbiod, void *buf, struct connectdata *conn = data->conn; if(conn) { struct ldapconninfo *li = Curl_conn_meta_get(conn, CURL_META_LDAP_CONN); - CURLcode err = CURLE_SEND_ERROR; + CURLcode result = CURLE_SEND_ERROR; size_t nwritten; if(!li) { SET_SOCKERRNO(SOCKEINVAL); return -1; } - err = (li->send)(data, FIRSTSOCKET, buf, len, FALSE, &nwritten); - if(err == CURLE_AGAIN) { + result = (li->send)(data, FIRSTSOCKET, buf, len, FALSE, &nwritten); + if(result == CURLE_AGAIN) { SET_SOCKERRNO(SOCKEWOULDBLOCK); } - ret = err ? -1 : (ber_slen_t)nwritten; + ret = result ? -1 : (ber_slen_t)nwritten; } } return ret; diff --git a/lib/rtsp.c b/lib/rtsp.c index 354a982c51..b08767f377 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -160,7 +160,7 @@ static CURLcode rtsp_done(struct Curl_easy *data, struct rtsp_conn *rtspc = Curl_conn_meta_get(data->conn, CURL_META_RTSP_CONN); struct RTSP *rtsp = Curl_meta_get(data, CURL_META_RTSP_EASY); - CURLcode httpStatus; + CURLcode result; if(!rtspc || !rtsp) return CURLE_FAILED_INIT; @@ -169,9 +169,9 @@ static CURLcode rtsp_done(struct Curl_easy *data, if(data->set.rtspreq == RTSPREQ_RECEIVE) premature = TRUE; - httpStatus = Curl_http_done(data, status, premature); + result = Curl_http_done(data, status, premature); - if(!status && !httpStatus) { + if(!status && !result) { /* Check the sequence numbers */ uint32_t CSeq_sent = rtsp->CSeq_sent; uint32_t CSeq_recv = rtsp->CSeq_recv; @@ -191,7 +191,7 @@ static CURLcode rtsp_done(struct Curl_easy *data, } } - return httpStatus; + return result; } static CURLcode rtsp_setup_body(struct Curl_easy *data, diff --git a/lib/urlapi.c b/lib/urlapi.c index 41e39e79f5..5b4c391856 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -261,7 +261,7 @@ static CURLUcode parse_hostname_login(struct Curl_URL *u, size_t *offset) /* to the hostname */ { CURLUcode ures = CURLUE_OK; - CURLcode ccode; + CURLcode result; char *userp = NULL; char *passwdp = NULL; char *optionsp = NULL; @@ -294,11 +294,11 @@ static CURLUcode parse_hostname_login(struct Curl_URL *u, /* We could use the login information in the URL so extract it. Only parse options if the handler says we should. Note that 'h' might be NULL! */ - ccode = Curl_parse_login_details(login, ptr - login - 1, - &userp, &passwdp, - (h && (h->flags & PROTOPT_URLOPTIONS)) ? - &optionsp : NULL); - if(ccode) { + result = Curl_parse_login_details(login, ptr - login - 1, + &userp, &passwdp, + (h && (h->flags & PROTOPT_URLOPTIONS)) ? + &optionsp : NULL); + if(result) { /* the only possible error from Curl_parse_login_details is out of memory: */ ures = CURLUE_OUT_OF_MEMORY; @@ -1373,11 +1373,12 @@ static CURLUcode urlget_format(const CURLU *u, CURLUPart what, if(urldecode) { char *decoded; size_t dlen; - /* this unconditional rejection of control bytes is documented - API behavior */ - CURLcode res = Curl_urldecode(part, partlen, &decoded, &dlen, REJECT_CTRL); + /* this unconditional rejection of control bytes is documented API + behavior */ + CURLcode result = Curl_urldecode(part, partlen, &decoded, &dlen, + REJECT_CTRL); curlx_free(part); - if(res) + if(result) return CURLUE_URLDECODE; part = decoded; partlen = dlen;