parent
06d4456a21
commit
5474d70c3e
@ -34,7 +34,7 @@
|
||||
static size_t writefunction(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
fwrite(ptr, size, nmemb, (FILE *)stream);
|
||||
return (nmemb*size);
|
||||
return nmemb * size;
|
||||
}
|
||||
|
||||
static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
|
||||
|
||||
@ -119,7 +119,7 @@ static size_t SyncTime_CURL_WriteOutput(void *ptr, size_t size, size_t nmemb,
|
||||
void *stream)
|
||||
{
|
||||
fwrite(ptr, size, nmemb, stream);
|
||||
return (nmemb*size);
|
||||
return nmemb * size;
|
||||
}
|
||||
|
||||
static size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
|
||||
@ -171,7 +171,7 @@ static size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
|
||||
" Server Date is no longer valid.\n");
|
||||
AutoSyncTime = 0;
|
||||
}
|
||||
return (nmemb*size);
|
||||
return nmemb * size;
|
||||
}
|
||||
|
||||
static void SyncTime_CURL_Init(CURL *curl, const char *proxy_port,
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
static size_t writefunction(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
fwrite(ptr, size, nmemb, stream);
|
||||
return (nmemb*size);
|
||||
return nmemb * size;
|
||||
}
|
||||
|
||||
static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
|
||||
|
||||
@ -203,7 +203,7 @@ static void tunnel_free(struct Curl_cfilter *cf,
|
||||
|
||||
static bool tunnel_want_send(struct h1_tunnel_state *ts)
|
||||
{
|
||||
return (ts->tunnel_state == H1_TUNNEL_CONNECT);
|
||||
return ts->tunnel_state == H1_TUNNEL_CONNECT;
|
||||
}
|
||||
|
||||
static CURLcode start_CONNECT(struct Curl_cfilter *cf,
|
||||
|
||||
@ -1459,7 +1459,7 @@ static bool cf_socket_data_pending(struct Curl_cfilter *cf,
|
||||
|
||||
(void)data;
|
||||
readable = SOCKET_READABLE(ctx->sock, 0);
|
||||
return (readable > 0 && (readable & CURL_CSELECT_IN));
|
||||
return readable > 0 && (readable & CURL_CSELECT_IN);
|
||||
}
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
|
||||
@ -469,7 +469,7 @@ static bool invalid_octets(const char *p)
|
||||
size_t len;
|
||||
/* scan for all the octets that are *not* in cookie-octet */
|
||||
len = strcspn(p, badoctets);
|
||||
return (p[len] != '\0');
|
||||
return p[len] != '\0';
|
||||
}
|
||||
|
||||
#define CERR_OK 0
|
||||
@ -1335,14 +1335,14 @@ static int cookie_sort(const void *p1, const void *p2)
|
||||
l2 = c2->path ? strlen(c2->path) : 0;
|
||||
|
||||
if(l1 != l2)
|
||||
return (l2 > l1) ? 1 : -1 ; /* avoid size_t <=> int conversions */
|
||||
return (l2 > l1) ? 1 : -1; /* avoid size_t <=> int conversions */
|
||||
|
||||
/* 2 - compare cookie domain lengths */
|
||||
l1 = c1->domain ? strlen(c1->domain) : 0;
|
||||
l2 = c2->domain ? strlen(c2->domain) : 0;
|
||||
|
||||
if(l1 != l2)
|
||||
return (l2 > l1) ? 1 : -1 ; /* avoid size_t <=> int conversions */
|
||||
return (l2 > l1) ? 1 : -1; /* avoid size_t <=> int conversions */
|
||||
|
||||
/* 3 - compare cookie name lengths */
|
||||
l1 = c1->name ? strlen(c1->name) : 0;
|
||||
|
||||
@ -237,7 +237,7 @@ cleanup:
|
||||
free(ibuf);
|
||||
free(obuf);
|
||||
#endif
|
||||
return (*out ? true : false);
|
||||
return *out ? true : false;
|
||||
}
|
||||
|
||||
int curlx_win32_open(const char *filename, int oflag, ...)
|
||||
|
||||
@ -377,6 +377,6 @@ struct curl_easyoption Curl_easyopts[] = {
|
||||
*/
|
||||
int Curl_easyopts_check(void)
|
||||
{
|
||||
return ((CURLOPT_LASTENTRY%10000) != (326 + 1));
|
||||
return (CURLOPT_LASTENTRY % 10000) != (326 + 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -632,7 +632,7 @@ bool Curl_ipv6works(struct Curl_easy *data)
|
||||
ipv6_works = 1;
|
||||
sclose(s);
|
||||
}
|
||||
return (ipv6_works > 0);
|
||||
return ipv6_works > 0;
|
||||
}
|
||||
}
|
||||
#endif /* USE_IPV6 */
|
||||
|
||||
@ -1234,8 +1234,8 @@ static bool use_http_1_1plus(const struct Curl_easy *data,
|
||||
if((data->state.httpwant == CURL_HTTP_VERSION_1_0) &&
|
||||
(conn->httpversion <= 10))
|
||||
return FALSE;
|
||||
return ((data->state.httpwant == CURL_HTTP_VERSION_NONE) ||
|
||||
(data->state.httpwant >= CURL_HTTP_VERSION_1_1));
|
||||
return (data->state.httpwant == CURL_HTTP_VERSION_NONE) ||
|
||||
(data->state.httpwant >= CURL_HTTP_VERSION_1_1);
|
||||
}
|
||||
|
||||
static const char *get_http_string(const struct Curl_easy *data,
|
||||
@ -4379,7 +4379,7 @@ static bool http_exp100_is_waiting(struct Curl_easy *data)
|
||||
struct Curl_creader *r = Curl_creader_get_by_type(data, &cr_exp100);
|
||||
if(r) {
|
||||
struct cr_exp100_ctx *ctx = r->ctx;
|
||||
return (ctx->state == EXP100_AWAITING_CONTINUE);
|
||||
return ctx->state == EXP100_AWAITING_CONTINUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -2955,7 +2955,7 @@ bool Curl_h2_http_1_1_error(struct Curl_easy *data)
|
||||
{
|
||||
if(Curl_conn_is_http2(data, data->conn, FIRSTSOCKET)) {
|
||||
int err = Curl_conn_get_stream_error(data, data->conn, FIRSTSOCKET);
|
||||
return (err == NGHTTP2_HTTP_1_1_REQUIRED);
|
||||
return err == NGHTTP2_HTTP_1_1_REQUIRED;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -805,7 +805,7 @@ static int str2scope(const char *p)
|
||||
return LDAP_SCOPE_SUBTREE;
|
||||
if(strcasecompare(p, "subtree"))
|
||||
return LDAP_SCOPE_SUBTREE;
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -153,7 +153,7 @@ ALLOC_FUNC void *curl_dbg_malloc(size_t wantedsize,
|
||||
source, line, wantedsize,
|
||||
mem ? (void *)mem->mem : (void *)0);
|
||||
|
||||
return (mem ? mem->mem : NULL);
|
||||
return mem ? mem->mem : NULL;
|
||||
}
|
||||
|
||||
ALLOC_FUNC void *curl_dbg_calloc(size_t wanted_elements, size_t wanted_size,
|
||||
@ -181,7 +181,7 @@ ALLOC_FUNC void *curl_dbg_calloc(size_t wanted_elements, size_t wanted_size,
|
||||
source, line, wanted_elements, wanted_size,
|
||||
mem ? (void *)mem->mem : (void *)0);
|
||||
|
||||
return (mem ? mem->mem : NULL);
|
||||
return mem ? mem->mem : NULL;
|
||||
}
|
||||
|
||||
ALLOC_FUNC char *curl_dbg_strdup(const char *str,
|
||||
|
||||
@ -2179,7 +2179,7 @@ static bool cr_mime_is_paused(struct Curl_easy *data,
|
||||
{
|
||||
struct cr_mime_ctx *ctx = reader->ctx;
|
||||
(void)data;
|
||||
return (ctx->part && ctx->part->lastreadstatus == CURL_READFUNC_PAUSE);
|
||||
return ctx->part && ctx->part->lastreadstatus == CURL_READFUNC_PAUSE;
|
||||
}
|
||||
|
||||
static const struct Curl_crtype cr_mime = {
|
||||
|
||||
@ -933,7 +933,7 @@ CURLMcode curl_multi_remove_handle(CURLM *m, CURL *d)
|
||||
/* Return TRUE if the application asked for multiplexing */
|
||||
bool Curl_multiplex_wanted(const struct Curl_multi *multi)
|
||||
{
|
||||
return (multi && (multi->multiplexing));
|
||||
return multi && multi->multiplexing;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -4150,7 +4150,7 @@ void Curl_set_in_callback(struct Curl_easy *data, bool value)
|
||||
|
||||
bool Curl_is_in_callback(struct Curl_easy *data)
|
||||
{
|
||||
return (data && data->multi && data->multi->in_callback);
|
||||
return data && data->multi && data->multi->in_callback;
|
||||
}
|
||||
|
||||
unsigned int Curl_multi_max_concurrent_streams(struct Curl_multi *multi)
|
||||
|
||||
@ -71,7 +71,7 @@ UNITTEST bool Curl_cidr4_match(const char *ipv4, /* 1.2.3.4 address */
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
return (address == check);
|
||||
return address == check;
|
||||
}
|
||||
|
||||
UNITTEST bool Curl_cidr6_match(const char *ipv6,
|
||||
|
||||
@ -145,7 +145,7 @@ print <<FOOT
|
||||
*/
|
||||
int Curl_easyopts_check(void)
|
||||
{
|
||||
return ((CURLOPT_LASTENTRY%10000) != ($lastnum + 1));
|
||||
return (CURLOPT_LASTENTRY % 10000) != ($lastnum + 1);
|
||||
}
|
||||
#endif
|
||||
FOOT
|
||||
|
||||
@ -448,7 +448,7 @@ CURLcode Curl_pp_disconnect(struct pingpong *pp)
|
||||
|
||||
bool Curl_pp_moredata(struct pingpong *pp)
|
||||
{
|
||||
return (!pp->sendleft && Curl_dyn_len(&pp->recvbuf) > pp->nfinal);
|
||||
return !pp->sendleft && Curl_dyn_len(&pp->recvbuf) > pp->nfinal;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -312,7 +312,7 @@ timediff_t Curl_pgrsLimitWaitTime(struct pgrs_dir *d,
|
||||
if(actual < minimum) {
|
||||
/* if it downloaded the data faster than the limit, make it wait the
|
||||
difference */
|
||||
return (minimum - actual);
|
||||
return minimum - actual;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@ -113,7 +113,7 @@ int curl_strequal(const char *first, const char *second)
|
||||
return casecompare(first, second);
|
||||
|
||||
/* if both pointers are NULL then treat them as equal */
|
||||
return (NULL == first && NULL == second);
|
||||
return NULL == first && NULL == second;
|
||||
}
|
||||
|
||||
static int ncasecompare(const char *first, const char *second, size_t max)
|
||||
@ -139,7 +139,7 @@ int curl_strnequal(const char *first, const char *second, size_t max)
|
||||
return ncasecompare(first, second, max);
|
||||
|
||||
/* if both pointers are NULL then treat them as equal if max is non-zero */
|
||||
return (NULL == first && NULL == second && max);
|
||||
return NULL == first && NULL == second && max;
|
||||
}
|
||||
/* Copy an upper case version of the string from src to dest. The
|
||||
* strings may overlap. No more than n characters of the string are copied
|
||||
|
||||
@ -808,7 +808,7 @@ get_winapi_error(int err, char *buf, size_t buflen)
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
return (*buf ? buf : NULL);
|
||||
return *buf ? buf : NULL;
|
||||
}
|
||||
#endif /* _WIN32 || _WIN32_WCE */
|
||||
|
||||
|
||||
@ -973,9 +973,9 @@ bool Curl_xfer_is_blocked(struct Curl_easy *data)
|
||||
bool want_send = ((data)->req.keepon & KEEP_SEND);
|
||||
bool want_recv = ((data)->req.keepon & KEEP_RECV);
|
||||
if(!want_send)
|
||||
return (want_recv && Curl_cwriter_is_paused(data));
|
||||
return want_recv && Curl_cwriter_is_paused(data);
|
||||
else if(!want_recv)
|
||||
return (want_send && Curl_creader_is_paused(data));
|
||||
return want_send && Curl_creader_is_paused(data);
|
||||
else
|
||||
return Curl_creader_is_paused(data) && Curl_cwriter_is_paused(data);
|
||||
}
|
||||
|
||||
@ -837,8 +837,8 @@ CURLcode Curl_conn_upkeep(struct Curl_easy *data,
|
||||
static bool ssh_config_matches(struct connectdata *one,
|
||||
struct connectdata *two)
|
||||
{
|
||||
return (Curl_safecmp(one->proto.sshc.rsa, two->proto.sshc.rsa) &&
|
||||
Curl_safecmp(one->proto.sshc.rsa_pub, two->proto.sshc.rsa_pub));
|
||||
return Curl_safecmp(one->proto.sshc.rsa, two->proto.sshc.rsa) &&
|
||||
Curl_safecmp(one->proto.sshc.rsa_pub, two->proto.sshc.rsa_pub);
|
||||
}
|
||||
#else
|
||||
#define ssh_config_matches(x,y) FALSE
|
||||
|
||||
@ -69,7 +69,7 @@ bool Curl_auth_is_digest_supported(void)
|
||||
Curl_pSecFn->FreeContextBuffer(SecurityPackage);
|
||||
}
|
||||
|
||||
return (status == SEC_E_OK);
|
||||
return status == SEC_E_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -64,7 +64,7 @@ bool Curl_auth_is_gssapi_supported(void)
|
||||
Curl_pSecFn->FreeContextBuffer(SecurityPackage);
|
||||
}
|
||||
|
||||
return (status == SEC_E_OK);
|
||||
return status == SEC_E_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -63,7 +63,7 @@ bool Curl_auth_is_ntlm_supported(void)
|
||||
Curl_pSecFn->FreeContextBuffer(SecurityPackage);
|
||||
}
|
||||
|
||||
return (status == SEC_E_OK);
|
||||
return status == SEC_E_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -67,7 +67,7 @@ bool Curl_auth_is_spnego_supported(void)
|
||||
}
|
||||
|
||||
|
||||
return (status == SEC_E_OK);
|
||||
return status == SEC_E_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -153,10 +153,10 @@ bool Curl_auth_user_contains_domain(const char *user)
|
||||
bool Curl_auth_allowed_to_host(struct Curl_easy *data)
|
||||
{
|
||||
struct connectdata *conn = data->conn;
|
||||
return (!data->state.this_is_a_follow ||
|
||||
data->set.allow_auth_to_other_hosts ||
|
||||
(data->state.first_host &&
|
||||
strcasecompare(data->state.first_host, conn->host.name) &&
|
||||
(data->state.first_remote_port == conn->remote_port) &&
|
||||
(data->state.first_remote_protocol == conn->handler->protocol)));
|
||||
return !data->state.this_is_a_follow ||
|
||||
data->set.allow_auth_to_other_hosts ||
|
||||
(data->state.first_host &&
|
||||
strcasecompare(data->state.first_host, conn->host.name) &&
|
||||
(data->state.first_remote_port == conn->remote_port) &&
|
||||
(data->state.first_remote_protocol == conn->handler->protocol));
|
||||
}
|
||||
|
||||
@ -708,8 +708,8 @@ bool Curl_conn_is_http3(const struct Curl_easy *data,
|
||||
#elif defined(USE_MSH3)
|
||||
return Curl_conn_is_msh3(data, conn, sockindex);
|
||||
#else
|
||||
return ((conn->handler->protocol & PROTO_FAMILY_HTTP) &&
|
||||
(conn->httpversion == 30));
|
||||
return (conn->handler->protocol & PROTO_FAMILY_HTTP) &&
|
||||
(conn->httpversion == 30);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -746,7 +746,7 @@ static long ossl_bio_cf_ctrl(BIO *bio, int cmd, long num, void *ptr)
|
||||
#ifdef BIO_CTRL_EOF
|
||||
case BIO_CTRL_EOF:
|
||||
/* EOF has been reached on input? */
|
||||
return (!cf->next || !cf->next->connected);
|
||||
return !cf->next || !cf->next->connected;
|
||||
#endif
|
||||
default:
|
||||
ret = 0;
|
||||
@ -1020,7 +1020,7 @@ static int passwd_callback(char *buf, int num, int encrypting,
|
||||
*/
|
||||
static bool rand_enough(void)
|
||||
{
|
||||
return (0 != RAND_status());
|
||||
return 0 != RAND_status();
|
||||
}
|
||||
|
||||
static CURLcode ossl_seed(struct Curl_easy *data)
|
||||
@ -1076,8 +1076,8 @@ static CURLcode ossl_seed(struct Curl_easy *data)
|
||||
}
|
||||
|
||||
infof(data, "libcurl is now using a weak random seed");
|
||||
return (rand_enough() ? CURLE_OK :
|
||||
CURLE_SSL_CONNECT_ERROR /* confusing error code */);
|
||||
return rand_enough() ? CURLE_OK :
|
||||
CURLE_SSL_CONNECT_ERROR; /* confusing error code */
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1155,7 +1155,7 @@ static int ssl_ui_writer(UI *ui, UI_STRING *uis)
|
||||
*/
|
||||
static bool is_pkcs11_uri(const char *string)
|
||||
{
|
||||
return (string && strncasecompare(string, "pkcs11:", 7));
|
||||
return string && strncasecompare(string, "pkcs11:", 7);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -5454,7 +5454,7 @@ static CURLcode ossl_random(struct Curl_easy *data,
|
||||
}
|
||||
/* RAND_bytes() returns 1 on success, 0 otherwise. */
|
||||
rc = RAND_bytes(entropy, (ossl_valsize_t)curlx_uztosi(length));
|
||||
return (rc == 1 ? CURLE_OK : CURLE_FAILED_INIT);
|
||||
return rc == 1 ? CURLE_OK : CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x0090800fL) && !defined(OPENSSL_NO_SHA256)
|
||||
|
||||
@ -2273,11 +2273,11 @@ static bool schannel_data_pending(struct Curl_cfilter *cf,
|
||||
DEBUGASSERT(backend);
|
||||
|
||||
if(backend->ctxt) /* SSL/TLS is in use */
|
||||
return (backend->decdata_offset > 0 ||
|
||||
(backend->encdata_offset > 0 && !backend->encdata_is_incomplete) ||
|
||||
backend->recv_connection_closed ||
|
||||
backend->recv_sspi_close_notify ||
|
||||
backend->recv_unrecoverable_err);
|
||||
return backend->decdata_offset > 0 ||
|
||||
(backend->encdata_offset > 0 && !backend->encdata_is_incomplete) ||
|
||||
backend->recv_connection_closed ||
|
||||
backend->recv_sspi_close_notify ||
|
||||
backend->recv_unrecoverable_err;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
@ -2467,7 +2467,7 @@ static void schannel_close(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
|
||||
static int schannel_init(void)
|
||||
{
|
||||
return (Curl_sspi_global_init() == CURLE_OK ? 1 : 0);
|
||||
return Curl_sspi_global_init() == CURLE_OK ? 1 : 0;
|
||||
}
|
||||
|
||||
static void schannel_cleanup(void)
|
||||
|
||||
@ -295,7 +295,7 @@ static long wolfssl_bio_cf_ctrl(WOLFSSL_BIO *bio, int cmd, long num, void *ptr)
|
||||
#ifdef WOLFSSL_BIO_CTRL_EOF
|
||||
case WOLFSSL_BIO_CTRL_EOF:
|
||||
/* EOF has been reached on input? */
|
||||
return (!cf->next || !cf->next->connected);
|
||||
return !cf->next || !cf->next->connected;
|
||||
#endif
|
||||
default:
|
||||
ret = 0;
|
||||
|
||||
@ -418,7 +418,7 @@ static SANITIZEcode msdosify(char **const sanitized, const char *file_name,
|
||||
}
|
||||
|
||||
*sanitized = strdup(dos_name);
|
||||
return (*sanitized ? SANITIZE_ERR_OK : SANITIZE_ERR_OUT_OF_MEMORY);
|
||||
return *sanitized ? SANITIZE_ERR_OK : SANITIZE_ERR_OUT_OF_MEMORY;
|
||||
}
|
||||
#endif /* MSDOS */
|
||||
|
||||
@ -547,7 +547,7 @@ static SANITIZEcode rename_if_reserved_dos(char **const sanitized,
|
||||
#endif
|
||||
|
||||
*sanitized = strdup(fname);
|
||||
return (*sanitized ? SANITIZE_ERR_OK : SANITIZE_ERR_OUT_OF_MEMORY);
|
||||
return *sanitized ? SANITIZE_ERR_OK : SANITIZE_ERR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
#ifdef __DJGPP__
|
||||
|
||||
@ -66,7 +66,7 @@ bool output_expected(const char *url, const char *uploadfile)
|
||||
|
||||
bool stdin_upload(const char *uploadfile)
|
||||
{
|
||||
return (!strcmp(uploadfile, "-") || !strcmp(uploadfile, "."));
|
||||
return !strcmp(uploadfile, "-") || !strcmp(uploadfile, ".");
|
||||
}
|
||||
|
||||
/* Convert a CURLUcode into a CURLcode */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user