lib/src: white space edits to comply better with code style

... as checksrc now finds and complains about these.

Closes #14921
This commit is contained in:
Daniel Stenberg 2024-09-18 15:29:51 +02:00
parent a57b45c386
commit fbf5d507ce
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
128 changed files with 854 additions and 837 deletions

View file

@ -96,7 +96,7 @@ static void fly(struct ProgressData *bar, bool moved)
if(bar->tick >= 200)
bar->tick -= 200;
bar->bar += (moved?bar->barmove:0);
bar->bar += (moved ? bar->barmove : 0);
if(bar->bar >= (bar->width - 6)) {
bar->barmove = -1;
bar->bar = bar->width - 6;

View file

@ -152,5 +152,5 @@ int tool_readbusy_cb(void *clientp,
tool_go_sleep(25);
}
return per->noprogress? 0 : CURL_PROGRESSFUNC_CONTINUE;
return per->noprogress ? 0 : CURL_PROGRESSFUNC_CONTINUE;
}

View file

@ -2242,9 +2242,8 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
case C_HEAD: /* --head */
config->no_body = toggle;
config->show_headers = toggle;
if(SetHTTPrequest(config,
(config->no_body)?TOOL_HTTPREQ_HEAD:TOOL_HTTPREQ_GET,
&config->httpreq))
if(SetHTTPrequest(config, (config->no_body) ? TOOL_HTTPREQ_HEAD :
TOOL_HTTPREQ_GET, &config->httpreq))
err = PARAM_BAD_USE;
break;
case C_REMOTE_HEADER_NAME: /* --remote-header-name */
@ -2303,7 +2302,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
config->nobuffer = longopt ? !toggle : TRUE;
break;
case C_REMOTE_NAME_ALL: /* --remote-name-all */
config->default_node_flags = toggle?GETOUT_USEREMOTE:0;
config->default_node_flags = toggle ? GETOUT_USEREMOTE : 0;
break;
case C_OUTPUT_DIR: /* --output-dir */
err = getstr(&config->output_dir, nextarg, DENY_BLANK);

View file

