tidy-up: miscellaneous

- examples: sync debug output printf masks.
- INSTALL-CMAKE.md: tidy up section for some options.
- curl_sha512_256: delete comment suggesting an optimization.
- vtls/keylog: scope a variable.
- vtls/openssl: make a source code URL a permalink.
- vtls/schannel: drop redundant parentheses.
- test1119.pl: robustify `$1` -> `$s`.
- sync arg names in comments to match the code.
- tidy up and minor fixes to comments.
- fix formatting/indenting/comment/newline/include nits.
- move `UNITTEST` protos next to definitions, sync their argument names.
- make variables static.
- add parentheses to Perl `open()` calls.
- drop unnecessary double quotes in Perl.
- clang-format.

Closes #21000
This commit is contained in:
Viktor Szakats 2026-03-09 12:27:12 +01:00
parent 3512b673dd
commit e0dd6eb4a4
No known key found for this signature in database
148 changed files with 612 additions and 684 deletions

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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",

View file

@ -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);

View file

@ -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++) {

View file

@ -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 }
};

View file

@ -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(<STDIN>) {
"${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 = <<MOO
if(first && present(first)) /* first setopt check only */
err("$name", first, __LINE__);
@ -515,7 +515,7 @@ MOO
elsif($type eq "CURLOPTTYPE_OFF_T") {
print $fh "${fpref} OFF_NO);\n$flongcheckzero";
print $fh "$ifpresent";
my $lvl = " " x 29;
my $lvl = " " x 25;
print $fh "${pref}\n${lvl}(curl_off_t)22);\n$longcheck";
print $fh "${pref} OFF_HI);\n$longcheck";
print $fh "${pref} OFF_LO);\n$longcheck";

View file

@ -36,7 +36,7 @@ my $what=$ARGV[2];
# Read the output of curl --version
my $curl_protocols="";
open(CURL, "$ARGV[1]") || die "Cannot get curl $what list\n";
open(CURL, $ARGV[1]) || die "Cannot get curl $what list\n";
while(<CURL>) {
$curl_protocols = $_ if(/$what:/i);
}

View file

@ -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";
$_ = <CURL>;
chomp;
/libcurl\/([\.\d]+((-DEV)|(-rc\d)|(-\d+))?)/;