mirror of
https://github.com/curl/curl.git
synced 2026-04-14 21:31:42 +03:00
clang-tidy: enable more checks, fix fallouts
- enable three checks: - bugprone-invalid-enum-default-initialization - bugprone-sizeof-expression - readability-inconsistent-declaration-parameter-name (strict) - fix remaining discrepancies with arg names in prototypes and implementation, in strict mode. - document reason for some checks tested but not enabled. Closes #20794
This commit is contained in:
parent
e0dd6eb4a4
commit
df6014894b
34 changed files with 222 additions and 209 deletions
|
|
@ -44,7 +44,7 @@ OM_uint32 Curl_gss_init_sec_context(struct Curl_easy *data,
|
|||
OM_uint32 *ret_flags);
|
||||
|
||||
OM_uint32 Curl_gss_delete_sec_context(OM_uint32 *min,
|
||||
gss_ctx_id_t *context_handle,
|
||||
gss_ctx_id_t *context,
|
||||
gss_buffer_t output_token);
|
||||
|
||||
#ifdef CURLVERBOSE
|
||||
|
|
|
|||
|
|
@ -1387,7 +1387,8 @@ CURL_EXTERN void curl_dbg_mark_sclose(curl_socket_t sockfd,
|
|||
int line, const char *source);
|
||||
CURL_EXTERN int curl_dbg_sclose(curl_socket_t sockfd,
|
||||
int line, const char *source);
|
||||
CURL_EXTERN curl_socket_t curl_dbg_accept(curl_socket_t s, void *a, void *alen,
|
||||
CURL_EXTERN curl_socket_t curl_dbg_accept(curl_socket_t s,
|
||||
void *saddr, void *saddrlen,
|
||||
int line, const char *source);
|
||||
#ifdef HAVE_ACCEPT4
|
||||
CURL_EXTERN curl_socket_t curl_dbg_accept4(curl_socket_t s, void *saddr,
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ size_t curlx_dyn_len(const struct dynbuf *s);
|
|||
|
||||
/* returns 0 on success, -1 on error */
|
||||
/* The implementation of this function exists in mprintf.c */
|
||||
int curlx_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save);
|
||||
int curlx_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list args);
|
||||
|
||||
/* Take the buffer out of the dynbuf. Caller has ownership and
|
||||
* dynbuf resets to initial state. */
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ HANDLE curlx_CreateFile(const char *filename,
|
|||
#define curlx_fstat _fstati64
|
||||
#define curlx_struct_stat struct _stati64
|
||||
FILE *curlx_win32_fopen(const char *filename, const char *mode);
|
||||
FILE *curlx_win32_freopen(const char *filename, const char *mode, FILE *fh);
|
||||
FILE *curlx_win32_freopen(const char *filename, const char *mode, FILE *fp);
|
||||
int curlx_win32_stat(const char *path, curlx_struct_stat *buffer);
|
||||
int curlx_win32_open(const char *filename, int oflag, ...);
|
||||
int curlx_win32_rename(const char *oldpath, const char *newpath);
|
||||
|
|
|
|||
|
|
@ -36,15 +36,15 @@
|
|||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#ifdef __AMIGA__
|
||||
#define curlx_inet_ntop(af, addr, buf, size) \
|
||||
(char *)inet_ntop(af, CURL_UNCONST(addr), (unsigned char *)(buf), \
|
||||
#define curlx_inet_ntop(af, src, buf, size) \
|
||||
(char *)inet_ntop(af, CURL_UNCONST(src), (unsigned char *)(buf), \
|
||||
(curl_socklen_t)(size))
|
||||
#else
|
||||
#define curlx_inet_ntop(af, addr, buf, size) \
|
||||
inet_ntop(af, addr, buf, (curl_socklen_t)(size))
|
||||
#define curlx_inet_ntop(af, src, buf, size) \
|
||||
inet_ntop(af, src, buf, (curl_socklen_t)(size))
|
||||
#endif
|
||||
#else
|
||||
char *curlx_inet_ntop(int af, const void *addr, char *buf, size_t size);
|
||||
char *curlx_inet_ntop(int af, const void *src, char *buf, size_t size);
|
||||
#endif /* HAVE_INET_NTOP */
|
||||
|
||||
#endif /* HEADER_CURL_INET_NTOP_H */
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ struct Curl_dnscache {
|
|||
};
|
||||
|
||||
/* init a new dns cache */
|
||||
void Curl_dnscache_init(struct Curl_dnscache *dns, size_t hashsize);
|
||||
void Curl_dnscache_init(struct Curl_dnscache *dns, size_t size);
|
||||
|
||||
void Curl_dnscache_destroy(struct Curl_dnscache *dns);
|
||||
|
||||
|
|
|
|||
|
|
@ -117,13 +117,12 @@ struct doh_probes {
|
|||
* Curl_doh() starts a name resolve using DoH (DNS-over-HTTPS). It resolves a
|
||||
* name and returns a 'Curl_addrinfo *' with the address information.
|
||||
*/
|
||||
|
||||
CURLcode Curl_doh(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async);
|
||||
|
||||
CURLcode Curl_doh_take_result(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async,
|
||||
struct Curl_dns_entry **dns);
|
||||
struct Curl_dns_entry **pdns);
|
||||
|
||||
#define DOH_MAX_ADDR 24
|
||||
#define DOH_MAX_CNAME 4
|
||||
|
|
|
|||
53
lib/easy.c
53
lib/easy.c
|
|
@ -815,9 +815,9 @@ static CURLcode easy_perform(struct Curl_easy *data, bool events)
|
|||
* curl_easy_perform() is the external interface that performs a blocking
|
||||
* transfer as previously setup.
|
||||
*/
|
||||
CURLcode curl_easy_perform(CURL *data)
|
||||
CURLcode curl_easy_perform(CURL *curl)
|
||||
{
|
||||
return easy_perform(data, FALSE);
|
||||
return easy_perform(curl, FALSE);
|
||||
}
|
||||
|
||||
#ifdef DEBUGBUILD
|
||||
|
|
@ -825,9 +825,9 @@ CURLcode curl_easy_perform(CURL *data)
|
|||
* curl_easy_perform_ev() is the external interface that performs a blocking
|
||||
* transfer using the event-based API internally.
|
||||
*/
|
||||
CURLcode curl_easy_perform_ev(struct Curl_easy *data)
|
||||
CURLcode curl_easy_perform_ev(struct Curl_easy *easy)
|
||||
{
|
||||
return easy_perform(data, TRUE);
|
||||
return easy_perform(easy, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -835,9 +835,9 @@ CURLcode curl_easy_perform_ev(struct Curl_easy *data)
|
|||
* curl_easy_cleanup() is the external interface to cleaning/freeing the given
|
||||
* easy handle.
|
||||
*/
|
||||
void curl_easy_cleanup(CURL *ptr)
|
||||
void curl_easy_cleanup(CURL *curl)
|
||||
{
|
||||
struct Curl_easy *data = ptr;
|
||||
struct Curl_easy *data = curl;
|
||||
if(GOOD_EASY_HANDLE(data)) {
|
||||
struct Curl_sigpipe_ctx sigpipe_ctx;
|
||||
sigpipe_ignore(data, &sigpipe_ctx);
|
||||
|
|
@ -851,9 +851,9 @@ void curl_easy_cleanup(CURL *ptr)
|
|||
* information from a performed transfer and similar.
|
||||
*/
|
||||
#undef curl_easy_getinfo
|
||||
CURLcode curl_easy_getinfo(CURL *easy, CURLINFO info, ...)
|
||||
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)
|
||||
{
|
||||
struct Curl_easy *data = easy;
|
||||
struct Curl_easy *data = curl;
|
||||
va_list arg;
|
||||
void *paramp;
|
||||
CURLcode result;
|
||||
|
|
@ -950,9 +950,9 @@ static void dupeasy_meta_freeentry(void *p)
|
|||
* given input easy handle. The returned handle will be a new working handle
|
||||
* with all options set exactly as the input source handle.
|
||||
*/
|
||||
CURL *curl_easy_duphandle(CURL *d)
|
||||
CURL *curl_easy_duphandle(CURL *curl)
|
||||
{
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
struct Curl_easy *outcurl = NULL;
|
||||
|
||||
if(!GOOD_EASY_HANDLE(data))
|
||||
|
|
@ -1081,9 +1081,9 @@ fail:
|
|||
* curl_easy_reset() is an external interface that allows an app to re-
|
||||
* initialize a session handle to the default values.
|
||||
*/
|
||||
void curl_easy_reset(CURL *d)
|
||||
void curl_easy_reset(CURL *curl)
|
||||
{
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
if(!GOOD_EASY_HANDLE(data))
|
||||
return;
|
||||
|
||||
|
|
@ -1130,12 +1130,12 @@ void curl_easy_reset(CURL *d)
|
|||
* NOTE: This is one of few API functions that are allowed to be called from
|
||||
* within a callback.
|
||||
*/
|
||||
CURLcode curl_easy_pause(CURL *d, int action)
|
||||
CURLcode curl_easy_pause(CURL *curl, int action)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
bool recursive = FALSE;
|
||||
bool changed = FALSE;
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
bool recv_paused, recv_paused_new;
|
||||
bool send_paused, send_paused_new;
|
||||
|
||||
|
|
@ -1220,11 +1220,11 @@ static CURLcode easy_connection(struct Curl_easy *data,
|
|||
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
|
||||
* Returns CURLE_OK on success, error code on error.
|
||||
*/
|
||||
CURLcode curl_easy_recv(CURL *d, void *buffer, size_t buflen, size_t *n)
|
||||
CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n)
|
||||
{
|
||||
CURLcode result;
|
||||
struct connectdata *c;
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
|
||||
if(!GOOD_EASY_HANDLE(data))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
|
@ -1298,11 +1298,12 @@ CURLcode Curl_senddata(struct Curl_easy *data, const void *buffer,
|
|||
* Sends data over the connected socket. Use after successful
|
||||
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
|
||||
*/
|
||||
CURLcode curl_easy_send(CURL *d, const void *buffer, size_t buflen, size_t *n)
|
||||
CURLcode curl_easy_send(CURL *curl, const void *buffer, size_t buflen,
|
||||
size_t *n)
|
||||
{
|
||||
size_t written = 0;
|
||||
CURLcode result;
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
if(!GOOD_EASY_HANDLE(data))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
if(Curl_is_in_callback(data))
|
||||
|
|
@ -1316,9 +1317,9 @@ CURLcode curl_easy_send(CURL *d, const void *buffer, size_t buflen, size_t *n)
|
|||
/*
|
||||
* Performs connection upkeep for the given session handle.
|
||||
*/
|
||||
CURLcode curl_easy_upkeep(CURL *d)
|
||||
CURLcode curl_easy_upkeep(CURL *curl)
|
||||
{
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
/* Verify that we got an easy handle we can work with. */
|
||||
if(!GOOD_EASY_HANDLE(data))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
|
@ -1330,18 +1331,18 @@ CURLcode curl_easy_upkeep(CURL *d)
|
|||
return Curl_cpool_upkeep(data);
|
||||
}
|
||||
|
||||
CURLcode curl_easy_ssls_import(CURL *d, const char *session_key,
|
||||
CURLcode curl_easy_ssls_import(CURL *curl, const char *session_key,
|
||||
const unsigned char *shmac, size_t shmac_len,
|
||||
const unsigned char *sdata, size_t sdata_len)
|
||||
{
|
||||
#if defined(USE_SSL) && defined(USE_SSLS_EXPORT)
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
if(!GOOD_EASY_HANDLE(data))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
return Curl_ssl_session_import(data, session_key,
|
||||
shmac, shmac_len, sdata, sdata_len);
|
||||
#else
|
||||
(void)d;
|
||||
(void)curl;
|
||||
(void)session_key;
|
||||
(void)shmac;
|
||||
(void)shmac_len;
|
||||
|
|
@ -1351,17 +1352,17 @@ CURLcode curl_easy_ssls_import(CURL *d, const char *session_key,
|
|||
#endif
|
||||
}
|
||||
|
||||
CURLcode curl_easy_ssls_export(CURL *d,
|
||||
CURLcode curl_easy_ssls_export(CURL *curl,
|
||||
curl_ssls_export_cb *export_fn,
|
||||
void *userptr)
|
||||
{
|
||||
#if defined(USE_SSL) && defined(USE_SSLS_EXPORT)
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
if(!GOOD_EASY_HANDLE(data))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
return Curl_ssl_session_export(data, export_fn, userptr);
|
||||
#else
|
||||
(void)d;
|
||||
(void)curl;
|
||||
(void)export_fn;
|
||||
(void)userptr;
|
||||
return CURLE_NOT_BUILT_IN;
|
||||
|
|
|
|||
35
lib/escape.c
35
lib/escape.c
|
|
@ -33,9 +33,9 @@ struct Curl_easy;
|
|||
#include "curl_printf.h"
|
||||
|
||||
/* for ABI-compatibility with previous versions */
|
||||
char *curl_escape(const char *string, int inlength)
|
||||
char *curl_escape(const char *string, int length)
|
||||
{
|
||||
return curl_easy_escape(NULL, string, inlength);
|
||||
return curl_easy_escape(NULL, string, length);
|
||||
}
|
||||
|
||||
/* for ABI-compatibility with previous versions */
|
||||
|
|
@ -47,25 +47,25 @@ char *curl_unescape(const char *string, int length)
|
|||
/* Escapes for URL the given unescaped string of given length.
|
||||
* 'data' is ignored since 7.82.0.
|
||||
*/
|
||||
char *curl_easy_escape(CURL *data, const char *string, int inlength)
|
||||
char *curl_easy_escape(CURL *curl, const char *string, int length)
|
||||
{
|
||||
size_t length;
|
||||
size_t len;
|
||||
struct dynbuf d;
|
||||
(void)data;
|
||||
(void)curl;
|
||||
|
||||
if(!string || (inlength < 0))
|
||||
if(!string || (length < 0))
|
||||
return NULL;
|
||||
|
||||
length = (inlength ? (size_t)inlength : strlen(string));
|
||||
if(!length)
|
||||
len = (length ? (size_t)length : strlen(string));
|
||||
if(!len)
|
||||
return curlx_strdup("");
|
||||
|
||||
if(length > SIZE_MAX / 16)
|
||||
if(len > SIZE_MAX / 16)
|
||||
return NULL;
|
||||
|
||||
curlx_dyn_init(&d, (length * 3) + 1);
|
||||
curlx_dyn_init(&d, (len * 3) + 1);
|
||||
|
||||
while(length--) {
|
||||
while(len--) {
|
||||
/* treat the characters unsigned */
|
||||
unsigned char in = (unsigned char)*string++;
|
||||
|
||||
|
|
@ -160,21 +160,22 @@ CURLcode Curl_urldecode(const char *string, size_t length,
|
|||
* If olen == NULL, no output length is stored.
|
||||
* 'data' is ignored since 7.82.0.
|
||||
*/
|
||||
char *curl_easy_unescape(CURL *data, const char *string, int length, int *olen)
|
||||
char *curl_easy_unescape(CURL *curl, const char *string, int inlength,
|
||||
int *outlength)
|
||||
{
|
||||
char *str = NULL;
|
||||
(void)data;
|
||||
if(string && (length >= 0)) {
|
||||
size_t inputlen = (size_t)length;
|
||||
(void)curl;
|
||||
if(string && (inlength >= 0)) {
|
||||
size_t inputlen = (size_t)inlength;
|
||||
size_t outputlen;
|
||||
CURLcode res = Curl_urldecode(string, inputlen, &str, &outputlen,
|
||||
REJECT_NADA);
|
||||
if(res)
|
||||
return NULL;
|
||||
|
||||
if(olen) {
|
||||
if(outlength) {
|
||||
if(outputlen <= (size_t)INT_MAX)
|
||||
*olen = curlx_uztosi(outputlen);
|
||||
*outlength = curlx_uztosi(outputlen);
|
||||
else
|
||||
/* too large to return in an int, fail! */
|
||||
curlx_safefree(str);
|
||||
|
|
|
|||
|
|
@ -52,23 +52,23 @@ static void copy_header_external(struct Curl_header_store *hs,
|
|||
}
|
||||
|
||||
/* public API */
|
||||
CURLHcode curl_easy_header(CURL *easy,
|
||||
CURLHcode curl_easy_header(CURL *curl,
|
||||
const char *name,
|
||||
size_t nameindex,
|
||||
unsigned int type,
|
||||
unsigned int origin,
|
||||
int request,
|
||||
struct curl_header **hout)
|
||||
{
|
||||
struct Curl_llist_node *e;
|
||||
struct Curl_llist_node *e_pick = NULL;
|
||||
struct Curl_easy *data = easy;
|
||||
struct Curl_easy *data = curl;
|
||||
size_t match = 0;
|
||||
size_t amount = 0;
|
||||
struct Curl_header_store *hs = NULL;
|
||||
struct Curl_header_store *pick = NULL;
|
||||
if(!name || !hout || !data ||
|
||||
(type > (CURLH_HEADER | CURLH_TRAILER | CURLH_CONNECT | CURLH_1XX |
|
||||
CURLH_PSEUDO)) || !type || (request < -1))
|
||||
(origin > (CURLH_HEADER | CURLH_TRAILER | CURLH_CONNECT | CURLH_1XX |
|
||||
CURLH_PSEUDO)) || !origin || (request < -1))
|
||||
return CURLHE_BAD_ARGUMENT;
|
||||
if(!Curl_llist_count(&data->state.httphdrs))
|
||||
return CURLHE_NOHEADERS; /* no headers available */
|
||||
|
|
@ -81,7 +81,7 @@ CURLHcode curl_easy_header(CURL *easy,
|
|||
for(e = Curl_llist_head(&data->state.httphdrs); e; e = Curl_node_next(e)) {
|
||||
hs = Curl_node_elem(e);
|
||||
if(curl_strequal(hs->name, name) &&
|
||||
(hs->type & type) &&
|
||||
(hs->type & origin) &&
|
||||
(hs->request == request)) {
|
||||
amount++;
|
||||
pick = hs;
|
||||
|
|
@ -100,7 +100,7 @@ CURLHcode curl_easy_header(CURL *easy,
|
|||
for(e = Curl_llist_head(&data->state.httphdrs); e; e = Curl_node_next(e)) {
|
||||
hs = Curl_node_elem(e);
|
||||
if(curl_strequal(hs->name, name) &&
|
||||
(hs->type & type) &&
|
||||
(hs->type & origin) &&
|
||||
(hs->request == request) &&
|
||||
(match++ == nameindex)) {
|
||||
e_pick = e;
|
||||
|
|
@ -118,12 +118,12 @@ CURLHcode curl_easy_header(CURL *easy,
|
|||
}
|
||||
|
||||
/* public API */
|
||||
struct curl_header *curl_easy_nextheader(CURL *easy,
|
||||
unsigned int type,
|
||||
struct curl_header *curl_easy_nextheader(CURL *curl,
|
||||
unsigned int origin,
|
||||
int request,
|
||||
struct curl_header *prev)
|
||||
{
|
||||
struct Curl_easy *data = easy;
|
||||
struct Curl_easy *data = curl;
|
||||
struct Curl_llist_node *pick;
|
||||
struct Curl_llist_node *e;
|
||||
struct Curl_header_store *hs;
|
||||
|
|
@ -149,7 +149,7 @@ struct curl_header *curl_easy_nextheader(CURL *easy,
|
|||
/* make sure it is the next header of the desired type */
|
||||
do {
|
||||
hs = Curl_node_elem(pick);
|
||||
if((hs->type & type) && (hs->request == request))
|
||||
if((hs->type & origin) && (hs->request == request))
|
||||
break;
|
||||
pick = Curl_node_next(pick);
|
||||
} while(pick);
|
||||
|
|
@ -167,7 +167,7 @@ struct curl_header *curl_easy_nextheader(CURL *easy,
|
|||
struct Curl_header_store *check = Curl_node_elem(e);
|
||||
if(curl_strequal(hs->name, check->name) &&
|
||||
(check->request == request) &&
|
||||
(check->type & type))
|
||||
(check->type & origin))
|
||||
amount++;
|
||||
if(e == pick)
|
||||
index = amount - 1;
|
||||
|
|
|
|||
16
lib/hostip.c
16
lib/hostip.c
|
|
@ -914,10 +914,10 @@ clean_up:
|
|||
* is ignored.
|
||||
*
|
||||
* Return codes:
|
||||
* CURLE_OK = success, *entry set to non-NULL
|
||||
* CURLE_AGAIN = resolving in progress, *entry == NULL
|
||||
* CURLE_COULDNT_RESOLVE_HOST = error, *entry == NULL
|
||||
* CURLE_OPERATION_TIMEDOUT = timeout expired, *entry == NULL
|
||||
* CURLE_OK = success, *pdns set to non-NULL
|
||||
* CURLE_AGAIN = resolving in progress, *pdns == NULL
|
||||
* CURLE_COULDNT_RESOLVE_HOST = error, *pdns == NULL
|
||||
* CURLE_OPERATION_TIMEDOUT = timeout expired, *pdns == NULL
|
||||
*/
|
||||
CURLcode Curl_resolv(struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
|
|
@ -926,11 +926,11 @@ CURLcode Curl_resolv(struct Curl_easy *data,
|
|||
uint8_t transport,
|
||||
timediff_t timeout_ms,
|
||||
uint32_t *presolv_id,
|
||||
struct Curl_dns_entry **entry)
|
||||
struct Curl_dns_entry **pdns)
|
||||
{
|
||||
DEBUGASSERT(hostname && *hostname);
|
||||
*presolv_id = 0;
|
||||
*entry = NULL;
|
||||
*pdns = NULL;
|
||||
|
||||
if(timeout_ms < 0)
|
||||
/* got an already expired timeout */
|
||||
|
|
@ -945,7 +945,7 @@ CURLcode Curl_resolv(struct Curl_easy *data,
|
|||
}
|
||||
if(timeout_ms && !Curl_doh_wanted(data)) {
|
||||
return resolv_alarm_timeout(data, dns_queries, hostname, port, transport,
|
||||
timeout_ms, presolv_id, entry);
|
||||
timeout_ms, presolv_id, pdns);
|
||||
}
|
||||
#endif /* !USE_ALARM_TIMEOUT */
|
||||
|
||||
|
|
@ -955,7 +955,7 @@ CURLcode Curl_resolv(struct Curl_easy *data,
|
|||
#endif
|
||||
|
||||
return hostip_resolv(data, dns_queries, hostname, port, transport,
|
||||
timeout_ms, TRUE, presolv_id, entry);
|
||||
timeout_ms, TRUE, presolv_id, pdns);
|
||||
}
|
||||
|
||||
#ifdef USE_CURL_ASYNC
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ struct ldap_urldesc {
|
|||
|
||||
static curl_ldap_num_t ldap_url_parse_low(struct Curl_easy *data,
|
||||
const struct connectdata *conn,
|
||||
LDAPURLDesc **ludp);
|
||||
LDAPURLDesc **ludpp);
|
||||
static void ldap_free_urldesc_low(LDAPURLDesc *ludp);
|
||||
|
||||
#undef ldap_free_urldesc
|
||||
|
|
|
|||
|
|
@ -1071,7 +1071,7 @@ static int addbyter(unsigned char outc, void *f)
|
|||
}
|
||||
|
||||
int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format,
|
||||
va_list ap_save)
|
||||
va_list args)
|
||||
{
|
||||
int retcode;
|
||||
struct nsprintf info;
|
||||
|
|
@ -1080,7 +1080,7 @@ int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format,
|
|||
info.length = 0;
|
||||
info.max = maxlength;
|
||||
|
||||
retcode = formatf(&info, addbyter, format, ap_save);
|
||||
retcode = formatf(&info, addbyter, format, args);
|
||||
if(info.max) {
|
||||
/* we terminate this with a zero byte */
|
||||
if(info.max == info.length) {
|
||||
|
|
@ -1098,10 +1098,10 @@ int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format,
|
|||
int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...)
|
||||
{
|
||||
int retcode;
|
||||
va_list ap_save; /* argument pointer */
|
||||
va_start(ap_save, format);
|
||||
retcode = curl_mvsnprintf(buffer, maxlength, format, ap_save);
|
||||
va_end(ap_save);
|
||||
va_list args; /* argument pointer */
|
||||
va_start(args, format);
|
||||
retcode = curl_mvsnprintf(buffer, maxlength, format, args);
|
||||
va_end(args);
|
||||
return retcode;
|
||||
}
|
||||
|
||||
|
|
@ -1118,13 +1118,13 @@ static int alloc_addbyter(unsigned char outc, void *f)
|
|||
}
|
||||
|
||||
/* appends the formatted string, returns MERR error code */
|
||||
int curlx_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save)
|
||||
int curlx_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list args)
|
||||
{
|
||||
struct asprintf info;
|
||||
info.b = dyn;
|
||||
info.merr = MERR_OK;
|
||||
|
||||
(void)formatf(&info, alloc_addbyter, format, ap_save);
|
||||
(void)formatf(&info, alloc_addbyter, format, args);
|
||||
if(info.merr) {
|
||||
curlx_dyn_free(info.b);
|
||||
return info.merr;
|
||||
|
|
@ -1132,7 +1132,7 @@ int curlx_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save)
|
|||
return 0;
|
||||
}
|
||||
|
||||
char *curl_mvaprintf(const char *format, va_list ap_save)
|
||||
char *curl_mvaprintf(const char *format, va_list args)
|
||||
{
|
||||
struct asprintf info;
|
||||
struct dynbuf dyn;
|
||||
|
|
@ -1140,7 +1140,7 @@ char *curl_mvaprintf(const char *format, va_list ap_save)
|
|||
curlx_dyn_init(info.b, DYN_APRINTF);
|
||||
info.merr = MERR_OK;
|
||||
|
||||
(void)formatf(&info, alloc_addbyter, format, ap_save);
|
||||
(void)formatf(&info, alloc_addbyter, format, args);
|
||||
if(info.merr) {
|
||||
curlx_dyn_free(info.b);
|
||||
return NULL;
|
||||
|
|
@ -1152,11 +1152,11 @@ char *curl_mvaprintf(const char *format, va_list ap_save)
|
|||
|
||||
char *curl_maprintf(const char *format, ...)
|
||||
{
|
||||
va_list ap_save;
|
||||
va_list args;
|
||||
char *s;
|
||||
va_start(ap_save, format);
|
||||
s = curl_mvaprintf(format, ap_save);
|
||||
va_end(ap_save);
|
||||
va_start(args, format);
|
||||
s = curl_mvaprintf(format, args);
|
||||
va_end(args);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
@ -1170,11 +1170,11 @@ static int storebuffer(unsigned char outc, void *f)
|
|||
|
||||
int curl_msprintf(char *buffer, const char *format, ...)
|
||||
{
|
||||
va_list ap_save; /* argument pointer */
|
||||
va_list args; /* argument pointer */
|
||||
int retcode;
|
||||
va_start(ap_save, format);
|
||||
retcode = formatf(&buffer, storebuffer, format, ap_save);
|
||||
va_end(ap_save);
|
||||
va_start(args, format);
|
||||
retcode = formatf(&buffer, storebuffer, format, args);
|
||||
va_end(args);
|
||||
*buffer = 0; /* we terminate this with a zero byte */
|
||||
return retcode;
|
||||
}
|
||||
|
|
@ -1190,36 +1190,36 @@ static int fputc_wrapper(unsigned char outc, void *f)
|
|||
int curl_mprintf(const char *format, ...)
|
||||
{
|
||||
int retcode;
|
||||
va_list ap_save; /* argument pointer */
|
||||
va_start(ap_save, format);
|
||||
retcode = formatf(stdout, fputc_wrapper, format, ap_save);
|
||||
va_end(ap_save);
|
||||
va_list args; /* argument pointer */
|
||||
va_start(args, format);
|
||||
retcode = formatf(stdout, fputc_wrapper, format, args);
|
||||
va_end(args);
|
||||
return retcode;
|
||||
}
|
||||
|
||||
int curl_mfprintf(FILE *whereto, const char *format, ...)
|
||||
int curl_mfprintf(FILE *fd, const char *format, ...)
|
||||
{
|
||||
int retcode;
|
||||
va_list ap_save; /* argument pointer */
|
||||
va_start(ap_save, format);
|
||||
retcode = formatf(whereto, fputc_wrapper, format, ap_save);
|
||||
va_end(ap_save);
|
||||
va_list args; /* argument pointer */
|
||||
va_start(args, format);
|
||||
retcode = formatf(fd, fputc_wrapper, format, args);
|
||||
va_end(args);
|
||||
return retcode;
|
||||
}
|
||||
|
||||
int curl_mvsprintf(char *buffer, const char *format, va_list ap_save)
|
||||
int curl_mvsprintf(char *buffer, const char *format, va_list args)
|
||||
{
|
||||
int retcode = formatf(&buffer, storebuffer, format, ap_save);
|
||||
int retcode = formatf(&buffer, storebuffer, format, args);
|
||||
*buffer = 0; /* we terminate this with a zero byte */
|
||||
return retcode;
|
||||
}
|
||||
|
||||
int curl_mvprintf(const char *format, va_list ap_save)
|
||||
int curl_mvprintf(const char *format, va_list args)
|
||||
{
|
||||
return formatf(stdout, fputc_wrapper, format, ap_save);
|
||||
return formatf(stdout, fputc_wrapper, format, args);
|
||||
}
|
||||
|
||||
int curl_mvfprintf(FILE *whereto, const char *format, va_list ap_save)
|
||||
int curl_mvfprintf(FILE *fd, const char *format, va_list args)
|
||||
{
|
||||
return formatf(whereto, fputc_wrapper, format, ap_save);
|
||||
return formatf(fd, fputc_wrapper, format, args);
|
||||
}
|
||||
|
|
|
|||
22
lib/multi.c
22
lib/multi.c
|
|
@ -453,11 +453,11 @@ static CURLMcode multi_xfers_add(struct Curl_multi *multi,
|
|||
return CURLM_OK;
|
||||
}
|
||||
|
||||
CURLMcode curl_multi_add_handle(CURLM *m, CURL *d)
|
||||
CURLMcode curl_multi_add_handle(CURLM *m, CURL *curl)
|
||||
{
|
||||
CURLMcode mresult;
|
||||
struct Curl_multi *multi = m;
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
|
||||
/* First, make some basic checks that the CURLM handle is a good handle */
|
||||
if(!GOOD_MULTI_HANDLE(multi))
|
||||
|
|
@ -775,10 +775,10 @@ static void close_connect_only(struct connectdata *conn,
|
|||
connclose(conn, "Removing connect-only easy handle");
|
||||
}
|
||||
|
||||
CURLMcode curl_multi_remove_handle(CURLM *m, CURL *d)
|
||||
CURLMcode curl_multi_remove_handle(CURLM *m, CURL *curl)
|
||||
{
|
||||
struct Curl_multi *multi = m;
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
bool premature;
|
||||
struct Curl_llist_node *e;
|
||||
CURLMcode mresult;
|
||||
|
|
@ -1655,22 +1655,22 @@ out:
|
|||
return mresult;
|
||||
}
|
||||
|
||||
CURLMcode curl_multi_wait(CURLM *multi,
|
||||
CURLMcode curl_multi_wait(CURLM *m,
|
||||
struct curl_waitfd extra_fds[],
|
||||
unsigned int extra_nfds,
|
||||
int timeout_ms,
|
||||
int *ret)
|
||||
{
|
||||
return multi_wait(multi, extra_fds, extra_nfds, timeout_ms, ret, FALSE);
|
||||
return multi_wait(m, extra_fds, extra_nfds, timeout_ms, ret, FALSE);
|
||||
}
|
||||
|
||||
CURLMcode curl_multi_poll(CURLM *multi,
|
||||
CURLMcode curl_multi_poll(CURLM *m,
|
||||
struct curl_waitfd extra_fds[],
|
||||
unsigned int extra_nfds,
|
||||
int timeout_ms,
|
||||
int *ret)
|
||||
{
|
||||
return multi_wait(multi, extra_fds, extra_nfds, timeout_ms, ret, TRUE);
|
||||
return multi_wait(m, extra_fds, extra_nfds, timeout_ms, ret, TRUE);
|
||||
}
|
||||
|
||||
CURLMcode curl_multi_wakeup(CURLM *m)
|
||||
|
|
@ -3723,14 +3723,14 @@ void Curl_expire_clear(struct Curl_easy *data)
|
|||
}
|
||||
}
|
||||
|
||||
CURLMcode curl_multi_assign(CURLM *m, curl_socket_t s,
|
||||
void *hashp)
|
||||
CURLMcode curl_multi_assign(CURLM *m, curl_socket_t sockfd,
|
||||
void *sockp)
|
||||
{
|
||||
struct Curl_multi *multi = m;
|
||||
if(!GOOD_MULTI_HANDLE(multi))
|
||||
return CURLM_BAD_HANDLE;
|
||||
|
||||
return Curl_multi_ev_assign(multi, s, hashp);
|
||||
return Curl_multi_ev_assign(multi, sockfd, sockp);
|
||||
}
|
||||
|
||||
static void move_pending_to_connect(struct Curl_multi *multi,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
***************************************************************************/
|
||||
CURLcode Curl_rand_bytes(struct Curl_easy *data,
|
||||
#ifdef DEBUGBUILD
|
||||
bool allow_env_override,
|
||||
bool env_override,
|
||||
#endif
|
||||
unsigned char *rnd, size_t num);
|
||||
|
||||
|
|
|
|||
10
lib/setopt.c
10
lib/setopt.c
|
|
@ -2901,21 +2901,21 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
|||
*/
|
||||
|
||||
#undef curl_easy_setopt
|
||||
CURLcode curl_easy_setopt(CURL *d, CURLoption tag, ...)
|
||||
CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...)
|
||||
{
|
||||
va_list arg;
|
||||
CURLcode result;
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
|
||||
if(!data)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
||||
va_start(arg, tag);
|
||||
va_start(arg, option);
|
||||
|
||||
result = Curl_vsetopt(data, tag, arg);
|
||||
result = Curl_vsetopt(data, option, arg);
|
||||
|
||||
va_end(arg);
|
||||
if(result == CURLE_BAD_FUNCTION_ARGUMENT)
|
||||
failf(data, "setopt 0x%x got bad argument", tag);
|
||||
failf(data, "setopt 0x%x got bad argument", option);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -424,7 +424,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
|
|||
const char *userp,
|
||||
const char *passwdp,
|
||||
const char *service,
|
||||
const char *hostname,
|
||||
const char *host,
|
||||
struct ntlmdata *ntlm,
|
||||
struct bufref *out)
|
||||
{
|
||||
|
|
@ -445,7 +445,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
|
|||
size_t size;
|
||||
|
||||
char *ntlmbuf;
|
||||
const char *host = ""; /* empty */
|
||||
const char *hostname = ""; /* empty */
|
||||
const char *domain = ""; /* empty */
|
||||
size_t hostlen = 0;
|
||||
size_t domlen = 0;
|
||||
|
|
@ -456,7 +456,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
|
|||
(void)userp;
|
||||
(void)passwdp;
|
||||
(void)service;
|
||||
(void)hostname;
|
||||
(void)host;
|
||||
|
||||
/* Clean up any former leftovers and initialise to defaults */
|
||||
Curl_auth_cleanup_ntlm(ntlm);
|
||||
|
|
@ -490,7 +490,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
|
|||
SHORTPAIR(hostlen),
|
||||
SHORTPAIR(hostoff),
|
||||
0, 0,
|
||||
host, /* this is empty */
|
||||
hostname, /* this is empty */
|
||||
domain /* this is empty */);
|
||||
|
||||
if(!ntlmbuf)
|
||||
|
|
|
|||
|
|
@ -191,21 +191,21 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
|
|||
* Returns CURLE_OK on success.
|
||||
*/
|
||||
CURLcode Curl_auth_decode_ntlm_type2_message(struct Curl_easy *data,
|
||||
const struct bufref *type2,
|
||||
const struct bufref *type2ref,
|
||||
struct ntlmdata *ntlm)
|
||||
{
|
||||
/* Ensure we have a valid type-2 message */
|
||||
if(!Curl_bufref_len(type2)) {
|
||||
if(!Curl_bufref_len(type2ref)) {
|
||||
infof(data, "NTLM handshake failure (empty type-2 message)");
|
||||
return CURLE_BAD_CONTENT_ENCODING;
|
||||
}
|
||||
|
||||
/* Store the challenge for later use */
|
||||
ntlm->input_token = curlx_memdup0(Curl_bufref_ptr(type2),
|
||||
Curl_bufref_len(type2));
|
||||
ntlm->input_token = curlx_memdup0(Curl_bufref_ptr(type2ref),
|
||||
Curl_bufref_len(type2ref));
|
||||
if(!ntlm->input_token)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
ntlm->input_token_len = Curl_bufref_len(type2);
|
||||
ntlm->input_token_len = Curl_bufref_len(type2ref);
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
|
|||
const char *userp,
|
||||
const char *passwdp,
|
||||
const char *service,
|
||||
const char *hostname,
|
||||
const char *host,
|
||||
struct ntlmdata *ntlm,
|
||||
struct bufref *out);
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
|
|||
const char *passwdp,
|
||||
const char *service,
|
||||
const char *host,
|
||||
const bool mutual,
|
||||
const bool mutual_auth,
|
||||
const struct bufref *chlg,
|
||||
struct kerberos5data *krb5,
|
||||
struct bufref *out);
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ CURLcode Curl_gtls_ctx_init(struct gtls_ctx *gctx,
|
|||
struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
struct ssl_peer *peer,
|
||||
const struct alpn_spec *alpns,
|
||||
const struct alpn_spec *alpns_requested,
|
||||
Curl_gtls_ctx_setup_cb *cb_setup,
|
||||
void *cb_user_data,
|
||||
void *ssl_user_data,
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ CURLcode Curl_wssl_ctx_init(struct wssl_ctx *wctx,
|
|||
struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
struct ssl_peer *peer,
|
||||
const struct alpn_spec *alpns,
|
||||
const struct alpn_spec *alpns_requested,
|
||||
Curl_wssl_ctx_setup_cb *cb_setup,
|
||||
void *cb_user_data,
|
||||
void *ssl_user_data,
|
||||
|
|
|
|||
28
lib/ws.c
28
lib/ws.c
|
|
@ -1527,16 +1527,16 @@ static CURLcode nw_in_recv(void *reader_ctx,
|
|||
return curl_easy_recv(data, buf, buflen, pnread);
|
||||
}
|
||||
|
||||
CURLcode curl_ws_recv(CURL *d, void *buffer,
|
||||
size_t buflen, size_t *nread,
|
||||
CURLcode curl_ws_recv(CURL *curl, void *buffer,
|
||||
size_t buflen, size_t *recv,
|
||||
const struct curl_ws_frame **metap)
|
||||
{
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
struct connectdata *conn;
|
||||
struct websocket *ws;
|
||||
struct ws_collect ctx;
|
||||
|
||||
*nread = 0;
|
||||
*recv = 0;
|
||||
*metap = NULL;
|
||||
if(!GOOD_EASY_HANDLE(data) || (buflen && !buffer))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
|
@ -1609,10 +1609,10 @@ CURLcode curl_ws_recv(CURL *d, void *buffer,
|
|||
update_meta(ws, ctx.frame_age, ctx.frame_flags, ctx.payload_offset,
|
||||
ctx.payload_len, ctx.bufidx);
|
||||
*metap = &ws->recvframe;
|
||||
*nread = ws->recvframe.len;
|
||||
*recv = ws->recvframe.len;
|
||||
CURL_TRC_WS(data, "curl_ws_recv(len=%zu) -> %zu bytes (frame at %"
|
||||
FMT_OFF_T ", %" FMT_OFF_T " left)",
|
||||
buflen, *nread, ws->recvframe.offset,
|
||||
buflen, *recv, ws->recvframe.offset,
|
||||
ws->recvframe.bytesleft);
|
||||
/* all's well, try to send any pending control. we do not know
|
||||
* when the application will call `curl_ws_send()` again. */
|
||||
|
|
@ -1763,7 +1763,7 @@ static CURLcode ws_send_raw(struct Curl_easy *data, const void *buffer,
|
|||
return result;
|
||||
}
|
||||
|
||||
CURLcode curl_ws_send(CURL *d, const void *buffer_arg,
|
||||
CURLcode curl_ws_send(CURL *curl, const void *buffer_arg,
|
||||
size_t buflen, size_t *sent,
|
||||
curl_off_t fragsize,
|
||||
unsigned int flags)
|
||||
|
|
@ -1771,7 +1771,7 @@ CURLcode curl_ws_send(CURL *d, const void *buffer_arg,
|
|||
struct websocket *ws;
|
||||
const uint8_t *buffer = buffer_arg;
|
||||
CURLcode result = CURLE_OK;
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
size_t ndummy;
|
||||
size_t *pnsent = sent ? sent : &ndummy;
|
||||
|
||||
|
|
@ -1851,11 +1851,11 @@ static CURLcode ws_setup_conn(struct Curl_easy *data,
|
|||
return Curl_http_setup_conn(data, conn);
|
||||
}
|
||||
|
||||
const struct curl_ws_frame *curl_ws_meta(CURL *d)
|
||||
const struct curl_ws_frame *curl_ws_meta(CURL *curl)
|
||||
{
|
||||
/* we only return something for websocket, called from within the callback
|
||||
when not using raw mode */
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
if(GOOD_EASY_HANDLE(data) && Curl_is_in_callback(data) &&
|
||||
data->conn && !data->set.ws_raw_mode) {
|
||||
struct websocket *ws;
|
||||
|
|
@ -1866,13 +1866,13 @@ const struct curl_ws_frame *curl_ws_meta(CURL *d)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
CURL_EXTERN CURLcode curl_ws_start_frame(CURL *d,
|
||||
CURL_EXTERN CURLcode curl_ws_start_frame(CURL *curl,
|
||||
unsigned int flags,
|
||||
curl_off_t frame_len)
|
||||
{
|
||||
struct websocket *ws;
|
||||
CURLcode result = CURLE_OK;
|
||||
struct Curl_easy *data = d;
|
||||
struct Curl_easy *data = curl;
|
||||
|
||||
if(!GOOD_EASY_HANDLE(data))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
|
@ -1941,13 +1941,13 @@ const struct Curl_protocol Curl_protocol_ws = {
|
|||
#else
|
||||
|
||||
CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen,
|
||||
size_t *nread,
|
||||
size_t *recv,
|
||||
const struct curl_ws_frame **metap)
|
||||
{
|
||||
(void)curl;
|
||||
(void)buffer;
|
||||
(void)buflen;
|
||||
(void)nread;
|
||||
(void)recv;
|
||||
(void)metap;
|
||||
return CURLE_NOT_BUILT_IN;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue