mirror of
https://github.com/curl/curl.git
synced 2026-08-24 19:03:40 +03:00
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:
parent
a57b45c386
commit
fbf5d507ce
128 changed files with 854 additions and 837 deletions
|
|
@ -127,7 +127,7 @@ char *hexdump(const unsigned char *buffer, size_t len)
|
|||
size_t i;
|
||||
if(len > 200)
|
||||
return NULL;
|
||||
for(i = 0; i<len; i++, p += 3)
|
||||
for(i = 0; i < len; i++, p += 3)
|
||||
msnprintf(p, 4, "%02x ", buffer[i]);
|
||||
return dump;
|
||||
}
|
||||
|
|
@ -157,7 +157,7 @@ int main(int argc, char **argv)
|
|||
setlocale(LC_ALL, "");
|
||||
#endif
|
||||
|
||||
if(argc< 2) {
|
||||
if(argc < 2) {
|
||||
fprintf(stderr, "Pass URL as argument please\n");
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -165,10 +165,10 @@ int main(int argc, char **argv)
|
|||
test_argc = argc;
|
||||
test_argv = argv;
|
||||
|
||||
if(argc>2)
|
||||
if(argc > 2)
|
||||
libtest_arg2 = argv[2];
|
||||
|
||||
if(argc>3)
|
||||
if(argc > 3)
|
||||
libtest_arg3 = argv[3];
|
||||
|
||||
URL = argv[1]; /* provide this to the rest */
|
||||
|
|
|
|||
|
|
@ -90,35 +90,35 @@ static int onetest(CURL *curl, const char *url, const struct testparams *p,
|
|||
unsigned int replyselector;
|
||||
char urlbuf[256];
|
||||
|
||||
replyselector = (p->flags & F_CONTENTRANGE)? 1: 0;
|
||||
replyselector = (p->flags & F_CONTENTRANGE) ? 1: 0;
|
||||
if(p->flags & F_HTTP416)
|
||||
replyselector += 2;
|
||||
msnprintf(urlbuf, sizeof(urlbuf), "%s%04u", url, replyselector);
|
||||
test_setopt(curl, CURLOPT_URL, urlbuf);
|
||||
test_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
test_setopt(curl, CURLOPT_RESUME_FROM, (p->flags & F_RESUME)? 3: 0);
|
||||
test_setopt(curl, CURLOPT_RANGE, !(p->flags & F_RESUME)?
|
||||
test_setopt(curl, CURLOPT_RESUME_FROM, (p->flags & F_RESUME) ? 3: 0);
|
||||
test_setopt(curl, CURLOPT_RANGE, !(p->flags & F_RESUME) ?
|
||||
"3-1000000": (char *) NULL);
|
||||
test_setopt(curl, CURLOPT_FAILONERROR, (p->flags & F_FAIL)? 1: 0);
|
||||
test_setopt(curl, CURLOPT_FAILONERROR, (p->flags & F_FAIL) ? 1: 0);
|
||||
hasbody = 0;
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != p->result) {
|
||||
printf("%zd: bad error code (%d): resume=%s, fail=%s, http416=%s, "
|
||||
"content-range=%s, expected=%d\n", num, res,
|
||||
(p->flags & F_RESUME)? "yes": "no",
|
||||
(p->flags & F_FAIL)? "yes": "no",
|
||||
(p->flags & F_HTTP416)? "yes": "no",
|
||||
(p->flags & F_CONTENTRANGE)? "yes": "no",
|
||||
(p->flags & F_RESUME) ? "yes": "no",
|
||||
(p->flags & F_FAIL) ? "yes": "no",
|
||||
(p->flags & F_HTTP416) ? "yes": "no",
|
||||
(p->flags & F_CONTENTRANGE) ? "yes": "no",
|
||||
p->result);
|
||||
return 1;
|
||||
}
|
||||
if(hasbody && (p->flags & F_IGNOREBODY)) {
|
||||
printf("body should be ignored and is not: resume=%s, fail=%s, "
|
||||
"http416=%s, content-range=%s\n",
|
||||
(p->flags & F_RESUME)? "yes": "no",
|
||||
(p->flags & F_FAIL)? "yes": "no",
|
||||
(p->flags & F_HTTP416)? "yes": "no",
|
||||
(p->flags & F_CONTENTRANGE)? "yes": "no");
|
||||
(p->flags & F_RESUME) ? "yes": "no",
|
||||
(p->flags & F_FAIL) ? "yes": "no",
|
||||
(p->flags & F_HTTP416) ? "yes": "no",
|
||||
(p->flags & F_CONTENTRANGE) ? "yes": "no");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -1769,13 +1769,13 @@ static int huge(void)
|
|||
char *partp;
|
||||
msnprintf(total, sizeof(total),
|
||||
"%s://%s:%s@%s/%s?%s#%s",
|
||||
(i == 0)? &bigpart[1] : smallpart,
|
||||
(i == 1)? &bigpart[1] : smallpart,
|
||||
(i == 2)? &bigpart[1] : smallpart,
|
||||
(i == 3)? &bigpart[1] : smallpart,
|
||||
(i == 4)? &bigpart[1] : smallpart,
|
||||
(i == 5)? &bigpart[1] : smallpart,
|
||||
(i == 6)? &bigpart[1] : smallpart);
|
||||
(i == 0) ? &bigpart[1] : smallpart,
|
||||
(i == 1) ? &bigpart[1] : smallpart,
|
||||
(i == 2) ? &bigpart[1] : smallpart,
|
||||
(i == 3) ? &bigpart[1] : smallpart,
|
||||
(i == 4) ? &bigpart[1] : smallpart,
|
||||
(i == 5) ? &bigpart[1] : smallpart,
|
||||
(i == 6) ? &bigpart[1] : smallpart);
|
||||
rc = curl_url_set(urlp, CURLUPART_URL, total, CURLU_NON_SUPPORT_SCHEME);
|
||||
if((!i && (rc != CURLUE_BAD_SCHEME)) ||
|
||||
(i && rc)) {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ static size_t add_data(struct ws_data *wd, const char *buf, size_t blen,
|
|||
if(wd->nwrites > 0)
|
||||
flush_data(wd);
|
||||
wd->has_meta = (meta != NULL);
|
||||
wd->meta_flags = meta? meta->flags : 0;
|
||||
wd->meta_flags = meta ? meta->flags : 0;
|
||||
}
|
||||
|
||||
if(wd->blen + blen > sizeof(wd->buf)) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ void dump(const char *text,
|
|||
|
||||
fprintf(stream, "%s, %zu bytes (0x%zx)\n", text, size, size);
|
||||
|
||||
for(i = 0; i<size; i += width) {
|
||||
for(i = 0; i < size; i += width) {
|
||||
|
||||
fprintf(stream, "%04zx: ", i);
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ void dump(const char *text,
|
|||
break;
|
||||
}
|
||||
fprintf(stream, "%c",
|
||||
(ptr[i + c] >= 0x20) && (ptr[i + c]<0x80)? ptr[i + c] : '.');
|
||||
(ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.');
|
||||
/* check again for 0D0A, to avoid an extra \n if it's at width */
|
||||
if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
|
||||
ptr[i + c + 2] == 0x0A) {
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ static int test_unsigned_short_formatting(void)
|
|||
|
||||
for(i = 1; i <= num_ushort_tests; i++) {
|
||||
|
||||
for(j = 0; j<BUFSZ; j++)
|
||||
for(j = 0; j < BUFSZ; j++)
|
||||
us_test[i].result[j] = 'X';
|
||||
us_test[i].result[BUFSZ-1] = '\0';
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ static int test_signed_short_formatting(void)
|
|||
|
||||
for(i = 1; i <= num_sshort_tests; i++) {
|
||||
|
||||
for(j = 0; j<BUFSZ; j++)
|
||||
for(j = 0; j < BUFSZ; j++)
|
||||
ss_test[i].result[j] = 'X';
|
||||
ss_test[i].result[BUFSZ-1] = '\0';
|
||||
|
||||
|
|
@ -374,7 +374,7 @@ static int test_unsigned_int_formatting(void)
|
|||
|
||||
for(i = 1; i <= num_uint_tests; i++) {
|
||||
|
||||
for(j = 0; j<BUFSZ; j++)
|
||||
for(j = 0; j < BUFSZ; j++)
|
||||
ui_test[i].result[j] = 'X';
|
||||
ui_test[i].result[BUFSZ-1] = '\0';
|
||||
|
||||
|
|
@ -602,7 +602,7 @@ static int test_signed_int_formatting(void)
|
|||
|
||||
for(i = 1; i <= num_sint_tests; i++) {
|
||||
|
||||
for(j = 0; j<BUFSZ; j++)
|
||||
for(j = 0; j < BUFSZ; j++)
|
||||
si_test[i].result[j] = 'X';
|
||||
si_test[i].result[BUFSZ-1] = '\0';
|
||||
|
||||
|
|
@ -751,7 +751,7 @@ static int test_unsigned_long_formatting(void)
|
|||
|
||||
for(i = 1; i <= num_ulong_tests; i++) {
|
||||
|
||||
for(j = 0; j<BUFSZ; j++)
|
||||
for(j = 0; j < BUFSZ; j++)
|
||||
ul_test[i].result[j] = 'X';
|
||||
ul_test[i].result[BUFSZ-1] = '\0';
|
||||
|
||||
|
|
@ -979,7 +979,7 @@ static int test_signed_long_formatting(void)
|
|||
|
||||
for(i = 1; i <= num_slong_tests; i++) {
|
||||
|
||||
for(j = 0; j<BUFSZ; j++)
|
||||
for(j = 0; j < BUFSZ; j++)
|
||||
sl_test[i].result[j] = 'X';
|
||||
sl_test[i].result[BUFSZ-1] = '\0';
|
||||
|
||||
|
|
@ -1093,7 +1093,7 @@ static int test_curl_off_t_formatting(void)
|
|||
|
||||
for(i = 1; i <= num_cofft_tests; i++) {
|
||||
|
||||
for(j = 0; j<BUFSZ; j++)
|
||||
for(j = 0; j < BUFSZ; j++)
|
||||
co_test[i].result[j] = 'X';
|
||||
co_test[i].result[BUFSZ-1] = '\0';
|
||||
|
||||
|
|
@ -1389,7 +1389,7 @@ static int test_float_formatting(void)
|
|||
/* very large precisions easily turn into system specific outputs so we only
|
||||
check the output buffer length here as we know the internal limit */
|
||||
|
||||
curl_msnprintf(buf, sizeof(buf), "%.*f", (1<<30), 9.2987654);
|
||||
curl_msnprintf(buf, sizeof(buf), "%.*f", (1 << 30), 9.2987654);
|
||||
errors += strlen_check(buf, 325);
|
||||
|
||||
curl_msnprintf(buf, sizeof(buf), "%10000.10000f", 9.2987654);
|
||||
|
|
@ -1406,7 +1406,7 @@ static int test_float_formatting(void)
|
|||
|
||||
/* curl_msnprintf() limits a single float output to 325 bytes maximum
|
||||
width */
|
||||
curl_msnprintf(buf, sizeof(buf), "%*f", (1<<30), 9.1);
|
||||
curl_msnprintf(buf, sizeof(buf), "%*f", (1 << 30), 9.1);
|
||||
errors += string_check(buf, " 9.100000");
|
||||
curl_msnprintf(buf, sizeof(buf), "%100000f", 9.1);
|
||||
errors += string_check(buf, " 9.100000");
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
|
|||
return CURL_READFUNC_PAUSE;
|
||||
case 2:
|
||||
delta = time(NULL) - pooh->origin;
|
||||
*ptr = delta >= PAUSE_TIME? '\x42': '\x41'; /* ASCII A or B. */
|
||||
*ptr = delta >= PAUSE_TIME ? '\x42': '\x41'; /* ASCII A or B. */
|
||||
return 1;
|
||||
case 3:
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue