diff --git a/.clang-tidy.yml b/.clang-tidy.yml index 411bc70002..0a1aee8e49 100644 --- a/.clang-tidy.yml +++ b/.clang-tidy.yml @@ -8,7 +8,7 @@ Checks: - clang-analyzer-* - -clang-analyzer-optin.performance.Padding - - -clang-analyzer-security.ArrayBound # due to false positives with clang-tidy v21.1.0 + - -clang-analyzer-security.ArrayBound # due to false positives with clang-tidy v21.1.0+ - -clang-analyzer-security.insecureAPI.bzero # for FD_ZERO() (seen on macOS) - -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling - -clang-diagnostic-nullability-extension diff --git a/.github/workflows/http3-linux.yml b/.github/workflows/http3-linux.yml index ee78ff14af..f70285e302 100644 --- a/.github/workflows/http3-linux.yml +++ b/.github/workflows/http3-linux.yml @@ -427,7 +427,8 @@ jobs: - name: 'openssl4' install_steps: skipall LDFLAGS: -Wl,-rpath,/home/runner/openssl4/build/lib - PKG_CONFIG_PATH: "/home/runner/openssl4/build/lib/pkgconfig:\ + PKG_CONFIG_PATH: "\ + /home/runner/openssl4/build/lib/pkgconfig:\ /home/runner/nghttp3/build/lib/pkgconfig:\ /home/runner/nghttp2-openssl4/build/lib/pkgconfig" configure: >- @@ -435,7 +436,8 @@ jobs: - name: 'openssl4' tflags: '--min=1640' - PKG_CONFIG_PATH: "/home/runner/openssl4/build/lib/pkgconfig:\ + PKG_CONFIG_PATH: "\ + /home/runner/openssl4/build/lib/pkgconfig:\ /home/runner/nghttp3/build/lib/pkgconfig:\ /home/runner/ngtcp2-openssl4/build/lib/pkgconfig:\ /home/runner/nghttp2/build/lib/pkgconfig" @@ -483,7 +485,8 @@ jobs: - name: 'boringssl' tflags: '--min=1790' - PKG_CONFIG_PATH: "/home/runner/boringssl/build/lib/pkgconfig:\ + PKG_CONFIG_PATH: "\ + /home/runner/boringssl/build/lib/pkgconfig:\ /home/runner/nghttp3/build/lib/pkgconfig:\ /home/runner/ngtcp2-boringssl/build/lib/pkgconfig:\ /home/runner/nghttp2/build/lib/pkgconfig" @@ -503,7 +506,8 @@ jobs: install_packages: libp11-kit-dev libssh-dev tflags: '--min=1840' LDFLAGS: -Wl,-rpath,/home/runner/gnutls/build/lib - PKG_CONFIG_PATH: "/home/runner/nettle/build/lib64/pkgconfig:\ + PKG_CONFIG_PATH: "\ + /home/runner/nettle/build/lib64/pkgconfig:\ /home/runner/gnutls/build/lib/pkgconfig:\ /home/runner/nghttp3/build/lib/pkgconfig:\ /home/runner/ngtcp2/build/lib/pkgconfig:\ diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index d528a91003..17560ac041 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -309,7 +309,8 @@ jobs: -Wl,-rpath,/home/runner/rustls/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/gsasl/lib - PKG_CONFIG_PATH: "/home/runner/wolfssl-opensslextra/lib/pkgconfig:\ + PKG_CONFIG_PATH: "\ + /home/runner/wolfssl-opensslextra/lib/pkgconfig:\ /home/runner/mbedtls/lib/pkgconfig:\ /home/runner/rustls/lib/pkgconfig:\ /home/linuxbrew/.linuxbrew/opt/gsasl/lib/pkgconfig" @@ -330,7 +331,8 @@ jobs: -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/libnghttp3/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/c-ares/lib - PKG_CONFIG_PATH: "/home/linuxbrew/.linuxbrew/opt/libngtcp2/lib/pkgconfig:\ + PKG_CONFIG_PATH: "\ + /home/linuxbrew/.linuxbrew/opt/libngtcp2/lib/pkgconfig:\ /home/linuxbrew/.linuxbrew/opt/libnghttp3/lib/pkgconfig:\ /home/linuxbrew/.linuxbrew/opt/c-ares/lib/pkgconfig" generate: >- @@ -354,7 +356,8 @@ jobs: CC: clang-20 CFLAGS: -fsanitize=address,undefined,signed-integer-overflow -fno-sanitize-recover=undefined,integer -Wformat -Werror=format-security -Werror=array-bounds -g LDFLAGS: -fsanitize=address,undefined -fno-sanitize-recover=undefined,integer -ldl -lubsan -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/c-ares/lib - PKG_CONFIG_PATH: "/home/linuxbrew/.linuxbrew/opt/libssh2/lib/pkgconfig:\ + PKG_CONFIG_PATH: "\ + /home/linuxbrew/.linuxbrew/opt/libssh2/lib/pkgconfig:\ /home/linuxbrew/.linuxbrew/opt/libngtcp2/lib/pkgconfig:\ /home/linuxbrew/.linuxbrew/opt/libnghttp3/lib/pkgconfig:\ /home/linuxbrew/.linuxbrew/opt/c-ares/lib/pkgconfig" diff --git a/CMake/PickyWarnings.cmake b/CMake/PickyWarnings.cmake index 2cd54190e9..aca79ec947 100644 --- a/CMake/PickyWarnings.cmake +++ b/CMake/PickyWarnings.cmake @@ -350,7 +350,7 @@ if(PICKY_COMPILER) endif() endif() - # + # Assemble list of flags set(_picky_skipped "") foreach(_ccopt IN LISTS _picky_enable) diff --git a/docs/INSTALL-CMAKE.md b/docs/INSTALL-CMAKE.md index a4359482dc..a84faf72f2 100644 --- a/docs/INSTALL-CMAKE.md +++ b/docs/INSTALL-CMAKE.md @@ -247,7 +247,7 @@ target_link_libraries(my_target PRIVATE CURL::libcurl) - `SHARE_LIB_OBJECT`: Build shared and static libcurl in a single pass (requires CMake 3.12 or newer). Default: `ON` for Windows - `STATIC_LIB_SUFFIX`: Static library suffix. Default: (empty) -## CA bundle options +## Root CA options - `CURL_CA_BUNDLE`: Absolute path to the CA bundle. Set `none` to disable or `auto` for auto-detection. Default: `auto` - `CURL_CA_EMBED`: Absolute path to the CA bundle to embed in the curl tool. Default: (disabled) @@ -257,6 +257,7 @@ target_link_libraries(my_target PRIVATE CURL::libcurl) - `CURL_CA_PATH`: Absolute path to a directory containing CA certificates stored individually. Set `none` to disable or `auto` for auto-detection. Default: `auto` - `CURL_CA_SEARCH_SAFE`: Enable safe CA bundle search (within the curl tool directory) on Windows. Default: `OFF` +- `USE_APPLE_SECTRUST`: Use Apple OS-native certificate verification. Default: `OFF` ## Enabling features @@ -267,9 +268,12 @@ target_link_libraries(my_target PRIVATE CURL::libcurl) - `ENABLE_THREADED_RESOLVER`: Enable threaded DNS lookup. Default: `ON` if c-ares is not enabled and target supports threading. - `ENABLE_UNICODE`: Use the Unicode version of the Windows API functions. Default: `OFF` - `ENABLE_UNIX_SOCKETS`: Enable Unix domain sockets support. Default: `ON` +- `USE_APPLE_IDN`: Use Apple built-in IDN support. Default: `OFF` - `USE_ECH`: Enable ECH support. Default: `OFF` - `USE_HTTPSRR`: Enable HTTPS RR support. Default: `OFF` - `USE_SSLS_EXPORT`: Enable experimental SSL session import/export. Default: `OFF` +- `USE_WIN32_IDN`: Use WinIDN for IDN support. Default: `OFF` +- `USE_WIN32_LDAP`: Use Windows LDAP implementation. Default: `ON` ## Disabling features @@ -369,14 +373,10 @@ Details via CMake - `CURL_ZLIB`: Use zlib (`ON`, `OFF` or `AUTO`). Default: `AUTO` - `CURL_ZSTD`: Use zstd (`ON`, `OFF` or `AUTO`). Default: `AUTO` - `ENABLE_ARES`: Enable c-ares support. Default: `OFF` -- `USE_APPLE_IDN`: Use Apple built-in IDN support. Default: `OFF` -- `USE_APPLE_SECTRUST`: Use Apple OS-native certificate verification. Default: `OFF` - `USE_LIBIDN2`: Use libidn2 for IDN support. Default: `ON` - `USE_NGHTTP2`: Use nghttp2 library. Default: `ON` - `USE_NGTCP2`: Use ngtcp2 and nghttp3 libraries for HTTP/3 support. Default: `OFF` - `USE_QUICHE`: Use quiche library for HTTP/3 support. Default: `OFF` -- `USE_WIN32_IDN`: Use WinIDN for IDN support. Default: `OFF` -- `USE_WIN32_LDAP`: Use Windows LDAP implementation. Default: `ON` ## Dependency options (via CMake) diff --git a/docs/examples/debug.c b/docs/examples/debug.c index 44156cd823..449cd1111b 100644 --- a/docs/examples/debug.c +++ b/docs/examples/debug.c @@ -45,7 +45,7 @@ static void dump(const char *text, const unsigned char *ptr, /* without the hex output, we can fit more on screen */ width = 0x40; - fprintf(stderr, "%s, %10.10lu bytes (0x%8.8lx)\n", + fprintf(stderr, "%s, %lu bytes (0x%lx)\n", text, (unsigned long)size, (unsigned long)size); for(i = 0; i < size; i += width) { diff --git a/docs/examples/multi-debugcallback.c b/docs/examples/multi-debugcallback.c index f56c287773..0885486ea9 100644 --- a/docs/examples/multi-debugcallback.c +++ b/docs/examples/multi-debugcallback.c @@ -42,7 +42,7 @@ static void dump(const char *text, const unsigned char *ptr, /* without the hex output, we can fit more on screen */ width = 0x40; - fprintf(stderr, "%s, %10.10lu bytes (0x%8.8lx)\n", + fprintf(stderr, "%s, %lu bytes (0x%lx)\n", text, (unsigned long)size, (unsigned long)size); for(i = 0; i < size; i += width) { diff --git a/docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.md b/docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.md index 6316c68bcb..b1d0dd872c 100644 --- a/docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.md +++ b/docs/libcurl/opts/CURLOPT_DEBUGFUNCTION.md @@ -118,7 +118,7 @@ static void dump(const char *text, size_t c; unsigned int width = 0x10; - fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n", + fprintf(stream, "%s, %lu bytes (0x%lx)\n", text, (long)size, (long)size); for(i = 0; i < size; i += width) { diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index 50a67051c0..2bf1d3c3b5 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -208,7 +208,7 @@ static void async_ares_cleanup(struct Curl_resolv_async *async) } void Curl_async_ares_shutdown(struct Curl_easy *data, - struct Curl_resolv_async *async) + struct Curl_resolv_async *async) { /* c-ares has a method to "cancel" operations on a channel, but * as reported in #18216, this does not totally reset the channel @@ -330,10 +330,10 @@ static timediff_t async_ares_poll_timeout(struct async_ares_ctx *ares, int itimeout_ms; #if TIMEDIFF_T_MAX > INT_MAX - itimeout_ms = (timeout_ms > INT_MAX) ? INT_MAX : - ((timeout_ms < 0) ? -1 : (int)timeout_ms); + itimeout_ms = (timeout_ms > INT_MAX) ? INT_MAX : + ((timeout_ms < 0) ? -1 : (int)timeout_ms); #else - itimeout_ms = (int)timeout_ms; + itimeout_ms = (int)timeout_ms; #endif max_timeout.tv_sec = itimeout_ms / 1000; max_timeout.tv_usec = (itimeout_ms % 1000) * 1000; @@ -349,9 +349,10 @@ static timediff_t async_ares_poll_timeout(struct async_ares_ctx *ares, return 1000; } -static const struct Curl_addrinfo * -async_ares_get_ai(const struct Curl_addrinfo *ai, - int ai_family, unsigned int index) +static const struct Curl_addrinfo *async_ares_get_ai( + const struct Curl_addrinfo *ai, + int ai_family, + unsigned int index) { unsigned int i = 0; for(i = 0; ai; ai = ai->ai_next) { @@ -364,10 +365,10 @@ async_ares_get_ai(const struct Curl_addrinfo *ai, return NULL; } -const struct Curl_addrinfo * -Curl_async_get_ai(struct Curl_easy *data, - struct Curl_resolv_async *async, - int ai_family, unsigned int index) +const struct Curl_addrinfo *Curl_async_get_ai(struct Curl_easy *data, + struct Curl_resolv_async *async, + int ai_family, + unsigned int index) { struct async_ares_ctx *ares = &async->ares; @@ -388,9 +389,9 @@ Curl_async_get_ai(struct Curl_easy *data, } #ifdef USE_HTTPSRR -const struct Curl_https_rrinfo * -Curl_async_get_https(struct Curl_easy *data, - struct Curl_resolv_async *async) +const struct Curl_https_rrinfo *Curl_async_get_https( + struct Curl_easy *data, + struct Curl_resolv_async *async) { if(Curl_async_knows_https(data, async)) return &async->ares.hinfo; @@ -415,7 +416,7 @@ bool Curl_async_knows_https(struct Curl_easy *data, * Waits for a resolve to finish. This function should be avoided since using * this risk getting the multi interface to "hang". * - * 'entry' MUST be non-NULL. + * 'pdns' MUST be non-NULL. * * Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved, * CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors. @@ -479,8 +480,8 @@ CURLcode Curl_async_await(struct Curl_easy *data, uint32_t resolv_id, * async_ares_node2addr() converts an address list provided by c-ares * to an internal libcurl compatible list. */ -static struct Curl_addrinfo * -async_ares_node2addr(struct ares_addrinfo_node *node) +static struct Curl_addrinfo *async_ares_node2addr( + struct ares_addrinfo_node *node) { /* traverse the ares_addrinfo_node list */ struct ares_addrinfo_node *ai; diff --git a/lib/asyn-thrdd.c b/lib/asyn-thrdd.c index cb589b45cc..6fe4ffeb02 100644 --- a/lib/asyn-thrdd.c +++ b/lib/asyn-thrdd.c @@ -135,11 +135,11 @@ static void async_thrdd_item_destroy(struct async_thrdd_item *item) } /* Initialize context for threaded resolver */ -static struct async_thrdd_item * -async_thrdd_item_create(struct Curl_easy *data, - uint32_t resolv_id, uint8_t dns_queries, - const char *hostname, uint16_t port, - uint8_t transport) +static struct async_thrdd_item *async_thrdd_item_create( + struct Curl_easy *data, + uint32_t resolv_id, uint8_t dns_queries, + const char *hostname, uint16_t port, + uint8_t transport) { size_t hostlen = strlen(hostname); struct async_thrdd_item *item; @@ -252,7 +252,7 @@ static CURLcode async_rr_start(struct Curl_easy *data, #endif void Curl_async_thrdd_shutdown(struct Curl_easy *data, - struct Curl_resolv_async *async) + struct Curl_resolv_async *async) { Curl_async_thrdd_destroy(data, async); } @@ -389,13 +389,13 @@ static void async_thrdd_item_process(void *item) struct async_thrdd_item *item = arg; #ifdef DEBUGBUILD - if(item->delay_ms) { - curlx_wait_ms(item->delay_ms); - } - if(item->delay_fail_ms) { - curlx_wait_ms(item->delay_fail_ms); - return; - } + if(item->delay_ms) { + curlx_wait_ms(item->delay_ms); + } + if(item->delay_fail_ms) { + curlx_wait_ms(item->delay_fail_ms); + return; + } #endif item->res = Curl_ipv4_resolve_r(item->hostname, item->port); if(!item->res) { @@ -496,10 +496,9 @@ static void async_thrdd_report_item(struct Curl_easy *data, } } - infof(data, "Host %s:%u resolved IPv%c: %s", - item->hostname, item->port, - (item->dns_queries & CURL_DNSQ_AAAA) ? '6' : '4', - (curlx_dyn_len(&tmp) ? curlx_dyn_ptr(&tmp) : "(none)")); + infof(data, "Host %s:%u resolved IPv%c: %s", item->hostname, item->port, + (item->dns_queries & CURL_DNSQ_AAAA) ? '6' : '4', + (curlx_dyn_len(&tmp) ? curlx_dyn_ptr(&tmp) : "(none)")); out: curlx_dyn_free(&tmp); } @@ -758,9 +757,9 @@ out: return result; } -static const struct Curl_addrinfo * -async_thrdd_get_ai(const struct Curl_addrinfo *ai, - int ai_family, unsigned int index) +static const struct Curl_addrinfo *async_thrdd_get_ai( + const struct Curl_addrinfo *ai, + int ai_family, unsigned int index) { unsigned int i = 0; for(i = 0; ai; ai = ai->ai_next) { @@ -773,10 +772,10 @@ async_thrdd_get_ai(const struct Curl_addrinfo *ai, return NULL; } -const struct Curl_addrinfo * -Curl_async_get_ai(struct Curl_easy *data, - struct Curl_resolv_async *async, - int ai_family, unsigned int index) +const struct Curl_addrinfo *Curl_async_get_ai(struct Curl_easy *data, + struct Curl_resolv_async *async, + int ai_family, + unsigned int index) { struct async_thrdd_ctx *thrdd = &async->thrdd; @@ -797,9 +796,9 @@ Curl_async_get_ai(struct Curl_easy *data, } #ifdef USE_HTTPSRR -const struct Curl_https_rrinfo * -Curl_async_get_https(struct Curl_easy *data, - struct Curl_resolv_async *async) +const struct Curl_https_rrinfo *Curl_async_get_https( + struct Curl_easy *data, + struct Curl_resolv_async *async) { #ifdef USE_HTTPSRR_ARES if(Curl_async_knows_https(data, async)) diff --git a/lib/asyn.h b/lib/asyn.h index 41f588b51f..06387a85ae 100644 --- a/lib/asyn.h +++ b/lib/asyn.h @@ -82,15 +82,15 @@ void Curl_async_global_cleanup(void); CURLcode Curl_async_getaddrinfo(struct Curl_easy *data, struct Curl_resolv_async *async); -const struct Curl_addrinfo * -Curl_async_get_ai(struct Curl_easy *data, - struct Curl_resolv_async *async, - int ai_family, unsigned int index); +const struct Curl_addrinfo *Curl_async_get_ai(struct Curl_easy *data, + struct Curl_resolv_async *async, + int ai_family, + unsigned int index); #ifdef USE_HTTPSRR -const struct Curl_https_rrinfo * -Curl_async_get_https(struct Curl_easy *data, - struct Curl_resolv_async *async); +const struct Curl_https_rrinfo *Curl_async_get_https( + struct Curl_easy *data, + struct Curl_resolv_async *async); bool Curl_async_knows_https(struct Curl_easy *data, struct Curl_resolv_async *async); #endif /* USE_HTTPSRR */ @@ -125,7 +125,7 @@ struct async_ares_ctx { }; void Curl_async_ares_shutdown(struct Curl_easy *data, - struct Curl_resolv_async *async); + struct Curl_resolv_async *async); void Curl_async_ares_destroy(struct Curl_easy *data, struct Curl_resolv_async *async); @@ -176,7 +176,7 @@ struct doh_probes; * Waits for a resolve to finish. This function should be avoided since using * this risk getting the multi interface to "hang". * - * On return 'entry' is assigned the resolved dns (CURLE_OK or NULL otherwise. + * On return 'dns' is assigned the resolved dns (CURLE_OK or NULL otherwise. * * Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved, * CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors. @@ -210,8 +210,8 @@ CURLcode Curl_async_pollset(struct Curl_easy *data, /* convert these functions if an asynch resolver is not used */ #define Curl_async_global_init() CURLE_OK #define Curl_async_global_cleanup() Curl_nop_stmt -#define Curl_async_get_ai(a,b,c,d) NULL -#define Curl_async_await(a,b,c) CURLE_COULDNT_RESOLVE_HOST +#define Curl_async_get_ai(a, b, c, d) NULL +#define Curl_async_await(a, b, c) CURLE_COULDNT_RESOLVE_HOST #define Curl_async_take_result(x, y, z) CURLE_COULDNT_RESOLVE_HOST #define Curl_async_pollset(x, y, z) CURLE_OK #endif /* !CURLRES_ASYNCH */ @@ -263,7 +263,7 @@ void Curl_async_destroy(struct Curl_easy *data, struct Curl_resolv_async *async); #else /* !USE_CURL_ASYNC */ -#define Curl_async_shutdown(x,y) Curl_nop_stmt +#define Curl_async_shutdown(x, y) Curl_nop_stmt #endif /* USE_CURL_ASYNC */ /********** end of generic resolver interface functions *****************/ diff --git a/lib/cf-dns.c b/lib/cf-dns.c index 436d08a1ed..bfa7b30780 100644 --- a/lib/cf-dns.c +++ b/lib/cf-dns.c @@ -47,11 +47,12 @@ struct cf_dns_ctx { char hostname[1]; }; -static struct cf_dns_ctx * -cf_dns_ctx_create(struct Curl_easy *data, uint8_t dns_queries, - const char *hostname, uint16_t port, uint8_t transport, - bool abstract_unix_socket, - struct Curl_dns_entry *dns) +static struct cf_dns_ctx *cf_dns_ctx_create(struct Curl_easy *data, + uint8_t dns_queries, + const char *hostname, + uint16_t port, uint8_t transport, + bool abstract_unix_socket, + struct Curl_dns_entry *dns) { struct cf_dns_ctx *ctx; size_t hlen = strlen(hostname); @@ -399,7 +400,7 @@ static CURLcode cf_dns_conn_create(struct Curl_cfilter **pcf, * there, thus overriding any defaults that might have been set above. */ hostname = ehost->name; port = conn->bits.conn_to_port ? - conn->conn_to_port : (uint16_t)conn->remote_port; + conn->conn_to_port : (uint16_t)conn->remote_port; } if(!hostname) { @@ -500,9 +501,10 @@ CURLcode Curl_conn_dns_result(struct connectdata *conn, int sockindex) return Curl_cf_dns_result(conn->cfilter[sockindex]); } -static const struct Curl_addrinfo * -cf_dns_get_nth_ai(struct Curl_cfilter *cf, const struct Curl_addrinfo *ai, - int ai_family, unsigned int index) +static const struct Curl_addrinfo *cf_dns_get_nth_ai( + struct Curl_cfilter *cf, + const struct Curl_addrinfo *ai, + int ai_family, unsigned int index) { struct cf_dns_ctx *ctx = cf->ctx; unsigned int i = 0; @@ -551,11 +553,10 @@ bool Curl_conn_dns_has_any_ai(struct Curl_easy *data, int sockindex) * first "resolve" filter underneath `cf`. If the DNS resolving is * not done yet or if no address for the family exists, returns NULL. */ -const struct Curl_addrinfo * -Curl_cf_dns_get_ai(struct Curl_cfilter *cf, - struct Curl_easy *data, - int ai_family, - unsigned int index) +const struct Curl_addrinfo *Curl_cf_dns_get_ai(struct Curl_cfilter *cf, + struct Curl_easy *data, + int ai_family, + unsigned int index) { (void)data; for(; cf; cf = cf->next) { @@ -576,15 +577,12 @@ Curl_cf_dns_get_ai(struct Curl_cfilter *cf, * first "resolve" filter at the connection. If the DNS resolving is * not done yet or if no address for the family exists, returns NULL. */ -const struct Curl_addrinfo * -Curl_conn_dns_get_ai(struct Curl_easy *data, - int sockindex, - int ai_family, - unsigned int index) +const struct Curl_addrinfo *Curl_conn_dns_get_ai(struct Curl_easy *data, + int sockindex, int ai_family, + unsigned int index) { struct connectdata *conn = data->conn; - return Curl_cf_dns_get_ai(conn->cfilter[sockindex], data, - ai_family, index); + return Curl_cf_dns_get_ai(conn->cfilter[sockindex], data, ai_family, index); } #ifdef USE_HTTPSRR @@ -592,8 +590,8 @@ Curl_conn_dns_get_ai(struct Curl_easy *data, * connection. If the DNS resolving is not done yet or if there * is no HTTPS-RR info, returns NULL. */ -const struct Curl_https_rrinfo * -Curl_conn_dns_get_https(struct Curl_easy *data, int sockindex) +const struct Curl_https_rrinfo *Curl_conn_dns_get_https(struct Curl_easy *data, + int sockindex) { struct Curl_cfilter *cf = data->conn->cfilter[sockindex]; for(; cf; cf = cf->next) { diff --git a/lib/cf-dns.h b/lib/cf-dns.h index 24e266f1dd..d9966ae295 100644 --- a/lib/cf-dns.h +++ b/lib/cf-dns.h @@ -51,28 +51,25 @@ CURLcode Curl_cf_dns_result(struct Curl_cfilter *cf); * `Curl_conn_dns_get_ai()`. */ bool Curl_conn_dns_has_any_ai(struct Curl_easy *data, int sockindex); -const struct Curl_addrinfo * -Curl_conn_dns_get_ai(struct Curl_easy *data, - int sockindex, - int ai_family, - unsigned int index); +const struct Curl_addrinfo *Curl_conn_dns_get_ai(struct Curl_easy *data, + int sockindex, + int ai_family, + unsigned int index); -const struct Curl_addrinfo * -Curl_cf_dns_get_ai(struct Curl_cfilter *cf, - struct Curl_easy *data, - int ai_family, - unsigned int index); +const struct Curl_addrinfo *Curl_cf_dns_get_ai(struct Curl_cfilter *cf, + struct Curl_easy *data, + int ai_family, + unsigned int index); #ifdef USE_HTTPSRR -const struct Curl_https_rrinfo * -Curl_conn_dns_get_https(struct Curl_easy *data, int sockindex); +const struct Curl_https_rrinfo *Curl_conn_dns_get_https(struct Curl_easy *data, + int sockindex); bool Curl_conn_dns_resolved_https(struct Curl_easy *data, int sockindex); #else -#define Curl_conn_dns_get_https(a,b) NULL -#define Curl_conn_dns_resolved_https(a,b) TRUE +#define Curl_conn_dns_get_https(a, b) NULL +#define Curl_conn_dns_resolved_https(a, b) TRUE #endif - extern struct Curl_cftype Curl_cft_dns; #endif /* HEADER_CURL_CF_DNS_H */ diff --git a/lib/cf-h2-proxy.c b/lib/cf-h2-proxy.c index 5dcf3112ed..4dd4f4ab35 100644 --- a/lib/cf-h2-proxy.c +++ b/lib/cf-h2-proxy.c @@ -685,15 +685,16 @@ static int proxy_h2_on_stream_close(nghttp2_session *session, return 0; } -static CURLcode proxy_h2_submit(int32_t *pstream_id, - struct Curl_cfilter *cf, - struct Curl_easy *data, - nghttp2_session *h2, - struct httpreq *req, - const nghttp2_priority_spec *pri_spec, - void *stream_user_data, - nghttp2_data_source_read_callback read_callback, - void *read_ctx) +static CURLcode proxy_h2_submit( + int32_t *pstream_id, + struct Curl_cfilter *cf, + struct Curl_easy *data, + nghttp2_session *h2, + struct httpreq *req, + const nghttp2_priority_spec *pri_spec, + void *stream_user_data, + nghttp2_data_source_read_callback read_callback, + void *read_ctx) { struct dynhds h2_headers; nghttp2_nv *nva = NULL; diff --git a/lib/cf-ip-happy.c b/lib/cf-ip-happy.c index c587f66d94..072f9b2c44 100644 --- a/lib/cf-ip-happy.c +++ b/lib/cf-ip-happy.c @@ -123,9 +123,8 @@ static void cf_ai_iter_init(struct cf_ai_iter *iter, iter->n = 0; } -static const struct Curl_addrinfo * -cf_ai_iter_next(struct cf_ai_iter *iter, - struct Curl_easy *data) +static const struct Curl_addrinfo *cf_ai_iter_next(struct cf_ai_iter *iter, + struct Curl_easy *data) { const struct Curl_addrinfo *addr; diff --git a/lib/cf-socket.c b/lib/cf-socket.c index 6a1057ea9b..796c39075e 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -100,9 +100,9 @@ static void tcpnodelay(struct Curl_cfilter *cf, defined(TCP_KEEPALIVE) || defined(TCP_KEEPALIVE_THRESHOLD) || \ defined(TCP_KEEPINTVL) || defined(TCP_KEEPALIVE_ABORT_THRESHOLD) #if defined(USE_WINSOCK) || \ - (defined(__sun) && !defined(TCP_KEEPIDLE)) || \ - (defined(__DragonFly__) && __DragonFly_version < 500702) || \ - (defined(_WIN32) && !defined(TCP_KEEPIDLE)) + (defined(__sun) && !defined(TCP_KEEPIDLE)) || \ + (defined(__DragonFly__) && __DragonFly_version < 500702) || \ + (defined(_WIN32) && !defined(TCP_KEEPIDLE)) /* Solaris < 11.4, DragonFlyBSD < 500702 and Windows < 10.0.16299 * use millisecond units. */ #define KEEPALIVE_FACTOR(x) ((x) *= 1000) @@ -638,7 +638,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, * to take a type parameter instead. */ uint8_t dns_queries = (af == AF_INET) ? - CURL_DNSQ_A : (CURL_DNSQ_A|CURL_DNSQ_AAAA); + CURL_DNSQ_A : (CURL_DNSQ_A | CURL_DNSQ_AAAA); #ifdef USE_IPV6 if(af == AF_INET6) dns_queries = CURL_DNSQ_AAAA; diff --git a/lib/config-os400.h b/lib/config-os400.h index 409cbeb643..3d8d59c97e 100644 --- a/lib/config-os400.h +++ b/lib/config-os400.h @@ -30,7 +30,6 @@ #pragma enum(int) - /* ---------------------------------------------------------------- */ /* Global configuration parameters: normally generated by autoconf. */ /* ---------------------------------------------------------------- */ diff --git a/lib/config-win32.h b/lib/config-win32.h index f73e2ab0a1..b1fc102209 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -262,7 +262,7 @@ /* Default define to enable threaded asynchronous DNS lookups. */ #if !defined(USE_SYNC_DNS) && !defined(USE_ARES) && \ - !defined(USE_RESOLV_THREADED) + !defined(USE_RESOLV_THREADED) # define USE_RESOLV_THREADED 1 #endif @@ -275,7 +275,7 @@ /* ---------------------------------------------------------------- */ #ifndef CURL_WINDOWS_UWP -#define HAVE_LDAP_SSL 1 +#define HAVE_LDAP_SSL 1 #define USE_WIN32_LDAP 1 /* Define to use the Windows crypto library. */ diff --git a/lib/cookie.c b/lib/cookie.c index 1516d38f5b..1e21d1bf75 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -423,18 +423,17 @@ static CURLcode storecookie(struct Cookie *co, struct Curl_str *cp, /* this function return errors on OOM etc, not on plain cookie format problems */ -static CURLcode -parse_cookie_header(struct Curl_easy *data, - struct Cookie *co, - struct CookieInfo *ci, - bool *okay, /* if the cookie was fine */ - const char *ptr, - const char *domain, /* default domain */ - const char *path, /* full path used when this cookie is - set, used to get default path for - the cookie unless set */ - bool secure) /* TRUE if connection is over secure - origin */ +static CURLcode parse_cookie_header( + struct Curl_easy *data, + struct Cookie *co, + struct CookieInfo *ci, + bool *okay, /* if the cookie was fine */ + const char *ptr, + const char *domain, /* default domain */ + const char *path, /* full path used when this cookie is + set, used to get default path for + the cookie unless set */ + bool secure) /* TRUE if connection is over secure origin */ { /* This line was read off an HTTP-header */ time_t now = 0; @@ -930,17 +929,16 @@ static bool replace_existing(struct Curl_easy *data, * IPv6 address. * */ -CURLcode -Curl_cookie_add(struct Curl_easy *data, - struct CookieInfo *ci, - bool httpheader, /* TRUE if HTTP header-style line */ - bool noexpire, /* if TRUE, skip remove_expired() */ - const char *lineptr, /* first character of the line */ - const char *domain, /* default domain */ - const char *path, /* full path used when this cookie is set, - used to get default path for the cookie - unless set */ - bool secure) /* TRUE if connection is over secure origin */ +CURLcode Curl_cookie_add( + struct Curl_easy *data, + struct CookieInfo *ci, + bool httpheader, /* TRUE if HTTP header-style line */ + bool noexpire, /* if TRUE, skip remove_expired() */ + const char *lineptr, /* first character of the line */ + const char *domain, /* default domain */ + const char *path, /* full path used when this cookie is set, used + to get default path for the cookie unless set */ + bool secure) /* TRUE if connection is over secure origin */ { struct Cookie comem; struct Cookie *co; diff --git a/lib/cookie.h b/lib/cookie.h index fabd04d398..f66e0ef591 100644 --- a/lib/cookie.h +++ b/lib/cookie.h @@ -125,11 +125,11 @@ void Curl_cookie_clearall(struct CookieInfo *ci); void Curl_cookie_clearsess(struct CookieInfo *ci); #if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_COOKIES) -#define Curl_cookie_list(x) NULL +#define Curl_cookie_list(x) NULL #define Curl_cookie_loadfiles(x) CURLE_OK -#define Curl_cookie_init() NULL -#define Curl_cookie_run(x) Curl_nop_stmt -#define Curl_cookie_cleanup(x) Curl_nop_stmt +#define Curl_cookie_init() NULL +#define Curl_cookie_run(x) Curl_nop_stmt +#define Curl_cookie_cleanup(x) Curl_nop_stmt #define Curl_flush_cookies(x, y) Curl_nop_stmt #else void Curl_flush_cookies(struct Curl_easy *data, bool cleanup); diff --git a/lib/curl_ctype.h b/lib/curl_ctype.h index 65fe71927b..f3291ad818 100644 --- a/lib/curl_ctype.h +++ b/lib/curl_ctype.h @@ -44,9 +44,9 @@ #define ISDIGIT(x) (((x) >= '0') && ((x) <= '9')) #define ISBLANK(x) (((x) == ' ') || ((x) == '\t')) #define ISSPACE(x) (ISBLANK(x) || (((x) >= 0xa) && ((x) <= 0x0d))) -#define ISURLPUNTCS(x) (((x) == '-') || ((x) == '.') || ((x) == '_') || \ - ((x) == '~')) +#define ISURLPUNTCS(x) \ + (((x) == '-') || ((x) == '.') || ((x) == '_') || ((x) == '~')) #define ISUNRESERVED(x) (ISALNUM(x) || ISURLPUNTCS(x)) -#define ISNEWLINE(x) (((x) == '\n') || (x) == '\r') +#define ISNEWLINE(x) (((x) == '\n') || (x) == '\r') #endif /* HEADER_CURL_CTYPE_H */ diff --git a/lib/curl_gssapi.c b/lib/curl_gssapi.c index 1feb0bf88f..650d1908d0 100644 --- a/lib/curl_gssapi.c +++ b/lib/curl_gssapi.c @@ -93,20 +93,20 @@ struct stub_gss_ctx_id_t_desc { char creds[250]; }; -static OM_uint32 -stub_gss_init_sec_context(OM_uint32 *min, - gss_cred_id_t initiator_cred_handle, - struct stub_gss_ctx_id_t_desc **context, - gss_name_t target_name, - const gss_OID mech_type, - OM_uint32 req_flags, - OM_uint32 time_req, - const gss_channel_bindings_t input_chan_bindings, - gss_buffer_desc *input_token, - gss_OID *actual_mech_type, - gss_buffer_desc *output_token, - OM_uint32 *ret_flags, - OM_uint32 *time_rec) +static OM_uint32 stub_gss_init_sec_context( + OM_uint32 *min, + gss_cred_id_t initiator_cred_handle, + struct stub_gss_ctx_id_t_desc **context, + gss_name_t target_name, + const gss_OID mech_type, + OM_uint32 req_flags, + OM_uint32 time_req, + const gss_channel_bindings_t input_chan_bindings, + gss_buffer_desc *input_token, + gss_OID *actual_mech_type, + gss_buffer_desc *output_token, + OM_uint32 *ret_flags, + OM_uint32 *time_rec) { struct stub_gss_ctx_id_t_desc *ctx = NULL; @@ -283,10 +283,10 @@ stub_gss_init_sec_context(OM_uint32 *min, return GSS_S_CONTINUE_NEEDED; } -static OM_uint32 -stub_gss_delete_sec_context(OM_uint32 *min, - struct stub_gss_ctx_id_t_desc **context, - gss_buffer_t output_token) +static OM_uint32 stub_gss_delete_sec_context( + OM_uint32 *min, + struct stub_gss_ctx_id_t_desc **context, + gss_buffer_t output_token) { (void)output_token; diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c index cb538af918..4b2007bbad 100644 --- a/lib/curl_ntlm_core.c +++ b/lib/curl_ntlm_core.c @@ -141,7 +141,7 @@ static void extend_key_56_to_64(const unsigned char *key_56, char *key) key[4] = (char)(((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4)); key[5] = (char)(((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5)); key[6] = (char)(((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6)); - key[7] = (char) ((key_56[6] << 1) & 0xFF); + key[7] = (char)((key_56[6] << 1) & 0xFF); } #ifdef USE_OPENSSL_DES diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 7930167658..5668340dd1 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -365,16 +365,14 @@ #endif /* based on logic in "curl/mprintf.h" */ -#if (defined(__GNUC__) || defined(__clang__) || \ - defined(__IAR_SYSTEMS_ICC__)) && \ - defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ +#if (defined(__GNUC__) || defined(__clang__) || \ + defined(__IAR_SYSTEMS_ICC__)) && \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ !defined(CURL_NO_FMT_CHECKS) #if defined(__MINGW32__) && !defined(__clang__) -#define CURL_PRINTF(fmt, arg) \ - __attribute__((format(gnu_printf, fmt, arg))) +#define CURL_PRINTF(fmt, arg) __attribute__((format(gnu_printf, fmt, arg))) #else -#define CURL_PRINTF(fmt, arg) \ - __attribute__((format(__printf__, fmt, arg))) +#define CURL_PRINTF(fmt, arg) __attribute__((format(__printf__, fmt, arg))) #endif #else #define CURL_PRINTF(fmt, arg) @@ -392,7 +390,7 @@ (defined(__GNUC__) && __GNUC__ <= 14)) && \ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ !defined(__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__) -#define __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ \ +#define __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ \ __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #endif @@ -733,8 +731,7 @@ #endif #if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \ - defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || \ - defined(USE_RUSTLS) + defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || defined(USE_RUSTLS) #define USE_SSL /* SSL support has been enabled */ #endif @@ -750,23 +747,23 @@ #endif /* Single point where USE_SPNEGO definition might be defined */ -#if !defined(CURL_DISABLE_NEGOTIATE_AUTH) && \ - (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)) +#if !defined(CURL_DISABLE_NEGOTIATE_AUTH) && \ + (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)) #define USE_SPNEGO #endif /* Single point where USE_KERBEROS5 definition might be defined */ -#if !defined(CURL_DISABLE_KERBEROS_AUTH) && \ - (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)) +#if !defined(CURL_DISABLE_KERBEROS_AUTH) && \ + (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)) #define USE_KERBEROS5 #endif /* Single point where USE_NTLM definition might be defined */ #ifdef CURL_ENABLE_NTLM -# if (defined(USE_OPENSSL) && defined(HAVE_DES_ECB_ENCRYPT)) || \ - defined(USE_GNUTLS) || \ - (defined(USE_MBEDTLS) && defined(HAVE_MBEDTLS_DES_CRYPT_ECB)) || \ - defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \ +# if (defined(USE_OPENSSL) && defined(HAVE_DES_ECB_ENCRYPT)) || \ + defined(USE_GNUTLS) || \ + (defined(USE_MBEDTLS) && defined(HAVE_MBEDTLS_DES_CRYPT_ECB)) || \ + defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \ (defined(USE_WOLFSSL) && defined(HAVE_WC_DES_ECBENCRYPT)) # define USE_CURL_NTLM_CORE # endif @@ -819,8 +816,8 @@ /* fallthrough attribute */ #ifndef FALLTHROUGH -#if (defined(__GNUC__) && __GNUC__ >= 7) || \ - (defined(__clang__) && __clang_major__ >= 10) +#if (defined(__GNUC__) && __GNUC__ >= 7) || \ + (defined(__clang__) && __clang_major__ >= 10) # define FALLTHROUGH() __attribute__((fallthrough)) #else # define FALLTHROUGH() do {} while(0) @@ -1015,7 +1012,7 @@ struct timeval { * 'bool' stuff compatible with HP-UX headers. */ #if defined(__hpux) && !defined(HAVE_BOOL_T) - typedef int bool; +typedef int bool; # define false 0 # define true 1 # define HAVE_BOOL_T @@ -1028,10 +1025,10 @@ struct timeval { * global namespace though, so use bool_false and bool_true. */ #ifndef HAVE_BOOL_T - typedef enum { - bool_false = 0, - bool_true = 1 - } bool; +typedef enum { + bool_false = 0, + bool_true = 1 +} bool; /* * Use a define to let 'true' and 'false' use those enums. There diff --git a/lib/curl_sha512_256.c b/lib/curl_sha512_256.c index 5777988613..5f5a738b3f 100644 --- a/lib/curl_sha512_256.c +++ b/lib/curl_sha512_256.c @@ -203,7 +203,7 @@ static CURLcode Curl_sha512_256_update(void *ctx, size_t length) { do { - word32 ilen = (word32) CURLMIN(length, UINT_MAX); + word32 ilen = (word32)CURLMIN(length, UINT_MAX); if(wc_Sha512_256Update(ctx, data, ilen)) return CURLE_SSL_CIPHER; length -= ilen; @@ -291,10 +291,7 @@ static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *context) /* ** This implementation of SHA-512/256 hash calculation was originally ** * * ** written by Evgeny Grin (Karlson2k) for GNU libmicrohttpd. ** * * ** The author ported the code to libcurl. The ported code is provided ** * - * ** under curl license. ** * - * ** This is a minimal version with minimal optimizations. Performance ** * - * ** can be significantly improved. Big-endian store and load macros ** * - * ** are obvious targets for optimization. ** */ + * ** under curl license. ** */ #ifdef __GNUC__ # if defined(__has_attribute) && defined(__STDC_VERSION__) diff --git a/lib/curl_threads.c b/lib/curl_threads.c index 5f1d47f3d7..01041f63c3 100644 --- a/lib/curl_threads.c +++ b/lib/curl_threads.c @@ -47,8 +47,8 @@ static void *curl_thread_create_thunk(void *arg) return 0; } -curl_thread_t Curl_thread_create(CURL_THREAD_RETURN_T - (CURL_STDCALL *func) (void *), void *arg) +curl_thread_t Curl_thread_create( + CURL_THREAD_RETURN_T(CURL_STDCALL *func)(void *), void *arg) { curl_thread_t t = curlx_malloc(sizeof(pthread_t)); struct Curl_actual_call *ac = NULL; @@ -97,8 +97,8 @@ int Curl_thread_join(curl_thread_t *hnd) #elif defined(_WIN32) -curl_thread_t Curl_thread_create(CURL_THREAD_RETURN_T - (CURL_STDCALL *func) (void *), void *arg) +curl_thread_t Curl_thread_create( + CURL_THREAD_RETURN_T(CURL_STDCALL *func)(void *), void *arg) { curl_thread_t t = CreateThread(NULL, 0, func, arg, 0, NULL); if(!t) { @@ -163,13 +163,13 @@ CURLcode Curl_cond_timedwait(pthread_cond_t *c, pthread_mutex_t *m, * that will be most likely in the past, as far as POSIX abstime is * concerned. */ #ifdef HAVE_GETTIMEOFDAY - struct timeval tv; - (void)gettimeofday(&tv, NULL); - now.tv_sec = tv.tv_sec; - now.tv_usec = (int)tv.tv_usec; + struct timeval tv; + (void)gettimeofday(&tv, NULL); + now.tv_sec = tv.tv_sec; + now.tv_usec = (int)tv.tv_usec; #else - now.tv_sec = time(NULL); - now.tv_usec = 0; + now.tv_sec = time(NULL); + now.tv_usec = 0; #endif ts.tv_sec = now.tv_sec + (timeout_ms / 1000); diff --git a/lib/curl_threads.h b/lib/curl_threads.h index 5a1609a2c9..081d155695 100644 --- a/lib/curl_threads.h +++ b/lib/curl_threads.h @@ -65,8 +65,8 @@ CURLcode Curl_cond_timedwait(curl_cond_t *c, curl_mutex_t *m, #ifdef USE_THREADS -curl_thread_t Curl_thread_create(CURL_THREAD_RETURN_T - (CURL_STDCALL *func) (void *), void *arg); +curl_thread_t Curl_thread_create( + CURL_THREAD_RETURN_T(CURL_STDCALL *func)(void *), void *arg); void Curl_thread_destroy(curl_thread_t *hnd); diff --git a/lib/dict.c b/lib/dict.c index 433d1553ec..7b83c6cff1 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -64,7 +64,6 @@ #define DICT_DEFINE2 "/D:" #define DICT_DEFINE3 "/LOOKUP:" - #define DYN_DICT_WORD 10000 static char *unescape_word(const char *input) { diff --git a/lib/dnscache.c b/lib/dnscache.c index 9dba448285..2129d283cc 100644 --- a/lib/dnscache.c +++ b/lib/dnscache.c @@ -329,8 +329,6 @@ static int num_addresses(const struct Curl_addrinfo *addr) return i; } -UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data, - struct Curl_addrinfo **addr); /* * Curl_shuffle_addr() shuffles the order of addresses in a 'Curl_addrinfo' * struct by re-linking its linked list. @@ -343,6 +341,8 @@ UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data, * * @unittest: 1608 */ +UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data, + struct Curl_addrinfo **addr); UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data, struct Curl_addrinfo **addr) { @@ -407,15 +407,15 @@ static bool dnscache_ai_has_family(struct Curl_addrinfo *ai, return FALSE; } -static struct Curl_dns_entry * -dnscache_entry_create(struct Curl_easy *data, - uint8_t dns_queries, - struct Curl_addrinfo **paddr1, - struct Curl_addrinfo **paddr2, - const char *hostname, - size_t hostlen, - uint16_t port, - bool permanent) +static struct Curl_dns_entry *dnscache_entry_create( + struct Curl_easy *data, + uint8_t dns_queries, + struct Curl_addrinfo **paddr1, + struct Curl_addrinfo **paddr2, + const char *hostname, + size_t hostlen, + uint16_t port, + bool permanent) { struct Curl_dns_entry *dns = NULL; @@ -488,25 +488,23 @@ out: return dns; } -struct Curl_dns_entry * -Curl_dnscache_mk_entry(struct Curl_easy *data, - uint8_t dns_queries, - struct Curl_addrinfo **paddr, - const char *hostname, - uint16_t port) +struct Curl_dns_entry *Curl_dnscache_mk_entry(struct Curl_easy *data, + uint8_t dns_queries, + struct Curl_addrinfo **paddr, + const char *hostname, + uint16_t port) { return dnscache_entry_create(data, dns_queries, paddr, NULL, hostname, hostname ? strlen(hostname) : 0, port, FALSE); } -struct Curl_dns_entry * -Curl_dnscache_mk_entry2(struct Curl_easy *data, - uint8_t dns_queries, - struct Curl_addrinfo **paddr1, - struct Curl_addrinfo **paddr2, - const char *hostname, - uint16_t port) +struct Curl_dns_entry *Curl_dnscache_mk_entry2(struct Curl_easy *data, + uint8_t dns_queries, + struct Curl_addrinfo **paddr1, + struct Curl_addrinfo **paddr2, + const char *hostname, + uint16_t port) { return dnscache_entry_create(data, dns_queries, paddr1, paddr2, hostname, hostname ? strlen(hostname) : 0, @@ -530,15 +528,14 @@ void Curl_dns_entry_set_https_rr(struct Curl_dns_entry *dns, } #endif /* USE_HTTPSRR */ -static struct Curl_dns_entry * -dnscache_add_addr(struct Curl_easy *data, - struct Curl_dnscache *dnscache, - uint8_t dns_queries, - struct Curl_addrinfo **paddr, - const char *hostname, - size_t hlen, - uint16_t port, - bool permanent) +static struct Curl_dns_entry *dnscache_add_addr(struct Curl_easy *data, + struct Curl_dnscache *dnscache, + uint8_t dns_queries, + struct Curl_addrinfo **paddr, + const char *hostname, + size_t hlen, + uint16_t port, + bool permanent) { char entry_id[MAX_HOSTCACHE_LEN]; size_t entry_len; diff --git a/lib/dnscache.h b/lib/dnscache.h index ba5eedb37d..a9f42356c7 100644 --- a/lib/dnscache.h +++ b/lib/dnscache.h @@ -57,25 +57,23 @@ struct Curl_dns_entry { * Create a `Curl_dns_entry` with a reference count of 1. * Use `Curl_dns_entry_unlink()` to release your hold on it. * - * The call takes ownership of `addr`, even in case of failure, and always + * The call takes ownership of `paddr`, even in case of failure, and always * clears `*paddr`. It makes a copy of `hostname`. * * Returns entry or NULL on OOM. */ -struct Curl_dns_entry * -Curl_dnscache_mk_entry(struct Curl_easy *data, - uint8_t dns_queries, - struct Curl_addrinfo **paddr, - const char *hostname, - uint16_t port); +struct Curl_dns_entry *Curl_dnscache_mk_entry(struct Curl_easy *data, + uint8_t dns_queries, + struct Curl_addrinfo **paddr, + const char *hostname, + uint16_t port); -struct Curl_dns_entry * -Curl_dnscache_mk_entry2(struct Curl_easy *data, - uint8_t dns_queries, - struct Curl_addrinfo **paddr1, - struct Curl_addrinfo **paddr2, - const char *hostname, - uint16_t port); +struct Curl_dns_entry *Curl_dnscache_mk_entry2(struct Curl_easy *data, + uint8_t dns_queries, + struct Curl_addrinfo **paddr1, + struct Curl_addrinfo **paddr2, + const char *hostname, + uint16_t port); #ifdef USE_HTTPSRR void Curl_dns_entry_set_https_rr(struct Curl_dns_entry *dns, @@ -92,7 +90,6 @@ struct Curl_dns_entry *Curl_dns_entry_link(struct Curl_easy *data, void Curl_dns_entry_unlink(struct Curl_easy *data, struct Curl_dns_entry **pdns); - struct Curl_dnscache { struct Curl_hash entries; }; diff --git a/lib/doh.c b/lib/doh.c index d287093d99..f152401862 100644 --- a/lib/doh.c +++ b/lib/doh.c @@ -714,7 +714,7 @@ static DOHcode doh_rdata(const unsigned char *doh, return DOH_OK; } -UNITTEST void de_init(struct dohentry *d); +UNITTEST void de_init(struct dohentry *de); UNITTEST void de_init(struct dohentry *de) { int i; @@ -1117,11 +1117,10 @@ static CURLcode doh_decode_rdata_name(const unsigned char **buf, return CURLE_OK; } +/* @unittest 1658 */ UNITTEST CURLcode doh_resp_decode_httpsrr(struct Curl_easy *data, const unsigned char *cp, size_t len, struct Curl_https_rrinfo **hrr); - -/* @unittest 1658 */ UNITTEST CURLcode doh_resp_decode_httpsrr(struct Curl_easy *data, const unsigned char *cp, size_t len, struct Curl_https_rrinfo **hrr) diff --git a/lib/easy_lock.h b/lib/easy_lock.h index 63c6e93541..b8f916ff65 100644 --- a/lib/easy_lock.h +++ b/lib/easy_lock.h @@ -49,8 +49,8 @@ __has_builtin() function, so override it. */ /* if GCC on i386/x86_64 or if the built-in is present */ -#if (defined(__GNUC__) && !defined(__clang__)) && \ - (defined(__i386__) || defined(__x86_64__)) +#if (defined(__GNUC__) && !defined(__clang__)) && \ + (defined(__i386__) || defined(__x86_64__)) #define HAVE_BUILTIN_IA32_PAUSE #elif defined(__has_builtin) /* Keep this PP check separate from others */ #if __has_builtin(__builtin_ia32_pause) diff --git a/lib/easygetopt.c b/lib/easygetopt.c index 2685adae95..533d7e3670 100644 --- a/lib/easygetopt.c +++ b/lib/easygetopt.c @@ -62,8 +62,8 @@ const struct curl_easyoption *curl_easy_option_by_id(CURLoption id) } /* Iterates over available options */ -const struct curl_easyoption * -curl_easy_option_next(const struct curl_easyoption *prev) +const struct curl_easyoption *curl_easy_option_next( + const struct curl_easyoption *prev) { if(prev && prev->name) { prev++; @@ -88,8 +88,8 @@ const struct curl_easyoption *curl_easy_option_by_id(CURLoption id) return NULL; } -const struct curl_easyoption * -curl_easy_option_next(const struct curl_easyoption *prev) +const struct curl_easyoption *curl_easy_option_next( + const struct curl_easyoption *prev) { (void)prev; return NULL; diff --git a/lib/ftp.c b/lib/ftp.c index 980efc3b2b..318ccab719 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -307,7 +307,7 @@ static CURLcode ftp_parse_url_path(struct Curl_easy *data, ftpc->file = fileName; else ftpc->file = NULL; /* instead of point to a zero byte, - we make it a NULL pointer */ + we make it a NULL pointer */ if(data->state.upload && !ftpc->file && (ftp->transfer == PPTRANSFER_BODY)) { /* We need a filename when uploading. Return error! */ @@ -1686,17 +1686,17 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data, if((data->state.resume_from && !sizechecked) || ((data->state.resume_from > 0) && sizechecked)) { - /* we are about to continue the uploading of a file */ - /* 1. get already existing file's size. We use the SIZE command for this - which may not exist in the server! The SIZE command is not in - RFC959. */ + /* we are about to continue the uploading of a file + 1. get already existing file's size. We use the SIZE command for this + which may not exist in the server! The SIZE command is not in + RFC959. - /* 2. This used to set REST, but since we can do append, we issue no - another ftp command. Skip the source file offset and APPEND the rest on - the file instead */ + 2. This used to set REST, but since we can do append, we issue no + another ftp command. Skip the source file offset and APPEND the rest + on the file instead - /* 3. pass file-size number of bytes in the source file */ - /* 4. lower the infilesize counter */ + 3. pass file-size number of bytes in the source file + 4. lower the infilesize counter */ /* => transfer as usual */ int seekerr = CURL_SEEKFUNC_OK; @@ -2507,7 +2507,6 @@ static bool twodigit(const char *p, int *val) /* * Unittest @1668 */ - UNITTEST bool ftp_213_date(const char *p, int *year, int *month, int *day, int *hour, int *minute, int *second); UNITTEST bool ftp_213_date(const char *p, int *year, int *month, int *day, @@ -3888,12 +3887,12 @@ static CURLcode ftp_nb_type(struct Curl_easy *data, * This is the actual DO function for FTP. Get a file/directory according to * the options previously setup. */ -static -CURLcode ftp_perform(struct Curl_easy *data, - struct ftp_conn *ftpc, - struct FTP *ftp, - bool *connected, /* connect status after PASV / PORT */ - bool *dophase_done) +static CURLcode ftp_perform( + struct Curl_easy *data, + struct ftp_conn *ftpc, + struct FTP *ftp, + bool *connected, /* connect status after PASV / PORT */ + bool *dophase_done) { /* this is FTP and no proxy */ CURLcode result = CURLE_OK; diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c index f53c68aa72..b5d9338c1b 100644 --- a/lib/ftplistparser.c +++ b/lib/ftplistparser.c @@ -325,8 +325,7 @@ static CURLcode ftp_pl_insert_finfo(struct Curl_easy *data, /* filter pattern-corresponding filenames */ Curl_set_in_callback(data, TRUE); - if(compare(data->set.fnmatch_data, wc->pattern, - finfo->filename) == 0) { + if(compare(data->set.fnmatch_data, wc->pattern, finfo->filename) == 0) { /* discard symlink which is containing multiple " -> " */ if((finfo->filetype == CURLFILETYPE_SYMLINK) && finfo->strings.target && (strstr(finfo->strings.target, " -> "))) { diff --git a/lib/hash.c b/lib/hash.c index 67879d8b57..3eae1d26a7 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -359,8 +359,8 @@ void Curl_hash_start_iterate(struct Curl_hash *hash, #endif } -struct Curl_hash_element * -Curl_hash_next_element(struct Curl_hash_iterator *iter) +struct Curl_hash_element *Curl_hash_next_element( + struct Curl_hash_iterator *iter) { struct Curl_hash *h; DEBUGASSERT(iter->init == ITERINIT); diff --git a/lib/hash.h b/lib/hash.h index 267f91d1ae..1d7d3de8ce 100644 --- a/lib/hash.h +++ b/lib/hash.h @@ -97,8 +97,8 @@ size_t curlx_str_key_compare(void *k1, size_t key1_len, void *k2, size_t key2_len); void Curl_hash_start_iterate(struct Curl_hash *hash, struct Curl_hash_iterator *iter); -struct Curl_hash_element * -Curl_hash_next_element(struct Curl_hash_iterator *iter); +struct Curl_hash_element *Curl_hash_next_element( + struct Curl_hash_iterator *iter); void Curl_hash_print(struct Curl_hash *h, void (*func)(void *)); diff --git a/lib/hmac.c b/lib/hmac.c index 6ae934d547..a4d6ebdd8a 100644 --- a/lib/hmac.c +++ b/lib/hmac.c @@ -25,8 +25,8 @@ ***************************************************************************/ #include "curl_setup.h" -#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) || \ - !defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) || \ +#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) || \ + !defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) || \ defined(USE_SSL) #include "curl_hmac.h" @@ -155,7 +155,7 @@ CURLcode Curl_hmacit(const struct HMAC_params *hashparams, /* Update the digest with the given challenge */ do { - unsigned int ilen = (unsigned int) CURLMIN(datalen, UINT_MAX); + unsigned int ilen = (unsigned int)CURLMIN(datalen, UINT_MAX); Curl_HMAC_update(ctxt, data, ilen); datalen -= ilen; data += ilen; diff --git a/lib/hostip.c b/lib/hostip.c index 87896cc5d6..d6052a45f8 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -111,14 +111,6 @@ * CURLRES_* defines based on the config*.h and curl_setup.h defines. */ -/* - * Curl_printable_address() stores a printable version of the 1st address - * given in the 'ai' argument. The result will be stored in the buf that is - * bufsize bytes big. - * - * If the conversion fails, the target buffer is empty. - */ - uint8_t Curl_resolv_dns_queries(struct Curl_easy *data, uint8_t ip_version) { (void)data; @@ -129,7 +121,7 @@ uint8_t Curl_resolv_dns_queries(struct Curl_easy *data, uint8_t ip_version) return CURL_DNSQ_A; default: if(Curl_ipv6works(data)) - return (CURL_DNSQ_A|CURL_DNSQ_AAAA); + return (CURL_DNSQ_A | CURL_DNSQ_AAAA); else return CURL_DNSQ_A; } @@ -139,15 +131,15 @@ uint8_t Curl_resolv_dns_queries(struct Curl_easy *data, uint8_t ip_version) const char *Curl_resolv_query_str(uint8_t dns_queries) { switch(dns_queries) { - case (CURL_DNSQ_A|CURL_DNSQ_AAAA|CURL_DNSQ_HTTPS): + case (CURL_DNSQ_A | CURL_DNSQ_AAAA | CURL_DNSQ_HTTPS): return "A+AAAA+HTTPS"; - case (CURL_DNSQ_A|CURL_DNSQ_AAAA): + case (CURL_DNSQ_A | CURL_DNSQ_AAAA): return "A+AAAA"; - case (CURL_DNSQ_AAAA|CURL_DNSQ_HTTPS): + case (CURL_DNSQ_AAAA | CURL_DNSQ_HTTPS): return "AAAA+HTTPS"; case (CURL_DNSQ_AAAA): return "AAAA"; - case (CURL_DNSQ_A|CURL_DNSQ_HTTPS): + case (CURL_DNSQ_A | CURL_DNSQ_HTTPS): return "A+HTTPS"; case (CURL_DNSQ_A): return "A"; @@ -162,6 +154,13 @@ const char *Curl_resolv_query_str(uint8_t dns_queries) } #endif +/* + * Curl_printable_address() stores a printable version of the 1st address + * given in the 'ai' argument. The result will be stored in the buf that is + * bufsize bytes big. + * + * If the conversion fails, the target buffer is empty. + */ void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf, size_t bufsize) { @@ -360,13 +359,12 @@ CURLcode Curl_resolv_announce_start(struct Curl_easy *data, } #ifdef USE_CURL_ASYNC -static struct Curl_resolv_async * -hostip_async_new(struct Curl_easy *data, - uint8_t dns_queries, - const char *hostname, - uint16_t port, - uint8_t transport, - timediff_t timeout_ms) +static struct Curl_resolv_async *hostip_async_new(struct Curl_easy *data, + uint8_t dns_queries, + const char *hostname, + uint16_t port, + uint8_t transport, + timediff_t timeout_ms) { struct Curl_resolv_async *async; size_t hostlen = strlen(hostname); @@ -442,9 +440,10 @@ static CURLcode hostip_resolv_take_result(struct Curl_easy *data, return result; } -const struct Curl_addrinfo * -Curl_resolv_get_ai(struct Curl_easy *data, uint32_t resolv_id, - int ai_family, unsigned int index) +const struct Curl_addrinfo *Curl_resolv_get_ai(struct Curl_easy *data, + uint32_t resolv_id, + int ai_family, + unsigned int index) { #ifdef CURLRES_ASYNCH struct Curl_resolv_async *async = Curl_async_get(data, resolv_id); @@ -959,7 +958,6 @@ CURLcode Curl_resolv(struct Curl_easy *data, timeout_ms, TRUE, presolv_id, entry); } - #ifdef USE_CURL_ASYNC struct Curl_resolv_async *Curl_async_get(struct Curl_easy *data, diff --git a/lib/hostip.h b/lib/hostip.h index a948fba9e7..fc91a0ca41 100644 --- a/lib/hostip.h +++ b/lib/hostip.h @@ -51,8 +51,8 @@ struct Curl_dns_entry; #define CURL_DNSQ_AAAA (1U << 1) #define CURL_DNSQ_HTTPS (1U << 2) -#define CURL_DNSQ_ALL (CURL_DNSQ_A|CURL_DNSQ_AAAA|CURL_DNSQ_HTTPS) -#define CURL_DNSQ_IP(x) (uint8_t)((x)&(CURL_DNSQ_A|CURL_DNSQ_AAAA)) +#define CURL_DNSQ_ALL (CURL_DNSQ_A | CURL_DNSQ_AAAA | CURL_DNSQ_HTTPS) +#define CURL_DNSQ_IP(x) (uint8_t)((x)&(CURL_DNSQ_A | CURL_DNSQ_AAAA)) #ifdef CURLVERBOSE const char *Curl_resolv_query_str(uint8_t dns_queries); @@ -88,10 +88,10 @@ struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname, uint16_t port); /* * Curl_printable_address() returns a printable version of the 1st address - * given in the 'ip' argument. The result will be stored in the buf that is + * given in the 'ai' argument. The result will be stored in the buf that is * bufsize bytes big. */ -void Curl_printable_address(const struct Curl_addrinfo *ip, +void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf, size_t bufsize); /* Start DNS resolving for the given parameters. Returns @@ -142,25 +142,26 @@ CURLcode Curl_resolv_take_result(struct Curl_easy *data, uint32_t resolv_id, void Curl_resolv_destroy(struct Curl_easy *data, uint32_t resolv_id); -const struct Curl_addrinfo * -Curl_resolv_get_ai(struct Curl_easy *data, uint32_t resolv_id, - int ai_family, unsigned int index); +const struct Curl_addrinfo *Curl_resolv_get_ai(struct Curl_easy *data, + uint32_t resolv_id, + int ai_family, + unsigned int index); #ifdef USE_HTTPSRR -const struct Curl_https_rrinfo * -Curl_resolv_get_https(struct Curl_easy *data, uint32_t resolv_id); +const struct Curl_https_rrinfo *Curl_resolv_get_https(struct Curl_easy *data, + uint32_t resolv_id); bool Curl_resolv_knows_https(struct Curl_easy *data, uint32_t resolv_id); #endif /* USE_HTTPSRR */ -#else /* USE_CURL_ASYNC */ -#define Curl_resolv_shutdown_all(x) Curl_nop_stmt -#define Curl_resolv_destroy_all(x) Curl_nop_stmt +#else /* !USE_CURL_ASYNC */ +#define Curl_resolv_shutdown_all(x) Curl_nop_stmt +#define Curl_resolv_destroy_all(x) Curl_nop_stmt #define Curl_resolv_take_result(x, y, z) CURLE_NOT_BUILT_IN -#define Curl_resolv_get_ai(x,y,z, a) NULL -#define Curl_resolv_get_https(x,y) NULL -#define Curl_resolv_knows_https(x,y) TRUE -#define Curl_resolv_pollset(x,y) CURLE_OK -#define Curl_resolv_destroy(x,y) Curl_nop_stmt -#endif /* USE_CURL_ASYNC, else */ +#define Curl_resolv_get_ai(x, y, z, a) NULL +#define Curl_resolv_get_https(x, y) NULL +#define Curl_resolv_knows_https(x, y) TRUE +#define Curl_resolv_pollset(x, y) CURLE_OK +#define Curl_resolv_destroy(x, y) Curl_nop_stmt +#endif /* USE_CURL_ASYNC */ CURLcode Curl_resolver_error(struct Curl_easy *data, const char *detail); diff --git a/lib/hostip4.c b/lib/hostip4.c index 2eb66ca42a..fb35e3992c 100644 --- a/lib/hostip4.c +++ b/lib/hostip4.c @@ -88,7 +88,7 @@ struct Curl_addrinfo *Curl_sync_getaddrinfo(struct Curl_easy *data, #endif /* CURLRES_IPV4 */ #if defined(CURLRES_IPV4) && !defined(USE_RESOLV_ARES) && \ - !defined(CURLRES_AMIGA) + !defined(CURLRES_AMIGA) /* * Curl_ipv4_resolve_r() - ipv4 thread-safe resolver function. diff --git a/lib/http.c b/lib/http.c index 34cd25722d..d82459e738 100644 --- a/lib/http.c +++ b/lib/http.c @@ -472,53 +472,53 @@ static bool http_should_fail(struct Curl_easy *data, int httpcode) DEBUGASSERT(data->conn); /* - ** If we have not been asked to fail on error, - ** do not fail. - */ + * If we have not been asked to fail on error, + * do not fail. + */ if(!data->set.http_fail_on_error) return FALSE; /* - ** Any code < 400 is never terminal. - */ + * Any code < 400 is never terminal. + */ if(httpcode < 400) return FALSE; /* - ** A 416 response to a resume request is presumably because the file is - ** already completely downloaded and thus not actually a fail. - */ + * A 416 response to a resume request is presumably because the file is + * already completely downloaded and thus not actually a fail. + */ if(data->state.resume_from && data->state.httpreq == HTTPREQ_GET && httpcode == 416) return FALSE; /* - ** Any code >= 400 that is not 401 or 407 is always - ** a terminal error - */ + * Any code >= 400 that is not 401 or 407 is always + * a terminal error + */ if((httpcode != 401) && (httpcode != 407)) return TRUE; /* - ** All we have left to deal with is 401 and 407 - */ + * All we have left to deal with is 401 and 407 + */ DEBUGASSERT((httpcode == 401) || (httpcode == 407)); /* - ** Examine the current authentication state to see if this is an error. The - ** idea is for this function to get called after processing all the headers - ** in a response message. If we have been to asked to authenticate - ** a particular stage, and we have done it, we are OK. If we are already - ** completely authenticated, it is not OK to get another 401 or 407. - ** - ** It is possible for authentication to go stale such that the client needs - ** to reauthenticate. Once that info is available, use it here. - */ + * Examine the current authentication state to see if this is an error. The + * idea is for this function to get called after processing all the headers + * in a response message. If we have been to asked to authenticate + * a particular stage, and we have done it, we are OK. If we are already + * completely authenticated, it is not OK to get another 401 or 407. + * + * It is possible for authentication to go stale such that the client needs + * to reauthenticate. Once that info is available, use it here. + */ /* - ** Either we are not authenticating, or we are supposed to be authenticating - ** something else. This is an error. - */ + * Either we are not authenticating, or we are supposed to be authenticating + * something else. This is an error. + */ if((httpcode == 401) && !data->state.aptr.user) return TRUE; #ifndef CURL_DISABLE_PROXY @@ -766,14 +766,14 @@ static CURLcode output_auth_headers(struct Curl_easy *data, * * @returns CURLcode */ -CURLcode -Curl_http_output_auth(struct Curl_easy *data, - struct connectdata *conn, - const char *request, - Curl_HttpReq httpreq, - const char *path, - bool proxytunnel) /* TRUE if this is the request setting - up the proxy tunnel */ +CURLcode Curl_http_output_auth(struct Curl_easy *data, + struct connectdata *conn, + const char *request, + Curl_HttpReq httpreq, + const char *path, + bool proxytunnel) /* TRUE if this is + the request setting up + the proxy tunnel */ { CURLcode result = CURLE_OK; struct auth *authhost; @@ -1506,7 +1506,7 @@ static CURLcode cr_exp100_read(struct Curl_easy *data, /* We are now waiting for a reply from the server or * a timeout on our side IFF the request has been fully sent. */ DEBUGF(infof(data, "cr_exp100_read, start AWAITING_CONTINUE, " - "timeout %dms", data->set.expect_100_timeout)); + "timeout %dms", data->set.expect_100_timeout)); ctx->state = EXP100_AWAITING_CONTINUE; ctx->start = *Curl_pgrs_now(data); Curl_expire(data, data->set.expect_100_timeout, EXPIRE_100_TIMEOUT); @@ -4024,7 +4024,7 @@ static void http_check_auth_closure(struct Curl_easy *data, #endif } #else -#define http_check_auth_closure(x,y) /* empty */ +#define http_check_auth_closure(x, y) /* empty */ #endif /* @@ -4603,7 +4603,7 @@ CURLcode Curl_http_write_resp_hd(struct Curl_easy *data, result = http_rw_hd(data, hd, hdlen, &tmp, 0, &consumed); if(!result && is_eos) { - result = Curl_client_write(data, (CLIENTWRITE_BODY|CLIENTWRITE_EOS), + result = Curl_client_write(data, (CLIENTWRITE_BODY | CLIENTWRITE_EOS), &tmp, 0); } return result; diff --git a/lib/http.h b/lib/http.h index 85d1c6c560..6e33c00e92 100644 --- a/lib/http.h +++ b/lib/http.h @@ -185,14 +185,14 @@ CURLcode Curl_http_write_resp_hds(struct Curl_easy *data, * * @returns CURLcode */ -CURLcode -Curl_http_output_auth(struct Curl_easy *data, - struct connectdata *conn, - const char *request, - Curl_HttpReq httpreq, - const char *path, - bool proxytunnel); /* TRUE if this is the request setting - up the proxy tunnel */ +CURLcode Curl_http_output_auth(struct Curl_easy *data, + struct connectdata *conn, + const char *request, + Curl_HttpReq httpreq, + const char *path, + bool proxytunnel); /* TRUE if this is + the request setting up + the proxy tunnel */ /* Decode HTTP status code string. */ CURLcode Curl_http_decode_status(int *pstatus, const char *s, size_t len); diff --git a/lib/http2.c b/lib/http2.c index d5f3132252..54044bcb9d 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -1734,8 +1734,8 @@ static CURLcode http2_handle_stream_close(struct Curl_cfilter *cf, break; curlx_dyn_reset(&dbuf); result = curlx_dyn_addf(&dbuf, "%.*s: %.*s\x0d\x0a", - (int)e->namelen, e->name, - (int)e->valuelen, e->value); + (int)e->namelen, e->name, + (int)e->valuelen, e->value); if(result) break; Curl_debug(data, CURLINFO_HEADER_IN, curlx_dyn_ptr(&dbuf), diff --git a/lib/http_aws_sigv4.c b/lib/http_aws_sigv4.c index 6414ca915a..a3d8cfeb2a 100644 --- a/lib/http_aws_sigv4.c +++ b/lib/http_aws_sigv4.c @@ -680,7 +680,8 @@ static int compare_func(const void *a, const void *b) } UNITTEST CURLcode canon_path(const char *q, size_t len, - struct dynbuf *new_path, bool normalize); + struct dynbuf *new_path, + bool do_uri_encode); UNITTEST CURLcode canon_path(const char *q, size_t len, struct dynbuf *new_path, bool do_uri_encode) diff --git a/lib/http_chunks.c b/lib/http_chunks.c index db650b1e1e..aa45c79e38 100644 --- a/lib/http_chunks.c +++ b/lib/http_chunks.c @@ -258,12 +258,12 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data, size_t trlen = curlx_dyn_len(&ch->trailer); if(cw_next) result = Curl_cwriter_write(data, cw_next, - CLIENTWRITE_HEADER| + CLIENTWRITE_HEADER | CLIENTWRITE_TRAILER, tr, trlen); else result = Curl_client_write(data, - CLIENTWRITE_HEADER| + CLIENTWRITE_HEADER | CLIENTWRITE_TRAILER, tr, trlen); if(result) { diff --git a/lib/httpsrr.c b/lib/httpsrr.c index c737d2ffd3..8d02d24542 100644 --- a/lib/httpsrr.c +++ b/lib/httpsrr.c @@ -135,7 +135,7 @@ void Curl_httpsrr_trace(struct Curl_easy *data, } #else -#define httpsrr_report_addr(a,b,c,d) Curl_nop_stmt +#define httpsrr_report_addr(a, b, c, d) Curl_nop_stmt #endif /* CURLVERBOSE */ CURLcode Curl_httpsrr_set(struct Curl_https_rrinfo *hi, @@ -194,8 +194,8 @@ CURLcode Curl_httpsrr_set(struct Curl_https_rrinfo *hi, return result; } -struct Curl_https_rrinfo * -Curl_httpsrr_dup_move(struct Curl_https_rrinfo *rrinfo) +struct Curl_https_rrinfo *Curl_httpsrr_dup_move( + struct Curl_https_rrinfo *rrinfo) { struct Curl_https_rrinfo *dup = curlx_memdup(rrinfo, sizeof(*rrinfo)); if(dup) diff --git a/lib/httpsrr.h b/lib/httpsrr.h index eba69489c5..68f5dad875 100644 --- a/lib/httpsrr.h +++ b/lib/httpsrr.h @@ -62,8 +62,8 @@ struct Curl_https_rrinfo { CURLcode Curl_httpsrr_set(struct Curl_https_rrinfo *hi, uint16_t rrkey, const uint8_t *val, size_t vlen); -struct Curl_https_rrinfo * -Curl_httpsrr_dup_move(struct Curl_https_rrinfo *rrinfo); +struct Curl_https_rrinfo *Curl_httpsrr_dup_move( + struct Curl_https_rrinfo *rrinfo); void Curl_httpsrr_cleanup(struct Curl_https_rrinfo *rrinfo); @@ -87,7 +87,7 @@ CURLcode Curl_httpsrr_from_ares(const ares_dns_record_t *dnsrec, void Curl_httpsrr_trace(struct Curl_easy *data, struct Curl_https_rrinfo *hi); #else -#define Curl_httpsrr_trace(a,b) Curl_nop_stmt +#define Curl_httpsrr_trace(a, b) Curl_nop_stmt #endif #endif /* USE_HTTPSRR */ diff --git a/lib/idn.c b/lib/idn.c index 2905e39162..f2b954e2d0 100644 --- a/lib/idn.c +++ b/lib/idn.c @@ -33,10 +33,10 @@ #include #if defined(_WIN32) && defined(UNICODE) -#define IDN2_LOOKUP(name, host, flags) \ +#define IDN2_LOOKUP(name, host, flags) \ idn2_lookup_u8((const uint8_t *)name, (uint8_t **)host, flags) #else -#define IDN2_LOOKUP(name, host, flags) \ +#define IDN2_LOOKUP(name, host, flags) \ idn2_lookup_ul((const char *)(name), (char **)(host), flags) #endif #endif /* USE_LIBIDN2 */ diff --git a/lib/md4.c b/lib/md4.c index d02675f1c0..0213483ad3 100644 --- a/lib/md4.c +++ b/lib/md4.c @@ -33,7 +33,7 @@ /* OpenSSL 3.0.0 marks the MD4 functions as deprecated */ #define OPENSSL_NO_MD4 #else -/* Cover also OPENSSL_NO_MD4 configured in openssl */ +/* Cover also OPENSSL_NO_MD4 configured in OpenSSL */ #include #endif #endif /* USE_OPENSSL */ diff --git a/lib/md5.c b/lib/md5.c index b4b77e4162..4dd0d7c278 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -548,7 +548,7 @@ CURLcode Curl_md5it(unsigned char *output, result = my_md5_init(&ctx); if(!result) { do { - unsigned int ilen = (unsigned int) CURLMIN(len, UINT_MAX); + unsigned int ilen = (unsigned int)CURLMIN(len, UINT_MAX); my_md5_update(&ctx, input, ilen); input += ilen; len -= ilen; diff --git a/lib/mime.c b/lib/mime.c index 93210d2613..157884a838 100644 --- a/lib/mime.c +++ b/lib/mime.c @@ -1937,7 +1937,7 @@ static CURLcode cr_mime_read(struct Curl_easy *data, case 0: if((ctx->total_len >= 0) && (ctx->read_len < ctx->total_len)) { failf(data, "client mime read EOF fail, " - "only %"FMT_OFF_T"/%"FMT_OFF_T + "only %" FMT_OFF_T "/%" FMT_OFF_T " of needed bytes read", ctx->read_len, ctx->total_len); return CURLE_READ_ERROR; } @@ -1992,7 +1992,7 @@ static CURLcode cr_mime_read(struct Curl_easy *data, } CURL_TRC_READ(data, "cr_mime_read(len=%zu, total=%" FMT_OFF_T - ", read=%"FMT_OFF_T") -> %d, %zu, %d", + ", read=%" FMT_OFF_T ") -> %d, %zu, %d", blen, ctx->total_len, ctx->read_len, result, *pnread, *peos); return result; } diff --git a/lib/mprintf.c b/lib/mprintf.c index 8a6a26c0e9..f2348aae0e 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -39,11 +39,11 @@ const unsigned char Curl_ldigits[] = "0123456789abcdef"; /* Upper-case digits. */ const unsigned char Curl_udigits[] = "0123456789ABCDEF"; -#define OUTCHAR(x) \ - do { \ - if(stream((unsigned char)(x), userp)) \ - return TRUE; \ - (*donep)++; \ +#define OUTCHAR(x) \ + do { \ + if(stream((unsigned char)(x), userp)) \ + return TRUE; \ + (*donep)++; \ } while(0) /* Data type to read from the arglist */ diff --git a/lib/multi.c b/lib/multi.c index 9a45548c75..10be2b56ab 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -74,7 +74,6 @@ #define CURL_MULTI_HANDLE 0x000bab1e - #ifdef DEBUGBUILD /* On a debug build, we want to fail hard on multi handles that * are not NULL, but no longer have the MAGIC touch. This gives diff --git a/lib/progress.c b/lib/progress.c index 230000939d..eecec2757b 100644 --- a/lib/progress.c +++ b/lib/progress.c @@ -361,7 +361,6 @@ void Curl_pgrs_deliver_inc(struct Curl_easy *data, size_t delta) data->progress.deliver += delta; } - void Curl_pgrs_download_inc(struct Curl_easy *data, size_t delta) { if(delta) { diff --git a/lib/protocol.c b/lib/protocol.c index 2a9f08388f..c8d43251cf 100644 --- a/lib/protocol.c +++ b/lib/protocol.c @@ -322,8 +322,7 @@ const struct Curl_scheme Curl_scheme_smb = { const struct Curl_scheme Curl_scheme_smbs = { "smbs", /* scheme */ -#if defined(CURL_ENABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \ - defined(USE_SSL) +#if defined(CURL_ENABLE_SMB) && defined(USE_CURL_NTLM_CORE) && defined(USE_SSL) &Curl_protocol_smb, #else ZERO_NULL, @@ -405,7 +404,7 @@ const struct Curl_scheme Curl_scheme_ws = { const struct Curl_scheme Curl_scheme_wss = { "wss", /* scheme */ #if defined(CURL_DISABLE_WEBSOCKETS) || defined(CURL_DISABLE_HTTP) || \ - !defined(USE_SSL) + !defined(USE_SSL) ZERO_NULL, #else &Curl_protocol_ws, diff --git a/lib/request.h b/lib/request.h index e35f99d2d8..391493a112 100644 --- a/lib/request.h +++ b/lib/request.h @@ -38,16 +38,17 @@ struct UserDefined; /* Low level request receive/send io_flags checks. */ #define CURL_REQ_WANT_SEND(d) ((d)->req.io_flags & REQ_IO_SEND) #define CURL_REQ_WANT_RECV(d) ((d)->req.io_flags & REQ_IO_RECV) -#define CURL_REQ_WANT_IO(d) ((d)->req.io_flags & (REQ_IO_RECV|REQ_IO_SEND)) +#define CURL_REQ_WANT_IO(d) \ + ((d)->req.io_flags & (REQ_IO_RECV | REQ_IO_SEND)) /* Low level request receive/send io_flags manipulations. */ -#define CURL_REQ_SET_SEND(d) ((d)->req.io_flags |= REQ_IO_SEND) -#define CURL_REQ_SET_RECV(d) ((d)->req.io_flags |= REQ_IO_RECV) +#define CURL_REQ_SET_SEND(d) ((d)->req.io_flags |= REQ_IO_SEND) +#define CURL_REQ_SET_RECV(d) ((d)->req.io_flags |= REQ_IO_RECV) #define CURL_REQ_CLEAR_SEND(d) \ ((d)->req.io_flags &= (uint8_t)~REQ_IO_SEND) #define CURL_REQ_CLEAR_RECV(d) \ ((d)->req.io_flags &= (uint8_t)~REQ_IO_RECV) #define CURL_REQ_CLEAR_IO(d) \ - ((d)->req.io_flags &= (uint8_t)~(REQ_IO_RECV|REQ_IO_SEND)) + ((d)->req.io_flags &= (uint8_t)~(REQ_IO_RECV | REQ_IO_SEND)) enum expect100 { EXP100_SEND_DATA, /* enough waiting, send the body now */ diff --git a/lib/rtsp.c b/lib/rtsp.c index c3c050fc69..285126371c 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -234,7 +234,7 @@ static CURLcode rtsp_setup_body(struct Curl_easy *data, /* As stated in the http comments, it is probably not wise to * actually set a custom Content-Length in the headers */ if(!Curl_checkheaders(data, STRCONST("Content-Length"))) { - result = curlx_dyn_addf(reqp, "Content-Length: %" FMT_OFF_T"\r\n", + result = curlx_dyn_addf(reqp, "Content-Length: %" FMT_OFF_T "\r\n", req_clen); if(result) return result; diff --git a/lib/select.c b/lib/select.c index 34461ccaa8..888490f2c9 100644 --- a/lib/select.c +++ b/lib/select.c @@ -274,7 +274,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms) if(ufds[i].fd == CURL_SOCKET_BAD) continue; VERIFY_SOCK(ufds[i].fd); - if(ufds[i].events & (POLLIN |POLLOUT |POLLPRI | + if(ufds[i].events & (POLLIN | POLLOUT | POLLPRI | POLLRDNORM | POLLWRNORM | POLLRDBAND)) { if(ufds[i].fd > maxfd) maxfd = ufds[i].fd; @@ -636,9 +636,9 @@ CURLcode Curl_pollset_set(struct Curl_easy *data, bool do_in, bool do_out) { return Curl_pollset_change(data, ps, sock, - (do_in ? CURL_POLL_IN : 0)| + (do_in ? CURL_POLL_IN : 0) | (do_out ? CURL_POLL_OUT : 0), - (!do_in ? CURL_POLL_IN : 0)| + (!do_in ? CURL_POLL_IN : 0) | (!do_out ? CURL_POLL_OUT : 0)); } diff --git a/lib/select.h b/lib/select.h index ffcd44cfcf..87b695463f 100644 --- a/lib/select.h +++ b/lib/select.h @@ -35,9 +35,7 @@ * Definition of pollfd struct and constants for platforms lacking them. */ -#if !defined(HAVE_SYS_POLL_H) && \ - !defined(HAVE_POLL_H) && \ - !defined(POLLIN) +#if !defined(HAVE_SYS_POLL_H) && !defined(HAVE_POLL_H) && !defined(POLLIN) #define POLLIN 0x01 #define POLLPRI 0x02 diff --git a/lib/sendf.c b/lib/sendf.c index 74e7038a7f..7c977d3b9e 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -372,8 +372,8 @@ static CURLcode do_init_writer_stack(struct Curl_easy *data) The bit pattern defines to what "streams" to write to. Body and/or header. The defines are in sendf.h of course. */ -CURLcode Curl_client_write(struct Curl_easy *data, - int type, const char *buf, size_t len) +CURLcode Curl_client_write(struct Curl_easy *data, int type, const char *buf, + size_t len) { CURLcode result; @@ -675,7 +675,7 @@ static CURLcode cr_in_read(struct Curl_easy *data, case 0: if((ctx->total_len >= 0) && (ctx->read_len < ctx->total_len)) { failf(data, "client read function EOF fail, " - "only %"FMT_OFF_T"/%"FMT_OFF_T " of needed bytes read", + "only %" FMT_OFF_T "/%" FMT_OFF_T " of needed bytes read", ctx->read_len, ctx->total_len); result = CURLE_READ_ERROR; break; @@ -729,8 +729,8 @@ static CURLcode cr_in_read(struct Curl_easy *data, *peos = (bool)ctx->seen_eos; break; } - CURL_TRC_READ(data, "cr_in_read(len=%zu, total=%"FMT_OFF_T - ", read=%"FMT_OFF_T") -> %d, nread=%zu, eos=%d", + CURL_TRC_READ(data, "cr_in_read(len=%zu, total=%" FMT_OFF_T + ", read=%" FMT_OFF_T ") -> %d, nread=%zu, eos=%d", blen, ctx->total_len, ctx->read_len, result, *pnread, *peos); return result; @@ -1138,7 +1138,7 @@ CURLcode Curl_creader_set_fread(struct Curl_easy *data, curl_off_t len) cl_reset_reader(data); result = do_init_reader_stack(data, r); out: - CURL_TRC_READ(data, "add fread reader, len=%"FMT_OFF_T " -> %d", + CURL_TRC_READ(data, "add fread reader, len=%" FMT_OFF_T " -> %d", len, result); return result; } diff --git a/lib/setup-os400.h b/lib/setup-os400.h index 084cd9f62b..b5bd733672 100644 --- a/lib/setup-os400.h +++ b/lib/setup-os400.h @@ -67,22 +67,22 @@ extern int Curl_getnameinfo_a(const struct sockaddr *sa, /* GSSAPI wrappers. */ -extern OM_uint32 Curl_gss_import_name_a(OM_uint32 * minor_status, +extern OM_uint32 Curl_gss_import_name_a(OM_uint32 *minor_status, gss_buffer_t in_name, gss_OID in_name_type, - gss_name_t * out_name); + gss_name_t *out_name); #define gss_import_name Curl_gss_import_name_a -extern OM_uint32 Curl_gss_display_status_a(OM_uint32 * minor_status, +extern OM_uint32 Curl_gss_display_status_a(OM_uint32 *minor_status, OM_uint32 status_value, int status_type, gss_OID mech_type, - gss_msg_ctx_t * message_context, + gss_msg_ctx_t *message_context, gss_buffer_t status_string); #define gss_display_status Curl_gss_display_status_a -extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 * minor_status, +extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 *minor_status, gss_cred_id_t cred_handle, - gss_ctx_id_t * context_handle, + gss_ctx_id_t *context_handle, gss_name_t target_name, gss_OID mech_type, gss_flags_t req_flags, @@ -90,10 +90,10 @@ extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 * minor_status, gss_channel_bindings_t input_chan_bindings, gss_buffer_t input_token, - gss_OID * actual_mech_type, + gss_OID *actual_mech_type, gss_buffer_t output_token, - gss_flags_t * ret_flags, - OM_uint32 * time_rec); + gss_flags_t *ret_flags, + OM_uint32 *time_rec); #define gss_init_sec_context Curl_gss_init_sec_context_a extern OM_uint32 Curl_gss_delete_sec_context_a(OM_uint32 *minor_status, diff --git a/lib/sha256.c b/lib/sha256.c index ba747ec042..d97f45f05f 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -255,7 +255,7 @@ static void my_sha256_final(unsigned char *digest, void *in) (a)[0] = (unsigned char)((((unsigned long)(val)) >> 24) & 0xff); \ (a)[1] = (unsigned char)((((unsigned long)(val)) >> 16) & 0xff); \ (a)[2] = (unsigned char)((((unsigned long)(val)) >> 8) & 0xff); \ - (a)[3] = (unsigned char) (((unsigned long)(val)) & 0xff); \ + (a)[3] = (unsigned char)(((unsigned long)(val)) & 0xff); \ } while(0) #define WPA_PUT_BE64(a, val) \ @@ -486,7 +486,7 @@ CURLcode Curl_sha256it(unsigned char *output, const unsigned char *input, result = my_sha256_init(&ctx); if(!result) { do { - unsigned int ilen = (unsigned int) CURLMIN(len, UINT_MAX); + unsigned int ilen = (unsigned int)CURLMIN(len, UINT_MAX); my_sha256_update(&ctx, input, ilen); len -= ilen; input += ilen; diff --git a/lib/socketpair.h b/lib/socketpair.h index 2aa173396b..0427e72fc5 100644 --- a/lib/socketpair.h +++ b/lib/socketpair.h @@ -37,7 +37,7 @@ int Curl_wakeup_signal(curl_socket_t socks[2]); CURLcode Curl_wakeup_consume(curl_socket_t socks[2], bool all); #else -#define Curl_wakeup_destroy(x) Curl_nop_stmt +#define Curl_wakeup_destroy(x) Curl_nop_stmt #endif #endif /* HEADER_CURL_SOCKETPAIR_H */ diff --git a/lib/socks_gssapi.c b/lib/socks_gssapi.c index 7158487555..32db07044a 100644 --- a/lib/socks_gssapi.c +++ b/lib/socks_gssapi.c @@ -228,7 +228,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, if(gss_major_status != GSS_S_CONTINUE_NEEDED) break; - /* analyse response */ + /* analyze response */ /* GSS-API response looks like * +----+------+-----+----------------+ diff --git a/lib/telnet.c b/lib/telnet.c index df82870900..c5ce9c2c97 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -1266,9 +1266,9 @@ static CURLcode telnet_do(struct Curl_easy *data, bool *done) #ifdef USE_WINSOCK /* We want to wait for both stdin and the socket. Since - ** the select() function in Winsock only works on sockets - ** we have to use the WaitForMultipleObjects() call. - */ + * the select() function in Winsock only works on sockets + * we have to use the WaitForMultipleObjects() call. + */ /* First, create a sockets event object */ event_handle = WSACreateEvent(); diff --git a/lib/uint-spbset.c b/lib/uint-spbset.c index 58dcbdac22..d05b530258 100644 --- a/lib/uint-spbset.c +++ b/lib/uint-spbset.c @@ -30,9 +30,6 @@ #define CURL_UINT32_SPBSET_MAGIC 0x70737362 #endif -/* Clear the bitset, making it empty. */ -UNITTEST void Curl_uint32_spbset_clear(struct uint32_spbset *bset); - void Curl_uint32_spbset_init(struct uint32_spbset *bset) { memset(bset, 0, sizeof(*bset)); @@ -41,6 +38,19 @@ void Curl_uint32_spbset_init(struct uint32_spbset *bset) #endif } +/* Clear the bitset, making it empty. */ +UNITTEST void Curl_uint32_spbset_clear(struct uint32_spbset *bset); +UNITTEST void Curl_uint32_spbset_clear(struct uint32_spbset *bset) +{ + struct uint32_spbset_chunk *next, *chunk; + + for(chunk = bset->head.next; chunk; chunk = next) { + next = chunk->next; + curlx_free(chunk); + } + memset(&bset->head, 0, sizeof(bset->head)); +} + void Curl_uint32_spbset_destroy(struct uint32_spbset *bset) { DEBUGASSERT(bset->init == CURL_UINT32_SPBSET_MAGIC); @@ -61,19 +71,8 @@ uint32_t Curl_uint32_spbset_count(struct uint32_spbset *bset) return n; } -UNITTEST void Curl_uint32_spbset_clear(struct uint32_spbset *bset) -{ - struct uint32_spbset_chunk *next, *chunk; - - for(chunk = bset->head.next; chunk; chunk = next) { - next = chunk->next; - curlx_free(chunk); - } - memset(&bset->head, 0, sizeof(bset->head)); -} - -static struct uint32_spbset_chunk * -uint32_spbset_get_chunk(struct uint32_spbset *bset, uint32_t i, bool grow) +static struct uint32_spbset_chunk *uint32_spbset_get_chunk( + struct uint32_spbset *bset, uint32_t i, bool grow) { struct uint32_spbset_chunk *chunk, **panchor = NULL; uint32_t i_offset = (i & ~CURL_UINT32_SPBSET_CH_MASK); diff --git a/lib/uint-table.c b/lib/uint-table.c index b9c1990130..e3162583dc 100644 --- a/lib/uint-table.c +++ b/lib/uint-table.c @@ -29,9 +29,6 @@ #define CURL_UINT32_TBL_MAGIC 0x62757473 #endif -/* Clear the table, making it empty. */ -UNITTEST void Curl_uint32_tbl_clear(struct uint32_tbl *tbl); - void Curl_uint32_tbl_init(struct uint32_tbl *tbl, Curl_uint32_tbl_entry_dtor *entry_dtor) { @@ -82,14 +79,8 @@ CURLcode Curl_uint32_tbl_resize(struct uint32_tbl *tbl, uint32_t nrows) return CURLE_OK; } -void Curl_uint32_tbl_destroy(struct uint32_tbl *tbl) -{ - DEBUGASSERT(tbl->init == CURL_UINT32_TBL_MAGIC); - Curl_uint32_tbl_clear(tbl); - curlx_free(tbl->rows); - memset(tbl, 0, sizeof(*tbl)); -} - +/* Clear the table, making it empty. */ +UNITTEST void Curl_uint32_tbl_clear(struct uint32_tbl *tbl); UNITTEST void Curl_uint32_tbl_clear(struct uint32_tbl *tbl) { DEBUGASSERT(tbl->init == CURL_UINT32_TBL_MAGIC); @@ -98,6 +89,14 @@ UNITTEST void Curl_uint32_tbl_clear(struct uint32_tbl *tbl) tbl->last_key_added = UINT32_MAX; } +void Curl_uint32_tbl_destroy(struct uint32_tbl *tbl) +{ + DEBUGASSERT(tbl->init == CURL_UINT32_TBL_MAGIC); + Curl_uint32_tbl_clear(tbl); + curlx_free(tbl->rows); + memset(tbl, 0, sizeof(*tbl)); +} + uint32_t Curl_uint32_tbl_capacity(struct uint32_tbl *tbl) { return tbl->nrows; diff --git a/lib/url.c b/lib/url.c index 6be3a61ef9..237d674cc9 100644 --- a/lib/url.c +++ b/lib/url.c @@ -386,7 +386,7 @@ void Curl_init_userdefined(struct Curl_easy *data) #endif set->new_file_perms = 0644; /* Default permissions */ - set->allowed_protocols = (curl_prot_t) CURLPROTO_64ALL; + set->allowed_protocols = (curl_prot_t)CURLPROTO_64ALL; set->redir_protocols = CURLPROTO_REDIR; #if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) diff --git a/lib/url.h b/lib/url.h index 3f3c4bef3c..837dbcd2fa 100644 --- a/lib/url.h +++ b/lib/url.h @@ -85,7 +85,7 @@ CURLcode Curl_conn_upkeep(struct Curl_easy *data, /** * Always eval all arguments, return the first - * result != (CURLE_OK|CURLE_AGAIN) or `r1`. + * result != (CURLE_OK | CURLE_AGAIN) or `r1`. */ CURLcode Curl_1st_fatal(CURLcode r1, CURLcode r2); diff --git a/lib/urlapi-int.h b/lib/urlapi-int.h index dc4323f939..1d29e545de 100644 --- a/lib/urlapi-int.h +++ b/lib/urlapi-int.h @@ -32,7 +32,7 @@ CURLUcode Curl_url_set_authority(CURLU *u, const char *authority); CURLUcode Curl_junkscan(const char *url, size_t *urllen, bool allowspace); -#define U_CURLU_URLDECODE (unsigned int)CURLU_URLDECODE +#define U_CURLU_URLDECODE (unsigned int)CURLU_URLDECODE #define U_CURLU_PATH_AS_IS (unsigned int)CURLU_PATH_AS_IS #endif /* HEADER_CURL_URLAPI_INT_H */ diff --git a/lib/urldata.h b/lib/urldata.h index 5928d1e440..97f29b000c 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -26,7 +26,7 @@ /* This file is for lib internal stuff */ #include "curl_setup.h" -#define CURL_DEFAULT_USER "anonymous" +#define CURL_DEFAULT_USER "anonymous" #define CURL_DEFAULT_PASSWORD "ftp@example.com" #if !defined(_WIN32) && !defined(MSDOS) diff --git a/lib/version.c b/lib/version.c index e5a6f8d80b..b3b0a46abb 100644 --- a/lib/version.c +++ b/lib/version.c @@ -243,11 +243,9 @@ char *curl_version(void) #endif #ifdef HAVE_GSSAPI #ifdef HAVE_GSSGNU - curl_msnprintf(gss_buf, sizeof(gss_buf), "libgss/%s", - GSS_VERSION); + curl_msnprintf(gss_buf, sizeof(gss_buf), "libgss/%s", GSS_VERSION); #elif defined(CURL_KRB5_VERSION) - curl_msnprintf(gss_buf, sizeof(gss_buf), "mit-krb5/%s", - CURL_KRB5_VERSION); + curl_msnprintf(gss_buf, sizeof(gss_buf), "mit-krb5/%s", CURL_KRB5_VERSION); #else curl_msnprintf(gss_buf, sizeof(gss_buf), "mit-krb5"); #endif @@ -432,7 +430,7 @@ static const struct feat features_table[] = { FEATURE("alt-svc", NULL, CURL_VERSION_ALTSVC), #endif #if defined(USE_ARES) && defined(USE_RESOLV_THREADED) && defined(USE_HTTPSRR) - FEATURE("asyn-rr", NULL, 0), + FEATURE("asyn-rr", NULL, 0), #endif #ifdef CURLRES_ASYNCH FEATURE("AsynchDNS", NULL, CURL_VERSION_ASYNCHDNS), diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index 5572b3dd07..44094e466c 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -147,7 +147,7 @@ static int myssh_is_known(struct Curl_easy *data, struct ssh_conn *sshc) rc = ssh_get_publickey_hash(pubkey, SSH_PUBLICKEY_HASH_MD5, &hash, &hlen); if(rc != SSH_OK || hlen != 16) { failf(data, - "Denied establishing ssh session: md5 fingerprint not available"); + "Denied establishing ssh session: MD5 fingerprint not available"); goto cleanup; } @@ -158,7 +158,7 @@ static int myssh_is_known(struct Curl_easy *data, struct ssh_conn *sshc) if(!curl_strequal(md5buffer, pubkey_md5)) { failf(data, - "Denied establishing ssh session: mismatch md5 fingerprint. " + "Denied establishing ssh session: mismatch MD5 fingerprint. " "Remote %s is not equal to %s", md5buffer, pubkey_md5); rc = SSH_ERROR; goto cleanup; diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index 40858d18c0..e4d35bbdcf 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -476,7 +476,7 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data, LIBSSH2_HOSTKEY_HASH_SHA256); if(!fingerprint) { failf(data, - "Denied establishing ssh session: sha256 fingerprint " + "Denied establishing ssh session: SHA256 fingerprint " "not available"); myssh_to(data, sshc, SSH_SESSION_FREE); return CURLE_PEER_FAILED_VERIFICATION; @@ -491,7 +491,7 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data, } if(!fingerprint_b64) { - failf(data, "sha256 fingerprint could not be encoded"); + failf(data, "SHA256 fingerprint could not be encoded"); myssh_to(data, sshc, SSH_SESSION_FREE); return CURLE_PEER_FAILED_VERIFICATION; } @@ -509,13 +509,13 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data, b64_pos++; } - /* Before we authenticate we check the hostkey's sha256 fingerprint + /* Before we authenticate we check the hostkey's SHA256 fingerprint * against a known fingerprint, if available. */ if((pub_pos != b64_pos) || strncmp(fingerprint_b64, pubkey_sha256, pub_pos)) { failf(data, - "Denied establishing ssh session: mismatch sha256 fingerprint. " + "Denied establishing ssh session: mismatch SHA256 fingerprint. " "Remote %s is not equal to %s", fingerprint_b64, pubkey_sha256); curlx_free(fingerprint_b64); myssh_to(data, sshc, SSH_SESSION_FREE); @@ -550,12 +550,12 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data, if(!fingerprint || !curl_strequal(md5buffer, pubkey_md5)) { if(fingerprint) { failf(data, - "Denied establishing ssh session: mismatch md5 fingerprint. " + "Denied establishing ssh session: mismatch MD5 fingerprint. " "Remote %s is not equal to %s", md5buffer, pubkey_md5); } else { failf(data, - "Denied establishing ssh session: md5 fingerprint " + "Denied establishing ssh session: MD5 fingerprint " "not available"); } myssh_to(data, sshc, SSH_SESSION_FREE); diff --git a/lib/vtls/keylog.c b/lib/vtls/keylog.c index 79f972be12..aa37814e06 100644 --- a/lib/vtls/keylog.c +++ b/lib/vtls/keylog.c @@ -35,10 +35,8 @@ static FILE *keylog_file_fp; void Curl_tls_keylog_open(void) { - char *keylog_file_name; - if(!keylog_file_fp) { - keylog_file_name = curl_getenv("SSLKEYLOGFILE"); + char *keylog_file_name = curl_getenv("SSLKEYLOGFILE"); if(keylog_file_name) { keylog_file_fp = curlx_fopen(keylog_file_name, FOPEN_APPENDTEXT); if(keylog_file_fp) { diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 9958e10303..71f792962d 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -2946,7 +2946,7 @@ static CURLcode ossl_windows_load_anchors(struct Curl_cfilter *cf, /* Import certificates from the Windows root certificate store if requested. https://stackoverflow.com/questions/9507184/ - https://github.com/d3x0r/SACK/blob/master/src/netlib/ssl_layer.c#L1037 + https://github.com/d3x0r/SACK/blob/ff15424d3c581b86d40f818532e5a400c516d39d/src/netlib/ssl_layer.c#L1410 https://datatracker.ietf.org/doc/html/rfc5280 */ const char *win_stores[] = { "ROOT", /* Trusted Root Certification Authorities */ diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index 7bfbbcf04c..05bd6a5194 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -175,20 +175,20 @@ static CURLcode schannel_set_ssl_version_min_max(DWORD *enabled_protocols, for(; i <= (ssl_version_max >> 16); ++i) { switch(i) { case CURL_SSLVERSION_TLSv1_0: - (*enabled_protocols) |= SP_PROT_TLS1_0_CLIENT; + *enabled_protocols |= SP_PROT_TLS1_0_CLIENT; break; case CURL_SSLVERSION_TLSv1_1: - (*enabled_protocols) |= SP_PROT_TLS1_1_CLIENT; + *enabled_protocols |= SP_PROT_TLS1_1_CLIENT; break; case CURL_SSLVERSION_TLSv1_2: - (*enabled_protocols) |= SP_PROT_TLS1_2_CLIENT; + *enabled_protocols |= SP_PROT_TLS1_2_CLIENT; break; case CURL_SSLVERSION_TLSv1_3: /* Windows Server 2022 and newer */ if(curlx_verify_windows_version(10, 0, 20348, PLATFORM_WINNT, VERSION_GREATER_THAN_EQUAL)) { - (*enabled_protocols) |= SP_PROT_TLS1_3_CLIENT; + *enabled_protocols |= SP_PROT_TLS1_3_CLIENT; break; } else { /* Windows 10 and older */ @@ -277,7 +277,7 @@ static int get_alg_id_by_name(const char *name) return 0; /* not found */ } -#define NUM_CIPHERS 47 /* There are 47 options listed above */ +#define NUM_CIPHERS 47 /* There are a maximum of 47 options listed above */ static CURLcode set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers, ALG_ID *algIds) diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index 146ea383ab..bed3a13ec8 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -1684,7 +1684,7 @@ struct Curl_cftype Curl_cft_ssl = { struct Curl_cftype Curl_cft_ssl_proxy = { "SSL-PROXY", - CF_TYPE_SSL|CF_TYPE_PROXY, + CF_TYPE_SSL | CF_TYPE_PROXY, CURL_LOG_LVL_NONE, ssl_cf_destroy, ssl_cf_connect, diff --git a/lib/vtls/x509asn1.c b/lib/vtls/x509asn1.c index 316a2f21c1..7b83dd542a 100644 --- a/lib/vtls/x509asn1.c +++ b/lib/vtls/x509asn1.c @@ -403,7 +403,8 @@ static CURLcode utf8asn1str(struct dynbuf *to, int type, const char *from, * * @unittest 1666 */ -UNITTEST CURLcode encodeOID(struct dynbuf *buf, const char *b, const char *e); +UNITTEST CURLcode encodeOID(struct dynbuf *store, + const char *beg, const char *end); UNITTEST CURLcode encodeOID(struct dynbuf *store, const char *beg, const char *end) { diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4 index 5823ce91ac..9d80f2f538 100644 --- a/m4/curl-functions.m4 +++ b/m4/curl-functions.m4 @@ -418,7 +418,7 @@ struct SocketIFace *ISocket = NULL; # else struct Library *SocketBase = NULL; # endif -# define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0) +# define select(a, b, c, d, e) WaitSelect(a, b, c, d, e, 0) #endif /* includes end */" AC_CHECK_HEADERS( diff --git a/scripts/badwords b/scripts/badwords index 3f9cb46d8d..5ed7a3ece1 100755 --- a/scripts/badwords +++ b/scripts/badwords @@ -219,9 +219,8 @@ if(@exact) { } # Build a single combined regex for removing whitelisted content -my $re_wl; my $pat = join('|', map { $_ } @whitelist); -$re_wl = qr/($pat)/; +my $re_wl = qr/($pat)/; my $errors = 0; diff --git a/scripts/delta b/scripts/delta index 7b26092741..02b0232c47 100755 --- a/scripts/delta +++ b/scripts/delta @@ -120,7 +120,7 @@ my $numchanges = 0; my $numbugfixes = 0; my $numcontributors = 0; open(F, ") { if($_ =~ /following changes:/) { $mode=1; @@ -175,7 +175,7 @@ printf "Added files: %d (total %d)\n", printf "Deleted files: %d (delta: %d)\n", $deletes, $creates - $deletes; print "Diffstat:$diffstat" if(!$fileschanged); -printf "Files changed: %d (%.2f%%)\n", $fileschanged, $fileschanged*100/$afiles; +printf "Files changed: %d (%.2f%%)\n", $fileschanged, $fileschanged * 100 / $afiles; printf "Lines inserted: %d\n", $insertions; printf "Lines deleted: %d (delta: %d)\n", $deletions, $insertions - $deletions; diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c index 90cbdcea39..515df19073 100644 --- a/src/tool_cfgable.c +++ b/src/tool_cfgable.c @@ -21,9 +21,10 @@ * SPDX-License-Identifier: curl * ***************************************************************************/ -#include #include "tool_setup.h" +#include + #include "tool_cfgable.h" #include "tool_formparse.h" #include "tool_libinfo.h" diff --git a/src/tool_findfile.c b/src/tool_findfile.c index 2745a2eb3c..146a273773 100644 --- a/src/tool_findfile.c +++ b/src/tool_findfile.c @@ -62,7 +62,7 @@ static const struct finder conf_list[] = { static char *checkhome(const char *home, const char *fname, bool dotscore) { - const char pref[2] = { '.', '_' }; + static const char pref[2] = { '.', '_' }; int i; for(i = 0; i < (dotscore ? 2 : 1); i++) { char *c; diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 68e7a9fe97..30163561ea 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -124,7 +124,7 @@ static const struct LongShort aliases[]= { {"dns-servers", ARG_STRG, ' ', C_DNS_SERVERS}, {"doh-cert-status", ARG_BOOL|ARG_TLS, ' ', C_DOH_CERT_STATUS}, {"doh-insecure", ARG_BOOL|ARG_TLS, ' ', C_DOH_INSECURE}, - {"doh-url" , ARG_STRG, ' ', C_DOH_URL}, + {"doh-url", ARG_STRG, ' ', C_DOH_URL}, {"dump-ca-embed", ARG_NONE|ARG_TLS, ' ', C_DUMP_CA_EMBED}, {"dump-header", ARG_FILE, 'D', C_DUMP_HEADER}, {"ech", ARG_STRG|ARG_TLS, ' ', C_ECH}, @@ -246,7 +246,8 @@ static const struct LongShort aliases[]= { {"proxy-ca-native", ARG_BOOL|ARG_TLS, ' ', C_PROXY_CA_NATIVE}, {"proxy-cacert", ARG_FILE|ARG_TLS, ' ', C_PROXY_CACERT}, {"proxy-capath", ARG_FILE|ARG_TLS, ' ', C_PROXY_CAPATH}, - {"proxy-cert", ARG_FILE|ARG_TLS|ARG_CLEAR, ' ', C_PROXY_CERT}, + {"proxy-cert", ARG_FILE|ARG_TLS|ARG_CLEAR, ' ', + C_PROXY_CERT}, {"proxy-cert-type", ARG_STRG|ARG_TLS, ' ', C_PROXY_CERT_TYPE}, {"proxy-ciphers", ARG_STRG|ARG_TLS, ' ', C_PROXY_CIPHERS}, {"proxy-crlfile", ARG_FILE|ARG_TLS, ' ', C_PROXY_CRLFILE}, diff --git a/src/tool_libinfo.c b/src/tool_libinfo.c index adcc0c4212..5a5382c007 100644 --- a/src/tool_libinfo.c +++ b/src/tool_libinfo.c @@ -132,7 +132,6 @@ size_t feature_count; * the latter is not returned by curl_version_info(), it is built from * the returned features bit mask. */ - CURLcode get_libcurl_info(void) { CURLcode result = CURLE_OK; @@ -197,7 +196,6 @@ CURLcode get_libcurl_info(void) * a given protocol and thus allows comparing pointers rather than strings. * In addition, the returned pointer is not deallocated until the program ends. */ - const char *proto_token(const char *proto) { const char * const *builtin; diff --git a/src/tool_operate.c b/src/tool_operate.c index 11b33eb3ce..1f5eb60512 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -576,8 +576,8 @@ static CURLcode retrycheck(struct OperationConfig *config, /* We have written data to an output file, we truncate file */ fflush(outs->stream); notef("Throwing away %" CURL_FORMAT_CURL_OFF_T " bytes", outs->bytes); - /* truncate file at the position where we started appending */ + /* truncate file at the position where we started appending */ if(toolx_ftruncate(fileno(outs->stream), outs->init)) { /* when truncate fails, we cannot append as then we create something strange, bail out */ diff --git a/src/tool_util.c b/src/tool_util.c index b5838f8564..5a8a3bc4db 100644 --- a/src/tool_util.c +++ b/src/tool_util.c @@ -96,7 +96,7 @@ int toolx_ftruncate_win32(int fd, curl_off_t where) } #elif defined(__DJGPP__) /* - * Only supports 'off_t' (signed 32 bit) as file size. + * Only supports 'off_t' (signed 32-bit) as file size. */ int toolx_ftruncate_djgpp(int fd, curl_off_t where) { diff --git a/tests/libtest/cli_h2_upgrade_extreme.c b/tests/libtest/cli_h2_upgrade_extreme.c index 1b3040ce22..d0aade56f6 100644 --- a/tests/libtest/cli_h2_upgrade_extreme.c +++ b/tests/libtest/cli_h2_upgrade_extreme.c @@ -137,7 +137,7 @@ static CURLcode test_cli_h2_upgrade_extreme(const char *URL) } curl_multi_remove_handle(multi, msg->easy_handle); curl_easy_cleanup(msg->easy_handle); - curl_mfprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T" retiring " + curl_mfprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T " retiring " "(%d now running)\n", xfer_id, running_handles); } } diff --git a/tests/libtest/cli_tls_session_reuse.c b/tests/libtest/cli_tls_session_reuse.c index 82ce28c3fe..031d4cfc2a 100644 --- a/tests/libtest/cli_tls_session_reuse.c +++ b/tests/libtest/cli_tls_session_reuse.c @@ -221,7 +221,7 @@ static CURLcode test_cli_tls_session_reuse(const char *URL) curl_multi_remove_handle(multi, msg->easy_handle); curl_easy_cleanup(msg->easy_handle); --ongoing; - curl_mfprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T" retiring " + curl_mfprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T " retiring " "(%d now running)\n", xfer_id, running_handles); } } diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c index 781f59b241..f35d62eb1e 100644 --- a/tests/libtest/lib1560.c +++ b/tests/libtest/lib1560.c @@ -240,7 +240,7 @@ static const struct testcase get_parts_list[] = { 0, 0, CURLUE_OK}, {"https://curl.se/# ", "https | [11] | [12] | [13] | curl.se | [15] | / | [16] | %20%20", - CURLU_URLENCODE|CURLU_ALLOW_SPACE, 0, CURLUE_OK}, + CURLU_URLENCODE | CURLU_ALLOW_SPACE, 0, CURLUE_OK}, {"", "", 0, 0, CURLUE_MALFORMED_INPUT}, {" ", "", 0, 0, CURLUE_MALFORMED_INPUT}, {"1h://example.net", "", 0, 0, CURLUE_BAD_SCHEME}, @@ -261,7 +261,7 @@ static const struct testcase get_parts_list[] = { CURLU_NON_SUPPORT_SCHEME, 0, CURLUE_OK}, {"https://user@example.net?hello# space ", "https | user | [12] | [13] | example.net | [15] | / | hello | %20space%20", - CURLU_ALLOW_SPACE|CURLU_URLENCODE, 0, CURLUE_OK}, + CURLU_ALLOW_SPACE | CURLU_URLENCODE, 0, CURLUE_OK}, {"https://test%test", "", 0, 0, CURLUE_BAD_HOSTNAME}, {"https://example.com%252f%40@example.net", "https | example.com%2f@ | [12] | [13] | example.net | [15] | / " @@ -387,7 +387,7 @@ static const struct testcase get_parts_list[] = { CURLU_DEFAULT_SCHEME, 0, CURLUE_MALFORMED_INPUT}, /* no space allowed in scheme */ {"htt ps://user:password@example.net/get?this=and-what", "", - CURLU_NON_SUPPORT_SCHEME|CURLU_ALLOW_SPACE, 0, CURLUE_BAD_SCHEME}, + CURLU_NON_SUPPORT_SCHEME | CURLU_ALLOW_SPACE, 0, CURLUE_BAD_SCHEME}, {"https://user:password@example.net/get?this=and what", "https | user | password | [13] | example.net | [15] | /get | " "this=and what | [17]", @@ -472,7 +472,7 @@ static const struct testcase get_parts_list[] = { CURLU_DEFAULT_SCHEME, 0, CURLUE_NO_HOST}, {"boing:80", "https | [11] | [12] | [13] | boing | 80 | / | [16] | [17]", - CURLU_DEFAULT_SCHEME|CURLU_GUESS_SCHEME, 0, CURLUE_OK}, + CURLU_DEFAULT_SCHEME | CURLU_GUESS_SCHEME, 0, CURLUE_OK}, {"http://[fd00:a41::50]:8080", "http | [11] | [12] | [13] | [fd00:a41::50] | 8080 | / | [16] | [17]", CURLU_DEFAULT_SCHEME, 0, CURLUE_OK}, @@ -1433,11 +1433,11 @@ static const struct redircase set_url_list[] = { {"http://example.com/please/../gimme/%TESTNUMBER?foobar#hello", "http://example.net/there/it/is/../../tes t case=/%TESTNUMBER0002? yes no", "http://example.net/there/tes%20t%20case=/%TESTNUMBER0002?+yes+no", - 0, CURLU_URLENCODE|CURLU_ALLOW_SPACE, CURLUE_OK}, + 0, CURLU_URLENCODE | CURLU_ALLOW_SPACE, CURLUE_OK}, {"http://local.test?redirect=http://local.test:80?-321", "http://local.test:80?-123", "http://local.test:80/?-123", - 0, CURLU_URLENCODE|CURLU_ALLOW_SPACE, CURLUE_OK}, + 0, CURLU_URLENCODE | CURLU_ALLOW_SPACE, CURLUE_OK}, {"http://local.test?redirect=http://local.test:80?-321", "http://local.test:80?-123", "http://local.test:80/?-123", diff --git a/tests/libtest/lib1965.c b/tests/libtest/lib1965.c index fd4207cca2..e09ff349b3 100644 --- a/tests/libtest/lib1965.c +++ b/tests/libtest/lib1965.c @@ -27,7 +27,7 @@ static CURLcode test_lib1965(const char *URL) { CURLcode result = CURLE_OK; CURLUcode rc; - const char *schemes[] = { + static const char *schemes[] = { "bad!", "bad{", "bad/", "bad\\", "a!", "a+123", "http-2", "http.1", "a+-.123", "http-+++2", "http.1--", @@ -35,9 +35,9 @@ static CURLcode test_lib1965(const char *URL) "ABC2", "2CBA", "", "a", "aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd", "aaaaaaaaaabbbbbbbbbbccccccccccdddddddddde", - NULL}; + NULL }; int i; - (void) URL; + (void)URL; global_init(CURL_GLOBAL_ALL); diff --git a/tests/libtest/lib3102.c b/tests/libtest/lib3102.c index 1b894bd971..765488f36e 100644 --- a/tests/libtest/lib3102.c +++ b/tests/libtest/lib3102.c @@ -34,7 +34,7 @@ static bool is_chain_in_order(struct curl_certinfo *cert_info) /* Chains with only a single certificate are always in order */ if(cert_info->num_of_certs <= 1) - return 1; + return true; /* Enumerate each certificate in the chain */ for(cert = 0; cert < cert_info->num_of_certs; cert++) { diff --git a/tests/libtest/lib517.c b/tests/libtest/lib517.c index b6c3d3a468..ba22a9bab5 100644 --- a/tests/libtest/lib517.c +++ b/tests/libtest/lib517.c @@ -163,26 +163,26 @@ static CURLcode test_lib517(const char *URL) #if SIZEOF_TIME_T > 4 { "2094 Nov 6 08:49:37", 3939871777 }, #endif - { "01 Jan 2001 8:0:0", 978336000}, - { "01 Jan 2001 8:00:0", 978336000}, + { "01 Jan 2001 8:0:0", 978336000 }, + { "01 Jan 2001 8:00:0", 978336000 }, /* Out-of-range day-of-month Cases */ - { "29 Feb 2023 12:00:00 GMT", 1677672000}, - { "31 Apr 2024 12:00:00 GMT", 1714564800}, - { "30 Feb 2024 12:00:00 GMT", 1709294400}, - { "01-13-2024", -1}, - { "32 Jan 2024", -1}, - { "31 Jan 2024", 1706659200}, - { "32 Feb 2024", -1}, - { "32 Mar 2024", -1}, - { "32 Apr 2024", -1}, - { "32 May 2024", -1}, - { "32 Jun 2024", -1}, - { "32 Jul 2024", -1}, - { "32 Aug 2024", -1}, - { "32 Sep 2024", -1}, - { "32 Oct 2024", -1}, - { "32 Nov 2024", -1}, - { "32 Dec 2024", -1}, + { "29 Feb 2023 12:00:00 GMT", 1677672000 }, + { "31 Apr 2024 12:00:00 GMT", 1714564800 }, + { "30 Feb 2024 12:00:00 GMT", 1709294400 }, + { "01-13-2024", -1 }, + { "32 Jan 2024", -1 }, + { "31 Jan 2024", 1706659200 }, + { "32 Feb 2024", -1 }, + { "32 Mar 2024", -1 }, + { "32 Apr 2024", -1 }, + { "32 May 2024", -1 }, + { "32 Jun 2024", -1 }, + { "32 Jul 2024", -1 }, + { "32 Aug 2024", -1 }, + { "32 Sep 2024", -1 }, + { "32 Oct 2024", -1 }, + { "32 Nov 2024", -1 }, + { "32 Dec 2024", -1 }, /* Timezone Offsets */ { "Sun, 06 Nov 1994 08:49:37 +0530", 784091977 }, { "Sun, 06 Nov 1994 08:49:37 +0545", 784091077 }, @@ -221,18 +221,18 @@ static CURLcode test_lib517(const char *URL) /* Y2K38 & Historical Boundaries */ #if SIZEOF_TIME_T > 4 /* for 32 bit time_t, we bail on >year 2037 */ - { "19 Jan 2038 03:14:07 GMT", 2147483647}, - { "19 Jan 2038 03:14:08 GMT", 2147483648}, - { "01 Jan 69 00:00:00 GMT", 3124224000}, + { "19 Jan 2038 03:14:07 GMT", 2147483647 }, + { "19 Jan 2038 03:14:08 GMT", 2147483648 }, + { "01 Jan 69 00:00:00 GMT", 3124224000 }, #endif - { "01 Jan 1500 00:00:00 GMT", -1}, + { "01 Jan 1500 00:00:00 GMT", -1 }, /* Formatting & Malformed Junk */ - { "Sun, 06-Nov/1994 08:49:37", 784111777}, - { "Sun, 06 Nov 1994 08:49:37 GMT", 784111777}, - { " Sun, 06 Nov 1994 08:49:37 GMT ", 784111777}, - { "Date: Sun, 06 Nov 1994 08:49:37 GMT", -1}, + { "Sun, 06-Nov/1994 08:49:37", 784111777 }, + { "Sun, 06 Nov 1994 08:49:37 GMT", 784111777 }, + { " Sun, 06 Nov 1994 08:49:37 GMT ", 784111777 }, + { "Date: Sun, 06 Nov 1994 08:49:37 GMT", -1 }, /* wrong day name is ignored */ - { "Monday, 06 Nov 1994 08:49:37 GMT", 784111777}, + { "Monday, 06 Nov 1994 08:49:37 GMT", 784111777 }, { NULL, 0 } }; diff --git a/tests/libtest/mk-lib1521.pl b/tests/libtest/mk-lib1521.pl index a6a816820b..f3d0c088e8 100755 --- a/tests/libtest/mk-lib1521.pl +++ b/tests/libtest/mk-lib1521.pl @@ -375,7 +375,7 @@ static CURLcode test_lib1521(const char *URL) curl_socket_t sockfd; const struct curl_certinfo *certinfo; struct curl_tlssessioninfo *tlssession; - struct curl_blob blob = { CURL_UNCONST("silly"), 5, 0}; + struct curl_blob blob = { CURL_UNCONST("silly"), 5, 0 }; CURLcode result = CURLE_OK; (void)URL; global_init(CURL_GLOBAL_ALL); @@ -455,7 +455,7 @@ while() { "${w3} curl_easy_setopt(curl, $name,"; my $ignoreset = "${w3}/* set string again to check for leaks */\n". "${w3}(void)curl_easy_setopt(curl, $name,"; - my $i = ' ' x (length($w) + 25); + my $i = ' ' x (length($w) + 21); my $fcheck = <) { $curl_protocols = $_ if(/$what:/i); } diff --git a/tests/libtest/test1022.pl b/tests/libtest/test1022.pl index 31fb98f1a4..c25ae3ce6c 100755 --- a/tests/libtest/test1022.pl +++ b/tests/libtest/test1022.pl @@ -34,7 +34,7 @@ if($#ARGV != 2) { my $what=$ARGV[2]; # Read the output of curl --version -open(CURL, "$ARGV[1]") || die "Cannot open curl --version list in $ARGV[1]\n"; +open(CURL, $ARGV[1]) || die "Cannot open curl --version list in $ARGV[1]\n"; $_ = ; chomp; /libcurl\/([\.\d]+((-DEV)|(-rc\d)|(-\d+))?)/; diff --git a/tests/pathhelp.pm b/tests/pathhelp.pm index 9836202082..e481255a3a 100644 --- a/tests/pathhelp.pm +++ b/tests/pathhelp.pm @@ -173,8 +173,8 @@ sub exe_ext { if($ENV{'CURL_TEST_EXE_EXT'}) { return $ENV{'CURL_TEST_EXE_EXT'}; } - if($ENV{'CURL_TEST_EXE_EXT_'.$component}) { - return $ENV{'CURL_TEST_EXE_EXT_'.$component}; + if($ENV{'CURL_TEST_EXE_EXT_' . $component}) { + return $ENV{'CURL_TEST_EXE_EXT_' . $component}; } if($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys' || $^O eq 'dos' || $^O eq 'os2') { diff --git a/tests/runner.pm b/tests/runner.pm index 2ecaba8ef4..c9aab65348 100644 --- a/tests/runner.pm +++ b/tests/runner.pm @@ -114,9 +114,9 @@ use memanalyzer; ####################################################################### # Global variables set elsewhere but used only by this package # These may only be set *before* runner_init is called -our $DBGCURL=$CURL; #"../src/.libs/curl"; # alternative for debugging -our $valgrind_logfile="--log-file"; # the option name for valgrind >=3 -our $valgrind_tool="--tool=memcheck"; +our $DBGCURL = $CURL; #"../src/.libs/curl"; # alternative for debugging +our $valgrind_logfile = "--log-file"; # the option name for valgrind >=3 +our $valgrind_tool = "--tool=memcheck"; our $gdb = checktestcmd("gdb"); our $gdbthis = 0; # run test case with debugger (gdb or lldb) our $gdbxwin; # use windowed gdb when using gdb @@ -142,12 +142,12 @@ my %controllerw; # pipe that controller writes to # redirected stdout/stderr to these files sub stdoutfilename { - my ($logdir, $testnum)=@_; + my ($logdir, $testnum) = @_; return "$logdir/stdout$testnum"; } sub stderrfilename { - my ($logdir, $testnum)=@_; + my ($logdir, $testnum) = @_; return "$logdir/stderr$testnum"; } @@ -157,19 +157,19 @@ sub stderrfilename { # runnerac_* functions # Called by controller sub runner_init { - my ($logdir, $jobs)=@_; + my ($logdir, $jobs) = @_; $multiprocess = !!$jobs; # enable memory debugging if curl is compiled with it $ENV{'CURL_MEMDEBUG'} = "$logdir/$MEMDUMP"; delete $ENV{'CURL_ENTROPY'} if($ENV{'CURL_ENTROPY'}); - $ENV{'CURL_FORCETIME'}=1; # for debug NTLM magic - $ENV{'CURL_GLOBAL_INIT'}=1; # debug curl_global_init/cleanup use - $ENV{'HOME'}=$pwd; - $ENV{'CURL_HOME'}=$ENV{'HOME'}; - $ENV{'XDG_CONFIG_HOME'}=$ENV{'HOME'}; - $ENV{'COLUMNS'}=79; # screen width! + $ENV{'CURL_FORCETIME'} = 1; # for debug NTLM magic + $ENV{'CURL_GLOBAL_INIT'} = 1; # debug curl_global_init/cleanup use + $ENV{'HOME'} = $pwd; + $ENV{'CURL_HOME'} = $ENV{'HOME'}; + $ENV{'XDG_CONFIG_HOME'} = $ENV{'HOME'}; + $ENV{'COLUMNS'} = 79; # screen width! # Incorporate the $logdir into the random seed and re-seed the PRNG. # This gives each runner a unique yet consistent seed which provides @@ -262,8 +262,8 @@ sub event_loop { # Check for a command in the PATH of the machine running curl. # sub checktestcmd { - my ($cmd)=@_; - my @testpaths=($LIBDIR . ".libs", $LIBDIR); + my ($cmd) = @_; + my @testpaths = ($LIBDIR . ".libs", $LIBDIR); return checkcmd($cmd, @testpaths); } @@ -452,7 +452,7 @@ sub torture { logmsg " CMD: $testcmd\n" if($verbose); # memanalyze -v is our friend, get the number of allocations made - my $count=0; + my $count = 0; my @out = memanalyze("$LOGDIR/$MEMDUMP", 1, 0, 0); for(@out) { if(/^Operations: (\d+)/) { @@ -498,7 +498,7 @@ sub torture { } if($verbose) { - my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = + my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time()); my $now = sprintf("%02d:%02d:%02d ", $hour, $min, $sec); logmsg "Fail function no: $limit at $now\r"; @@ -550,16 +550,16 @@ sub torture { # and does not core dump if(($ret & 255) || ($ret >> 8) >= 128) { logmsg " system() returned $ret\n"; - $fail=1; + $fail = 1; } else { my @memdata = memanalyze("$LOGDIR/$MEMDUMP", 0, 0, 0); - my $leak=0; + my $leak = 0; for(@memdata) { if($_ ne "") { # well it could be other memory problems as well, but # we call it leak for short here - $leak=1; + $leak = 1; } } if($leak) { @@ -753,9 +753,9 @@ sub singletest_prepare { # create (possibly-empty) files before starting the test for my $partsuffix (('', '1', '2', '3', '4')) { - my @inputfile=getpart("client", "file".$partsuffix); + my @inputfile = getpart("client", "file".$partsuffix); my %fileattr = getpartattr("client", "file".$partsuffix); - my $filename=$fileattr{'name'}; + my $filename = $fileattr{'name'}; if(@inputfile || $filename) { if(!$filename) { logmsg " $testnum: IGNORED: Section client=>file has no name attribute\n"; @@ -812,25 +812,25 @@ sub singletest_run { } else { # there was no command given, use something silly - $cmd="-"; + $cmd = "-"; } - my $CURLOUT="$LOGDIR/curl$testnum.out"; # curl output if not stdout + my $CURLOUT = "$LOGDIR/curl$testnum.out"; # curl output if not stdout # if stdout section exists, we verify that the stdout contained this: - my $out=""; + my $out = ""; my %cmdhash = getpartattr("client", "command"); if((!$cmdhash{'option'}) || ($cmdhash{'option'} !~ /no-output/)) { #We may slap on --output! if(!partexists("verify", "stdout") || ($cmdhash{'option'} && $cmdhash{'option'} =~ /force-output/)) { - $out=" --output $CURLOUT "; + $out = " --output $CURLOUT "; } } my @codepieces = getpart("client", "tool"); - my $tool=""; - my $tool_name=""; # without exe extension + my $tool = ""; + my $tool_name = ""; # without exe extension if(@codepieces) { $tool_name = $codepieces[0]; chomp $tool_name; @@ -839,27 +839,27 @@ sub singletest_run { my $oldmemdebug; my $disablevalgrind; - my $CMDLINE=""; + my $CMDLINE = ""; my $cmdargs; my $cmdtype = $cmdhash{'type'} || "default"; my $fail_due_event_based = $run_event_based; if($cmdtype eq "perl") { # run the command line prepended with "perl" - $cmdargs =$cmd; + $cmdargs = $cmd; $CMDLINE = "$perl "; - $tool=$CMDLINE; - $disablevalgrind=1; + $tool = $CMDLINE; + $disablevalgrind = 1; } elsif($cmdtype eq "shell") { # run the command line prepended with "/bin/sh" - $cmdargs =$cmd; + $cmdargs = $cmd; $CMDLINE = "/bin/sh "; - $tool=$CMDLINE; - $disablevalgrind=1; + $tool = $CMDLINE; + $disablevalgrind = 1; } elsif(!$tool && !$keywords{"unittest"}) { # run curl, add suitable command line options - my $inc=""; + my $inc = ""; if((!$cmdhash{'option'}) || ($cmdhash{'option'} !~ /no-include/)) { $inc = " --include"; } @@ -899,21 +899,21 @@ sub singletest_run { # Default the tool to a unit test with the same name as the test spec if($keywords{"unittest"} && !$tool) { - $tool_name="unit$testnum"; + $tool_name = "unit$testnum"; $tool = $tool_name . exe_ext('TOOL'); } if($tool =~ /^lib/) { $tool = "libtests" . exe_ext('TOOL'); - $CMDLINE=$LIBDIR . $tool; + $CMDLINE = $LIBDIR . $tool; } elsif($tool =~ /^tool/) { $tool = "tunits" . exe_ext('TOOL'); - $CMDLINE=$TUNITDIR . $tool; + $CMDLINE = $TUNITDIR . $tool; } elsif($tool =~ /^unit/) { $tool = "units" . exe_ext('TOOL'); - $CMDLINE=$UNITDIR . $tool; + $CMDLINE = $UNITDIR . $tool; } if(! -f $CMDLINE) { @@ -921,16 +921,16 @@ sub singletest_run { return (-1, 0, 0, "", "", 0); } - $CMDLINE=exerunner() . $CMDLINE; + $CMDLINE = exerunner() . $CMDLINE; if($gdbthis) { - $cmdargs =" $tool_name$cmdargs"; + $cmdargs = " $tool_name$cmdargs"; } else { - $CMDLINE.=" $tool_name"; + $CMDLINE .= " $tool_name"; } - $DBGCURL=$CMDLINE; + $DBGCURL = $CMDLINE; } if($fail_due_event_based) { @@ -942,13 +942,13 @@ sub singletest_run { # gdb is incompatible with valgrind, so disable it when debugging # Perhaps a better approach would be to run it under valgrind anyway # with --db-attach=yes or --vgdb=yes. - $disablevalgrind=1; + $disablevalgrind = 1; } my @stdintest = getpart("client", "stdin"); if(@stdintest) { - my $stdinfile="$LOGDIR/stdin-for-$testnum"; + my $stdinfile = "$LOGDIR/stdin-for-$testnum"; my %hash = getpartattr("client", "stdin"); if($hash{'nonewline'}) { @@ -966,7 +966,7 @@ sub singletest_run { } if(!$tool) { - $CMDLINE=exerunner() . shell_quote($CURL); + $CMDLINE = exerunner() . shell_quote($CURL); if((!$cmdhash{'option'}) || ($cmdhash{'option'} !~ /no-q/)) { $CMDLINE .= " -q"; } @@ -1038,13 +1038,13 @@ sub singletest_run { # gdb my $GDBW = ($gdbxwin) ? "-w" : ""; runclient("$gdb --directory $LIBDIR " . shell_quote($DBGCURL) . " $GDBW -x $LOGDIR/gdbcmd"); - $cmdres=0; # makes it always continue after a debugged run + $cmdres = 0; # makes it always continue after a debugged run } elsif($gdbthis == 2) { # $gdb is "lldb" print "runs lldb -- $CURL $cmdargs\n"; runclient("lldb -- $CURL $cmdargs"); - $cmdres=0; # makes it always continue after a debugged run + $cmdres = 0; # makes it always continue after a debugged run } else { # Convert the raw result code into a more useful one @@ -1065,7 +1065,7 @@ sub singletest_run { ####################################################################### # Clean up after test command sub singletest_clean { - my ($testnum, $dumped_core, $testtimings)=@_; + my ($testnum, $dumped_core, $testtimings) = @_; if(!$dumped_core) { if(-r "core") { @@ -1138,15 +1138,15 @@ sub singletest_clean { ####################################################################### # Verify that the postcheck succeeded sub singletest_postcheck { - my ($testnum)=@_; + my ($testnum) = @_; # run the postcheck command - my @postcheck= getpart("client", "postcheck"); + my @postcheck = getpart("client", "postcheck"); if(@postcheck) { die "test$testnum uses client/postcheck"; } - @postcheck= getpart("verify", "postcheck"); + @postcheck = getpart("verify", "postcheck"); if(@postcheck) { my $cmd = join("", @postcheck); chomp $cmd; @@ -1173,7 +1173,7 @@ sub singletest_postcheck { ################################################################### # Get ready to run a single test case sub runner_test_preprocess { - my ($testnum)=@_; + my ($testnum) = @_; my %testtimings; if(clearlogs()) { @@ -1233,7 +1233,7 @@ sub runner_test_preprocess { # 1=unskippable test failure, as first integer, plus any log messages, # plus more return values when error is 0 sub runner_test_run { - my ($testnum)=@_; + my ($testnum) = @_; if(clearlogs()) { logmsg "Warning: log messages were lost\n"; @@ -1285,7 +1285,7 @@ sub runner_test_run { # received. # Called by controller sub runnerac_shutdown { - my ($runnerid)=$_[0]; + my ($runnerid) = $_[0]; my $err = controlleripccall(\&runner_shutdown, @_); # These have no more use @@ -1362,7 +1362,7 @@ sub runnerar { } # system call was interrupted, probably by ^C; restart it so we stay in sync } - my $len=unpack("L", $datalen); + my $len = unpack("L", $datalen); my $buf; while(! defined ($err = sysread($controllerr{$runnerid}, $buf, $len)) || $err <= 0) { if((!defined $err && ! $!{EINTR}) || (defined $err && $err == 0)) { @@ -1391,7 +1391,7 @@ sub runnerar_ready { my ($blocking) = @_; my $r_in = ""; my %idbyfileno; - my $maxfileno=0; + my $maxfileno = 0; my @ready_runners = (); foreach my $p (keys(%controllerr)) { my $fd = fileno($controllerr{$p}); @@ -1408,7 +1408,7 @@ sub runnerar_ready { # caller will need to later call this function again. # TODO: this is relatively slow with hundreds of fds my $e_in = $r_in; - if(select(my $r_out=$r_in, undef, my $e_out=$e_in, $blocking) >= 1) { + if(select(my $r_out = $r_in, undef, my $e_out = $e_in, $blocking) >= 1) { for my $fd (0..$maxfileno) { # Return an error condition first in case it is both if(vec($e_out, $fd, 1)) { @@ -1451,7 +1451,7 @@ sub ipcrecv { } # system call was interrupted, probably by ^C; restart it so we stay in sync } - my $len=unpack("L", $datalen); + my $len = unpack("L", $datalen); my $buf; while(! defined ($err = sysread($runnerr, $buf, $len)) || $err <= 0) { if((!defined $err && ! $!{EINTR}) || (defined $err && $err == 0)) { diff --git a/tests/servers.pm b/tests/servers.pm index fca0597ec6..dba3c3e1d1 100644 --- a/tests/servers.pm +++ b/tests/servers.pm @@ -1899,7 +1899,7 @@ sub runsshserver { !close($hostfile) || ($SSHSRVMD5 !~ /^[a-f0-9]{32}$/i)) { - my $msg = "Fatal: $srvrname pubkey md5 missing : \"$hstpubmd5f\" : $!"; + my $msg = "Fatal: $srvrname pubkey MD5 missing : \"$hstpubmd5f\" : $!"; logmsg "$msg\n"; stopservers($verb); die $msg; @@ -1909,7 +1909,7 @@ sub runsshserver { (read($hostfile, $SSHSRVSHA256, 48) == 0) || !close($hostfile)) { - my $msg = "Fatal: $srvrname pubkey sha256 missing : \"$hstpubsha256f\" : $!"; + my $msg = "Fatal: $srvrname pubkey SHA256 missing : \"$hstpubsha256f\" : $!"; logmsg "$msg\n"; stopservers($verb); die $msg; diff --git a/tests/sshserver.pl b/tests/sshserver.pl index e425f92ff0..f74ff0bd2d 100755 --- a/tests/sshserver.pl +++ b/tests/sshserver.pl @@ -446,21 +446,21 @@ if((! -e pp($hstprvkeyf)) || (! -s pp($hstprvkeyf)) || my @rsahostkey = do { local $/ = ' '; <$rsakeyfile> }; close($rsakeyfile); if(!$rsahostkey[1]) { - logmsg "Failed parsing base64 encoded RSA host key\n"; + logmsg "Failed parsing base64 encoded SSH host key\n"; exit 1; } open(my $pubmd5file, ">", pp($hstpubmd5f)); print $pubmd5file md5_hex(decode_base64($rsahostkey[1])); close($pubmd5file); if((! -e pp($hstpubmd5f)) || (! -s pp($hstpubmd5f))) { - logmsg "Failed writing md5 hash of RSA host key\n"; + logmsg "Failed writing MD5 hash of SSH host key\n"; exit 1; } open(my $pubsha256file, ">", pp($hstpubsha256f)); print $pubsha256file sha256_base64(decode_base64($rsahostkey[1])); close($pubsha256file); if((! -e pp($hstpubsha256f)) || (! -s pp($hstpubsha256f))) { - logmsg "Failed writing sha256 hash of RSA host key\n"; + logmsg "Failed writing SHA256 hash of SSH host key\n"; exit 1; } } diff --git a/tests/test1119.pl b/tests/test1119.pl index 796a2816ca..9004696f6f 100755 --- a/tests/test1119.pl +++ b/tests/test1119.pl @@ -81,7 +81,7 @@ sub scanenum { sub scanheader { my ($f)=@_; - open my $h, "<", $f; + open(my $h, "<", $f); while(<$h>) { if(/^#define ((LIB|)CURL[A-Za-z0-9_]*)/) { push @syms, $1; @@ -120,7 +120,7 @@ sub checkmanpage { my $s = $1; # skip two "special" ones if($s !~ /(^(CURLE_OBSOLETE|CURLOPT_TEMPLATE))|_$/) { - push @manrefs, "$1:$m:$line"; + push @manrefs, "$s:$m:$line"; } } $line++; @@ -143,7 +143,7 @@ scanallheaders(); scanman_md_dir("$root/docs/libcurl"); scanman_md_dir("$root/docs/libcurl/opts"); -open my $s, "<", "$root/docs/libcurl/symbols-in-versions"; +open(my $s, "<", "$root/docs/libcurl/symbols-in-versions"); while(<$s>) { if(/(^[^ \n]+) +(.*)/) { my ($sym, $rest)=($1, $2); diff --git a/tests/test1167.pl b/tests/test1167.pl index 649e19506f..dd0097e371 100755 --- a/tests/test1167.pl +++ b/tests/test1167.pl @@ -119,7 +119,7 @@ sub scanenums { sub scanheader { my ($f)=@_; scanenums($f); - open H, "<$f"; + open(H, '<', $f); while() { my ($line, $linenum) = ($_, $.); if(/^ *# *define +([^ \n]*)/) { diff --git a/tests/tunit/tool1394.c b/tests/tunit/tool1394.c index 9d97dbb0de..33a5340cd6 100644 --- a/tests/tunit/tool1394.c +++ b/tests/tunit/tool1394.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "tool_getparam.h" static CURLcode test_tool1394(const char *arg) diff --git a/tests/tunit/tool1604.c b/tests/tunit/tool1604.c index 3593fb6f2a..f16b0bfe0a 100644 --- a/tests/tunit/tool1604.c +++ b/tests/tunit/tool1604.c @@ -24,7 +24,6 @@ #include "unitcheck.h" #if defined(_WIN32) || defined(MSDOS) - #include "tool_cfgable.h" #include "tool_doswin.h" diff --git a/tests/tunit/tool1621.c b/tests/tunit/tool1621.c index ba9e280294..35ac1a3b87 100644 --- a/tests/tunit/tool1621.c +++ b/tests/tunit/tool1621.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "tool_xattr.h" static CURLcode test_tool1621(const char *arg) diff --git a/tests/tunit/tool1622.c b/tests/tunit/tool1622.c index de6bcd9633..ec585983ba 100644 --- a/tests/tunit/tool1622.c +++ b/tests/tunit/tool1622.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "tool_progress.h" static CURLcode test_tool1622(const char *arg) diff --git a/tests/tunit/tool1623.c b/tests/tunit/tool1623.c index 2d94c8cebb..a79ccc97c4 100644 --- a/tests/tunit/tool1623.c +++ b/tests/tunit/tool1623.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "tool_getparam.h" struct check1623 { diff --git a/tests/unit/unit1300.c b/tests/unit/unit1300.c index a554cd5156..d5f762bad7 100644 --- a/tests/unit/unit1300.c +++ b/tests/unit/unit1300.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "llist.h" static void test_Curl_llist_dtor(void *key, void *value) diff --git a/tests/unit/unit1302.c b/tests/unit/unit1302.c index c96f055273..e840486511 100644 --- a/tests/unit/unit1302.c +++ b/tests/unit/unit1302.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "url.h" /* for curlx_safefree */ diff --git a/tests/unit/unit1303.c b/tests/unit/unit1303.c index 2a6b54366d..8caa3c75e0 100644 --- a/tests/unit/unit1303.c +++ b/tests/unit/unit1303.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "connect.h" @@ -50,10 +49,10 @@ static void t1303_stop(struct Curl_easy *easy) #define BASE 1000000 /* macro to set the pretended current time */ -#define NOW(x,y) now.tv_sec = x; now.tv_usec = y +#define NOW(x, y) now.tv_sec = x; now.tv_usec = y /* macro to set the millisecond based timeouts to use */ -#define TIMEOUTS(x,y) easy->set.timeout = x; \ - easy->set.connecttimeout = y +#define TIMEOUTS(x, y) easy->set.timeout = x; \ + easy->set.connecttimeout = y /* * To test: diff --git a/tests/unit/unit1304.c b/tests/unit/unit1304.c index e0e3d60501..72b2ab5a32 100644 --- a/tests/unit/unit1304.c +++ b/tests/unit/unit1304.c @@ -24,7 +24,6 @@ #include "unitcheck.h" #ifndef CURL_DISABLE_NETRC - #include "netrc.h" static void t1304_stop(char **password, char **login) diff --git a/tests/unit/unit1307.c b/tests/unit/unit1307.c index 146d5ae714..53377afdb9 100644 --- a/tests/unit/unit1307.c +++ b/tests/unit/unit1307.c @@ -24,7 +24,6 @@ #include "unitcheck.h" #ifndef CURL_DISABLE_FTP - #include "curl_fnmatch.h" /* diff --git a/tests/unit/unit1309.c b/tests/unit/unit1309.c index 5807d497ee..b49a5de994 100644 --- a/tests/unit/unit1309.c +++ b/tests/unit/unit1309.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "splay.h" static void splayprint(struct Curl_tree *t, int d, char output) diff --git a/tests/unit/unit1397.c b/tests/unit/unit1397.c index 8ba973376a..b133f2cc99 100644 --- a/tests/unit/unit1397.c +++ b/tests/unit/unit1397.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "vtls/hostcheck.h" static CURLcode test_unit1397(const char *arg) diff --git a/tests/unit/unit1399.c b/tests/unit/unit1399.c index 9ce182c154..e1e472a536 100644 --- a/tests/unit/unit1399.c +++ b/tests/unit/unit1399.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "progress.h" diff --git a/tests/unit/unit1600.c b/tests/unit/unit1600.c index 4b53b4e36b..649e92a4ca 100644 --- a/tests/unit/unit1600.c +++ b/tests/unit/unit1600.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "curl_ntlm_core.h" diff --git a/tests/unit/unit1601.c b/tests/unit/unit1601.c index 1e3cf096be..8d41be7822 100644 --- a/tests/unit/unit1601.c +++ b/tests/unit/unit1601.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "curl_md5.h" static CURLcode test_unit1601(const char *arg) diff --git a/tests/unit/unit1602.c b/tests/unit/unit1602.c index 5841717691..057ead6dd7 100644 --- a/tests/unit/unit1602.c +++ b/tests/unit/unit1602.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "hash.h" static void t1602_mydtor(void *p) diff --git a/tests/unit/unit1603.c b/tests/unit/unit1603.c index ed6be10516..9d7d950d32 100644 --- a/tests/unit/unit1603.c +++ b/tests/unit/unit1603.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "hash.h" static const size_t slots = 3; diff --git a/tests/unit/unit1605.c b/tests/unit/unit1605.c index d634f0d6df..8c63dc3b19 100644 --- a/tests/unit/unit1605.c +++ b/tests/unit/unit1605.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "llist.h" static CURLcode t1605_setup(CURL **easy) diff --git a/tests/unit/unit1607.c b/tests/unit/unit1607.c index d4fefca4f9..dc12b99a56 100644 --- a/tests/unit/unit1607.c +++ b/tests/unit/unit1607.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "connect.h" #include "curl_addrinfo.h" diff --git a/tests/unit/unit1609.c b/tests/unit/unit1609.c index da099d72b2..9d16918639 100644 --- a/tests/unit/unit1609.c +++ b/tests/unit/unit1609.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "connect.h" #include "curl_addrinfo.h" diff --git a/tests/unit/unit1610.c b/tests/unit/unit1610.c index a46b7d965b..eeb3ccceb7 100644 --- a/tests/unit/unit1610.c +++ b/tests/unit/unit1610.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "curl_sha256.h" static CURLcode t1610_setup(void) diff --git a/tests/unit/unit1611.c b/tests/unit/unit1611.c index 2b483dbd6c..c22c5f1689 100644 --- a/tests/unit/unit1611.c +++ b/tests/unit/unit1611.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "curl_md4.h" static CURLcode test_unit1611(const char *arg) diff --git a/tests/unit/unit1612.c b/tests/unit/unit1612.c index dd6f9e0fc0..cc7c36c4c8 100644 --- a/tests/unit/unit1612.c +++ b/tests/unit/unit1612.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "curl_hmac.h" #include "curl_md5.h" diff --git a/tests/unit/unit1614.c b/tests/unit/unit1614.c index ed0e3aba98..828de886d0 100644 --- a/tests/unit/unit1614.c +++ b/tests/unit/unit1614.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "noproxy.h" static CURLcode test_unit1614(const char *arg) diff --git a/tests/unit/unit1615.c b/tests/unit/unit1615.c index cfb1997f1c..7e26a158a1 100644 --- a/tests/unit/unit1615.c +++ b/tests/unit/unit1615.c @@ -23,7 +23,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "curl_sha512_256.h" static CURLcode test_unit1615(const char *arg) diff --git a/tests/unit/unit1620.c b/tests/unit/unit1620.c index 2b46d86290..2ce26b1ed4 100644 --- a/tests/unit/unit1620.c +++ b/tests/unit/unit1620.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "url.h" diff --git a/tests/unit/unit1625.c b/tests/unit/unit1625.c index 031422df63..ca310cfa51 100644 --- a/tests/unit/unit1625.c +++ b/tests/unit/unit1625.c @@ -24,7 +24,6 @@ #include "unitcheck.h" #ifndef CURL_DISABLE_HTTP - #include "urldata.h" #include "url.h" @@ -126,8 +125,7 @@ static CURLcode test_unit1625(const char *arg) return CURLE_OK; } -#else -/* for HTTP-disabled builds */ +#else /* CURL_DISABLE_HTTP */ static CURLcode test_unit1625(const char *arg) { (void)arg; diff --git a/tests/unit/unit1626.c b/tests/unit/unit1626.c index 80bb4d1181..30189fdf8d 100644 --- a/tests/unit/unit1626.c +++ b/tests/unit/unit1626.c @@ -24,7 +24,6 @@ #include "unitcheck.h" #ifndef CURL_DISABLE_HTTP - #include "urldata.h" #include "url.h" diff --git a/tests/unit/unit1627.c b/tests/unit/unit1627.c index 115c94e615..c3c679bb0e 100644 --- a/tests/unit/unit1627.c +++ b/tests/unit/unit1627.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "url.h" #include "strcase.h" diff --git a/tests/unit/unit1651.c b/tests/unit/unit1651.c index 10fc979724..fc84b33657 100644 --- a/tests/unit/unit1651.c +++ b/tests/unit/unit1651.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "vtls/x509asn1.h" static CURLcode test_unit1651(const char *arg) diff --git a/tests/unit/unit1652.c b/tests/unit/unit1652.c index 56354641a2..13c1b0175a 100644 --- a/tests/unit/unit1652.c +++ b/tests/unit/unit1652.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "curl_trc.h" diff --git a/tests/unit/unit1654.c b/tests/unit/unit1654.c index b2987e8693..ef42153ba1 100644 --- a/tests/unit/unit1654.c +++ b/tests/unit/unit1654.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "altsvc.h" diff --git a/tests/unit/unit1656.c b/tests/unit/unit1656.c index e1cf6e1ec6..7fc1a2dca6 100644 --- a/tests/unit/unit1656.c +++ b/tests/unit/unit1656.c @@ -24,7 +24,6 @@ #include "unitcheck.h" #if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS) - #include "vtls/x509asn1.h" struct test_spec { diff --git a/tests/unit/unit1657.c b/tests/unit/unit1657.c index e728da94e2..1a33ec1b92 100644 --- a/tests/unit/unit1657.c +++ b/tests/unit/unit1657.c @@ -24,7 +24,6 @@ #include "unitcheck.h" #if defined(USE_GNUTLS) || defined(USE_SCHANNEL) || defined(USE_MBEDTLS) - #include "vtls/x509asn1.h" struct test1657_spec { diff --git a/tests/unit/unit1658.c b/tests/unit/unit1658.c index f2536e6e62..fa281fe3ea 100644 --- a/tests/unit/unit1658.c +++ b/tests/unit/unit1658.c @@ -25,7 +25,6 @@ /* DoH + HTTPSRR are required */ #if !defined(CURL_DISABLE_DOH) && defined(USE_HTTPSRR) - #include "doh.h" #include "httpsrr.h" diff --git a/tests/unit/unit1660.c b/tests/unit/unit1660.c index a0698b31cd..b42a0bae7a 100644 --- a/tests/unit/unit1660.c +++ b/tests/unit/unit1660.c @@ -24,7 +24,6 @@ #include "unitcheck.h" #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_HSTS) - #include "urldata.h" #include "hsts.h" diff --git a/tests/unit/unit2601.c b/tests/unit/unit2601.c index 1a211db28e..01ea112ce6 100644 --- a/tests/unit/unit2601.c +++ b/tests/unit/unit2601.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "bufq.h" #include "curl_trc.h" diff --git a/tests/unit/unit2602.c b/tests/unit/unit2602.c index 4c757bd4b7..7c9b480eae 100644 --- a/tests/unit/unit2602.c +++ b/tests/unit/unit2602.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "dynhds.h" #include "curl_trc.h" diff --git a/tests/unit/unit2603.c b/tests/unit/unit2603.c index 730b604dc3..15ec12c41d 100644 --- a/tests/unit/unit2603.c +++ b/tests/unit/unit2603.c @@ -24,7 +24,6 @@ #include "unitcheck.h" #ifndef CURL_DISABLE_HTTP - #include "urldata.h" #include "http1.h" #include "curl_trc.h" diff --git a/tests/unit/unit3205.c b/tests/unit/unit3205.c index cc8ca3cd6c..e7de755331 100644 --- a/tests/unit/unit3205.c +++ b/tests/unit/unit3205.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "vtls/cipher_suite.h" static CURLcode test_unit3205(const char *arg) diff --git a/tests/unit/unit3212.c b/tests/unit/unit3212.c index a8b7fbd660..6ed9cbfe1b 100644 --- a/tests/unit/unit3212.c +++ b/tests/unit/unit3212.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "uint-table.h" #include "curl_trc.h" diff --git a/tests/unit/unit3213.c b/tests/unit/unit3213.c index f288d4a3f5..f2ecae4d13 100644 --- a/tests/unit/unit3213.c +++ b/tests/unit/unit3213.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" #include "uint-spbset.h" #include "curl_trc.h" diff --git a/tests/unit/unit3214.c b/tests/unit/unit3214.c index 6b10352953..8f22f53cc6 100644 --- a/tests/unit/unit3214.c +++ b/tests/unit/unit3214.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "urldata.h" static void checksize(const char *name, size_t size, size_t allowed) diff --git a/tests/unit/unit3216.c b/tests/unit/unit3216.c index 4c7b276229..6bf922545f 100644 --- a/tests/unit/unit3216.c +++ b/tests/unit/unit3216.c @@ -22,7 +22,6 @@ * ***************************************************************************/ #include "unitcheck.h" - #include "ratelimit.h" static CURLcode test_unit3216(const char *arg)