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

@ -180,31 +180,31 @@ int main(int argc, char *argv[])
/* check for bytes downloaded */
res = curl_easy_getinfo(curl_handle, CURLINFO_SIZE_DOWNLOAD_T, &val);
if((CURLE_OK == res) && (val>0))
if((CURLE_OK == res) && (val > 0))
printf("Data downloaded: %lu bytes.\n", (unsigned long)val);
/* check for total download time */
res = curl_easy_getinfo(curl_handle, CURLINFO_TOTAL_TIME_T, &val);
if((CURLE_OK == res) && (val>0))
if((CURLE_OK == res) && (val > 0))
printf("Total download time: %lu.%06lu sec.\n",
(unsigned long)(val / 1000000), (unsigned long)(val % 1000000));
/* check for average download speed */
res = curl_easy_getinfo(curl_handle, CURLINFO_SPEED_DOWNLOAD_T, &val);
if((CURLE_OK == res) && (val>0))
if((CURLE_OK == res) && (val > 0))
printf("Average download speed: %lu kbyte/sec.\n",
(unsigned long)(val / 1024));
if(prtall) {
/* check for name resolution time */
res = curl_easy_getinfo(curl_handle, CURLINFO_NAMELOOKUP_TIME_T, &val);
if((CURLE_OK == res) && (val>0))
if((CURLE_OK == res) && (val > 0))
printf("Name lookup time: %lu.%06lu sec.\n",
(unsigned long)(val / 1000000), (unsigned long)(val % 1000000));
/* check for connect time */
res = curl_easy_getinfo(curl_handle, CURLINFO_CONNECT_TIME_T, &val);
if((CURLE_OK == res) && (val>0))
if((CURLE_OK == res) && (val > 0))
printf("Connect time: %lu.%06lu sec.\n",
(unsigned long)(val / 1000000), (unsigned long)(val % 1000000));
}

View file

@ -49,7 +49,7 @@ void dump(const char *text,
fprintf(stream, "%s, %10.10lu bytes (0x%8.8lx)\n",
text, (unsigned long)size, (unsigned long)size);
for(i = 0; i<size; i += width) {
for(i = 0; i < size; i += width) {
fprintf(stream, "%4.4lx: ", (unsigned long)i);
@ -70,7 +70,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) {

View file

@ -74,7 +74,7 @@ int main(void)
}
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
&filesize);
if((CURLE_OK == res) && (filesize>0))
if((CURLE_OK == res) && (filesize > 0))
printf("filesize %s: %" CURL_FORMAT_CURL_OFF_T " bytes\n",
filename, filesize);
}

View file

@ -311,7 +311,7 @@ static void new_conn(char *url, GlobalInfo *g)
curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, (long)SHOW_VERBOSE);
curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error);
curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn);
curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, SHOW_PROGRESS?0L:1L);
curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, SHOW_PROGRESS ? 0L : 1L);
curl_easy_setopt(conn->easy, CURLOPT_PROGRESSFUNCTION, prog_cb);
curl_easy_setopt(conn->easy, CURLOPT_PROGRESSDATA, conn);
curl_easy_setopt(conn->easy, CURLOPT_FOLLOWLOCATION, 1L);

View file

@ -56,8 +56,8 @@ void dumpNode(TidyDoc doc, TidyNode tnod, int indent)
/* walk the attribute list */
for(attr = tidyAttrFirst(child); attr; attr = tidyAttrNext(attr) ) {
printf("%s", tidyAttrName(attr));
tidyAttrValue(attr)?printf("=\"%s\" ",
tidyAttrValue(attr)):printf(" ");
tidyAttrValue(attr) ? printf("=\"%s\" ",
tidyAttrValue(attr)) : printf(" ");
}
printf(">\n");
}
@ -66,7 +66,7 @@ void dumpNode(TidyDoc doc, TidyNode tnod, int indent)
TidyBuffer buf;
tidyBufInit(&buf);
tidyNodeGetText(doc, child, &buf);
printf("%*.*s\n", indent, indent, buf.bp?(char *)buf.bp:"");
printf("%*.*s\n", indent, indent, buf.bp ? (char *)buf.bp : "");
tidyBufFree(&buf);
}
dumpNode(doc, child, indent + 4); /* recursive */