@ -813,7 +813,7 @@ static CURLcode url_proto(char **url,
curl_url_cleanup(uh);
}
*scheme = (char *) (proto? proto: "???"); /* Never match if not found. */
*scheme = (char *) (proto ? proto : "???"); /* Never match if not found. */
return result;
}
@ -839,9 +839,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
/* Use the postfields data for an HTTP get */
httpgetfields = state->httpgetfields = config->postfields;
config->postfields = NULL;
if(SetHTTPrequest(config,
(config->no_body?TOOL_HTTPREQ_HEAD:TOOL_HTTPREQ_GET),
&config->httpreq)) {
if(SetHTTPrequest(config, (config->no_body ? TOOL_HTTPREQ_HEAD :
TOOL_HTTPREQ_GET), &config->httpreq)) {
result = CURLE_FAILED_INIT;
}
}
@ -900,8 +899,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
if(!config->globoff && infiles && !inglob) {
/* Unless explicitly shut off */
result = glob_url(&inglob, infiles, &state->infilenum,
(!global->silent || global->showerror)?
tool_stderr:NULL);
(!global->silent || global->showerror) ?
tool_stderr : NULL);
if(result)
break;
config->state.inglob = inglob;
@ -936,8 +935,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
/* Unless explicitly shut off, we expand '{...}' and '[...]'
expressions and return total number of URLs in pattern set */
result = glob_url(&state->urls, urlnode->url, &state->urlnum,
(!global->silent || global->showerror)?
tool_stderr:NULL);
(!global->silent || global->showerror) ?
tool_stderr : NULL);
if(result)
break;
urlnum = state->urlnum;
@ -1284,7 +1283,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
* If the user has also selected --anyauth or --proxy-anyauth
* we should warn them.
*/
if(config->proxyanyauth || (authbits>1)) {
if(config->proxyanyauth || (authbits > 1)) {
warnf(global,
"Using --anyauth or --proxy-anyauth with upload from stdin"
" involves a big risk of it not working. Use a temporary"
@ -1433,7 +1432,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
my_setopt_str(curl, CURLOPT_URL, per->this_url);
my_setopt(curl, CURLOPT_NOPROGRESS,
global->noprogress || global->silent?1L:0L);
global->noprogress || global->silent ? 1L : 0L);
if(config->no_body)
my_setopt(curl, CURLOPT_NOBODY, 1L);
@ -1456,7 +1455,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
my_setopt_str(curl, CURLOPT_PROXYUSERPWD, config->proxyuserpwd);
/* new in libcurl 7.3 */
my_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, config->proxytunnel?1L:0L);
my_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, config->proxytunnel ?
1L : 0L);
/* new in libcurl 7.52.0 */
if(config->preproxy)
@ -1483,13 +1483,13 @@ static CURLcode single_transfer(struct GlobalConfig *global,
my_setopt_str(curl, CURLOPT_NOPROXY, config->noproxy);
my_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS,
config->suppress_connect_headers?1L:0L);
config->suppress_connect_headers ? 1L : 0L);
my_setopt(curl, CURLOPT_FAILONERROR, config->failonerror?1L:0L);
my_setopt(curl, CURLOPT_FAILONERROR, config->failonerror ? 1L : 0L);
my_setopt(curl, CURLOPT_REQUEST_TARGET, config->request_target);
my_setopt(curl, CURLOPT_UPLOAD, per->uploadfile?1L:0L);
my_setopt(curl, CURLOPT_DIRLISTONLY, config->dirlistonly?1L:0L);
my_setopt(curl, CURLOPT_APPEND, config->ftp_append?1L:0L);
my_setopt(curl, CURLOPT_UPLOAD, per->uploadfile ? 1L : 0L);
my_setopt(curl, CURLOPT_DIRLISTONLY, config->dirlistonly ? 1L : 0L);
my_setopt(curl, CURLOPT_APPEND, config->ftp_append ? 1L : 0L);
if(config->netrc_opt)
my_setopt_enum(curl, CURLOPT_NETRC, (long)CURL_NETRC_OPTIONAL);
@ -1501,7 +1501,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
if(config->netrc_file)
my_setopt_str(curl, CURLOPT_NETRC_FILE, config->netrc_file);
my_setopt(curl, CURLOPT_TRANSFERTEXT, config->use_ascii?1L:0L);
my_setopt(curl, CURLOPT_TRANSFERTEXT, config->use_ascii ? 1L : 0L);
if(config->login_options)
my_setopt_str(curl, CURLOPT_LOGIN_OPTIONS, config->login_options);
my_setopt_str(curl, CURLOPT_USERPWD, config->userpwd);
@ -1564,11 +1564,11 @@ static CURLcode single_transfer(struct GlobalConfig *global,
long postRedir = 0;
my_setopt(curl, CURLOPT_FOLLOWLOCATION,
config->followlocation?1L:0L);
config->followlocation ? 1L : 0L);
my_setopt(curl, CURLOPT_UNRESTRICTED_AUTH,
config->unrestricted_auth?1L:0L);
config->unrestricted_auth ? 1L : 0L);
my_setopt_str(curl, CURLOPT_AWS_SIGV4, config->aws_sigv4);
my_setopt(curl, CURLOPT_AUTOREFERER, config->autoreferer?1L:0L);
my_setopt(curl, CURLOPT_AUTOREFERER, config->autoreferer ? 1L : 0L);
/* new in libcurl 7.36.0 */
if(config->proxyheaders) {
@ -1972,7 +1972,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
my_setopt(curl, CURLOPT_FILETIME, 1L);
}
my_setopt(curl, CURLOPT_CRLF, config->crlf?1L:0L);
my_setopt(curl, CURLOPT_CRLF, config->crlf ? 1L : 0L);
my_setopt_slist(curl, CURLOPT_QUOTE, config->quote);
my_setopt_slist(curl, CURLOPT_POSTQUOTE, config->postquote);
my_setopt_slist(curl, CURLOPT_PREQUOTE, config->prequote);
@ -2014,7 +2014,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
my_setopt_str(curl, CURLOPT_COOKIEJAR, config->cookiejar);
/* new in libcurl 7.9.7 */
my_setopt(curl, CURLOPT_COOKIESESSION, config->cookiesession?1L:0L);
my_setopt(curl, CURLOPT_COOKIESESSION, config->cookiesession ?
1L : 0L);
my_setopt_enum(curl, CURLOPT_TIMECONDITION, (long)config->timecond);
my_setopt(curl, CURLOPT_TIMEVALUE_LARGE, config->condtime);
@ -2118,9 +2119,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
/* new in curl 7.10.7, extended in 7.19.4. Modified to use
CREATE_DIR_RETRY in 7.49.0 */
my_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,
(long)(config->ftp_create_dirs?
CURLFTP_CREATE_DIR_RETRY:
CURLFTP_CREATE_DIR_NONE));
(long)(config->ftp_create_dirs ?
CURLFTP_CREATE_DIR_RETRY : CURLFTP_CREATE_DIR_NONE));
/* new in curl 7.10.8 */
if(config->max_filesize)
@ -2167,10 +2167,12 @@ static CURLcode single_transfer(struct GlobalConfig *global,
/* curl 7.13.0 */
my_setopt_str(curl, CURLOPT_FTP_ACCOUNT, config->ftp_account);
my_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, config->ignorecl?1L:0L);
my_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, config->ignorecl ?
1L : 0L);
/* curl 7.14.2 */
my_setopt(curl, CURLOPT_FTP_SKIP_PASV_IP, config->ftp_skip_ip?1L:0L);
my_setopt(curl, CURLOPT_FTP_SKIP_PASV_IP, config->ftp_skip_ip ?
1L : 0L);
/* curl 7.15.1 */
if(proto_ftp)

View file

@ -645,7 +645,7 @@ CURLcode glob_match_url(char **result, char *filename, struct URLGlob *glob)
unsigned long i;
num--; /* make it zero based */
/* find the correct glob entry */
for(i = 0; i<glob->size; i++) {
for(i = 0; i < glob->size; i++) {
if(glob->pattern[i].globindex == (int)num) {
pat = &glob->pattern[i];
break;

View file

@ -140,7 +140,7 @@ long tvdiff(struct timeval newer, struct timeval older)
int struplocompare(const char *p1, const char *p2)
{
if(!p1)
return p2? -1: 0;
return p2 ? -1 : 0;
if(!p2)
return 1;
#ifdef HAVE_STRCASECMP

View file

@ -652,7 +652,7 @@ void ourWriteOut(struct OperationConfig *config, struct per_transfer *per,
FILE *stream2;
memcpy(fname, ptr, flen);
fname[flen] = 0;
stream2 = fopen(fname, append? FOPEN_APPENDTEXT :
stream2 = fopen(fname, append ? FOPEN_APPENDTEXT :
FOPEN_WRITETEXT);
if(stream2) {
/* only change if the open worked */

View file

@ -361,7 +361,7 @@ static ParameterError addvariable(struct GlobalConfig *global,
if(p) {
memcpy(p->name, name, nlen);
p->content = contalloc ? content: Memdup(content, clen);
p->content = contalloc ? content : Memdup(content, clen);
if(p->content) {
p->clen = clen;