From: Viktor Szakats Date: Mon, 29 Sep 2025 10:36:14 +0000 (+0200) Subject: tidy-up: miscellaneous (cont.) X-Git-Tag: rc-8_17_0-1~106 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6f0e212f6e2746005fe63aab81f04d479bb8d01b;p=thirdparty%2Fcurl.git tidy-up: miscellaneous (cont.) - examples: replace magic numbers with `sizeof()`. - typos: drop rules no longer needed after excluding tests/data. - typos: move an exception inline. - alpha-sort lists. - fix indentation, whitespace. Closes #18898 --- diff --git a/.github/scripts/typos.toml b/.github/scripts/typos.toml index 97c682b5b6..a84017cf53 100644 --- a/.github/scripts/typos.toml +++ b/.github/scripts/typos.toml @@ -9,13 +9,10 @@ extend-ignore-identifiers-re = [ "^(ECT0|ECT1|HELO|htpt|PASE)$", "^[A-Za-z0-9_-]*(EDE|GOST)[A-Z0-9_-]*$", # ciphers "^0x[0-9a-fA-F]+FUL$", # unsigned long hex literals ending with 'F' - "^[0-9a-zA-Z+]{64,}$", # possibly base64 - "^(Januar|eyeballers|HELO_smtp|kno22|MkTypLibCompatible|optin|passin|perfec|__SecURE|SMTP_HELO|v_alue)$", - "^(clen|req_clen|smtp_perform_helo|smtp_state_helo_resp|_stati64)$", - "^Tru64$", + "^(eyeballers|HELO_smtp|optin|passin|perfec|SMTP_HELO)$", + "^(clen|req_clen|smtp_perform_helo|smtp_state_helo_resp|Tru64|_stati64)$", "secur32", - # this should be limited to tests/http/*. Short for secure proxy. - "proxys", + "proxys", # this should be limited to tests/http/*. Short for secure proxy. ] extend-ignore-re = [ @@ -28,8 +25,8 @@ extend-exclude = [ ".github/scripts/spellcheck.words", "docs/THANKS", "packages/*", - "scripts/wcurl", "projects/Windows/tmpl/curl.vcxproj", "projects/Windows/tmpl/libcurl.vcxproj", + "scripts/wcurl", "tests/data/test*", ] diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index f2050bd2ce..a5f42f9d40 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -10,6 +10,7 @@ # https://github.com/actions/labeler name: 'Labeler' + 'on': [pull_request_target] # zizmor: ignore[dangerous-triggers] permissions: {} diff --git a/configure.ac b/configure.ac index 5dde9f6c96..c90606f507 100644 --- a/configure.ac +++ b/configure.ac @@ -281,7 +281,7 @@ OPT_APPLE_SECTRUST=$curl_cv_apple AC_ARG_WITH(apple-sectrust,dnl AS_HELP_STRING([--with-apple-sectrust],[enable Apple OS native certificate verification]),[ OPT_APPLE_SECTRUST=$withval - ]) +]) AC_PATH_PROG(PERL, perl,, $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin) AC_SUBST(PERL) diff --git a/docs/examples/multi-event.c b/docs/examples/multi-event.c index f2c3e87c2b..23dff05ed2 100644 --- a/docs/examples/multi-event.c +++ b/docs/examples/multi-event.c @@ -69,7 +69,7 @@ static void add_download(const char *url, int num) FILE *file; CURL *handle; - snprintf(filename, 50, "%d.download", num); + snprintf(filename, sizeof(filename), "%d.download", num); file = fopen(filename, "wb"); if(!file) { diff --git a/docs/examples/multi-uv.c b/docs/examples/multi-uv.c index 1a61745dfa..ee0ac0e1b3 100644 --- a/docs/examples/multi-uv.c +++ b/docs/examples/multi-uv.c @@ -85,7 +85,7 @@ static void add_download(const char *url, int num, CURLM *multi) FILE *file; CURL *handle; - snprintf(filename, 50, "%d.download", num); + snprintf(filename, sizeof(filename), "%d.download", num); file = fopen(filename, "wb"); if(!file) { diff --git a/lib/amigaos.c b/lib/amigaos.c index cc5d49f9b8..e51236d126 100644 --- a/lib/amigaos.c +++ b/lib/amigaos.c @@ -222,8 +222,8 @@ CURLcode Curl_amiga_init(void) return CURLE_FAILED_INIT; } - if(SocketBaseTags(SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno, - SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "curl", + if(SocketBaseTags(SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG)&errno, + SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG)"curl", TAG_DONE)) { CURL_AMIGA_REQUEST("SocketBaseTags ERROR"); return CURLE_FAILED_INIT; diff --git a/lib/cf-ip-happy.c b/lib/cf-ip-happy.c index f6675e275d..6b7130be83 100644 --- a/lib/cf-ip-happy.c +++ b/lib/cf-ip-happy.c @@ -412,9 +412,9 @@ evaluate: if(!more_possible) more_possible = cf_ai_iter_has_more(&bs->ipv6_iter); #endif - do_more = more_possible && - (curlx_timediff(now, bs->last_attempt_started) >= - bs->attempt_delay_ms); + do_more = more_possible && + (curlx_timediff(now, bs->last_attempt_started) >= + bs->attempt_delay_ms); if(do_more) CURL_TRC_CF(data, cf, "happy eyeballs timeout expired, " "start next attempt"); diff --git a/lib/curl_trc.c b/lib/curl_trc.c index 7f234437f2..0b91315e36 100644 --- a/lib/curl_trc.c +++ b/lib/curl_trc.c @@ -312,6 +312,7 @@ void Curl_trc_timer(struct Curl_easy *data, int tid, const char *fmt, ...) va_end(ap); } } + void Curl_trc_easy_timers(struct Curl_easy *data) { if(CURL_TRC_TIMER_is_verbose(data)) { diff --git a/lib/rtsp.c b/lib/rtsp.c index 3ede0fe62d..1f952a07cc 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -558,7 +558,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done) * Go ahead and use the Range stuff supplied for HTTP */ if(data->state.use_range && - (rtspreq & (RTSPREQ_PLAY | RTSPREQ_PAUSE | RTSPREQ_RECORD))) { + (rtspreq & (RTSPREQ_PLAY | RTSPREQ_PAUSE | RTSPREQ_RECORD))) { /* Check to see if there is a range set in the custom headers */ if(!Curl_checkheaders(data, STRCONST("Range")) && data->state.range) { diff --git a/lib/vauth/digest_sspi.c b/lib/vauth/digest_sspi.c index f231dabc81..5bf3770565 100644 --- a/lib/vauth/digest_sspi.c +++ b/lib/vauth/digest_sspi.c @@ -364,7 +364,7 @@ CURLcode Curl_auth_decode_digest_http_message(const char *chlg, } /* Store the challenge for use later */ - digest->input_token = (BYTE *) Curl_memdup(chlg, chlglen + 1); + digest->input_token = (BYTE *)Curl_memdup(chlg, chlglen + 1); if(!digest->input_token) return CURLE_OUT_OF_MEMORY; diff --git a/lib/vauth/ntlm_sspi.c b/lib/vauth/ntlm_sspi.c index d421879161..071617182e 100644 --- a/lib/vauth/ntlm_sspi.c +++ b/lib/vauth/ntlm_sspi.c @@ -175,7 +175,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data, ntlm->context, &type_1_desc, &attrs, NULL); if(status == SEC_I_COMPLETE_NEEDED || - status == SEC_I_COMPLETE_AND_CONTINUE) + status == SEC_I_COMPLETE_AND_CONTINUE) Curl_pSecFn->CompleteAuthToken(ntlm->context, &type_1_desc); else if(status == SEC_E_INSUFFICIENT_MEMORY) return CURLE_OUT_OF_MEMORY; diff --git a/lib/vquic/curl_ngtcp2.c b/lib/vquic/curl_ngtcp2.c index 3a301f1b71..7a26e2bf08 100644 --- a/lib/vquic/curl_ngtcp2.c +++ b/lib/vquic/curl_ngtcp2.c @@ -143,8 +143,8 @@ struct cf_ngtcp2_ctx { uint64_t max_bidi_streams; /* max bidi streams we can open */ size_t earlydata_max; /* max amount of early data supported by server on session reuse */ - size_t earlydata_skip; /* sending bytes to skip when earlydata - * is accepted by peer */ + size_t earlydata_skip; /* sending bytes to skip when earlydata + is accepted by peer */ CURLcode tls_vrfy_result; /* result of TLS peer verification */ int qlogfd; BIT(initialized); diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 3145d4d203..039eb51c9a 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -3358,9 +3358,9 @@ static CURLcode ossl_windows_load_anchors(struct Curl_cfilter *cf, #endif /* USE_WIN32_CRYPTO */ static CURLcode ossl_load_trust_anchors(struct Curl_cfilter *cf, - struct Curl_easy *data, - struct ossl_ctx *octx, - X509_STORE *store) + struct Curl_easy *data, + struct ossl_ctx *octx, + X509_STORE *store) { struct ssl_primary_config *conn_config = Curl_ssl_cf_get_primary_config(cf); struct ssl_config_data *ssl_config = Curl_ssl_cf_get_config(cf, data); diff --git a/src/Makefile.inc b/src/Makefile.inc index d57d6c9125..fa55837552 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -34,9 +34,9 @@ # the official API, but we reuse the code here to avoid duplication. CURLX_CFILES = \ ../lib/curlx/base64.c \ - ../lib/curlx/multibyte.c \ ../lib/curlx/dynbuf.c \ ../lib/curlx/fopen.c \ + ../lib/curlx/multibyte.c \ ../lib/curlx/nonblock.c \ ../lib/curlx/strerr.c \ ../lib/curlx/strparse.c \ @@ -48,11 +48,11 @@ CURLX_CFILES = \ ../lib/curlx/winapi.c CURLX_HFILES = \ - ../lib/curlx/binmode.h \ - ../lib/curlx/multibyte.h \ ../lib/curl_setup.h \ + ../lib/curlx/binmode.h \ ../lib/curlx/dynbuf.h \ ../lib/curlx/fopen.h \ + ../lib/curlx/multibyte.h \ ../lib/curlx/nonblock.h \ ../lib/curlx/strerr.h \ ../lib/curlx/strparse.h \ diff --git a/src/tool_operate.c b/src/tool_operate.c index 38482b496e..3c29d28ec3 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -999,7 +999,7 @@ static CURLcode setup_outfile(struct OperationConfig *config, /* open file for output, forcing VMS output format into stream mode which is needed for stat() call above to always work. */ FILE *file = curlx_fopen(outfile, "ab", - "ctx=stm", "rfm=stmlf", "rat=cr", "mrs=0"); + "ctx=stm", "rfm=stmlf", "rat=cr", "mrs=0"); #else /* open file for output: */ FILE *file = curlx_fopen(per->outfile, "ab"); diff --git a/tests/libtest/lib517.c b/tests/libtest/lib517.c index 85950dd866..01d3ac4bad 100644 --- a/tests/libtest/lib517.c +++ b/tests/libtest/lib517.c @@ -80,7 +80,7 @@ static CURLcode test_lib517(const char *URL) {"Sat, 15-Apr-17\"21:01:22\"GMT", 1492290082 }, {"Partyday, 18- April-07 22:50:12", -1 }, {"Partyday, 18 - Apri-07 22:50:12", -1 }, - {"Wednes, 1-Januar-2003 00:00:00 GMT", -1 }, + {"Wednes, 1-Januar-2003 00:00:00 GMT", -1 },/* spellchecker:disable-line */ {"Sat, 15-Apr-17 21:01:22", 1492290082 }, {"Sat, 15-Apr-17 21:01:22 GMT-2", 1492290082 }, {"Sat, 15-Apr-17 21:01:22 GMT BLAH", 1492290082 }, diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index 3f4c9ef8b0..48728bfd01 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -461,13 +461,13 @@ static DWORD WINAPI select_ws_wait_thread(void *lpParameter) size.QuadPart = 0; size.LowPart = GetFileSize(handle, &length); if((size.LowPart != INVALID_FILE_SIZE) || - (GetLastError() == NO_ERROR)) { + (GetLastError() == NO_ERROR)) { size.HighPart = (LONG)length; /* get the current position within the file */ pos.QuadPart = 0; pos.LowPart = SetFilePointer(handle, 0, &pos.HighPart, FILE_CURRENT); if((pos.LowPart != INVALID_SET_FILE_POINTER) || - (GetLastError() == NO_ERROR)) { + (GetLastError() == NO_ERROR)) { /* compare position with size, abort if not equal */ if(size.QuadPart == pos.QuadPart) { /* sleep and continue waiting */