View file

@ -65,7 +65,7 @@ void dump(const char *text, unsigned int num, unsigned char *ptr, size_t size,
fprintf(stderr, "%u %s, %lu bytes (0x%lx)\n",
num, text, (unsigned long)size, (unsigned long)size);
for(i = 0; i<size; i += width) {
for(i = 0; i < size; i += width) {
fprintf(stderr, "%4.4lx: ", (unsigned long)i);
@ -86,7 +86,7 @@ void dump(const char *text, unsigned int num, unsigned char *ptr, size_t size,
break;
}
fprintf(stderr, "%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) {

View file

@ -52,7 +52,7 @@ void dump(const char *text, unsigned char *ptr, size_t size,
fprintf(stderr, "%s, %lu bytes (0x%lx)\n",
text, (unsigned long)size, (unsigned long)size);
for(i = 0; i<size; i += width) {
for(i = 0; i < size; i += width) {
fprintf(stderr, "%4.4lx: ", (unsigned long)i);
@ -73,7 +73,7 @@ void dump(const char *text, unsigned char *ptr, size_t size,
break;
}
fprintf(stderr, "%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) {
@ -188,7 +188,7 @@ static int server_push_callback(CURL *parent,
fprintf(stderr, "**** push callback approves stream %u, got %lu headers!\n",
count, (unsigned long)num_headers);
for(i = 0; i<num_headers; i++) {
for(i = 0; i < num_headers; i++) {
headp = curl_pushheader_bynum(headers, i);
fprintf(stderr, "**** header %lu: %s\n", (unsigned long)i, headp);
}

View file

@ -93,7 +93,7 @@ void dump(const char *text, int num, unsigned char *ptr, size_t size,
fprintf(stderr, "%d %s, %lu bytes (0x%lx)\n",
num, text, (unsigned long)size, (unsigned long)size);
for(i = 0; i<size; i += width) {
for(i = 0; i < size; i += width) {
fprintf(stderr, "%4.4lx: ", (unsigned long)i);
@ -114,7 +114,7 @@ void dump(const char *text, int num, unsigned char *ptr, size_t size,
break;
}
fprintf(stderr, "%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) {
@ -290,7 +290,7 @@ int main(int argc, char **argv)
/* init a multi stack */
multi_handle = curl_multi_init();
for(i = 0; i<num_transfers; i++) {
for(i = 0; i < num_transfers; i++) {
setup(&trans[i], i, filename);
/* add the individual transfer */
@ -316,7 +316,7 @@ int main(int argc, char **argv)
curl_multi_cleanup(multi_handle);
for(i = 0; i<num_transfers; i++) {
for(i = 0; i < num_transfers; i++) {
curl_multi_remove_handle(multi_handle, trans[i].hnd);
curl_easy_cleanup(trans[i].hnd);
}

View file

@ -53,7 +53,7 @@ int main(void)
int msgs_left; /* how many messages are left */
/* Allocate one CURL handle per transfer */
for(i = 0; i<HANDLECOUNT; i++)
for(i = 0; i < HANDLECOUNT; i++)
handles[i] = curl_easy_init();
/* set the options (I left out a few, you get the point anyway) */
@ -66,7 +66,7 @@ int main(void)
multi_handle = curl_multi_init();
/* add the individual transfers */
for(i = 0; i<HANDLECOUNT; i++)
for(i = 0; i < HANDLECOUNT; i++)
curl_multi_add_handle(multi_handle, handles[i]);
while(still_running) {
@ -86,7 +86,7 @@ int main(void)
int idx;
/* Find out which handle this message is about */
for(idx = 0; idx<HANDLECOUNT; idx++) {
for(idx = 0; idx < HANDLECOUNT; idx++) {
int found = (msg->easy_handle == handles[idx]);
if(found)
break;
@ -104,7 +104,7 @@ int main(void)
}
/* remove the transfers and cleanup the handles */
for(i = 0; i<HANDLECOUNT; i++) {
for(i = 0; i < HANDLECOUNT; i++) {
curl_multi_remove_handle(multi_handle, handles[i]);
curl_easy_cleanup(handles[i]);
}

View file

@ -49,7 +49,7 @@ static void dump(const char *text, FILE *stream, unsigned char *ptr,
fprintf(stream, "%s, %10.10lu bytes (0x%8.8lx)\n",
text, (unsigned long)size, (unsigned long)size);
for(i = 0; i<size; i += width) {
for(i = 0; i < size; i += width) {
fprintf(stream, "%4.4lx: ", (unsigned long)i);
@ -70,7 +70,7 @@ static void dump(const char *text, FILE *stream, unsigned char *ptr,
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) {

View file

@ -59,7 +59,7 @@ int main(void)
int msgs_left; /* how many messages are left */
/* Allocate one CURL handle per transfer */
for(i = 0; i<HANDLECOUNT; i++)
for(i = 0; i < HANDLECOUNT; i++)
handles[i] = curl_easy_init();
/* set the options (I left out a few, you get the point anyway) */
@ -72,7 +72,7 @@ int main(void)
multi_handle = curl_multi_init();
/* add the individual transfers */
for(i = 0; i<HANDLECOUNT; i++)
for(i = 0; i < HANDLECOUNT; i++)
curl_multi_add_handle(multi_handle, handles[i]);
/* we start some action by calling perform right away */
@ -155,7 +155,7 @@ int main(void)
int idx;
/* Find out which handle this message is about */
for(idx = 0; idx<HANDLECOUNT; idx++) {
for(idx = 0; idx < HANDLECOUNT; idx++) {
int found = (msg->easy_handle == handles[idx]);
if(found)
break;
@ -175,7 +175,7 @@ int main(void)
curl_multi_cleanup(multi_handle);
/* Free the CURL handles */
for(i = 0; i<HANDLECOUNT; i++)
for(i = 0; i < HANDLECOUNT; i++)
curl_easy_cleanup(handles[i]);
return 0;

View file

@ -75,7 +75,7 @@ int main(int argc, char **argv)
/* Must initialize libcurl before any threads are started */
curl_global_init(CURL_GLOBAL_ALL);
for(i = 0; i< NUMT; i++) {
for(i = 0; i < NUMT; i++) {
int error = pthread_create(&tid[i],
NULL, /* default attributes please */
pull_one_url,
@ -87,7 +87,7 @@ int main(int argc, char **argv)
}
/* now wait for all threads to terminate */
for(i = 0; i< NUMT; i++) {
for(i = 0; i < NUMT; i++) {
pthread_join(tid[i], NULL);
fprintf(stderr, "Thread %d terminated\n", i);
}

View file

@ -165,7 +165,7 @@ size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
if(RetVal == 7) {
int i;
SYSTime.wMilliseconds = 500; /* adjust to midpoint, 0.5 sec */
for(i = 0; i<12; i++) {
for(i = 0; i < 12; i++) {
if(strcmp(MthStr[i], TmpStr2) == 0) {
SYSTime.wMonth = i + 1;
break;
@ -250,7 +250,7 @@ int conf_init(conf_t *conf)
int i;
*conf->http_proxy = 0;
for(i = 0; i<MAX_STRING1; i++)
for(i = 0; i < MAX_STRING1; i++)
conf->proxy_user[i] = 0; /* Clean up password from memory */
*conf->timeserver = 0;
return 1;

View file

@ -78,7 +78,7 @@ int main(int argc, char **argv)
/* Must initialize libcurl before any threads are started */
curl_global_init(CURL_GLOBAL_ALL);
for(i = 0; i< NUMT; i++) {
for(i = 0; i < NUMT; i++) {
int error = pthread_create(&tid[i],
NULL, /* default attributes please */
pull_one_url,
@ -90,7 +90,7 @@ int main(int argc, char **argv)
}
/* now wait for all threads to terminate */
for(i = 0; i< NUMT; i++) {
for(i = 0; i < NUMT; i++) {
pthread_join(tid[i], NULL);
fprintf(stderr, "Thread %d terminated\n", i);
}