src: fix formatting nits

Closes #19823
This commit is contained in:
Viktor Szakats 2025-12-03 15:53:46 +01:00
parent 1753de9d7a
commit 0417d323c9
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
52 changed files with 490 additions and 543 deletions

View file

@ -39,7 +39,7 @@
#include "var.h"
#define ALLOW_BLANK TRUE
#define DENY_BLANK FALSE
#define DENY_BLANK FALSE
static ParameterError getstr(char **str, const char *val, bool allowblank)
{
@ -432,22 +432,22 @@ ParameterError parse_cert_parameter(const char *cert_parameter,
case '\\':
param_place++;
switch(*param_place) {
case '\0':
*certname_place++ = '\\';
break;
case '\\':
*certname_place++ = '\\';
param_place++;
break;
case ':':
*certname_place++ = ':';
param_place++;
break;
default:
*certname_place++ = '\\';
*certname_place++ = *param_place;
param_place++;
break;
case '\0':
*certname_place++ = '\\';
break;
case '\\':
*certname_place++ = '\\';
param_place++;
break;
case ':':
*certname_place++ = ':';
param_place++;
break;
default:
*certname_place++ = '\\';
*certname_place++ = *param_place;
param_place++;
break;
}
break;
case ':':
@ -459,7 +459,7 @@ ParameterError parse_cert_parameter(const char *cert_parameter,
#ifdef _WIN32
if((param_place == &cert_parameter[1]) &&
(cert_parameter[2] == '\\' || cert_parameter[2] == '/') &&
(ISALPHA(cert_parameter[0])) ) {
(ISALPHA(cert_parameter[0]))) {
/* colon in the second column, followed by a backslash, and the
first character is an alphabetic letter:
@ -503,7 +503,7 @@ static size_t replace_url_encoded_space_by_plus(char *url)
url[new_index] = '+';
orig_index += 3;
}
else{
else {
if(new_index != orig_index) {
url[new_index] = url[orig_index];
}
@ -517,8 +517,8 @@ static size_t replace_url_encoded_space_by_plus(char *url)
return new_index; /* new size */
}
static ParameterError
GetFileAndPassword(const char *nextarg, char **file, char **password)
static ParameterError GetFileAndPassword(const char *nextarg, char **file,
char **password)
{
char *certname, *passphrase;
ParameterError err;
@ -558,15 +558,15 @@ static ParameterError GetSizeParameter(const char *arg,
switch(*unit) {
case 'G':
case 'g':
if(value > (CURL_OFF_T_MAX / (1024*1024*1024)))
if(value > (CURL_OFF_T_MAX / (1024 * 1024 * 1024)))
return PARAM_NUMBER_TOO_LARGE;
value *= 1024*1024*1024;
value *= 1024 * 1024 * 1024;
break;
case 'M':
case 'm':
if(value > (CURL_OFF_T_MAX / (1024*1024)))
if(value > (CURL_OFF_T_MAX / (1024 * 1024)))
return PARAM_NUMBER_TOO_LARGE;
value *= 1024*1024;
value *= 1024 * 1024;
break;
case 'K':
case 'k':
@ -602,7 +602,7 @@ static void cleanarg(char *str)
#endif
/* the maximum size we allow the dynbuf generated string */
#define MAX_DATAURLENCODE (500*1024*1024)
#define MAX_DATAURLENCODE (500 * 1024 * 1024)
/* --data-urlencode */
static ParameterError data_urlencode(const char *nextarg,
@ -706,8 +706,7 @@ error:
return err;
}
static void sethttpver(struct OperationConfig *config,
long httpversion)
static void sethttpver(struct OperationConfig *config, long httpversion)
{
if(config->httpversion &&
(config->httpversion != httpversion))
@ -732,20 +731,20 @@ static CURLcode set_trace_config(const char *token)
len = strlen(token);
switch(*token) {
case '-':
toggle = FALSE;
name = token + 1;
len--;
break;
case '+':
toggle = TRUE;
name = token + 1;
len--;
break;
default:
toggle = TRUE;
name = token;
break;
case '-':
toggle = FALSE;
name = token + 1;
len--;
break;
case '+':
toggle = TRUE;
name = token + 1;
len--;
break;
default:
toggle = TRUE;
name = token;
break;
}
if((len == 3) && curl_strnequal(name, "all", 3)) {
@ -816,37 +815,37 @@ struct TOSEntry {
};
static const struct TOSEntry tos_entries[] = {
{"AF11", 0x28},
{"AF12", 0x30},
{"AF13", 0x38},
{"AF21", 0x48},
{"AF22", 0x50},
{"AF23", 0x58},
{"AF31", 0x68},
{"AF32", 0x70},
{"AF33", 0x78},
{"AF41", 0x88},
{"AF42", 0x90},
{"AF43", 0x98},
{"CE", 0x03},
{"CS0", 0x00},
{"CS1", 0x20},
{"CS2", 0x40},
{"CS3", 0x60},
{"CS4", 0x80},
{"CS5", 0xa0},
{"CS6", 0xc0},
{"CS7", 0xe0},
{"ECT0", 0x02},
{"ECT1", 0x01},
{"EF", 0xb8},
{"LE", 0x04},
{"LOWCOST", 0x02},
{"LOWDELAY", 0x10},
{"MINCOST", 0x02},
{"RELIABILITY", 0x04},
{"THROUGHPUT", 0x08},
{"VOICE-ADMIT", 0xb0}
{ "AF11", 0x28 },
{ "AF12", 0x30 },
{ "AF13", 0x38 },
{ "AF21", 0x48 },
{ "AF22", 0x50 },
{ "AF23", 0x58 },
{ "AF31", 0x68 },
{ "AF32", 0x70 },
{ "AF33", 0x78 },
{ "AF41", 0x88 },
{ "AF42", 0x90 },
{ "AF43", 0x98 },
{ "CE", 0x03 },
{ "CS0", 0x00 },
{ "CS1", 0x20 },
{ "CS2", 0x40 },
{ "CS3", 0x60 },
{ "CS4", 0x80 },
{ "CS5", 0xa0 },
{ "CS6", 0xc0 },
{ "CS7", 0xe0 },
{ "ECT0", 0x02 },
{ "ECT1", 0x01 },
{ "EF", 0xb8 },
{ "LE", 0x04 },
{ "LOWCOST", 0x02 },
{ "LOWDELAY", 0x10 },
{ "MINCOST", 0x02 },
{ "RELIABILITY", 0x04 },
{ "THROUGHPUT", 0x08 },
{ "VOICE-ADMIT", 0xb0 }
};
static int find_tos(const void *a, const void *b)
@ -986,9 +985,9 @@ static ParameterError set_rate(const char *nextarg)
const char *div = strchr(nextarg, '/');
char number[26];
long denominator;
long numerator = 60*60*1000; /* default per hour */
long numerator = 60 * 60 * 1000; /* default per hour */
size_t numlen = div ? (size_t)(div - nextarg) : strlen(nextarg);
if(numlen > sizeof(number) -1)
if(numlen > sizeof(number) - 1)
return PARAM_NUMBER_TOO_LARGE;
memcpy(number, nextarg, numlen);
@ -1012,12 +1011,12 @@ static ParameterError set_rate(const char *nextarg)
numerator = 1000;
break;
case 'm': /* per minute */
numerator = 60*1000;
numerator = 60 * 1000;
break;
case 'h': /* per hour */
break;
case 'd': /* per day */
numerator = 24*60*60*1000;
numerator = 24 * 60 * 60 * 1000;
break;
default:
errorf("unsupported --rate unit");
@ -1040,7 +1039,7 @@ static ParameterError set_rate(const char *nextarg)
else if(denominator > numerator)
err = PARAM_NUMBER_TOO_LARGE;
else
global->ms_per_transfer = numerator/denominator;
global->ms_per_transfer = numerator / denominator;
return err;
}
@ -1133,7 +1132,6 @@ static ParameterError parse_url(struct OperationConfig *config,
return add_url(config, nextarg, FALSE);
}
static ParameterError parse_localport(struct OperationConfig *config,
const char *nextarg)
{
@ -1163,7 +1161,7 @@ static ParameterError parse_localport(struct OperationConfig *config,
else {
if(str2unummax(&config->localportrange, pp, 65535))
return PARAM_BAD_USE;
config->localportrange -= (config->localport-1);
config->localportrange -= (config->localport - 1);
if(config->localportrange < 1)
return PARAM_BAD_USE;
}
@ -1237,7 +1235,7 @@ static ParameterError parse_ech(struct OperationConfig *config,
curlx_fclose(file);
if(err)
return err;
config->ech_config = curl_maprintf("ecl:%s",tmpcfg);
config->ech_config = curl_maprintf("ecl:%s", tmpcfg);
curlx_free(tmpcfg);
if(!config->ech_config)
return PARAM_NO_MEM;
@ -1268,7 +1266,7 @@ static ParameterError parse_header(struct OperationConfig *config,
else {
struct dynbuf line;
bool error = FALSE;
curlx_dyn_init(&line, 1024*100);
curlx_dyn_init(&line, 1024 * 100);
while(my_get_line(file, &line, &error)) {
const char *ptr = curlx_dyn_ptr(&line);
err = add2list(cmd == C_PROXY_HEADER ? /* --proxy-header? */
@ -1287,7 +1285,7 @@ static ParameterError parse_header(struct OperationConfig *config,
else {
if(!strchr(nextarg, ':') && !strchr(nextarg, ';')) {
warnf("The provided %s header '%s' does not look like a header?",
(cmd == C_PROXY_HEADER) ? "proxy": "HTTP", nextarg);
(cmd == C_PROXY_HEADER) ? "proxy" : "HTTP", nextarg);
}
if(cmd == C_PROXY_HEADER) /* --proxy-header */
err = add2list(&config->proxyheaders, nextarg);
@ -1629,12 +1627,12 @@ struct flagmap {
};
static const struct flagmap flag_table[] = {
{"answered", 8, CURLULFLAG_ANSWERED},
{"deleted", 7, CURLULFLAG_DELETED},
{"draft", 5, CURLULFLAG_DRAFT},
{"flagged", 7, CURLULFLAG_FLAGGED},
{"seen", 4, CURLULFLAG_SEEN},
{NULL, 0, 0}
{ "answered", 8, CURLULFLAG_ANSWERED },
{ "deleted", 7, CURLULFLAG_DELETED },
{ "draft", 5, CURLULFLAG_DRAFT },
{ "flagged", 7, CURLULFLAG_FLAGGED },
{ "seen", 4, CURLULFLAG_SEEN },
{ NULL, 0, 0 }
};
static ParameterError parse_upload_flags(struct OperationConfig *config,
@ -2902,7 +2900,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
p = word;
/* is there an '=' ? */
if(!curlx_str_until(&p, &out, MAX_OPTION_LEN, '=') &&
!curlx_str_single(&p, '=') ) {
!curlx_str_single(&p, '=')) {
/* there is an equal sign */
char tempword[MAX_OPTION_LEN + 1];
memcpy(tempword, curlx_str(&out), curlx_strlen(&out));