mirror of
https://github.com/curl/curl.git
synced 2026-08-25 02:33:31 +03:00
tidy-up: use uppercase TRUE/FALSE where missing
Keep it only in external API calls and C++ code. Also: - curlx/fopen: replace with `!!`. Spotted by GitHub Code Quality in cf-socket.c. Closes #21925
This commit is contained in:
parent
9dcc57b801
commit
847aac066d
23 changed files with 90 additions and 91 deletions
|
|
@ -125,12 +125,12 @@ static size_t win_console(intptr_t fhnd, struct OutStruct *outs,
|
|||
/* attempt to complete an incomplete UTF-8 sequence from previous call. the
|
||||
sequence does not have to be well-formed. */
|
||||
if(outs->utf8seq[0] && rlen) {
|
||||
bool complete = false;
|
||||
bool complete = FALSE;
|
||||
/* two byte sequence (lead byte 110yyyyy) */
|
||||
if(0xC0 <= outs->utf8seq[0] && outs->utf8seq[0] < 0xE0) {
|
||||
outs->utf8seq[1] = *rbuf++;
|
||||
--rlen;
|
||||
complete = true;
|
||||
complete = TRUE;
|
||||
}
|
||||
/* three byte sequence (lead byte 1110zzzz) */
|
||||
else if(0xE0 <= outs->utf8seq[0] && outs->utf8seq[0] < 0xF0) {
|
||||
|
|
@ -141,7 +141,7 @@ static size_t win_console(intptr_t fhnd, struct OutStruct *outs,
|
|||
if(rlen && !outs->utf8seq[2]) {
|
||||
outs->utf8seq[2] = *rbuf++;
|
||||
--rlen;
|
||||
complete = true;
|
||||
complete = TRUE;
|
||||
}
|
||||
}
|
||||
/* four byte sequence (lead byte 11110uuu) */
|
||||
|
|
@ -157,7 +157,7 @@ static size_t win_console(intptr_t fhnd, struct OutStruct *outs,
|
|||
if(rlen && !outs->utf8seq[3]) {
|
||||
outs->utf8seq[3] = *rbuf++;
|
||||
--rlen;
|
||||
complete = true;
|
||||
complete = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -678,7 +678,7 @@ static void init_terminal(void)
|
|||
return;
|
||||
|
||||
if((TerminalSettings.dwOutputMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING))
|
||||
tool_term_has_bold = true;
|
||||
tool_term_has_bold = TRUE;
|
||||
else {
|
||||
/* The signal handler is set before attempting to change the console mode
|
||||
because otherwise a signal would not be caught after the change but
|
||||
|
|
@ -688,7 +688,7 @@ static void init_terminal(void)
|
|||
if(SetConsoleMode(TerminalSettings.hStdOut,
|
||||
(TerminalSettings.dwOutputMode |
|
||||
ENABLE_VIRTUAL_TERMINAL_PROCESSING))) {
|
||||
tool_term_has_bold = true;
|
||||
tool_term_has_bold = TRUE;
|
||||
atexit(restore_terminal);
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ static int writeTime(FILE *stream, const struct writeoutvar *wovar,
|
|||
struct per_transfer *per, CURLcode per_result,
|
||||
bool use_json)
|
||||
{
|
||||
bool valid = false;
|
||||
bool valid = FALSE;
|
||||
curl_off_t us = 0;
|
||||
|
||||
(void)per;
|
||||
|
|
@ -54,7 +54,7 @@ static int writeTime(FILE *stream, const struct writeoutvar *wovar,
|
|||
|
||||
if(wovar->ci) {
|
||||
if(!curl_easy_getinfo(per->curl, wovar->ci, &us))
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
}
|
||||
else {
|
||||
DEBUGASSERT(0);
|
||||
|
|
@ -173,7 +173,7 @@ static int writeString(FILE *stream, const struct writeoutvar *wovar,
|
|||
struct per_transfer *per, CURLcode per_result,
|
||||
bool use_json)
|
||||
{
|
||||
bool valid = false;
|
||||
bool valid = FALSE;
|
||||
const char *strinfo = NULL;
|
||||
const char *freestr = NULL;
|
||||
struct dynbuf buf;
|
||||
|
|
@ -189,7 +189,7 @@ static int writeString(FILE *stream, const struct writeoutvar *wovar,
|
|||
while(m->str) {
|
||||
if(m->num == version) {
|
||||
strinfo = m->str;
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
break;
|
||||
}
|
||||
m++;
|
||||
|
|
@ -198,7 +198,7 @@ static int writeString(FILE *stream, const struct writeoutvar *wovar,
|
|||
}
|
||||
else {
|
||||
if(!curl_easy_getinfo(per->curl, wovar->ci, &strinfo) && strinfo)
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -243,7 +243,7 @@ static int writeString(FILE *stream, const struct writeoutvar *wovar,
|
|||
if(!strinfo)
|
||||
/* maybe not a TLS protocol */
|
||||
strinfo = "";
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -253,19 +253,19 @@ static int writeString(FILE *stream, const struct writeoutvar *wovar,
|
|||
if(per_result) {
|
||||
strinfo = (per->errorbuffer[0]) ? per->errorbuffer :
|
||||
curl_easy_strerror(per_result);
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
}
|
||||
break;
|
||||
case VAR_EFFECTIVE_FILENAME:
|
||||
if(per->outs.filename) {
|
||||
strinfo = per->outs.filename;
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
}
|
||||
break;
|
||||
case VAR_INPUT_URL:
|
||||
if(per->url) {
|
||||
strinfo = per->url;
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
}
|
||||
break;
|
||||
case VAR_INPUT_URLSCHEME:
|
||||
|
|
@ -291,7 +291,7 @@ static int writeString(FILE *stream, const struct writeoutvar *wovar,
|
|||
if(per->url) {
|
||||
if(!urlpart(per, wovar->id, &strinfo)) {
|
||||
freestr = strinfo;
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -324,33 +324,33 @@ static int writeLong(FILE *stream, const struct writeoutvar *wovar,
|
|||
struct per_transfer *per, CURLcode per_result,
|
||||
bool use_json)
|
||||
{
|
||||
bool valid = false;
|
||||
bool valid = FALSE;
|
||||
long longinfo = 0;
|
||||
|
||||
DEBUGASSERT(wovar->writefunc == writeLong);
|
||||
|
||||
if(wovar->ci) {
|
||||
if(!curl_easy_getinfo(per->curl, wovar->ci, &longinfo))
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
}
|
||||
else {
|
||||
switch(wovar->id) {
|
||||
case VAR_NUM_RETRY:
|
||||
longinfo = per->num_retries;
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
break;
|
||||
case VAR_NUM_CERTS:
|
||||
certinfo(per);
|
||||
longinfo = per->certinfo ? per->certinfo->num_of_certs : 0;
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
break;
|
||||
case VAR_NUM_HEADERS:
|
||||
longinfo = per->num_headers;
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
break;
|
||||
case VAR_EXITCODE:
|
||||
longinfo = (long)per_result;
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
break;
|
||||
default:
|
||||
DEBUGASSERT(0);
|
||||
|
|
@ -380,7 +380,7 @@ static int writeOffset(FILE *stream, const struct writeoutvar *wovar,
|
|||
struct per_transfer *per, CURLcode per_result,
|
||||
bool use_json)
|
||||
{
|
||||
bool valid = false;
|
||||
bool valid = FALSE;
|
||||
curl_off_t offinfo = 0;
|
||||
|
||||
(void)per;
|
||||
|
|
@ -389,14 +389,14 @@ static int writeOffset(FILE *stream, const struct writeoutvar *wovar,
|
|||
|
||||
if(wovar->ci) {
|
||||
if(!curl_easy_getinfo(per->curl, wovar->ci, &offinfo))
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
}
|
||||
else {
|
||||
switch(wovar->id) {
|
||||
case VAR_URLNUM:
|
||||
if(per->urlnum <= INT_MAX) {
|
||||
offinfo = per->urlnum;
|
||||
valid = true;
|
||||
valid = TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -787,7 +787,7 @@ void ourWriteOut(struct OperationConfig *config, struct per_transfer *per,
|
|||
headerJSON(stream, per);
|
||||
break;
|
||||
default:
|
||||
(void)wv->writefunc(stream, wv, per, per_result, false);
|
||||
(void)wv->writefunc(stream, wv, per, per_result, FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ void ourWriteOutJSON(FILE *stream, const struct writeoutvar mappings[],
|
|||
|
||||
for(i = 0; i < nentries; i++) {
|
||||
if(mappings[i].writefunc &&
|
||||
mappings[i].writefunc(stream, &mappings[i], per, per_result, true))
|
||||
mappings[i].writefunc(stream, &mappings[i], per, per_result, TRUE))
|
||||
fputs(",", stream);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ ParameterError varexpand(const char *line, struct dynbuf *out, bool *replaced)
|
|||
if(result)
|
||||
return PARAM_NO_MEM;
|
||||
|
||||
added = true;
|
||||
added = TRUE;
|
||||
}
|
||||
}
|
||||
line = &clp[2];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue