mirror of
https://github.com/curl/curl.git
synced 2026-08-25 17:53:43 +03:00
tidy-up: more whitespace/indent, comments
Also a couple of minor formatting updates in the root `CMakeLists.txt`. One swap to `#ifdef`. Closes #17929
This commit is contained in:
parent
63a8167f3e
commit
4d977fe552
82 changed files with 351 additions and 378 deletions
|
|
@ -71,12 +71,12 @@ static const struct testparams testparams[] = {
|
|||
CURLE_OK }
|
||||
};
|
||||
|
||||
static int hasbody;
|
||||
static int hasbody;
|
||||
|
||||
static size_t writedata(char *data, size_t size, size_t nmemb, void *userdata)
|
||||
{
|
||||
(void) data;
|
||||
(void) userdata;
|
||||
(void)data;
|
||||
(void)userdata;
|
||||
|
||||
if(size && nmemb)
|
||||
hasbody = 1;
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ static int sockopt_callback(void *clientp, curl_socket_t curlfd,
|
|||
{
|
||||
#if defined(SOL_SOCKET) && defined(SO_SNDBUF)
|
||||
int sndbufsize = 4 * 1024; /* 4KB send buffer */
|
||||
(void) clientp;
|
||||
(void) purpose;
|
||||
(void)clientp;
|
||||
(void)purpose;
|
||||
setsockopt(curlfd, SOL_SOCKET, SO_SNDBUF,
|
||||
(char *)&sndbufsize, sizeof(sndbufsize));
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ static CURLcode test_lib3026(char *URL)
|
|||
unsigned tid_count = NUM_THREADS, i;
|
||||
CURLcode test_failure = CURLE_OK;
|
||||
curl_version_info_data *ver;
|
||||
(void) URL;
|
||||
(void)URL;
|
||||
|
||||
ver = curl_version_info(CURLVERSION_NOW);
|
||||
if((ver->features & CURL_VERSION_THREADSAFE) == 0) {
|
||||
|
|
@ -118,7 +118,7 @@ static CURLcode test_lib3026(char *URL)
|
|||
unsigned tid_count = NUM_THREADS, i;
|
||||
CURLcode test_failure = CURLE_OK;
|
||||
curl_version_info_data *ver;
|
||||
(void) URL;
|
||||
(void)URL;
|
||||
|
||||
ver = curl_version_info(CURLVERSION_NOW);
|
||||
if((ver->features & CURL_VERSION_THREADSAFE) == 0) {
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ static void execute(CURLSH *share, struct Ctx *ctx)
|
|||
static void execute(CURLSH *share, struct Ctx *ctx)
|
||||
{
|
||||
size_t i;
|
||||
(void) share;
|
||||
(void)share;
|
||||
for(i = 0; i < THREAD_SIZE; i++) {
|
||||
test_thread((void *)&ctx[i]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ static size_t count_chars(void *userp, const char *buf, size_t len)
|
|||
{
|
||||
size_t *pcounter = (size_t *) userp;
|
||||
|
||||
(void) buf;
|
||||
(void)buf;
|
||||
*pcounter += len;
|
||||
return len;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ static size_t t668_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
|
|||
struct t668_WriteThis *pooh = (struct t668_WriteThis *)userp;
|
||||
size_t len = strlen(pooh->readptr);
|
||||
|
||||
(void) size; /* Always 1.*/
|
||||
(void)size; /* Always 1.*/
|
||||
|
||||
if(len > nmemb)
|
||||
len = nmemb;
|
||||
|
|
|
|||
|
|
@ -65,10 +65,10 @@ static int t670_xferinfo(void *clientp,
|
|||
{
|
||||
struct t670_ReadThis *pooh = (struct t670_ReadThis *) clientp;
|
||||
|
||||
(void) dltotal;
|
||||
(void) dlnow;
|
||||
(void) ultotal;
|
||||
(void) ulnow;
|
||||
(void)dltotal;
|
||||
(void)dlnow;
|
||||
(void)ultotal;
|
||||
(void)ulnow;
|
||||
|
||||
if(pooh->origin) {
|
||||
time_t delta = time(NULL) - pooh->origin;
|
||||
|
|
|
|||
|
|
@ -76,10 +76,10 @@ static CURLcode test_cert_blob(const char *url, const char *cafile)
|
|||
}
|
||||
|
||||
if(loadfile(cafile, &certdata, &certsize)) {
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, "CURLOPT_CAINFO_BLOB");
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, "CURLOPT_CAINFO_BLOB");
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS,
|
||||
(long)CURLSSLOPT_REVOKE_BEST_EFFORT);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@
|
|||
/* write callback that does nothing */
|
||||
static size_t write_it(char *ptr, size_t size, size_t nmemb, void *userdata)
|
||||
{
|
||||
(void) ptr;
|
||||
(void) userdata;
|
||||
(void)ptr;
|
||||
(void)userdata;
|
||||
return size * nmemb;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -865,18 +865,18 @@ sub checksystemfeatures {
|
|||
}
|
||||
|
||||
# display summary information about curl and the test host
|
||||
logmsg ("********* System characteristics ******** \n",
|
||||
"* $curl\n",
|
||||
"* $libcurl\n",
|
||||
"* Protocols: $proto\n",
|
||||
"* Features: $feat\n",
|
||||
"* Disabled: $dis\n",
|
||||
"* Host: $hostname\n",
|
||||
"* System: $hosttype\n",
|
||||
"* OS: $hostos\n",
|
||||
"* Perl: $^V ($^X)\n",
|
||||
"* diff: $havediff\n",
|
||||
"* Args: $args\n");
|
||||
logmsg("********* System characteristics ******** \n",
|
||||
"* $curl\n",
|
||||
"* $libcurl\n",
|
||||
"* Protocols: $proto\n",
|
||||
"* Features: $feat\n",
|
||||
"* Disabled: $dis\n",
|
||||
"* Host: $hostname\n",
|
||||
"* System: $hosttype\n",
|
||||
"* OS: $hostos\n",
|
||||
"* Perl: $^V ($^X)\n",
|
||||
"* diff: $havediff\n",
|
||||
"* Args: $args\n");
|
||||
|
||||
if($jobs) {
|
||||
# Only show if not the default for now
|
||||
|
|
@ -895,7 +895,7 @@ sub checksystemfeatures {
|
|||
$run_event_based?"event-based ":"",
|
||||
$nghttpx_h3);
|
||||
logmsg sprintf("%s\n", $libtool?"Libtool ":"");
|
||||
logmsg ("* Seed: $randseed\n");
|
||||
logmsg "* Seed: $randseed\n";
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
|
|
|
|||
|
|
@ -619,7 +619,6 @@ static int test_dnsd(int argc, char **argv)
|
|||
}
|
||||
|
||||
logmsg("end of one transfer");
|
||||
|
||||
}
|
||||
|
||||
dnsd_cleanup:
|
||||
|
|
|
|||
|
|
@ -228,11 +228,8 @@ static int disconnect(FILE *dump, curl_socket_t fd)
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
do
|
||||
|
||||
encodedByte = X MOD 128
|
||||
|
||||
X = X DIV 128
|
||||
|
|
|
|||
|
|
@ -120,22 +120,22 @@ static const char *docbadconnect =
|
|||
|
||||
/* send back this on HTTP 404 file not found */
|
||||
static const char *doc404_HTTP = "HTTP/1.1 404 Not Found\r\n"
|
||||
"Server: " RTSPDVERSION "\r\n"
|
||||
"Connection: close\r\n"
|
||||
"Content-Type: text/html"
|
||||
END_OF_HEADERS
|
||||
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
|
||||
"<HTML><HEAD>\n"
|
||||
"<TITLE>404 Not Found</TITLE>\n"
|
||||
"</HEAD><BODY>\n"
|
||||
"<H1>Not Found</H1>\n"
|
||||
"The requested URL was not found on this server.\n"
|
||||
"<P><HR><ADDRESS>" RTSPDVERSION "</ADDRESS>\n" "</BODY></HTML>\n";
|
||||
"Server: " RTSPDVERSION "\r\n"
|
||||
"Connection: close\r\n"
|
||||
"Content-Type: text/html"
|
||||
END_OF_HEADERS
|
||||
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
|
||||
"<HTML><HEAD>\n"
|
||||
"<TITLE>404 Not Found</TITLE>\n"
|
||||
"</HEAD><BODY>\n"
|
||||
"<H1>Not Found</H1>\n"
|
||||
"The requested URL was not found on this server.\n"
|
||||
"<P><HR><ADDRESS>" RTSPDVERSION "</ADDRESS>\n" "</BODY></HTML>\n";
|
||||
|
||||
/* send back this on RTSP 404 file not found */
|
||||
static const char *doc404_RTSP = "RTSP/1.0 404 Not Found\r\n"
|
||||
"Server: " RTSPDVERSION
|
||||
END_OF_HEADERS;
|
||||
"Server: " RTSPDVERSION
|
||||
END_OF_HEADERS;
|
||||
|
||||
/* Default size to send away fake RTP data */
|
||||
#define RTP_DATA_SIZE 12
|
||||
|
|
|
|||
|
|
@ -143,17 +143,17 @@ static const char *docquit_sws =
|
|||
|
||||
/* send back this on 404 file not found */
|
||||
static const char *doc404 = "HTTP/1.1 404 Not Found\r\n"
|
||||
"Server: " SWSVERSION "\r\n"
|
||||
"Connection: close\r\n"
|
||||
"Content-Type: text/html"
|
||||
END_OF_HEADERS
|
||||
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
|
||||
"<HTML><HEAD>\n"
|
||||
"<TITLE>404 Not Found</TITLE>\n"
|
||||
"</HEAD><BODY>\n"
|
||||
"<H1>Not Found</H1>\n"
|
||||
"The requested URL was not found on this server.\n"
|
||||
"<P><HR><ADDRESS>" SWSVERSION "</ADDRESS>\n" "</BODY></HTML>\n";
|
||||
"Server: " SWSVERSION "\r\n"
|
||||
"Connection: close\r\n"
|
||||
"Content-Type: text/html"
|
||||
END_OF_HEADERS
|
||||
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
|
||||
"<HTML><HEAD>\n"
|
||||
"<TITLE>404 Not Found</TITLE>\n"
|
||||
"</HEAD><BODY>\n"
|
||||
"<H1>Not Found</H1>\n"
|
||||
"The requested URL was not found on this server.\n"
|
||||
"<P><HR><ADDRESS>" SWSVERSION "</ADDRESS>\n" "</BODY></HTML>\n";
|
||||
|
||||
/* work around for handling trailing headers */
|
||||
static int already_recv_zeroed_chunk = FALSE;
|
||||
|
|
@ -405,7 +405,6 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
|
|||
logmsg("No test number in path");
|
||||
req->testno = DOCNUMBER_NOTHING;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(req->testno == DOCNUMBER_NOTHING) {
|
||||
|
|
|
|||
|
|
@ -510,13 +510,13 @@ static int synchnet(curl_socket_t f /* socket to flush */)
|
|||
for(;;) {
|
||||
#if defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO)
|
||||
long i;
|
||||
(void) IoctlSocket(f, FIONBIO, &i);
|
||||
(void)IoctlSocket(f, FIONBIO, &i);
|
||||
#elif defined(HAVE_IOCTLSOCKET)
|
||||
unsigned long i;
|
||||
(void) ioctlsocket(f, FIONREAD, &i);
|
||||
(void)ioctlsocket(f, FIONREAD, &i);
|
||||
#else
|
||||
int i;
|
||||
(void) ioctl(f, FIONREAD, &i);
|
||||
(void)ioctl(f, FIONREAD, &i);
|
||||
#endif
|
||||
if(i) {
|
||||
j++;
|
||||
|
|
@ -528,8 +528,8 @@ static int synchnet(curl_socket_t f /* socket to flush */)
|
|||
else
|
||||
fromaddrlen = sizeof(fromaddr.sa6);
|
||||
#endif
|
||||
(void) recvfrom(f, rbuf, sizeof(rbuf), 0,
|
||||
&fromaddr.sa, &fromaddrlen);
|
||||
(void)recvfrom(f, rbuf, sizeof(rbuf), 0,
|
||||
&fromaddr.sa, &fromaddrlen);
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
|
@ -1179,7 +1179,7 @@ static void sendtftp(struct testcase *test, const struct formats *pf)
|
|||
sdp->th_block = htons(sendblock);
|
||||
timeout = 0;
|
||||
#ifdef HAVE_SIGSETJMP
|
||||
(void) sigsetjmp(timeoutbuf, 1);
|
||||
(void)sigsetjmp(timeoutbuf, 1);
|
||||
#endif
|
||||
if(test->writedelay) {
|
||||
logmsg("Pausing %d seconds before %d bytes", test->writedelay,
|
||||
|
|
@ -1223,7 +1223,7 @@ send_data:
|
|||
break;
|
||||
}
|
||||
/* Re-synchronize with the other side */
|
||||
(void) synchnet(peer);
|
||||
(void)synchnet(peer);
|
||||
if(sap->th_block == (sendblock-1)) {
|
||||
goto send_data;
|
||||
}
|
||||
|
|
@ -1257,7 +1257,7 @@ static void recvtftp(struct testcase *test, const struct formats *pf)
|
|||
rap->th_block = htons(recvblock);
|
||||
recvblock++;
|
||||
#ifdef HAVE_SIGSETJMP
|
||||
(void) sigsetjmp(timeoutbuf, 1);
|
||||
(void)sigsetjmp(timeoutbuf, 1);
|
||||
#endif
|
||||
send_ack:
|
||||
logmsg("write");
|
||||
|
|
@ -1291,7 +1291,7 @@ send_ack:
|
|||
break; /* normal */
|
||||
}
|
||||
/* Re-synchronize with the other side */
|
||||
(void) synchnet(peer);
|
||||
(void)synchnet(peer);
|
||||
if(rdp->th_block == (recvblock-1))
|
||||
goto send_ack; /* rexmit */
|
||||
}
|
||||
|
|
@ -1315,7 +1315,7 @@ send_ack:
|
|||
|
||||
rap->th_opcode = htons(opcode_ACK); /* send the "final" ack */
|
||||
rap->th_block = htons(recvblock);
|
||||
(void) swrite(peer, &ackbuf.storage[0], 4);
|
||||
(void)swrite(peer, &ackbuf.storage[0], 4);
|
||||
#if defined(HAVE_ALARM) && defined(SIGALRM)
|
||||
mysignal(SIGALRM, justtimeout); /* just abort read on timeout */
|
||||
alarm(rexmtval);
|
||||
|
|
@ -1330,7 +1330,7 @@ send_ack:
|
|||
if(n >= 4 && /* if read some data */
|
||||
rdp->th_opcode == opcode_DATA && /* and got a data block */
|
||||
recvblock == rdp->th_block) { /* then my last ack was lost */
|
||||
(void) swrite(peer, &ackbuf.storage[0], 4); /* resend final ack */
|
||||
(void)swrite(peer, &ackbuf.storage[0], 4); /* resend final ack */
|
||||
}
|
||||
abort:
|
||||
/* make sure the output file is closed in case of abort */
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ static void win32_cleanup(void)
|
|||
{
|
||||
#ifdef USE_WINSOCK
|
||||
WSACleanup();
|
||||
#endif /* USE_WINSOCK */
|
||||
#endif
|
||||
|
||||
/* flush buffers of all streams regardless of their mode */
|
||||
_flushall();
|
||||
|
|
@ -560,7 +560,7 @@ static SIGHANDLER_T set_signal(int signum, SIGHANDLER_T handler,
|
|||
if(oldhdlr != SIG_ERR)
|
||||
siginterrupt(signum, (int) restartable);
|
||||
#else
|
||||
(void) restartable;
|
||||
(void)restartable;
|
||||
#endif
|
||||
|
||||
return oldhdlr;
|
||||
|
|
@ -640,31 +640,31 @@ void restore_signal_handlers(bool keep_sigalrm)
|
|||
{
|
||||
#ifdef SIGHUP
|
||||
if(SIG_ERR != old_sighup_handler)
|
||||
(void) set_signal(SIGHUP, old_sighup_handler, FALSE);
|
||||
(void)set_signal(SIGHUP, old_sighup_handler, FALSE);
|
||||
#endif
|
||||
#ifdef SIGPIPE
|
||||
if(SIG_ERR != old_sigpipe_handler)
|
||||
(void) set_signal(SIGPIPE, old_sigpipe_handler, FALSE);
|
||||
(void)set_signal(SIGPIPE, old_sigpipe_handler, FALSE);
|
||||
#endif
|
||||
#ifdef SIGALRM
|
||||
if(!keep_sigalrm) {
|
||||
if(SIG_ERR != old_sigalrm_handler)
|
||||
(void) set_signal(SIGALRM, old_sigalrm_handler, FALSE);
|
||||
(void)set_signal(SIGALRM, old_sigalrm_handler, FALSE);
|
||||
}
|
||||
#else
|
||||
(void)keep_sigalrm;
|
||||
#endif
|
||||
#ifdef SIGINT
|
||||
if(SIG_ERR != old_sigint_handler)
|
||||
(void) set_signal(SIGINT, old_sigint_handler, FALSE);
|
||||
(void)set_signal(SIGINT, old_sigint_handler, FALSE);
|
||||
#endif
|
||||
#ifdef SIGTERM
|
||||
if(SIG_ERR != old_sigterm_handler)
|
||||
(void) set_signal(SIGTERM, old_sigterm_handler, FALSE);
|
||||
(void)set_signal(SIGTERM, old_sigterm_handler, FALSE);
|
||||
#endif
|
||||
#if defined(SIGBREAK) && defined(_WIN32)
|
||||
if(SIG_ERR != old_sigbreak_handler)
|
||||
(void) set_signal(SIGBREAK, old_sigbreak_handler, FALSE);
|
||||
(void)set_signal(SIGBREAK, old_sigbreak_handler, FALSE);
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#ifndef UNDER_CE
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ static CURLcode test_unit1601(char *arg)
|
|||
{
|
||||
UNITTEST_BEGIN_SIMPLE
|
||||
|
||||
#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) \
|
||||
|| !defined(CURL_DISABLE_DIGEST_AUTH)
|
||||
#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) || \
|
||||
!defined(CURL_DISABLE_DIGEST_AUTH)
|
||||
|
||||
static const char string1[] = "1";
|
||||
static const char string2[] = "hello-you-fool";
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ static CURLcode test_unit1610(char *arg)
|
|||
{
|
||||
UNITTEST_BEGIN(t1610_setup())
|
||||
|
||||
#if !defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) \
|
||||
|| defined(USE_LIBSSH2)
|
||||
#if !defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) || \
|
||||
defined(USE_LIBSSH2)
|
||||
|
||||
static const char string1[] = "1";
|
||||
static const char string2[] = "hello-you-fool";
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ static CURLcode test_unit1612(char *arg)
|
|||
{
|
||||
UNITTEST_BEGIN_SIMPLE
|
||||
|
||||
#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) \
|
||||
|| !defined(CURL_DISABLE_DIGEST_AUTH)
|
||||
#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) || \
|
||||
!defined(CURL_DISABLE_DIGEST_AUTH)
|
||||
|
||||
static const char password[] = "Pa55worD";
|
||||
static const char string1[] = "1";
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ static CURLcode test_unit1651(char *arg)
|
|||
for(i = 0; i < 45; i++) {
|
||||
unsigned char backup = cert[i];
|
||||
cert[i] = (unsigned char) (byte & 0xff);
|
||||
(void) Curl_extract_certinfo(data, 0, beg, end);
|
||||
(void)Curl_extract_certinfo(data, 0, beg, end);
|
||||
cert[i] = backup;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue