]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tidy-up: miscellaneous (cont.)
authorViktor Szakats <commit@vsz.me>
Mon, 29 Sep 2025 10:36:14 +0000 (12:36 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 6 Oct 2025 20:33:38 +0000 (22:33 +0200)
- 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

17 files changed:
.github/scripts/typos.toml
.github/workflows/label.yml
configure.ac
docs/examples/multi-event.c
docs/examples/multi-uv.c
lib/amigaos.c
lib/cf-ip-happy.c
lib/curl_trc.c
lib/rtsp.c
lib/vauth/digest_sspi.c
lib/vauth/ntlm_sspi.c
lib/vquic/curl_ngtcp2.c
lib/vtls/openssl.c
src/Makefile.inc
src/tool_operate.c
tests/libtest/lib517.c
tests/server/sockfilt.c

index 97c682b5b6ee590ec6772242cb838e828ec33b85..a84017cf5303cfe1bd02ffb21a49e5eacad1e2a8 100644 (file)
@@ -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*",
 ]
index f2050bd2cedbb4aa9bfa7200e057776b5825b3e8..a5f42f9d409b99a9a3799c106c8a8f5d43cb3c5d 100644 (file)
@@ -10,6 +10,7 @@
 # https://github.com/actions/labeler
 
 name: 'Labeler'
+
 'on': [pull_request_target]  # zizmor: ignore[dangerous-triggers]
 
 permissions: {}
index 5dde9f6c96f261e8a904954986fd29fc23618f5d..c90606f5078095e4f8e0059918a0b2a578093cb3 100644 (file)
@@ -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)
index f2c3e87c2b3c3d39a6ee6bcc143c114c4b562c7a..23dff05ed2b4e6402fba70968021ad2f84b048f5 100644 (file)
@@ -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) {
index 1a61745dfa3f877be1de103c3a11bd9c6ccb452b..ee0ac0e1b33fd9ed205e5e49f7bb036630339356 100644 (file)
@@ -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) {
index cc5d49f9b8e73a5dc51370ce8ed541986d0412b2..e51236d1260a82e50ef48cc57b10b9d410bc163f 100644 (file)
@@ -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;
index f6675e275db6c27c8108cca6009ef2d571422639..6b7130be83f5fb439f6d38033dec4f08c5475b24 100644 (file)
@@ -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");
index 7f234437f291ee427b793984c2f2ac94f7db2acd..0b91315e3668df4410df94093acf0ad44da56472 100644 (file)
@@ -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)) {
index 3ede0fe62ddc11dff71b720386e69d632fe02918..1f952a07cccb4231b3d2f3289b73dfd27fe3aead 100644 (file)
@@ -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) {
index f231dabc81dfb3a40f5824dcf6f0960ee0732830..5bf37705653a72d170b1dc7dcc40b2ca9fc1ff0d 100644 (file)
@@ -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;
 
index d42187916138ea569dbaae0dfe4ab732480953a7..071617182e7ef0d8491d00d4aabf7f92dd882672 100644 (file)
@@ -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;
index 3a301f1b71fb85dd1f792d096c8c30b368ae5092..7a26e2bf08c83ac9519bb56f99da54330cfd40a9 100644 (file)
@@ -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);
index 3145d4d203150a39077ee886bf9f0c33e57e2b57..039eb51c9ad48c78acbc7a9a8e0f68a69aaab8a4 100644 (file)
@@ -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);
index d57d6c9125f487097b14c91118fe56af863f7692..fa558375520354dc3c203ae945f73ca28a688c65 100644 (file)
@@ -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 \
index 38482b496e7f023fae7b4c40b99688757171eba3..3c29d28ec3a091a3c39d8b556be628d590c8e3f6 100644 (file)
@@ -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");
index 85950dd866bc74423bad1afc88de2a86102ef5bb..01d3ac4bad1a316863cc6544c5b485497971c336 100644 (file)
@@ -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 },
index 3f4c9ef8b0501da520d0b09f52bcce4de97b347f..48728bfd01a4add92ebac6ef07b75e56dff89159 100644 (file)
@@ -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 */