summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-12-13 23:34:59 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-12-13 23:39:11 +0100
commitb228d2952b6762b5c9b851fba0cf391e80c6761a (patch)
treed8d52d61b047a31b1c51851f1b48c4dc9cfcd1f4 /lib
parent5fad800efdf1cb84f863f3634b85c898fb3d0d66 (diff)
downloadcurl-b228d2952b6762b5c9b851fba0cf391e80c6761a.tar.gz
checksrc: stricter no-space-before-paren enforcement
In order to make the code style more uniform everywhere
Diffstat (limited to 'lib')
-rw-r--r--lib/asyn-ares.c4
-rw-r--r--lib/asyn-thread.c12
-rwxr-xr-xlib/checksrc.pl20
-rw-r--r--lib/connect.c4
-rw-r--r--lib/content_encoding.c14
-rw-r--r--lib/curl_addrinfo.c8
-rw-r--r--lib/curl_ntlm_core.c2
-rw-r--r--lib/curl_sec.h10
-rw-r--r--lib/curl_threads.c1
-rw-r--r--lib/curl_threads.h1
-rw-r--r--lib/escape.c2
-rw-r--r--lib/formdata.c4
-rw-r--r--lib/ftp.c8
-rw-r--r--lib/ftplistparser.c8
-rw-r--r--lib/getinfo.c4
-rw-r--r--lib/hash.c2
-rw-r--r--lib/hostip.c2
-rw-r--r--lib/hostip.h2
-rw-r--r--lib/http.c22
-rw-r--r--lib/http_chunks.c14
-rw-r--r--lib/http_proxy.c4
-rw-r--r--lib/inet_ntop.c2
-rw-r--r--lib/inet_pton.c2
-rw-r--r--lib/ldap.c32
-rw-r--r--lib/mprintf.c4
-rw-r--r--lib/nwlib.c4
-rw-r--r--lib/nwos.c8
-rw-r--r--lib/rtsp.c8
-rw-r--r--lib/sendf.c6
-rw-r--r--lib/share.h8
-rw-r--r--lib/socks_gssapi.c6
-rw-r--r--lib/ssh.c8
-rw-r--r--lib/strcase.c2
-rw-r--r--lib/strerror.c12
-rw-r--r--lib/telnet.c14
-rw-r--r--lib/tftp.c4
-rw-r--r--lib/transfer.c10
-rw-r--r--lib/url.c12
-rw-r--r--lib/vtls/axtls.c12
-rw-r--r--lib/vtls/cyassl.c8
-rw-r--r--lib/vtls/darwinssl.c16
-rw-r--r--lib/vtls/gskit.c22
-rw-r--r--lib/vtls/gtls.c14
-rw-r--r--lib/vtls/nss.c2
-rw-r--r--lib/vtls/openssl.c12
-rw-r--r--lib/x509asn1.c14
46 files changed, 204 insertions, 186 deletions
diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c
index 2aed94fe1..c038c2a3f 100644
--- a/lib/asyn-ares.c
+++ b/lib/asyn-ares.c
@@ -169,7 +169,7 @@ int Curl_resolver_duphandle(void **to, void *from)
return CURLE_OK;
}
-static void destroy_async_data (struct Curl_async *async);
+static void destroy_async_data(struct Curl_async *async);
/*
* Cancel all possibly still on-going resolves for this connection.
@@ -184,7 +184,7 @@ void Curl_resolver_cancel(struct connectdata *conn)
/*
* destroy_async_data() cleans up async resolver data.
*/
-static void destroy_async_data (struct Curl_async *async)
+static void destroy_async_data(struct Curl_async *async)
{
free(async->hostname);
diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c
index da444f092..26a15b110 100644
--- a/lib/asyn-thread.c
+++ b/lib/asyn-thread.c
@@ -263,7 +263,7 @@ static int getaddrinfo_complete(struct connectdata *conn)
* For builds without ARES, but with ENABLE_IPV6, create a resolver thread
* and wait on it.
*/
-static unsigned int CURL_STDCALL getaddrinfo_thread (void *arg)
+static unsigned int CURL_STDCALL getaddrinfo_thread(void *arg)
{
struct thread_sync_data *tsd = (struct thread_sync_data*)arg;
struct thread_data *td = tsd->td;
@@ -303,7 +303,7 @@ static unsigned int CURL_STDCALL getaddrinfo_thread (void *arg)
/*
* gethostbyname_thread() resolves a name and then exits.
*/
-static unsigned int CURL_STDCALL gethostbyname_thread (void *arg)
+static unsigned int CURL_STDCALL gethostbyname_thread(void *arg)
{
struct thread_sync_data *tsd = (struct thread_sync_data *)arg;
struct thread_data *td = tsd->td;
@@ -336,7 +336,7 @@ static unsigned int CURL_STDCALL gethostbyname_thread (void *arg)
/*
* destroy_async_data() cleans up async resolver data and thread handle.
*/
-static void destroy_async_data (struct Curl_async *async)
+static void destroy_async_data(struct Curl_async *async)
{
if(async->os_specific) {
struct thread_data *td = (struct thread_data*) async->os_specific;
@@ -375,9 +375,9 @@ static void destroy_async_data (struct Curl_async *async)
*
* Returns FALSE in case of failure, otherwise TRUE.
*/
-static bool init_resolve_thread (struct connectdata *conn,
- const char *hostname, int port,
- const struct addrinfo *hints)
+static bool init_resolve_thread(struct connectdata *conn,
+ const char *hostname, int port,
+ const struct addrinfo *hints)
{
struct thread_data *td = calloc(1, sizeof(struct thread_data));
int err = RESOLVER_ENOMEM;
diff --git a/lib/checksrc.pl b/lib/checksrc.pl
index 479a5dbde..022b193aa 100755
--- a/lib/checksrc.pl
+++ b/lib/checksrc.pl
@@ -243,6 +243,12 @@ sub checksrc {
}
}
+sub nostrings {
+ my ($str) = @_;
+ $str =~ s/\".*\"//g;
+ return $str;
+}
+
sub scanfile {
my ($file) = @_;
@@ -329,11 +335,21 @@ sub scanfile {
$line, length($1), $file, $l, "\/\/ comment");
}
- # check spaces after for/if/while
- if($l =~ /^(.*)(for|if|while) \(/) {
+ my $nostr = nostrings($l);
+ # check spaces after for/if/while/function call
+ if($nostr =~ /^(.*)(for|if|while| ([a-zA-Z0-9_]+)) \((.)/) {
if($1 =~ / *\#/) {
# this is a #if, treat it differently
}
+ elsif($3 eq "return") {
+ # return must have a space
+ }
+ elsif($4 eq "*") {
+ # (* beginning makes the space OK!
+ }
+ elsif($1 =~ / *typedef/) {
+ # typedefs can use space-paren
+ }
else {
checkwarn("SPACEBEFOREPAREN", $line, length($1)+length($2), $file, $l,
"$2 with space");
diff --git a/lib/connect.c b/lib/connect.c
index c78d3da36..f86c31d4d 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -194,7 +194,7 @@ time_t Curl_timeleft(struct Curl_easy *data,
if(duringconnect && (data->set.connecttimeout > 0))
timeout_set |= 2;
- switch (timeout_set) {
+ switch(timeout_set) {
case 1:
timeout_ms = data->set.timeout;
break;
@@ -620,7 +620,7 @@ static bool getaddressinfo(struct sockaddr *sa, char *addr,
struct sockaddr_un *su = NULL;
#endif
- switch (sa->sa_family) {
+ switch(sa->sa_family) {
case AF_INET:
si = (struct sockaddr_in *)(void *) sa;
if(Curl_inet_ntop(sa->sa_family, &si->sin_addr,
diff --git a/lib/content_encoding.c b/lib/content_encoding.c
index 5a5824db4..5385058e2 100644
--- a/lib/content_encoding.c
+++ b/lib/content_encoding.c
@@ -69,11 +69,11 @@ process_zlib_error(struct connectdata *conn, z_stream *z)
{
struct Curl_easy *data = conn->data;
if(z->msg)
- failf (data, "Error while processing content unencoding: %s",
- z->msg);
+ failf(data, "Error while processing content unencoding: %s",
+ z->msg);
else
- failf (data, "Error while processing content unencoding: "
- "Unknown failure within decompression software.");
+ failf(data, "Error while processing content unencoding: "
+ "Unknown failure within decompression software.");
return CURLE_BAD_CONTENT_ENCODING;
}
@@ -327,14 +327,14 @@ Curl_unencode_gzip_write(struct connectdata *conn,
* can handle the gzip header themselves.
*/
- switch (k->zlib_init) {
+ switch(k->zlib_init) {
/* Skip over gzip header? */
case ZLIB_INIT:
{
/* Initial call state */
ssize_t hlen;
- switch (check_gzip_header((unsigned char *)k->str, nread, &hlen)) {
+ switch(check_gzip_header((unsigned char *)k->str, nread, &hlen)) {
case GZIP_OK:
z->next_in = (Bytef *)k->str + hlen;
z->avail_in = (uInt)(nread - hlen);
@@ -379,7 +379,7 @@ Curl_unencode_gzip_write(struct connectdata *conn,
/* Append the new block of data to the previous one */
memcpy(z->next_in + z->avail_in - nread, k->str, nread);
- switch (check_gzip_header(z->next_in, z->avail_in, &hlen)) {
+ switch(check_gzip_header(z->next_in, z->avail_in, &hlen)) {
case GZIP_OK:
/* This is the zlib stream data */
free(z->next_in);
diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c
index 35eb2ddb9..c8ff83c79 100644
--- a/lib/curl_addrinfo.c
+++ b/lib/curl_addrinfo.c
@@ -286,10 +286,10 @@ Curl_he2ai(const struct hostent *he, int port)
size_t ss_size;
#ifdef ENABLE_IPV6
if(he->h_addrtype == AF_INET6)
- ss_size = sizeof (struct sockaddr_in6);
+ ss_size = sizeof(struct sockaddr_in6);
else
#endif
- ss_size = sizeof (struct sockaddr_in);
+ ss_size = sizeof(struct sockaddr_in);
if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL) {
result = CURLE_OUT_OF_MEMORY;
@@ -325,7 +325,7 @@ Curl_he2ai(const struct hostent *he, int port)
/* leave the rest of the struct filled with zero */
- switch (ai->ai_family) {
+ switch(ai->ai_family) {
case AF_INET:
addr = (void *)ai->ai_addr; /* storage area for this info */
@@ -576,7 +576,7 @@ void Curl_addrinfo_set_port(Curl_addrinfo *addrinfo, int port)
struct sockaddr_in6 *addr6;
#endif
for(ca = addrinfo; ca != NULL; ca = ca->ai_next) {
- switch (ca->ai_family) {
+ switch(ca->ai_family) {
case AF_INET:
addr = (void *)ca->ai_addr; /* storage area for this info */
addr->sin_port = htons((unsigned short)port);
diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c
index 812a07313..73d983cf2 100644
--- a/lib/curl_ntlm_core.c
+++ b/lib/curl_ntlm_core.c
@@ -566,7 +566,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struct Curl_easy *data,
gcry_md_hd_t MD4pw;
gcry_md_open(&MD4pw, GCRY_MD_MD4, 0);
gcry_md_write(MD4pw, pw, 2 * len);
- memcpy (ntbuffer, gcry_md_read (MD4pw, 0), MD4_DIGEST_LENGTH);
+ memcpy(ntbuffer, gcry_md_read(MD4pw, 0), MD4_DIGEST_LENGTH);
gcry_md_close(MD4pw);
#elif defined(USE_MBEDTLS)
mbedtls_md4(pw, 2 * len, ntbuffer);
diff --git a/lib/curl_sec.h b/lib/curl_sec.h
index 073a981f2..7bdde269b 100644
--- a/lib/curl_sec.h
+++ b/lib/curl_sec.h
@@ -39,11 +39,11 @@ struct Curl_sec_client_mech {
#define AUTH_ERROR 2
#ifdef HAVE_GSSAPI
-int Curl_sec_read_msg (struct connectdata *conn, char *,
- enum protection_level);
-void Curl_sec_end (struct connectdata *);
-CURLcode Curl_sec_login (struct connectdata *);
-int Curl_sec_request_prot (struct connectdata *conn, const char *level);
+int Curl_sec_read_msg(struct connectdata *conn, char *,
+ enum protection_level);
+void Curl_sec_end(struct connectdata *);
+CURLcode Curl_sec_login(struct connectdata *);
+int Curl_sec_request_prot(struct connectdata *conn, const char *level);
extern struct Curl_sec_client_mech Curl_krb5_client_mech;
#endif
diff --git a/lib/curl_threads.c b/lib/curl_threads.c
index d88269872..a78eff5c2 100644
--- a/lib/curl_threads.c
+++ b/lib/curl_threads.c
@@ -100,6 +100,7 @@ int Curl_thread_join(curl_thread_t *hnd)
#elif defined(USE_THREADS_WIN32)
+/* !checksrc! disable SPACEBEFOREPAREN 1 */
curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
void *arg)
{
diff --git a/lib/curl_threads.h b/lib/curl_threads.h
index 0778dd552..9e0d14a30 100644
--- a/lib/curl_threads.h
+++ b/lib/curl_threads.h
@@ -50,6 +50,7 @@
#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
+/* !checksrc! disable SPACEBEFOREPAREN 1 */
curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
void *arg);
diff --git a/lib/escape.c b/lib/escape.c
index 9fb8d3e15..9c811b8ed 100644
--- a/lib/escape.c
+++ b/lib/escape.c
@@ -43,7 +43,7 @@
*/
static bool Curl_isunreserved(unsigned char in)
{
- switch (in) {
+ switch(in) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case 'a': case 'b': case 'c': case 'd': case 'e':
diff --git a/lib/formdata.c b/lib/formdata.c
index 2aef5faf1..53dee39f4 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -316,7 +316,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
break;
}
- switch (option) {
+ switch(option) {
case CURLFORM_ARRAY:
if(array_state)
/* we don't support an array from within an array */
@@ -1434,7 +1434,7 @@ static FILE * vmsfopenread(const char *file, const char *mode)
result = stat(file, &statbuf);
- switch (statbuf.st_fab_rfm) {
+ switch(statbuf.st_fab_rfm) {
case FAB$C_VAR:
case FAB$C_VFC:
case FAB$C_STMCR:
diff --git a/lib/ftp.c b/lib/ftp.c
index 1e61fc551..683f05de4 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -455,7 +455,7 @@ static CURLcode ReceivedServerConnect(struct connectdata *conn, bool *received)
result = Curl_socket_check(ctrl_sock, data_sock, CURL_SOCKET_BAD, 0);
/* see if the connection request is already here */
- switch (result) {
+ switch(result) {
case -1: /* error */
/* let's die here */
failf(data, "Error while waiting for server connect");
@@ -741,7 +741,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
*/
}
else if(!Curl_ssl_data_pending(conn, FIRSTSOCKET)) {
- switch (SOCKET_READABLE(sockfd, interval_ms)) {
+ switch(SOCKET_READABLE(sockfd, interval_ms)) {
case -1: /* select() error, stop reading */
failf(data, "FTP response aborted due to select/poll error: %d",
SOCKERRNO);
@@ -3873,7 +3873,7 @@ static CURLcode wc_statemach(struct connectdata *conn)
struct WildcardData * const wildcard = &(conn->data->wildcard);
CURLcode result = CURLE_OK;
- switch (wildcard->state) {
+ switch(wildcard->state) {
case CURLWC_INIT:
result = init_wc_data(conn);
if(wildcard->state == CURLWC_CLEAN)
@@ -4501,7 +4501,7 @@ static CURLcode ftp_setup_connection(struct connectdata *conn)
command = Curl_raw_toupper(type[6]);
conn->bits.type_set = TRUE;
- switch (command) {
+ switch(command) {
case 'A': /* ASCII mode */
data->set.prefer_ascii = TRUE;
break;
diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c
index 747dbbad3..f94b31b9c 100644
--- a/lib/ftplistparser.c
+++ b/lib/ftplistparser.c
@@ -396,9 +396,9 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
}
}
- switch (parser->os_type) {
+ switch(parser->os_type) {
case OS_TYPE_UNIX:
- switch (parser->state.UNIX.main) {
+ switch(parser->state.UNIX.main) {
case PL_UNIX_TOTALSIZE:
switch(parser->state.UNIX.sub.total_dirsize) {
case PL_UNIX_TOTALSIZE_INIT:
@@ -447,7 +447,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
}
break;
case PL_UNIX_FILETYPE:
- switch (c) {
+ switch(c) {
case '-':
finfo->filetype = CURLFILETYPE_FILE;
break;
@@ -967,7 +967,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
}
break;
case PL_WINNT_FILENAME:
- switch (parser->state.NT.sub.filename) {
+ switch(parser->state.NT.sub.filename) {
case PL_WINNT_FILENAME_PRESPACE:
if(c != ' ') {
parser->item_offset = finfo->b_used -1;
diff --git a/lib/getinfo.c b/lib/getinfo.c
index 9c3ae6e27..a1ce5058e 100644
--- a/lib/getinfo.c
+++ b/lib/getinfo.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -220,7 +220,7 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
*param_longp = data->state.rtsp_CSeq_recv;
break;
case CURLINFO_HTTP_VERSION:
- switch (data->info.httpversion) {
+ switch(data->info.httpversion) {
case 10:
*param_longp = CURL_HTTP_VERSION_1_0;
break;
diff --git a/lib/hash.c b/lib/hash.c
index 72a7a9b70..065504235 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -135,7 +135,7 @@ Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p)
{
struct curl_hash_element *he;
struct curl_llist_element *le;
- struct curl_llist *l = FETCH_LIST (h, key, key_len);
+ struct curl_llist *l = FETCH_LIST(h, key, key_len);
for(le = l->head; le; le = le->next) {
he = (struct curl_hash_element *) le->ptr;
diff --git a/lib/hostip.c b/lib/hostip.c
index 464fa4e1e..fa4bad982 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -172,7 +172,7 @@ Curl_printable_address(const Curl_addrinfo *ai, char *buf, size_t bufsize)
const struct in6_addr *ipaddr6;
#endif
- switch (ai->ai_family) {
+ switch(ai->ai_family) {
case AF_INET:
sa4 = (const void *)ai->ai_addr;
ipaddr4 = &sa4->sin_addr;
diff --git a/lib/hostip.h b/lib/hostip.h
index 0924d5458..1dc4079fe 100644
--- a/lib/hostip.h
+++ b/lib/hostip.h
@@ -131,7 +131,7 @@ int Curl_mk_dnscache(struct curl_hash *hash);
void Curl_hostcache_prune(struct Curl_easy *data);
/* Return # of adresses in a Curl_addrinfo struct */
-int Curl_num_addresses (const Curl_addrinfo *addr);
+int Curl_num_addresses(const Curl_addrinfo *addr);
#if defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO)
int curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa,
diff --git a/lib/http.c b/lib/http.c
index 36317f563..fba33d8e6 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -545,8 +545,8 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
}
}
if(http_should_fail(conn)) {
- failf (data, "The requested URL returned error: %d",
- data->req.httpcode);
+ failf(data, "The requested URL returned error: %d",
+ data->req.httpcode);
result = CURLE_HTTP_RETURNED_ERROR;
}
@@ -2063,7 +2063,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
/* when doing ftp, append ;type=<a|i> if not present */
char *type = strstr(ppath, ";type=");
if(type && type[6] && type[7] == 0) {
- switch (Curl_raw_toupper(type[6])) {
+ switch(Curl_raw_toupper(type[6])) {
case 'A':
case 'D':
case 'I':
@@ -2299,7 +2299,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
* Free proxyuserpwd for Negotiate/NTLM. Cannot reuse as it is associated
* with the connection and shouldn't be repeated over it either.
*/
- switch (data->state.authproxy.picked) {
+ switch(data->state.authproxy.picked) {
case CURLAUTH_NEGOTIATE:
case CURLAUTH_NTLM:
case CURLAUTH_NTLM_WB:
@@ -2753,7 +2753,7 @@ checkhttpprefix(struct Curl_easy *data,
/* convert from the network encoding using a scratch area */
char *scratch = strdup(s);
if(NULL == scratch) {
- failf (data, "Failed to allocate memory for conversion!");
+ failf(data, "Failed to allocate memory for conversion!");
return FALSE; /* can't return CURLE_OUT_OF_MEMORY so return FALSE */
}
if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s)+1)) {
@@ -2791,7 +2791,7 @@ checkrtspprefix(struct Curl_easy *data,
/* convert from the network encoding using a scratch area */
char *scratch = strdup(s);
if(NULL == scratch) {
- failf (data, "Failed to allocate memory for conversion!");
+ failf(data, "Failed to allocate memory for conversion!");
return FALSE; /* can't return CURLE_OUT_OF_MEMORY so return FALSE */
}
if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s)+1)) {
@@ -2843,8 +2843,8 @@ static CURLcode header_append(struct Curl_easy *data,
/* The reason to have a max limit for this is to avoid the risk of a bad
server feeding libcurl with a never-ending header that will cause
reallocs infinitely */
- failf (data, "Avoided giant realloc for header (max is %d)!",
- CURL_MAX_HTTP_HEADER);
+ failf(data, "Avoided giant realloc for header (max is %d)!",
+ CURL_MAX_HTTP_HEADER);
return CURLE_OUT_OF_MEMORY;
}
@@ -2852,7 +2852,7 @@ static CURLcode header_append(struct Curl_easy *data,
hbufp_index = k->hbufp - data->state.headerbuff;
newbuff = realloc(data->state.headerbuff, newsize);
if(!newbuff) {
- failf (data, "Failed to alloc memory for big header!");
+ failf(data, "Failed to alloc memory for big header!");
return CURLE_OUT_OF_MEMORY;
}
data->state.headersize=newsize;
@@ -3093,8 +3093,8 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
* up and return an error.
*/
if(http_should_fail(conn)) {
- failf (data, "The requested URL returned error: %d",
- k->httpcode);
+ failf(data, "The requested URL returned error: %d",
+ k->httpcode);
return CURLE_HTTP_RETURNED_ERROR;
}
diff --git a/lib/http_chunks.c b/lib/http_chunks.c
index ea171092b..1bdf6974c 100644
--- a/lib/http_chunks.c
+++ b/lib/http_chunks.c
@@ -190,8 +190,8 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
/* Write the data portion available */
#ifdef HAVE_LIBZ
- switch (conn->data->set.http_ce_skip?
- IDENTITY : data->req.auto_decoding) {
+ switch(conn->data->set.http_ce_skip?
+ IDENTITY : data->req.auto_decoding) {
case IDENTITY:
#endif
if(!k->ignorebody) {
@@ -219,10 +219,10 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
break;
default:
- failf (conn->data,
- "Unrecognized content encoding type. "
- "libcurl understands `identity', `deflate' and `gzip' "
- "content encodings.");
+ failf(conn->data,
+ "Unrecognized content encoding type. "
+ "libcurl understands `identity', `deflate' and `gzip' "
+ "content encodings.");
return CHUNKE_BAD_ENCODING;
}
#endif
@@ -360,7 +360,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
const char *Curl_chunked_strerror(CHUNKcode code)
{
- switch (code) {
+ switch(code) {
default:
return "OK";
case CHUNKE_TOO_LONG_HEX:
diff --git a/lib/http_proxy.c b/lib/http_proxy.c
index fc54741c3..f4e98e534 100644
--- a/lib/http_proxy.c
+++ b/lib/http_proxy.c
@@ -320,7 +320,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
}
/* loop every second at least, less if the timeout is near */
- switch (SOCKET_READABLE(tunnelsocket, check<1000L?check:1000)) {
+ switch(SOCKET_READABLE(tunnelsocket, check<1000L?check:1000)) {
case -1: /* select() error, stop reading */
error = SELECT_ERROR;
failf(data, "Proxy CONNECT aborted due to select/poll error");
@@ -632,7 +632,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
data->state.authproxy.done = TRUE;
- infof (data, "Proxy replied OK to CONNECT request\n");
+ infof(data, "Proxy replied OK to CONNECT request\n");
data->req.ignorebody = FALSE; /* put it (back) to non-ignore state */
conn->bits.rewindaftersend = FALSE; /* make sure this isn't set for the
document request */
diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c
index 38311e314..9afbdbb32 100644
--- a/lib/inet_ntop.c
+++ b/lib/inet_ntop.c
@@ -182,7 +182,7 @@ static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size)
*/
char *Curl_inet_ntop(int af, const void *src, char *buf, size_t size)
{
- switch (af) {
+ switch(af) {
case AF_INET:
return inet_ntop4((const unsigned char *)src, buf, size);
#ifdef ENABLE_IPV6
diff --git a/lib/inet_pton.c b/lib/inet_pton.c
index cf8b88a1d..bff8ddadd 100644
--- a/lib/inet_pton.c
+++ b/lib/inet_pton.c
@@ -65,7 +65,7 @@ static int inet_pton6(const char *src, unsigned char *dst);
int
Curl_inet_pton(int af, const char *src, void *dst)
{
- switch (af) {
+ switch(af) {
case AF_INET:
return (inet_pton4(src, (unsigned char *)dst));
#ifdef ENABLE_IPV6
diff --git a/lib/ldap.c b/lib/ldap.c
index a366e0cd0..979ce7de4 100644
--- a/lib/ldap.c
+++ b/lib/ldap.c
@@ -109,9 +109,9 @@ typedef struct {
#undef LDAPURLDesc
#define LDAPURLDesc CURL_LDAPURLDesc
-static int _ldap_url_parse (const struct connectdata *conn,
- LDAPURLDesc **ludp);
-static void _ldap_free_urldesc (LDAPURLDesc *ludp);
+static int _ldap_url_parse(const struct connectdata *conn,
+ LDAPURLDesc **ludp);
+static void _ldap_free_urldesc(LDAPURLDesc *ludp);
#undef ldap_free_urldesc
#define ldap_free_urldesc _ldap_free_urldesc
@@ -119,11 +119,11 @@ static void _ldap_free_urldesc (LDAPURLDesc *ludp);
#ifdef DEBUG_LDAP
#define LDAP_TRACE(x) do { \
- _ldap_trace ("%u: ", __LINE__); \
+ _ldap_trace("%u: ", __LINE__); \
_ldap_trace x; \
} WHILE_FALSE
- static void _ldap_trace (const char *fmt, ...);
+ static void _ldap_trace(const char *fmt, ...);
#else
#define LDAP_TRACE(x) Curl_nop_stmt
#endif
@@ -655,7 +655,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
quit:
if(ldapmsg) {
ldap_msgfree(ldapmsg);
- LDAP_TRACE (("Received %d entries\n", num));
+ LDAP_TRACE(("Received %d entries\n", num));
}
if(rc == LDAP_SIZELIMIT_EXCEEDED)
infof(data, "There are more than %d entries\n", num);
@@ -682,7 +682,7 @@ quit:
}
#ifdef DEBUG_LDAP
-static void _ldap_trace (const char *fmt, ...)
+static void _ldap_trace(const char *fmt, ...)
{
static int do_trace = -1;
va_list args;
@@ -694,9 +694,9 @@ static void _ldap_trace (const char *fmt, ...)
if(!do_trace)
return;
- va_start (args, fmt);
- vfprintf (stderr, fmt, args);
- va_end (args);
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
}
#endif
@@ -705,7 +705,7 @@ static void _ldap_trace (const char *fmt, ...)
/*
* Return scope-value for a scope-string.
*/
-static int str2scope (const char *p)
+static int str2scope(const char *p)
{
if(strcasecompare(p, "one"))
return LDAP_SCOPE_ONELEVEL;
@@ -799,7 +799,7 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
char *unescaped;
CURLcode result;
- LDAP_TRACE (("DN '%s'\n", dn));
+ LDAP_TRACE(("DN '%s'\n", dn));
/* Unescape the DN */
result = Curl_urldecode(conn->data, dn, 0, &unescaped, NULL, FALSE);
@@ -864,7 +864,7 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
char *unescaped;
CURLcode result;
- LDAP_TRACE (("attr[%d] '%s'\n", i, attributes[i]));
+ LDAP_TRACE(("attr[%d] '%s'\n", i, attributes[i]));
/* Unescape the attribute */
result = Curl_urldecode(conn->data, attributes[i], 0, &unescaped, NULL,
@@ -917,7 +917,7 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
goto quit;
}
- LDAP_TRACE (("scope %d\n", ludp->lud_scope));
+ LDAP_TRACE(("scope %d\n", ludp->lud_scope));
}
p = q;
@@ -934,7 +934,7 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
char *unescaped;
CURLcode result;
- LDAP_TRACE (("filter '%s'\n", filter));
+ LDAP_TRACE(("filter '%s'\n", filter));
/* Unescape the filter */
result = Curl_urldecode(conn->data, filter, 0, &unescaped, NULL, FALSE);
@@ -1009,7 +1009,7 @@ static void _ldap_free_urldesc(LDAPURLDesc *ludp)
free(ludp->lud_attrs);
}
- free (ludp);
+ free(ludp);
}
#endif /* !HAVE_LDAP_URL_PARSE */
#endif /* !CURL_DISABLE_LDAP && !USE_OPENLDAP */
diff --git a/lib/mprintf.c b/lib/mprintf.c
index e1ad537f6..a995c59a4 100644
--- a/lib/mprintf.c
+++ b/lib/mprintf.c
@@ -501,7 +501,7 @@ static int dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos,
(mp_intmax_t)va_arg(arglist, int);
}
- switch (vto[i].type) {
+ switch(vto[i].type) {
case FORMAT_STRING:
vto[i].data.str = va_arg(arglist, char *);
break;
@@ -691,7 +691,7 @@ static int dprintf_formatf(
is_alt = (p->flags & FLAGS_ALT) ? 1 : 0;
- switch (p->type) {
+ switch(p->type) {
case FORMAT_INT:
num = p->data.num.as_unsigned;
if(p->flags & FLAGS_CHAR) {
diff --git a/lib/nwlib.c b/lib/nwlib.c
index 42b6aa0da..27e33e472 100644
--- a/lib/nwlib.c
+++ b/lib/nwlib.c
@@ -303,14 +303,14 @@ void DisposeThreadData(void *data)
/* For native CLib-based NLM seems we can do a bit more simple. */
#include <nwthread.h>
-int main (void)
+int main(void)
{
/* initialize any globals here... */
/* do this if any global initializing was done
SynchronizeStart();
*/
- ExitThread (TSR_THREAD, 0);
+ ExitThread(TSR_THREAD, 0);
return 0;
}
diff --git a/lib/nwos.c b/lib/nwos.c
index 385f9c8ad..c6c22ccbb 100644
--- a/lib/nwos.c
+++ b/lib/nwos.c
@@ -26,7 +26,7 @@
#ifdef __NOVELL_LIBC__
/* For native LibC-based NLM we need to do nothing. */
-int netware_init (void)
+int netware_init(void)
{
return 0;
}
@@ -45,7 +45,7 @@ NETDB_DEFINE_CONTEXT
#include <arpa/inet.h>
NETINET_DEFINE_CONTEXT
-int netware_init (void)
+int netware_init(void)
{
int rc = 0;
unsigned int myHandle = GetNLMHandle();
@@ -72,13 +72,13 @@ int netware_init (void)
}
/* dummy function to satisfy newer prelude */
-int __init_environment (void)
+int __init_environment(void)
{
return 0;
}
/* dummy function to satisfy newer prelude */
-int __deinit_environment (void)
+int __deinit_environment(void)
{
return 0;
}
diff --git a/lib/rtsp.c b/lib/rtsp.c
index 5da33d42c..c8484c44b 100644
--- a/lib/rtsp.c
+++ b/lib/rtsp.c
@@ -489,7 +489,7 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
* Free userpwd now --- cannot reuse this for Negotiate and possibly NTLM
* with basic and digest, it will be freed anyway by the next request
*/
- Curl_safefree (conn->allocptr.userpwd);
+ Curl_safefree(conn->allocptr.userpwd);
conn->allocptr.userpwd = NULL;
if(result)
@@ -737,7 +737,7 @@ CURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len)
curl_write_callback writeit;
if(len == 0) {
- failf (data, "Cannot write a 0 size RTP packet.");
+ failf(data, "Cannot write a 0 size RTP packet.");
return CURLE_WRITE_ERROR;
}
@@ -745,12 +745,12 @@ CURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len)
wrote = writeit(ptr, 1, len, data->set.rtp_out);
if(CURL_WRITEFUNC_PAUSE == wrote) {
- failf (data, "Cannot pause RTP");
+ failf(data, "Cannot pause RTP");
return CURLE_WRITE_ERROR;
}
if(wrote != len) {
- failf (data, "Failed writing RTP data");
+ failf(data, "Failed writing RTP data");
return CURLE_WRITE_ERROR;
}
diff --git a/lib/sendf.c b/lib/sendf.c
index 4f552e894..29333e0e2 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -571,7 +571,7 @@ CURLcode Curl_client_chop_write(struct connectdata *conn,
return pausewrite(data, CLIENTWRITE_HEADER, ptr, len);
if(wrote != chunklen) {
- failf (data, "Failed writing header");
+ failf(data, "Failed writing header");
return CURLE_WRITE_ERROR;
}
}
@@ -692,7 +692,7 @@ CURLcode Curl_read(struct connectdata *conn, /* connection data */
}
/* If we come here, it means that there is no data to read from the buffer,
* so we read from the socket */
- bytesfromsocket = CURLMIN(sizerequested, BUFSIZE * sizeof (char));
+ bytesfromsocket = CURLMIN(sizerequested, BUFSIZE * sizeof(char));
buffertofill = conn->master_buffer;
}
else {
@@ -796,7 +796,7 @@ int Curl_debug(struct Curl_easy *data, curl_infotype type,
char buffer[160];
const char *t=NULL;
const char *w="Data";
- switch (type) {
+ switch(type) {
case CURLINFO_HEADER_IN:
w = "Header";
/* FALLTHROUGH */
diff --git a/lib/share.h b/lib/share.h
index e689ff2d2..c039a16cb 100644
--- a/lib/share.h
+++ b/lib/share.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -54,8 +54,8 @@ struct Curl_share {
long sessionage;
};
-CURLSHcode Curl_share_lock (struct Curl_easy *, curl_lock_data,
- curl_lock_access);
-CURLSHcode Curl_share_unlock (struct Curl_easy *, curl_lock_data);
+CURLSHcode Curl_share_lock(struct Curl_easy *, curl_lock_data,
+ curl_lock_access);
+CURLSHcode Curl_share_unlock(struct Curl_easy *, curl_lock_data);
#endif /* HEADER_CURL_SHARE_H */
diff --git a/lib/socks_gssapi.c b/lib/socks_gssapi.c
index 32d6725ca..54d063504 100644
--- a/lib/socks_gssapi.c
+++ b/lib/socks_gssapi.c
@@ -292,9 +292,9 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
gss_release_name(&gss_status, &server);
/* Everything is good so far, user was authenticated! */
- gss_major_status = gss_inquire_context (&gss_minor_status, gss_context,
- &gss_client_name, NULL, NULL, NULL,
- NULL, NULL, NULL);
+ gss_major_status = gss_inquire_context(&gss_minor_status, gss_context,
+ &gss_client_name, NULL, NULL, NULL,
+ NULL, NULL, NULL);
if(check_gss_err(data, gss_major_status,
gss_minor_status, "gss_inquire_context")) {
gss_delete_sec_context(&gss_status, &gss_context, NULL);
diff --git a/lib/ssh.c b/lib/ssh.c
index 04ca39cef..80831dbfa 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -239,7 +239,7 @@ kbd_callback(const char *name, int name_len, const char *instruction,
static CURLcode sftp_libssh2_error_to_CURLE(int err)
{
- switch (err) {
+ switch(err) {
case LIBSSH2_FX_OK:
return CURLE_OK;
@@ -271,7 +271,7 @@ static CURLcode sftp_libssh2_error_to_CURLE(int err)
static CURLcode libssh2_session_error_to_CURLE(int err)
{
- switch (err) {
+ switch(err) {
/* Ordered by order of appearance in libssh2.h */
case LIBSSH2_ERROR_NONE:
return CURLE_OK;
@@ -2652,7 +2652,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
else if(rc < 0) {
infof(data, "Failed to disconnect from libssh2 agent\n");
}
- libssh2_agent_free (sshc->ssh_agent);
+ libssh2_agent_free(sshc->ssh_agent);
sshc->ssh_agent = NULL;
/* NB: there is no need to free identities, they are part of internal
@@ -3384,7 +3384,7 @@ get_pathname(const char **cpp, char **path)
static const char *sftp_libssh2_strerror(int err)
{
- switch (err) {
+ switch(err) {
case LIBSSH2_FX_NO_SUCH_FILE:
return "No such file or directory";
diff --git a/lib/strcase.c b/lib/strcase.c
index ccbaac176..a750f7b4d 100644
--- a/lib/strcase.c
+++ b/lib/strcase.c
@@ -34,7 +34,7 @@ char Curl_raw_toupper(char in)
if(in >= 'a' && in <= 'z')
return (char)('A' + in - 'a');
#else
- switch (in) {
+ switch(in) {
case 'a':
return 'A';
case 'b':
diff --git a/lib/strerror.c b/lib/strerror.c
index db50c7d1a..8f8ce036c 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -53,7 +53,7 @@ const char *
curl_easy_strerror(CURLcode error)
{
#ifndef CURL_DISABLE_VERBOSE_STRINGS
- switch (error) {
+ switch(error) {
case CURLE_OK:
return "No error";
@@ -348,7 +348,7 @@ const char *
curl_multi_strerror(CURLMcode error)
{
#ifndef CURL_DISABLE_VERBOSE_STRINGS
- switch (error) {
+ switch(error) {
case CURLM_CALL_MULTI_PERFORM:
return "Please call curl_multi_perform() soon";
@@ -393,7 +393,7 @@ const char *
curl_share_strerror(CURLSHcode error)
{
#ifndef CURL_DISABLE_VERBOSE_STRINGS
- switch (error) {
+ switch(error) {
case CURLSHE_OK:
return "No error";
@@ -435,7 +435,7 @@ get_winsock_error (int err, char *buf, size_t len)
const char *p;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
- switch (err) {
+ switch(err) {
case WSAEINTR:
p = "Call interrupted";
break;
@@ -609,7 +609,7 @@ get_winsock_error (int err, char *buf, size_t len)
else
p = "error";
#endif
- strncpy (buf, p, len);
+ strncpy(buf, p, len);
buf [len-1] = '\0';
return buf;
}
@@ -750,7 +750,7 @@ const char *Curl_sspi_strerror (struct connectdata *conn, int err)
old_errno = ERRNO;
- switch (err) {
+ switch(err) {
case SEC_E_OK:
txt = "No error";
break;
diff --git a/lib/telnet.c b/lib/telnet.c
index ddf3d3b9a..935cde35b 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -91,7 +91,7 @@
#ifdef USE_WINSOCK
typedef FARPROC WSOCK2_FUNC;
-static CURLcode check_wsock2 (struct Curl_easy *data);
+static CURLcode check_wsock2(struct Curl_easy *data);
#endif
static
@@ -935,7 +935,7 @@ static void suboption(struct connectdata *conn)
struct TELNET *tn = (struct TELNET *)data->req.protop;
printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn)+2);
- switch (CURL_SB_GET(tn)) {
+ switch(CURL_SB_GET(tn)) {
case CURL_TELOPT_TTYPE:
len = strlen(tn->subopt_ttype) + 4 + 2;
snprintf((char *)temp, sizeof(temp),
@@ -1009,7 +1009,7 @@ static void sendsuboption(struct connectdata *conn, int option)
struct Curl_easy *data = conn->data;
struct TELNET *tn = (struct TELNET *)data->req.protop;
- switch (option) {
+ switch(option) {
case CURL_TELOPT_NAWS:
/* We prepare data to be sent */
CURL_SB_CLEAR(tn);
@@ -1087,7 +1087,7 @@ CURLcode telrcv(struct connectdata *conn,
while(count--) {
c = inbuf[in];
- switch (tn->telrcv_state) {
+ switch(tn->telrcv_state) {
case CURL_TS_CR:
tn->telrcv_state = CURL_TS_DATA;
if(c == '\0') {
@@ -1111,7 +1111,7 @@ CURLcode telrcv(struct connectdata *conn,
case CURL_TS_IAC:
process_iac:
DEBUGASSERT(startwrite < 0);
- switch (c) {
+ switch(c) {
case CURL_WILL:
tn->telrcv_state = CURL_TS_WILL;
break;
@@ -1241,7 +1241,7 @@ static CURLcode send_telnet_data(struct connectdata *conn,
struct pollfd pfd[1];
pfd[0].fd = conn->sock[FIRSTSOCKET];
pfd[0].events = POLLOUT;
- switch (Curl_poll(pfd, 1, -1)) {
+ switch(Curl_poll(pfd, 1, -1)) {
case -1: /* error, abort writing */
case 0: /* timeout (will never happen) */
result = CURLE_SEND_ERROR;
@@ -1576,7 +1576,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
}
while(keepon) {
- switch (Curl_poll(pfd, poll_cnt, interval_ms)) {
+ switch(Curl_poll(pfd, poll_cnt, interval_ms)) {
case -1: /* error, stop reading */
keepon = FALSE;
continue;
diff --git a/lib/tftp.c b/lib/tftp.c
index de99c6ef4..f2f834775 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -304,7 +304,7 @@ static unsigned short getrpacketblock(const tftp_packet_t *packet)
static size_t Curl_strnlen(const char *string, size_t maxlen)
{
- const char *end = memchr (string, '\0', maxlen);
+ const char *end = memchr(string, '\0', maxlen);
return end ? (size_t) (end - string) : maxlen;
}
@@ -1372,7 +1372,7 @@ static CURLcode tftp_setup_connection(struct connectdata * conn)
*type = 0; /* it was in the middle of the hostname */
command = Curl_raw_toupper(type[6]);
- switch (command) {
+ switch(command) {
case 'A': /* ASCII mode */
case 'N': /* NETASCII mode */
data->set.prefer_ascii = TRUE;
diff --git a/lib/transfer.c b/lib/transfer.c
index 052ecc182..750fb04e2 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -741,8 +741,8 @@ static CURLcode readwrite_data(struct Curl_easy *data,
Make sure that ALL_CONTENT_ENCODINGS contains all the
encodings handled here. */
#ifdef HAVE_LIBZ
- switch (conn->data->set.http_ce_skip ?
- IDENTITY : k->auto_decoding) {
+ switch(conn->data->set.http_ce_skip ?
+ IDENTITY : k->auto_decoding) {
case IDENTITY:
#endif
/* This is the default when the server sends no
@@ -775,9 +775,9 @@ static CURLcode readwrite_data(struct Curl_easy *data,
break;
default:
- failf (data, "Unrecognized content encoding type. "
- "libcurl understands `identity', `deflate' and `gzip' "
- "content encodings.");
+ failf(data, "Unrecognized content encoding type. "
+ "libcurl understands `identity', `deflate' and `gzip' "
+ "content encodings.");
result = CURLE_BAD_CONTENT_ENCODING;
break;
}
diff --git a/lib/url.c b/lib/url.c
index 48016e2ba..acdda6313 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1501,7 +1501,7 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
/*
* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy
*/
- switch (va_arg(param, long)) {
+ switch(va_arg(param, long)) {
case 0:
data->set.proxy_transfer_mode = FALSE;
break;
@@ -2890,10 +2890,10 @@ static void conn_reset_postponed_data(struct connectdata *conn, int num)
#endif /* DEBUGBUILD */
}
else {
- DEBUGASSERT (psnd->allocated_size == 0);
- DEBUGASSERT (psnd->recv_size == 0);
- DEBUGASSERT (psnd->recv_processed == 0);
- DEBUGASSERT (psnd->bindsock == CURL_SOCKET_BAD);
+ DEBUGASSERT(psnd->allocated_size == 0);
+ DEBUGASSERT(psnd->recv_size == 0);
+ DEBUGASSERT(psnd->recv_processed == 0);
+ DEBUGASSERT(psnd->bindsock == CURL_SOCKET_BAD);
}
}
@@ -4166,7 +4166,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
if(Curl_pipeline_wanted(data->multi, CURLPIPE_HTTP1) &&
!conn->master_buffer) {
/* Allocate master_buffer to be used for HTTP/1 pipelining */
- conn->master_buffer = calloc(BUFSIZE, sizeof (char));
+ conn->master_buffer = calloc(BUFSIZE, sizeof(char));
if(!conn->master_buffer)
goto error;
}
diff --git a/lib/vtls/axtls.c b/lib/vtls/axtls.c
index 8a5029f78..ff4634e5b 100644
--- a/lib/vtls/axtls.c
+++ b/lib/vtls/axtls.c
@@ -65,7 +65,7 @@ int Curl_axtls_cleanup(void)
static CURLcode map_error_to_curl(int axtls_err)
{
- switch (axtls_err) {
+ switch(axtls_err) {
case SSL_ERROR_NOT_SUPPORTED:
case SSL_ERROR_INVALID_VERSION:
case -70: /* protocol version alert from server */
@@ -121,7 +121,7 @@ static Curl_send axtls_send;
static void free_ssl_structs(struct ssl_connect_data *connssl)
{
if(connssl->ssl) {
- ssl_free (connssl->ssl);
+ ssl_free(connssl->ssl);
connssl->ssl = NULL;
}
if(connssl->ssl_ctx) {
@@ -265,7 +265,7 @@ static CURLcode connect_prep(struct connectdata *conn, int sockindex)
if(!Curl_ssl_getsessionid(conn, (void **) &ssl_sessionid, &ssl_idsize,
sockindex)) {
/* we got a session id, use it! */
- infof (data, "SSL re-using session ID\n");
+ infof(data, "SSL re-using session ID\n");
ssl = ssl_client_new(ssl_ctx, conn->sock[sockindex],
ssl_sessionid, (uint8_t)ssl_idsize);
}
@@ -392,7 +392,7 @@ static CURLcode connect_finish(struct connectdata *conn, int sockindex)
Curl_ssl_sessionid_lock(conn);
if(Curl_ssl_addsessionid(conn, (void *) ssl_sessionid, ssl_idsize,
sockindex) != CURLE_OK)
- infof (data, "failed to add session to cache\n");
+ infof(data, "failed to add session to cache\n");
Curl_ssl_sessionid_unlock(conn);
}
@@ -440,7 +440,7 @@ CURLcode Curl_axtls_connect_nonblocking(
return CURLE_OK;
}
}
- infof (conn->data, "handshake completed successfully\n");
+ infof(conn->data, "handshake completed successfully\n");
conn->ssl[sockindex].connecting_state = ssl_connect_3;
}
@@ -506,7 +506,7 @@ Curl_axtls_connect(struct connectdata *conn,
/* TODO: avoid polling */
Curl_wait_ms(10);
}
- infof (conn->data, "handshake completed successfully\n");
+ infof(conn->data, "handshake completed successfully\n");
conn_step = connect_finish(conn, sockindex);
if(conn_step != CURLE_OK) {
diff --git a/lib/vtls/cyassl.c b/lib/vtls/cyassl.c
index 757b17db6..fc4dde4a1 100644
--- a/lib/vtls/cyassl.c
+++ b/lib/vtls/cyassl.c
@@ -397,7 +397,7 @@ cyassl_connect_step1(struct connectdata *conn,
return CURLE_SSL_CONNECT_ERROR;
}
/* Informational message */
- infof (data, "SSL re-using session ID\n");
+ infof(data, "SSL re-using session ID\n");
}
Curl_ssl_sessionid_unlock(conn);
}
@@ -669,11 +669,11 @@ void Curl_cyassl_close(struct connectdata *conn, int sockindex)
if(conssl->handle) {
(void)SSL_shutdown(conssl->handle);
- SSL_free (conssl->handle);
+ SSL_free(conssl->handle);
conssl->handle = NULL;
}
if(conssl->ctx) {
- SSL_CTX_free (conssl->ctx);
+ SSL_CTX_free(conssl->ctx);
conssl->ctx = NULL;
}
}
@@ -755,7 +755,7 @@ int Curl_cyassl_shutdown(struct connectdata *conn, int sockindex)
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
if(connssl->handle) {
- SSL_free (connssl->handle);
+ SSL_free(connssl->handle);
connssl->handle = NULL;
}
return retval;
diff --git a/lib/vtls/darwinssl.c b/lib/vtls/darwinssl.c
index 0602cdbda..a43e39125 100644
--- a/lib/vtls/darwinssl.c
+++ b/lib/vtls/darwinssl.c
@@ -221,7 +221,7 @@ static OSStatus SocketWrite(SSLConnectionRef connection,
CF_INLINE const char *SSLCipherNameForNumber(SSLCipherSuite cipher)
{
- switch (cipher) {
+ switch(cipher) {
/* SSL version 3.0 */
case SSL_RSA_WITH_NULL_MD5:
return "SSL_RSA_WITH_NULL_MD5";
@@ -1143,7 +1143,7 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn,
(void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,
kSSLProtocolAll,
false);
- switch (conn->ssl_config.version) {
+ switch(conn->ssl_config.version) {
case CURL_SSLVERSION_DEFAULT:
case CURL_SSLVERSION_TLSv1:
(void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,
@@ -1879,7 +1879,7 @@ static int verify_cert(const char *cafile, struct Curl_easy *data,
return sslerr_to_curlerr(data, ret);
}
- switch (trust_eval) {
+ switch(trust_eval) {
case kSecTrustResultUnspecified:
case kSecTrustResultProceed:
return CURLE_OK;
@@ -1912,7 +1912,7 @@ darwinssl_connect_step2(struct connectdata *conn, int sockindex)
err = SSLHandshake(connssl->ssl_ctx);
if(err != noErr) {
- switch (err) {
+ switch(err) {
case errSSLWouldBlock: /* they're not done with us yet */
connssl->connecting_state = connssl->ssl_direction ?
ssl_connect_2_writing : ssl_connect_2_reading;
@@ -2002,7 +2002,7 @@ darwinssl_connect_step2(struct connectdata *conn, int sockindex)
/* Informational message */
(void)SSLGetNegotiatedCipher(connssl->ssl_ctx, &cipher);
(void)SSLGetNegotiatedProtocolVersion(connssl->ssl_ctx, &protocol);
- switch (protocol) {
+ switch(protocol) {
case kSSLProtocol2:
infof(data, "SSL 2.0 connection using %s\n",
SSLCipherNameForNumber(cipher));
@@ -2489,7 +2489,7 @@ static ssize_t darwinssl_send(struct connectdata *conn,
if(connssl->ssl_write_buffered_length) {
/* Write the buffered data: */
err = SSLWrite(connssl->ssl_ctx, NULL, 0UL, &processed);
- switch (err) {
+ switch(err) {
case noErr:
/* processed is always going to be 0 because we didn't write to
the buffer, so return how much was written to the socket */
@@ -2509,7 +2509,7 @@ static ssize_t darwinssl_send(struct connectdata *conn,
/* We've got new data to write: */
err = SSLWrite(connssl->ssl_ctx, mem, len, &processed);
if(err != noErr) {
- switch (err) {
+ switch(err) {
case errSSLWouldBlock:
/* Data was buffered but not sent, we have to tell the caller
to try sending again, and remember how much was buffered */
@@ -2538,7 +2538,7 @@ static ssize_t darwinssl_recv(struct connectdata *conn,
OSStatus err = SSLRead(connssl->ssl_ctx, buf, buffersize, &processed);
if(err != noErr) {
- switch (err) {
+ switch(err) {
case errSSLWouldBlock: /* return how much we read (if anything) */
if(processed)
return (ssize_t)processed;
diff --git a/lib/vtls/gskit.c b/lib/vtls/gskit.c
index fccbe508e..a0d462b70 100644
--- a/lib/vtls/gskit.c
+++ b/lib/vtls/gskit.c
@@ -155,7 +155,7 @@ static const gskit_cipher ciphertable[] = {
static bool is_separator(char c)
{
/* Return whether character is a cipher list separator. */
- switch (c) {
+ switch(c) {
case ' ':
case '\t':
case ':':
@@ -171,7 +171,7 @@ static CURLcode gskit_status(struct Curl_easy *data, int rc,
const char *procname, CURLcode defcode)
{
/* Process GSKit status and map it to a CURLcode. */
- switch (rc) {
+ switch(rc) {
case GSK_OK:
case GSK_OS400_ASYNCHRONOUS_SOC_INIT:
return CURLE_OK;
@@ -194,7 +194,7 @@ static CURLcode gskit_status(struct Curl_easy *data, int rc,
case GSK_OS400_ERROR_NOT_REGISTERED:
break;
case GSK_ERROR_IO:
- switch (errno) {
+ switch(errno) {
case ENOMEM:
return CURLE_OUT_OF_MEMORY;
default:
@@ -215,7 +215,7 @@ static CURLcode set_enum(struct Curl_easy *data, gsk_handle h,
{
int rc = gsk_attribute_set_enum(h, id, value);
- switch (rc) {
+ switch(rc) {
case GSK_OK:
return CURLE_OK;
case GSK_ERROR_IO:
@@ -237,7 +237,7 @@ static CURLcode set_buffer(struct Curl_easy *data, gsk_handle h,
{
int rc = gsk_attribute_set_buffer(h, id, buffer, 0);
- switch (rc) {
+ switch(rc) {
case GSK_OK:
return CURLE_OK;
case GSK_ERROR_IO:
@@ -259,7 +259,7 @@ static CURLcode set_numeric(struct Curl_easy *data,
{
int rc = gsk_attribute_set_numeric_value(h, id, value);
- switch (rc) {
+ switch(rc) {
case GSK_OK:
return CURLE_OK;
case GSK_ERROR_IO:
@@ -279,7 +279,7 @@ static CURLcode set_callback(struct Curl_easy *data,
{
int rc = gsk_attribute_set_callback(h, id, info);
- switch (rc) {
+ switch(rc) {
case GSK_OK:
return CURLE_OK;
case GSK_ERROR_IO:
@@ -453,7 +453,7 @@ static CURLcode init_environment(struct Curl_easy *data,
/* Creates the GSKit environment. */
rc = gsk_environment_open(&h);
- switch (rc) {
+ switch(rc) {
case GSK_OK:
break;
case GSK_INSUFFICIENT_STORAGE:
@@ -834,7 +834,7 @@ static CURLcode gskit_connect_step1(struct connectdata *conn, int sockindex)
/* Determine which SSL/TLS version should be enabled. */
sni = hostname;
- switch (ssl_version) {
+ switch(ssl_version) {
case CURL_SSLVERSION_SSLv2:
protoflags = CURL_GSKPROTO_SSLV2_MASK;
sni = NULL;
@@ -996,7 +996,7 @@ static CURLcode gskit_connect_step2(struct connectdata *conn, int sockindex,
timeout_ms = 0;
stmv.tv_sec = timeout_ms / 1000;
stmv.tv_usec = (timeout_ms - stmv.tv_sec * 1000) * 1000;
- switch (QsoWaitForIOCompletion(connssl->iocport, &cstat, &stmv)) {
+ switch(QsoWaitForIOCompletion(connssl->iocport, &cstat, &stmv)) {
case 1: /* Operation complete. */
break;
case -1: /* An error occurred: handshake still in progress. */
@@ -1053,7 +1053,7 @@ static CURLcode gskit_connect_step3(struct connectdata *conn, int sockindex)
infof(data, "Server certificate:\n");
p = cdev;
for(i = 0; i++ < cdec; p++)
- switch (p->cert_data_id) {
+ switch(p->cert_data_id) {
case CERT_BODY_DER:
cert = p->cert_data_p;
certend = cert + cdev->cert_data_l;
diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
index c3bfeed51..1435284b8 100644
--- a/lib/vtls/gtls.c
+++ b/lib/vtls/gtls.c
@@ -235,7 +235,7 @@ static void showtime(struct Curl_easy *data,
infof(data, "%s\n", data->state.buffer);
}
-static gnutls_datum_t load_file (const char *file)
+static gnutls_datum_t load_file(const char *file)
{
FILE *f;
gnutls_datum_t loaded_file = { NULL, 0 };
@@ -567,7 +567,7 @@ gtls_connect_step1(struct connectdata *conn,
return CURLE_SSL_CONNECT_ERROR;
}
- switch (SSL_CONN_CONFIG(version) {
+ switch(SSL_CONN_CONFIG(version) {
case CURL_SSLVERSION_SSLv3:
protocol_priority[0] = GNUTLS_SSL3;
break;
@@ -606,7 +606,7 @@ gtls_connect_step1(struct connectdata *conn,
/* Ensure +SRP comes at the *end* of all relevant strings so that it can be
* removed if a run-time error indicates that SRP is not supported by this
* GnuTLS version */
- switch (SSL_CONN_CONFIG(version)) {
+ switch(SSL_CONN_CONFIG(version)) {
case CURL_SSLVERSION_SSLv3:
prioritylist = GNUTLS_CIPHERS ":-VERS-TLS-ALL:+VERS-SSL3.0";
sni = false;
@@ -791,7 +791,7 @@ gtls_connect_step1(struct connectdata *conn,
gnutls_session_set_data(session, ssl_sessionid, ssl_idsize);
/* Informational message */
- infof (data, "SSL re-using session ID\n");
+ infof(data, "SSL re-using session ID\n");
}
Curl_ssl_sessionid_unlock(conn);
}
@@ -1374,7 +1374,7 @@ gtls_connect_common(struct connectdata *conn,
/* Initiate the connection, if not already done */
if(ssl_connect_1==connssl->connecting_state) {
- rc = gtls_connect_step1 (conn, sockindex);
+ rc = gtls_connect_step1(conn, sockindex);
if(rc)
return rc;
}
@@ -1653,7 +1653,7 @@ void Curl_gtls_md5sum(unsigned char *tmp, /* input */
gcry_md_hd_t MD5pw;
gcry_md_open(&MD5pw, GCRY_MD_MD5, 0);
gcry_md_write(MD5pw, tmp, tmplen);
- memcpy(md5sum, gcry_md_read (MD5pw, 0), md5len);
+ memcpy(md5sum, gcry_md_read(MD5pw, 0), md5len);
gcry_md_close(MD5pw);
#endif
}
@@ -1672,7 +1672,7 @@ void Curl_gtls_sha256sum(const unsigned char *tmp, /* input */
gcry_md_hd_t SHA256pw;
gcry_md_open(&SHA256pw, GCRY_MD_SHA256, 0);
gcry_md_write(SHA256pw, tmp, tmplen);
- memcpy(sha256sum, gcry_md_read (SHA256pw, 0), sha256len);
+ memcpy(sha256sum, gcry_md_read(SHA256pw, 0), sha256len);
gcry_md_close(SHA256pw);
#endif
}
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
index efb19e6e7..455bad641 100644
--- a/lib/vtls/nss.c
+++ b/lib/vtls/nss.c
@@ -1515,7 +1515,7 @@ static CURLcode nss_init_sslver(SSLVersionRange *sslver,
struct Curl_easy *data,
struct connectdata *conn)
{
- switch (SSL_CONN_CONFIG(version)) {
+ switch(SSL_CONN_CONFIG(version)) {
case CURL_SSLVERSION_DEFAULT:
/* map CURL_SSLVERSION_DEFAULT to NSS default */
if(SSL_VersionRangeGetDefault(ssl_variant_stream, sslver) != SECSuccess)
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
index 559e71087..75051d41e 100644
--- a/lib/vtls/openssl.c
+++ b/lib/vtls/openssl.c
@@ -905,11 +905,11 @@ static void ossl_close(struct ssl_connect_data *connssl)
(void)SSL_shutdown(connssl->handle);
SSL_set_connect_state(connssl->handle);
- SSL_free (connssl->handle);
+ SSL_free(connssl->handle);
connssl->handle = NULL;
}
if(connssl->ctx) {
- SSL_CTX_free (connssl->ctx);
+ SSL_CTX_free(connssl->ctx);
connssl->ctx = NULL;
}
}
@@ -1018,7 +1018,7 @@ int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)
#endif
}
- SSL_free (connssl->handle);
+ SSL_free(connssl->handle);
connssl->handle = NULL;
}
return retval;
@@ -1416,7 +1416,7 @@ static const char *ssl_msg_type(int ssl_ver, int msg)
{
#ifdef SSL2_VERSION_MAJOR
if(ssl_ver == SSL2_VERSION_MAJOR) {
- switch (msg) {
+ switch(msg) {
case SSL2_MT_ERROR:
return "Error";
case SSL2_MT_CLIENT_HELLO:
@@ -1440,7 +1440,7 @@ static const char *ssl_msg_type(int ssl_ver, int msg)
else
#endif
if(ssl_ver == SSL3_VERSION_MAJOR) {
- switch (msg) {
+ switch(msg) {
case SSL3_MT_HELLO_REQUEST:
return "Hello request";
case SSL3_MT_CLIENT_HELLO:
@@ -2174,7 +2174,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
return CURLE_SSL_CONNECT_ERROR;
}
/* Informational message */
- infof (data, "SSL re-using session ID\n");
+ infof(data, "SSL re-using session ID\n");
}
Curl_ssl_sessionid_unlock(conn);
}
diff --git a/lib/x509asn1.c b/lib/x509asn1.c
index acd98e492..c4bc7c1fd 100644
--- a/lib/x509asn1.c
+++ b/lib/x509asn1.c
@@ -267,7 +267,7 @@ utf8asn1str(char **to, int type, const char *from, const char *end)
string length. */
*to = (char *) NULL;
- switch (type) {
+ switch(type) {
case CURL_ASN1_BMP_STRING:
size = 2;
break;
@@ -302,7 +302,7 @@ utf8asn1str(char **to, int type, const char *from, const char *end)
else {
for(outlength = 0; from < end;) {
wc = 0;
- switch (size) {
+ switch(size) {
case 4:
wc = (wc << 8) | *(const unsigned char *) from++;
wc = (wc << 8) | *(const unsigned char *) from++;
@@ -460,7 +460,7 @@ static const char *GTime2str(const char *beg, const char *end)
/* Get seconds digits. */
sec1 = '0';
- switch (fracp - beg - 12) {
+ switch(fracp - beg - 12) {
case 0:
sec2 = '0';
break;
@@ -519,7 +519,7 @@ static const char *UTime2str(const char *beg, const char *end)
;
/* Get the seconds. */
sec = beg + 10;
- switch (tzp - sec) {
+ switch(tzp - sec) {
case 0:
sec = "00";
case 2:
@@ -556,7 +556,7 @@ const char *Curl_ASN1tostr(curl_asn1Element *elem, int type)
if(!type)
type = elem->tag; /* Type not forced: use element tag as type. */
- switch (type) {
+ switch(type) {
case CURL_ASN1_BOOLEAN:
return bool2str(elem->beg, elem->end);
case CURL_ASN1_INTEGER:
@@ -1122,7 +1122,7 @@ CURLcode Curl_verifyhost(struct connectdata *conn,
/* Check all GeneralNames. */
for(q = elem.beg; matched != 1 && q < elem.end;) {
q = Curl_getASN1Element(&name, q, elem.end);
- switch (name.tag) {
+ switch(name.tag) {
case 2: /* DNS name. */
len = utf8asn1str(&dnsname, CURL_ASN1_IA5_STRING,
name.beg, name.end);
@@ -1142,7 +1142,7 @@ CURLcode Curl_verifyhost(struct connectdata *conn,
}
}
- switch (matched) {
+ switch(matched) {
case 1:
/* an alternative name matched the server hostname */
infof(data, "\t subjectAltName: %s matched\n", dispname);