1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

checksrc: stricter no-space-before-paren enforcement

In order to make the code style more uniform everywhere
This commit is contained in:
Daniel Stenberg 2016-12-13 23:34:59 +01:00
parent 5fad800efd
commit b228d2952b
81 changed files with 281 additions and 260 deletions

View File

@ -293,7 +293,7 @@ int main(int argc, char **argv)
binaryptr = malloc(tabLength); binaryptr = malloc(tabLength);
p.verbose = 0; p.verbose = 0;
p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE); p.errorbio = BIO_new_fp(stderr, BIO_NOCLOSE);
curl_global_init(CURL_GLOBAL_DEFAULT); curl_global_init(CURL_GLOBAL_DEFAULT);
@ -408,7 +408,7 @@ int main(int argc, char **argv)
} }
p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE); p.errorbio = BIO_new_fp(stderr, BIO_NOCLOSE);
if(!(p.curl = curl_easy_init())) { if(!(p.curl = curl_easy_init())) {
BIO_printf(p.errorbio, "Cannot init curl lib\n"); BIO_printf(p.errorbio, "Cannot init curl lib\n");
@ -419,7 +419,7 @@ int main(int argc, char **argv)
BIO_printf(p.errorbio, "Error opening P12 file %s\n", p.p12file); BIO_printf(p.errorbio, "Error opening P12 file %s\n", p.p12file);
goto err; goto err;
} }
if(!(p.p12 = d2i_PKCS12_bio (p12bio, NULL))) { if(!(p.p12 = d2i_PKCS12_bio(p12bio, NULL))) {
BIO_printf(p.errorbio, "Cannot decode P12 structure %s\n", p.p12file); BIO_printf(p.errorbio, "Cannot decode P12 structure %s\n", p.p12file);
goto err; goto err;
} }
@ -505,7 +505,7 @@ int main(int argc, char **argv)
{ {
int lu; int i=0; int lu; int i=0;
while((lu = BIO_read (in, &binaryptr[i], tabLength-i)) >0) { while((lu = BIO_read(in, &binaryptr[i], tabLength-i)) >0) {
i+=lu; i+=lu;
if(i== tabLength) { if(i== tabLength) {
tabLength+=100; tabLength+=100;

View File

@ -88,7 +88,7 @@ int my_trace(CURL *handle, curl_infotype type,
const char *text; const char *text;
(void)handle; /* prevent compiler warning */ (void)handle; /* prevent compiler warning */
switch (type) { switch(type) {
case CURLINFO_TEXT: case CURLINFO_TEXT:
fprintf(stderr, "== Info: %s", data); fprintf(stderr, "== Info: %s", data);
default: /* in case a new one is introduced to shock us */ default: /* in case a new one is introduced to shock us */

View File

@ -134,7 +134,7 @@ static void mcode_or_die(const char *where, CURLMcode code)
{ {
if(CURLM_OK != code) { if(CURLM_OK != code) {
const char *s; const char *s;
switch (code) { switch(code) {
case CURLM_BAD_HANDLE: case CURLM_BAD_HANDLE:
s="CURLM_BAD_HANDLE"; s="CURLM_BAD_HANDLE";
break; break;
@ -317,7 +317,7 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)
/* CURLOPT_PROGRESSFUNCTION */ /* CURLOPT_PROGRESSFUNCTION */
static int prog_cb (void *p, double dltotal, double dlnow, double ult, static int prog_cb(void *p, double dltotal, double dlnow, double ult,
double uln) double uln)
{ {
ConnInfo *conn = (ConnInfo *)p; ConnInfo *conn = (ConnInfo *)p;
@ -388,7 +388,7 @@ static void fifo_cb(EV_P_ struct ev_io *w, int revents)
} }
/* Create a named pipe and tell libevent to monitor it */ /* Create a named pipe and tell libevent to monitor it */
static int init_fifo (GlobalInfo *g) static int init_fifo(GlobalInfo *g)
{ {
struct stat st; struct stat st;
static const char *fifo = "hiper.fifo"; static const char *fifo = "hiper.fifo";
@ -399,18 +399,18 @@ static int init_fifo (GlobalInfo *g)
if((st.st_mode & S_IFMT) == S_IFREG) { if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST; errno = EEXIST;
perror("lstat"); perror("lstat");
exit (1); exit(1);
} }
} }
unlink(fifo); unlink(fifo);
if(mkfifo (fifo, 0600) == -1) { if(mkfifo (fifo, 0600) == -1) {
perror("mkfifo"); perror("mkfifo");
exit (1); exit(1);
} }
sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0); sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0);
if(sockfd == -1) { if(sockfd == -1) {
perror("open"); perror("open");
exit (1); exit(1);
} }
g->input = fdopen(sockfd, "r"); g->input = fdopen(sockfd, "r");

View File

@ -127,7 +127,7 @@ int main(void)
curl_easy_strerror(res)); curl_easy_strerror(res));
/* clean up the FTP commands list */ /* clean up the FTP commands list */
curl_slist_free_all (headerlist); curl_slist_free_all(headerlist);
/* always cleanup */ /* always cleanup */
curl_easy_cleanup(curl); curl_easy_cleanup(curl);

View File

@ -98,7 +98,7 @@ static void mcode_or_die(const char *where, CURLMcode code)
{ {
if(CURLM_OK != code) { if(CURLM_OK != code) {
const char *s; const char *s;
switch (code) { switch(code) {
case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break; case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break;
case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break; case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break;
case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break; case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break;
@ -272,7 +272,7 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)
} }
/* CURLOPT_PROGRESSFUNCTION */ /* CURLOPT_PROGRESSFUNCTION */
static int prog_cb (void *p, double dltotal, double dlnow, double ult, static int prog_cb(void *p, double dltotal, double dlnow, double ult,
double uln) double uln)
{ {
ConnInfo *conn = (ConnInfo *)p; ConnInfo *conn = (ConnInfo *)p;
@ -318,7 +318,7 @@ static void new_conn(char *url, GlobalInfo *g)
} }
/* This gets called by glib whenever data is received from the fifo */ /* This gets called by glib whenever data is received from the fifo */
static gboolean fifo_cb (GIOChannel *ch, GIOCondition condition, gpointer data) static gboolean fifo_cb(GIOChannel *ch, GIOCondition condition, gpointer data)
{ {
#define BUF_SIZE 1024 #define BUF_SIZE 1024
gsize len, tp; gsize len, tp;
@ -380,21 +380,21 @@ int init_fifo(void)
if((st.st_mode & S_IFMT) == S_IFREG) { if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST; errno = EEXIST;
perror("lstat"); perror("lstat");
exit (1); exit(1);
} }
} }
unlink (fifo); unlink(fifo);
if(mkfifo (fifo, 0600) == -1) { if(mkfifo (fifo, 0600) == -1) {
perror("mkfifo"); perror("mkfifo");
exit (1); exit(1);
} }
socket = open (fifo, O_RDWR | O_NONBLOCK, 0); socket = open(fifo, O_RDWR | O_NONBLOCK, 0);
if(socket == -1) { if(socket == -1) {
perror("open"); perror("open");
exit (1); exit(1);
} }
MSG_OUT("Now, pipe some URL's into > %s\n", fifo); MSG_OUT("Now, pipe some URL's into > %s\n", fifo);

View File

@ -128,7 +128,7 @@ static void mcode_or_die(const char *where, CURLMcode code)
{ {
if(CURLM_OK != code) { if(CURLM_OK != code) {
const char *s; const char *s;
switch (code) { switch(code) {
case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break; case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break;
case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break; case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break;
case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break; case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break;
@ -300,7 +300,7 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)
/* CURLOPT_PROGRESSFUNCTION */ /* CURLOPT_PROGRESSFUNCTION */
static int prog_cb (void *p, double dltotal, double dlnow, double ult, static int prog_cb(void *p, double dltotal, double dlnow, double ult,
double uln) double uln)
{ {
ConnInfo *conn = (ConnInfo *)p; ConnInfo *conn = (ConnInfo *)p;
@ -371,7 +371,7 @@ static void fifo_cb(int fd, short event, void *arg)
/* Create a named pipe and tell libevent to monitor it */ /* Create a named pipe and tell libevent to monitor it */
static const char *fifo = "hiper.fifo"; static const char *fifo = "hiper.fifo";
static int init_fifo (GlobalInfo *g) static int init_fifo(GlobalInfo *g)
{ {
struct stat st; struct stat st;
curl_socket_t sockfd; curl_socket_t sockfd;
@ -381,18 +381,18 @@ static int init_fifo (GlobalInfo *g)
if((st.st_mode & S_IFMT) == S_IFREG) { if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST; errno = EEXIST;
perror("lstat"); perror("lstat");
exit (1); exit(1);
} }
} }
unlink(fifo); unlink(fifo);
if(mkfifo (fifo, 0600) == -1) { if(mkfifo (fifo, 0600) == -1) {
perror("mkfifo"); perror("mkfifo");
exit (1); exit(1);
} }
sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0); sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0);
if(sockfd == -1) { if(sockfd == -1) {
perror("open"); perror("open");
exit (1); exit(1);
} }
g->input = fdopen(sockfd, "r"); g->input = fdopen(sockfd, "r");

View File

@ -114,7 +114,7 @@ int my_trace(CURL *handle, curl_infotype type,
int num = hnd2num(handle); int num = hnd2num(handle);
(void)handle; /* prevent compiler warning */ (void)handle; /* prevent compiler warning */
(void)userp; (void)userp;
switch (type) { switch(type) {
case CURLINFO_TEXT: case CURLINFO_TEXT:
fprintf(stderr, "== %d Info: %s", num, data); fprintf(stderr, "== %d Info: %s", num, data);
default: /* in case a new one is introduced to shock us */ default: /* in case a new one is introduced to shock us */

View File

@ -93,7 +93,7 @@ int my_trace(CURL *handle, curl_infotype type,
const char *text; const char *text;
(void)handle; /* prevent compiler warning */ (void)handle; /* prevent compiler warning */
(void)userp; (void)userp;
switch (type) { switch(type) {
case CURLINFO_TEXT: case CURLINFO_TEXT:
fprintf(stderr, "== Info: %s", data); fprintf(stderr, "== Info: %s", data);
default: /* in case a new one is introduced to shock us */ default: /* in case a new one is introduced to shock us */

View File

@ -133,7 +133,7 @@ int my_trace(CURL *handle, curl_infotype type,
snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld", snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld",
now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec); now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
switch (type) { switch(type) {
case CURLINFO_TEXT: case CURLINFO_TEXT:
fprintf(stderr, "%s [%d] Info: %s", timebuf, num, data); fprintf(stderr, "%s [%d] Info: %s", timebuf, num, data);
default: /* in case a new one is introduced to shock us */ default: /* in case a new one is introduced to shock us */

View File

@ -156,7 +156,7 @@ int main(void)
break; break;
} }
switch (idx) { switch(idx) {
case HTTP_HANDLE: case HTTP_HANDLE:
printf("HTTP transfer completed with status %d\n", msg->data.result); printf("HTTP transfer completed with status %d\n", msg->data.result);
break; break;

View File

@ -96,7 +96,7 @@ int my_trace(CURL *handle, curl_infotype type,
(void)userp; (void)userp;
(void)handle; /* prevent compiler warning */ (void)handle; /* prevent compiler warning */
switch (type) { switch(type) {
case CURLINFO_TEXT: case CURLINFO_TEXT:
fprintf(stderr, "== Info: %s", data); fprintf(stderr, "== Info: %s", data);
default: /* in case a new one is introduced to shock us */ default: /* in case a new one is introduced to shock us */

View File

@ -165,7 +165,7 @@ int main(void)
curl_formfree(formpost); curl_formfree(formpost);
/* free slist */ /* free slist */
curl_slist_free_all (headerlist); curl_slist_free_all(headerlist);
} }
return 0; return 0;
} }

View File

@ -101,7 +101,7 @@ int main(int argc, char *argv[])
/* then cleanup the formpost chain */ /* then cleanup the formpost chain */
curl_formfree(formpost); curl_formfree(formpost);
/* free slist */ /* free slist */
curl_slist_free_all (headerlist); curl_slist_free_all(headerlist);
} }
return 0; return 0;
} }

View File

@ -105,7 +105,7 @@ void *pull_one_url(void *NaN)
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
} }
g_free (http); g_free(http);
/* Adds more latency, testing the mutex.*/ /* Adds more latency, testing the mutex.*/
sleep(1); sleep(1);
@ -118,7 +118,7 @@ void *pull_one_url(void *NaN)
gboolean pulse_bar(gpointer data) gboolean pulse_bar(gpointer data)
{ {
gdk_threads_enter(); gdk_threads_enter();
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (data)); gtk_progress_bar_pulse(GTK_PROGRESS_BAR (data));
gdk_threads_leave(); gdk_threads_leave();
/* Return true so the function will be called again; /* Return true so the function will be called again;
@ -182,8 +182,8 @@ int main(int argc, char **argv)
/* Init thread */ /* Init thread */
g_thread_init(NULL); g_thread_init(NULL);
gdk_threads_init (); gdk_threads_init();
gdk_threads_enter (); gdk_threads_enter();
gtk_init(&argc, &argv); gtk_init(&argc, &argv);
@ -203,9 +203,9 @@ int main(int argc, char **argv)
/* Progress bar */ /* Progress bar */
progress_bar = gtk_progress_bar_new(); progress_bar = gtk_progress_bar_new();
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progress_bar)); gtk_progress_bar_pulse(GTK_PROGRESS_BAR (progress_bar));
/* Make uniform pulsing */ /* Make uniform pulsing */
gint pulse_ref = g_timeout_add (300, pulse_bar, progress_bar); gint pulse_ref = g_timeout_add(300, pulse_bar, progress_bar);
g_object_set_data(G_OBJECT(progress_bar), "pulse_id", g_object_set_data(G_OBJECT(progress_bar), "pulse_id",
GINT_TO_POINTER(pulse_ref)); GINT_TO_POINTER(pulse_ref));
gtk_container_add(GTK_CONTAINER(inside_frame), progress_bar); gtk_container_add(GTK_CONTAINER(inside_frame), progress_bar);

View File

@ -152,7 +152,7 @@ size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
TmpStr1 & 2? */ TmpStr1 & 2? */
AutoSyncTime = 0; AutoSyncTime = 0;
else { else {
RetVal = sscanf ((char *)(ptr), "Date: %s %hu %s %hu %hu:%hu:%hu", RetVal = sscanf((char *)(ptr), "Date: %s %hu %s %hu %hu:%hu:%hu",
TmpStr1, &SYSTime.wDay, TmpStr2, &SYSTime.wYear, TmpStr1, &SYSTime.wDay, TmpStr2, &SYSTime.wYear,
&SYSTime.wHour, &SYSTime.wMinute, &SYSTime.wSecond); &SYSTime.wHour, &SYSTime.wMinute, &SYSTime.wSecond);

View File

@ -1910,7 +1910,10 @@ typedef enum {
/* curl_strequal() and curl_strnequal() are subject for removal in a future /* curl_strequal() and curl_strnequal() are subject for removal in a future
libcurl, see lib/README.curlx for details */ libcurl, see lib/README.curlx for details
!checksrc! disable SPACEBEFOREPAREN 2
*/
CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2); CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n); CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -24,8 +24,8 @@
#include <sys/types.h> #include <sys/types.h>
size_t fread (void *, size_t, size_t, FILE *); size_t fread(void *, size_t, size_t, FILE *);
size_t fwrite (const void *, size_t, size_t, FILE *); size_t fwrite(const void *, size_t, size_t, FILE *);
int strcasecmp(const char *, const char *); int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t); int strncasecmp(const char *, const char *, size_t);

View File

@ -40,7 +40,7 @@
*/ */
#define curl_easy_setopt(handle, option, value) \ #define curl_easy_setopt(handle, option, value) \
__extension__ ({ \ __extension__ ({ \
__typeof__ (option) _curl_opt = option; \ __typeof__(option) _curl_opt = option; \
if(__builtin_constant_p(_curl_opt)) { \ if(__builtin_constant_p(_curl_opt)) { \
if(_curl_is_long_option(_curl_opt)) \ if(_curl_is_long_option(_curl_opt)) \
if(!_curl_is_long(value)) \ if(!_curl_is_long(value)) \
@ -110,7 +110,7 @@ __extension__ ({ \
/* FIXME: don't allow const pointers */ /* FIXME: don't allow const pointers */
#define curl_easy_getinfo(handle, info, arg) \ #define curl_easy_getinfo(handle, info, arg) \
__extension__ ({ \ __extension__ ({ \
__typeof__ (info) _curl_info = info; \ __typeof__(info) _curl_info = info; \
if(__builtin_constant_p(_curl_info)) { \ if(__builtin_constant_p(_curl_info)) { \
if(_curl_is_string_info(_curl_info)) \ if(_curl_is_string_info(_curl_info)) \
if(!_curl_is_arr((arg), char *)) \ if(!_curl_is_arr((arg), char *)) \

View File

@ -169,7 +169,7 @@ int Curl_resolver_duphandle(void **to, void *from)
return CURLE_OK; 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. * 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. * 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); free(async->hostname);

View File

@ -263,7 +263,7 @@ static int getaddrinfo_complete(struct connectdata *conn)
* For builds without ARES, but with ENABLE_IPV6, create a resolver thread * For builds without ARES, but with ENABLE_IPV6, create a resolver thread
* and wait on it. * 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_sync_data *tsd = (struct thread_sync_data*)arg;
struct thread_data *td = tsd->td; 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. * 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_sync_data *tsd = (struct thread_sync_data *)arg;
struct thread_data *td = tsd->td; 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. * 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) { if(async->os_specific) {
struct thread_data *td = (struct thread_data*) async->os_specific; struct thread_data *td = (struct thread_data*) async->os_specific;
@ -375,7 +375,7 @@ static void destroy_async_data (struct Curl_async *async)
* *
* Returns FALSE in case of failure, otherwise TRUE. * Returns FALSE in case of failure, otherwise TRUE.
*/ */
static bool init_resolve_thread (struct connectdata *conn, static bool init_resolve_thread(struct connectdata *conn,
const char *hostname, int port, const char *hostname, int port,
const struct addrinfo *hints) const struct addrinfo *hints)
{ {

View File

@ -243,6 +243,12 @@ sub checksrc {
} }
} }
sub nostrings {
my ($str) = @_;
$str =~ s/\".*\"//g;
return $str;
}
sub scanfile { sub scanfile {
my ($file) = @_; my ($file) = @_;
@ -329,11 +335,21 @@ sub scanfile {
$line, length($1), $file, $l, "\/\/ comment"); $line, length($1), $file, $l, "\/\/ comment");
} }
# check spaces after for/if/while my $nostr = nostrings($l);
if($l =~ /^(.*)(for|if|while) \(/) { # check spaces after for/if/while/function call
if($nostr =~ /^(.*)(for|if|while| ([a-zA-Z0-9_]+)) \((.)/) {
if($1 =~ / *\#/) { if($1 =~ / *\#/) {
# this is a #if, treat it differently # 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 { else {
checkwarn("SPACEBEFOREPAREN", $line, length($1)+length($2), $file, $l, checkwarn("SPACEBEFOREPAREN", $line, length($1)+length($2), $file, $l,
"$2 with space"); "$2 with space");

View File

@ -194,7 +194,7 @@ time_t Curl_timeleft(struct Curl_easy *data,
if(duringconnect && (data->set.connecttimeout > 0)) if(duringconnect && (data->set.connecttimeout > 0))
timeout_set |= 2; timeout_set |= 2;
switch (timeout_set) { switch(timeout_set) {
case 1: case 1:
timeout_ms = data->set.timeout; timeout_ms = data->set.timeout;
break; break;
@ -620,7 +620,7 @@ static bool getaddressinfo(struct sockaddr *sa, char *addr,
struct sockaddr_un *su = NULL; struct sockaddr_un *su = NULL;
#endif #endif
switch (sa->sa_family) { switch(sa->sa_family) {
case AF_INET: case AF_INET:
si = (struct sockaddr_in *)(void *) sa; si = (struct sockaddr_in *)(void *) sa;
if(Curl_inet_ntop(sa->sa_family, &si->sin_addr, if(Curl_inet_ntop(sa->sa_family, &si->sin_addr,

View File

@ -69,10 +69,10 @@ process_zlib_error(struct connectdata *conn, z_stream *z)
{ {
struct Curl_easy *data = conn->data; struct Curl_easy *data = conn->data;
if(z->msg) if(z->msg)
failf (data, "Error while processing content unencoding: %s", failf(data, "Error while processing content unencoding: %s",
z->msg); z->msg);
else else
failf (data, "Error while processing content unencoding: " failf(data, "Error while processing content unencoding: "
"Unknown failure within decompression software."); "Unknown failure within decompression software.");
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
@ -327,14 +327,14 @@ Curl_unencode_gzip_write(struct connectdata *conn,
* can handle the gzip header themselves. * can handle the gzip header themselves.
*/ */
switch (k->zlib_init) { switch(k->zlib_init) {
/* Skip over gzip header? */ /* Skip over gzip header? */
case ZLIB_INIT: case ZLIB_INIT:
{ {
/* Initial call state */ /* Initial call state */
ssize_t hlen; 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: case GZIP_OK:
z->next_in = (Bytef *)k->str + hlen; z->next_in = (Bytef *)k->str + hlen;
z->avail_in = (uInt)(nread - 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 */ /* Append the new block of data to the previous one */
memcpy(z->next_in + z->avail_in - nread, k->str, nread); 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: case GZIP_OK:
/* This is the zlib stream data */ /* This is the zlib stream data */
free(z->next_in); free(z->next_in);

View File

@ -286,10 +286,10 @@ Curl_he2ai(const struct hostent *he, int port)
size_t ss_size; size_t ss_size;
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
if(he->h_addrtype == AF_INET6) if(he->h_addrtype == AF_INET6)
ss_size = sizeof (struct sockaddr_in6); ss_size = sizeof(struct sockaddr_in6);
else else
#endif #endif
ss_size = sizeof (struct sockaddr_in); ss_size = sizeof(struct sockaddr_in);
if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL) { if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL) {
result = CURLE_OUT_OF_MEMORY; 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 */ /* leave the rest of the struct filled with zero */
switch (ai->ai_family) { switch(ai->ai_family) {
case AF_INET: case AF_INET:
addr = (void *)ai->ai_addr; /* storage area for this info */ 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; struct sockaddr_in6 *addr6;
#endif #endif
for(ca = addrinfo; ca != NULL; ca = ca->ai_next) { for(ca = addrinfo; ca != NULL; ca = ca->ai_next) {
switch (ca->ai_family) { switch(ca->ai_family) {
case AF_INET: case AF_INET:
addr = (void *)ca->ai_addr; /* storage area for this info */ addr = (void *)ca->ai_addr; /* storage area for this info */
addr->sin_port = htons((unsigned short)port); addr->sin_port = htons((unsigned short)port);

View File

@ -566,7 +566,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struct Curl_easy *data,
gcry_md_hd_t MD4pw; gcry_md_hd_t MD4pw;
gcry_md_open(&MD4pw, GCRY_MD_MD4, 0); gcry_md_open(&MD4pw, GCRY_MD_MD4, 0);
gcry_md_write(MD4pw, pw, 2 * len); 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); gcry_md_close(MD4pw);
#elif defined(USE_MBEDTLS) #elif defined(USE_MBEDTLS)
mbedtls_md4(pw, 2 * len, ntbuffer); mbedtls_md4(pw, 2 * len, ntbuffer);

View File

@ -39,11 +39,11 @@ struct Curl_sec_client_mech {
#define AUTH_ERROR 2 #define AUTH_ERROR 2
#ifdef HAVE_GSSAPI #ifdef HAVE_GSSAPI
int Curl_sec_read_msg (struct connectdata *conn, char *, int Curl_sec_read_msg(struct connectdata *conn, char *,
enum protection_level); enum protection_level);
void Curl_sec_end (struct connectdata *); void Curl_sec_end(struct connectdata *);
CURLcode Curl_sec_login (struct connectdata *); CURLcode Curl_sec_login(struct connectdata *);
int Curl_sec_request_prot (struct connectdata *conn, const char *level); int Curl_sec_request_prot(struct connectdata *conn, const char *level);
extern struct Curl_sec_client_mech Curl_krb5_client_mech; extern struct Curl_sec_client_mech Curl_krb5_client_mech;
#endif #endif

View File

@ -100,6 +100,7 @@ int Curl_thread_join(curl_thread_t *hnd)
#elif defined(USE_THREADS_WIN32) #elif defined(USE_THREADS_WIN32)
/* !checksrc! disable SPACEBEFOREPAREN 1 */
curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *), curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
void *arg) void *arg)
{ {

View File

@ -50,6 +50,7 @@
#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32) #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 *), curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
void *arg); void *arg);

View File

@ -43,7 +43,7 @@
*/ */
static bool Curl_isunreserved(unsigned char in) static bool Curl_isunreserved(unsigned char in)
{ {
switch (in) { switch(in) {
case '0': case '1': case '2': case '3': case '4': case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'a': case 'b': case 'c': case 'd': case 'e':

View File

@ -316,7 +316,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
break; break;
} }
switch (option) { switch(option) {
case CURLFORM_ARRAY: case CURLFORM_ARRAY:
if(array_state) if(array_state)
/* we don't support an array from within an array */ /* 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); result = stat(file, &statbuf);
switch (statbuf.st_fab_rfm) { switch(statbuf.st_fab_rfm) {
case FAB$C_VAR: case FAB$C_VAR:
case FAB$C_VFC: case FAB$C_VFC:
case FAB$C_STMCR: case FAB$C_STMCR:

View File

@ -455,7 +455,7 @@ static CURLcode ReceivedServerConnect(struct connectdata *conn, bool *received)
result = Curl_socket_check(ctrl_sock, data_sock, CURL_SOCKET_BAD, 0); result = Curl_socket_check(ctrl_sock, data_sock, CURL_SOCKET_BAD, 0);
/* see if the connection request is already here */ /* see if the connection request is already here */
switch (result) { switch(result) {
case -1: /* error */ case -1: /* error */
/* let's die here */ /* let's die here */
failf(data, "Error while waiting for server connect"); 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)) { 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 */ case -1: /* select() error, stop reading */
failf(data, "FTP response aborted due to select/poll error: %d", failf(data, "FTP response aborted due to select/poll error: %d",
SOCKERRNO); SOCKERRNO);
@ -3873,7 +3873,7 @@ static CURLcode wc_statemach(struct connectdata *conn)
struct WildcardData * const wildcard = &(conn->data->wildcard); struct WildcardData * const wildcard = &(conn->data->wildcard);
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
switch (wildcard->state) { switch(wildcard->state) {
case CURLWC_INIT: case CURLWC_INIT:
result = init_wc_data(conn); result = init_wc_data(conn);
if(wildcard->state == CURLWC_CLEAN) if(wildcard->state == CURLWC_CLEAN)
@ -4501,7 +4501,7 @@ static CURLcode ftp_setup_connection(struct connectdata *conn)
command = Curl_raw_toupper(type[6]); command = Curl_raw_toupper(type[6]);
conn->bits.type_set = TRUE; conn->bits.type_set = TRUE;
switch (command) { switch(command) {
case 'A': /* ASCII mode */ case 'A': /* ASCII mode */
data->set.prefer_ascii = TRUE; data->set.prefer_ascii = TRUE;
break; break;

View File

@ -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: case OS_TYPE_UNIX:
switch (parser->state.UNIX.main) { switch(parser->state.UNIX.main) {
case PL_UNIX_TOTALSIZE: case PL_UNIX_TOTALSIZE:
switch(parser->state.UNIX.sub.total_dirsize) { switch(parser->state.UNIX.sub.total_dirsize) {
case PL_UNIX_TOTALSIZE_INIT: case PL_UNIX_TOTALSIZE_INIT:
@ -447,7 +447,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
} }
break; break;
case PL_UNIX_FILETYPE: case PL_UNIX_FILETYPE:
switch (c) { switch(c) {
case '-': case '-':
finfo->filetype = CURLFILETYPE_FILE; finfo->filetype = CURLFILETYPE_FILE;
break; break;
@ -967,7 +967,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
} }
break; break;
case PL_WINNT_FILENAME: case PL_WINNT_FILENAME:
switch (parser->state.NT.sub.filename) { switch(parser->state.NT.sub.filename) {
case PL_WINNT_FILENAME_PRESPACE: case PL_WINNT_FILENAME_PRESPACE:
if(c != ' ') { if(c != ' ') {
parser->item_offset = finfo->b_used -1; parser->item_offset = finfo->b_used -1;

View File

@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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; *param_longp = data->state.rtsp_CSeq_recv;
break; break;
case CURLINFO_HTTP_VERSION: case CURLINFO_HTTP_VERSION:
switch (data->info.httpversion) { switch(data->info.httpversion) {
case 10: case 10:
*param_longp = CURL_HTTP_VERSION_1_0; *param_longp = CURL_HTTP_VERSION_1_0;
break; break;

View File

@ -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_hash_element *he;
struct curl_llist_element *le; 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) { for(le = l->head; le; le = le->next) {
he = (struct curl_hash_element *) le->ptr; he = (struct curl_hash_element *) le->ptr;

View File

@ -172,7 +172,7 @@ Curl_printable_address(const Curl_addrinfo *ai, char *buf, size_t bufsize)
const struct in6_addr *ipaddr6; const struct in6_addr *ipaddr6;
#endif #endif
switch (ai->ai_family) { switch(ai->ai_family) {
case AF_INET: case AF_INET:
sa4 = (const void *)ai->ai_addr; sa4 = (const void *)ai->ai_addr;
ipaddr4 = &sa4->sin_addr; ipaddr4 = &sa4->sin_addr;

View File

@ -131,7 +131,7 @@ int Curl_mk_dnscache(struct curl_hash *hash);
void Curl_hostcache_prune(struct Curl_easy *data); void Curl_hostcache_prune(struct Curl_easy *data);
/* Return # of adresses in a Curl_addrinfo struct */ /* 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) #if defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO)
int curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa, int curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa,

View File

@ -545,7 +545,7 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
} }
} }
if(http_should_fail(conn)) { if(http_should_fail(conn)) {
failf (data, "The requested URL returned error: %d", failf(data, "The requested URL returned error: %d",
data->req.httpcode); data->req.httpcode);
result = CURLE_HTTP_RETURNED_ERROR; 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 */ /* when doing ftp, append ;type=<a|i> if not present */
char *type = strstr(ppath, ";type="); char *type = strstr(ppath, ";type=");
if(type && type[6] && type[7] == 0) { if(type && type[6] && type[7] == 0) {
switch (Curl_raw_toupper(type[6])) { switch(Curl_raw_toupper(type[6])) {
case 'A': case 'A':
case 'D': case 'D':
case 'I': 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 * Free proxyuserpwd for Negotiate/NTLM. Cannot reuse as it is associated
* with the connection and shouldn't be repeated over it either. * 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_NEGOTIATE:
case CURLAUTH_NTLM: case CURLAUTH_NTLM:
case CURLAUTH_NTLM_WB: case CURLAUTH_NTLM_WB:
@ -2753,7 +2753,7 @@ checkhttpprefix(struct Curl_easy *data,
/* convert from the network encoding using a scratch area */ /* convert from the network encoding using a scratch area */
char *scratch = strdup(s); char *scratch = strdup(s);
if(NULL == scratch) { 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 */ return FALSE; /* can't return CURLE_OUT_OF_MEMORY so return FALSE */
} }
if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s)+1)) { 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 */ /* convert from the network encoding using a scratch area */
char *scratch = strdup(s); char *scratch = strdup(s);
if(NULL == scratch) { 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 */ return FALSE; /* can't return CURLE_OUT_OF_MEMORY so return FALSE */
} }
if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s)+1)) { if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s)+1)) {
@ -2843,7 +2843,7 @@ 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 /* 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 server feeding libcurl with a never-ending header that will cause
reallocs infinitely */ reallocs infinitely */
failf (data, "Avoided giant realloc for header (max is %d)!", failf(data, "Avoided giant realloc for header (max is %d)!",
CURL_MAX_HTTP_HEADER); CURL_MAX_HTTP_HEADER);
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
} }
@ -2852,7 +2852,7 @@ static CURLcode header_append(struct Curl_easy *data,
hbufp_index = k->hbufp - data->state.headerbuff; hbufp_index = k->hbufp - data->state.headerbuff;
newbuff = realloc(data->state.headerbuff, newsize); newbuff = realloc(data->state.headerbuff, newsize);
if(!newbuff) { 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; return CURLE_OUT_OF_MEMORY;
} }
data->state.headersize=newsize; data->state.headersize=newsize;
@ -3093,7 +3093,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
* up and return an error. * up and return an error.
*/ */
if(http_should_fail(conn)) { if(http_should_fail(conn)) {
failf (data, "The requested URL returned error: %d", failf(data, "The requested URL returned error: %d",
k->httpcode); k->httpcode);
return CURLE_HTTP_RETURNED_ERROR; return CURLE_HTTP_RETURNED_ERROR;
} }

View File

@ -190,7 +190,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
/* Write the data portion available */ /* Write the data portion available */
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
switch (conn->data->set.http_ce_skip? switch(conn->data->set.http_ce_skip?
IDENTITY : data->req.auto_decoding) { IDENTITY : data->req.auto_decoding) {
case IDENTITY: case IDENTITY:
#endif #endif
@ -219,7 +219,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
break; break;
default: default:
failf (conn->data, failf(conn->data,
"Unrecognized content encoding type. " "Unrecognized content encoding type. "
"libcurl understands `identity', `deflate' and `gzip' " "libcurl understands `identity', `deflate' and `gzip' "
"content encodings."); "content encodings.");
@ -360,7 +360,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
const char *Curl_chunked_strerror(CHUNKcode code) const char *Curl_chunked_strerror(CHUNKcode code)
{ {
switch (code) { switch(code) {
default: default:
return "OK"; return "OK";
case CHUNKE_TOO_LONG_HEX: case CHUNKE_TOO_LONG_HEX:

View File

@ -320,7 +320,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
} }
/* loop every second at least, less if the timeout is near */ /* 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 */ case -1: /* select() error, stop reading */
error = SELECT_ERROR; error = SELECT_ERROR;
failf(data, "Proxy CONNECT aborted due to select/poll 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; 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 */ data->req.ignorebody = FALSE; /* put it (back) to non-ignore state */
conn->bits.rewindaftersend = FALSE; /* make sure this isn't set for the conn->bits.rewindaftersend = FALSE; /* make sure this isn't set for the
document request */ document request */

View File

@ -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) char *Curl_inet_ntop(int af, const void *src, char *buf, size_t size)
{ {
switch (af) { switch(af) {
case AF_INET: case AF_INET:
return inet_ntop4((const unsigned char *)src, buf, size); return inet_ntop4((const unsigned char *)src, buf, size);
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6

View File

@ -65,7 +65,7 @@ static int inet_pton6(const char *src, unsigned char *dst);
int int
Curl_inet_pton(int af, const char *src, void *dst) Curl_inet_pton(int af, const char *src, void *dst)
{ {
switch (af) { switch(af) {
case AF_INET: case AF_INET:
return (inet_pton4(src, (unsigned char *)dst)); return (inet_pton4(src, (unsigned char *)dst));
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6

View File

@ -109,9 +109,9 @@ typedef struct {
#undef LDAPURLDesc #undef LDAPURLDesc
#define LDAPURLDesc CURL_LDAPURLDesc #define LDAPURLDesc CURL_LDAPURLDesc
static int _ldap_url_parse (const struct connectdata *conn, static int _ldap_url_parse(const struct connectdata *conn,
LDAPURLDesc **ludp); LDAPURLDesc **ludp);
static void _ldap_free_urldesc (LDAPURLDesc *ludp); static void _ldap_free_urldesc(LDAPURLDesc *ludp);
#undef ldap_free_urldesc #undef ldap_free_urldesc
#define ldap_free_urldesc _ldap_free_urldesc #define ldap_free_urldesc _ldap_free_urldesc
@ -119,11 +119,11 @@ static void _ldap_free_urldesc (LDAPURLDesc *ludp);
#ifdef DEBUG_LDAP #ifdef DEBUG_LDAP
#define LDAP_TRACE(x) do { \ #define LDAP_TRACE(x) do { \
_ldap_trace ("%u: ", __LINE__); \ _ldap_trace("%u: ", __LINE__); \
_ldap_trace x; \ _ldap_trace x; \
} WHILE_FALSE } WHILE_FALSE
static void _ldap_trace (const char *fmt, ...); static void _ldap_trace(const char *fmt, ...);
#else #else
#define LDAP_TRACE(x) Curl_nop_stmt #define LDAP_TRACE(x) Curl_nop_stmt
#endif #endif
@ -655,7 +655,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
quit: quit:
if(ldapmsg) { if(ldapmsg) {
ldap_msgfree(ldapmsg); ldap_msgfree(ldapmsg);
LDAP_TRACE (("Received %d entries\n", num)); LDAP_TRACE(("Received %d entries\n", num));
} }
if(rc == LDAP_SIZELIMIT_EXCEEDED) if(rc == LDAP_SIZELIMIT_EXCEEDED)
infof(data, "There are more than %d entries\n", num); infof(data, "There are more than %d entries\n", num);
@ -682,7 +682,7 @@ quit:
} }
#ifdef DEBUG_LDAP #ifdef DEBUG_LDAP
static void _ldap_trace (const char *fmt, ...) static void _ldap_trace(const char *fmt, ...)
{ {
static int do_trace = -1; static int do_trace = -1;
va_list args; va_list args;
@ -694,9 +694,9 @@ static void _ldap_trace (const char *fmt, ...)
if(!do_trace) if(!do_trace)
return; return;
va_start (args, fmt); va_start(args, fmt);
vfprintf (stderr, fmt, args); vfprintf(stderr, fmt, args);
va_end (args); va_end(args);
} }
#endif #endif
@ -705,7 +705,7 @@ static void _ldap_trace (const char *fmt, ...)
/* /*
* Return scope-value for a scope-string. * Return scope-value for a scope-string.
*/ */
static int str2scope (const char *p) static int str2scope(const char *p)
{ {
if(strcasecompare(p, "one")) if(strcasecompare(p, "one"))
return LDAP_SCOPE_ONELEVEL; return LDAP_SCOPE_ONELEVEL;
@ -799,7 +799,7 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
char *unescaped; char *unescaped;
CURLcode result; CURLcode result;
LDAP_TRACE (("DN '%s'\n", dn)); LDAP_TRACE(("DN '%s'\n", dn));
/* Unescape the DN */ /* Unescape the DN */
result = Curl_urldecode(conn->data, dn, 0, &unescaped, NULL, FALSE); 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; char *unescaped;
CURLcode result; CURLcode result;
LDAP_TRACE (("attr[%d] '%s'\n", i, attributes[i])); LDAP_TRACE(("attr[%d] '%s'\n", i, attributes[i]));
/* Unescape the attribute */ /* Unescape the attribute */
result = Curl_urldecode(conn->data, attributes[i], 0, &unescaped, NULL, 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; goto quit;
} }
LDAP_TRACE (("scope %d\n", ludp->lud_scope)); LDAP_TRACE(("scope %d\n", ludp->lud_scope));
} }
p = q; p = q;
@ -934,7 +934,7 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
char *unescaped; char *unescaped;
CURLcode result; CURLcode result;
LDAP_TRACE (("filter '%s'\n", filter)); LDAP_TRACE(("filter '%s'\n", filter));
/* Unescape the filter */ /* Unescape the filter */
result = Curl_urldecode(conn->data, filter, 0, &unescaped, NULL, FALSE); 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->lud_attrs);
} }
free (ludp); free(ludp);
} }
#endif /* !HAVE_LDAP_URL_PARSE */ #endif /* !HAVE_LDAP_URL_PARSE */
#endif /* !CURL_DISABLE_LDAP && !USE_OPENLDAP */ #endif /* !CURL_DISABLE_LDAP && !USE_OPENLDAP */

View File

@ -501,7 +501,7 @@ static int dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos,
(mp_intmax_t)va_arg(arglist, int); (mp_intmax_t)va_arg(arglist, int);
} }
switch (vto[i].type) { switch(vto[i].type) {
case FORMAT_STRING: case FORMAT_STRING:
vto[i].data.str = va_arg(arglist, char *); vto[i].data.str = va_arg(arglist, char *);
break; break;
@ -691,7 +691,7 @@ static int dprintf_formatf(
is_alt = (p->flags & FLAGS_ALT) ? 1 : 0; is_alt = (p->flags & FLAGS_ALT) ? 1 : 0;
switch (p->type) { switch(p->type) {
case FORMAT_INT: case FORMAT_INT:
num = p->data.num.as_unsigned; num = p->data.num.as_unsigned;
if(p->flags & FLAGS_CHAR) { if(p->flags & FLAGS_CHAR) {

View File

@ -303,14 +303,14 @@ void DisposeThreadData(void *data)
/* For native CLib-based NLM seems we can do a bit more simple. */ /* For native CLib-based NLM seems we can do a bit more simple. */
#include <nwthread.h> #include <nwthread.h>
int main (void) int main(void)
{ {
/* initialize any globals here... */ /* initialize any globals here... */
/* do this if any global initializing was done /* do this if any global initializing was done
SynchronizeStart(); SynchronizeStart();
*/ */
ExitThread (TSR_THREAD, 0); ExitThread(TSR_THREAD, 0);
return 0; return 0;
} }

View File

@ -26,7 +26,7 @@
#ifdef __NOVELL_LIBC__ #ifdef __NOVELL_LIBC__
/* For native LibC-based NLM we need to do nothing. */ /* For native LibC-based NLM we need to do nothing. */
int netware_init (void) int netware_init(void)
{ {
return 0; return 0;
} }
@ -45,7 +45,7 @@ NETDB_DEFINE_CONTEXT
#include <arpa/inet.h> #include <arpa/inet.h>
NETINET_DEFINE_CONTEXT NETINET_DEFINE_CONTEXT
int netware_init (void) int netware_init(void)
{ {
int rc = 0; int rc = 0;
unsigned int myHandle = GetNLMHandle(); unsigned int myHandle = GetNLMHandle();
@ -72,13 +72,13 @@ int netware_init (void)
} }
/* dummy function to satisfy newer prelude */ /* dummy function to satisfy newer prelude */
int __init_environment (void) int __init_environment(void)
{ {
return 0; return 0;
} }
/* dummy function to satisfy newer prelude */ /* dummy function to satisfy newer prelude */
int __deinit_environment (void) int __deinit_environment(void)
{ {
return 0; return 0;
} }

View File

@ -489,7 +489,7 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
* Free userpwd now --- cannot reuse this for Negotiate and possibly NTLM * Free userpwd now --- cannot reuse this for Negotiate and possibly NTLM
* with basic and digest, it will be freed anyway by the next request * 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; conn->allocptr.userpwd = NULL;
if(result) if(result)
@ -737,7 +737,7 @@ CURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len)
curl_write_callback writeit; curl_write_callback writeit;
if(len == 0) { 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; 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); wrote = writeit(ptr, 1, len, data->set.rtp_out);
if(CURL_WRITEFUNC_PAUSE == wrote) { if(CURL_WRITEFUNC_PAUSE == wrote) {
failf (data, "Cannot pause RTP"); failf(data, "Cannot pause RTP");
return CURLE_WRITE_ERROR; return CURLE_WRITE_ERROR;
} }
if(wrote != len) { if(wrote != len) {
failf (data, "Failed writing RTP data"); failf(data, "Failed writing RTP data");
return CURLE_WRITE_ERROR; return CURLE_WRITE_ERROR;
} }

View File

@ -571,7 +571,7 @@ CURLcode Curl_client_chop_write(struct connectdata *conn,
return pausewrite(data, CLIENTWRITE_HEADER, ptr, len); return pausewrite(data, CLIENTWRITE_HEADER, ptr, len);
if(wrote != chunklen) { if(wrote != chunklen) {
failf (data, "Failed writing header"); failf(data, "Failed writing header");
return CURLE_WRITE_ERROR; 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, /* If we come here, it means that there is no data to read from the buffer,
* so we read from the socket */ * so we read from the socket */
bytesfromsocket = CURLMIN(sizerequested, BUFSIZE * sizeof (char)); bytesfromsocket = CURLMIN(sizerequested, BUFSIZE * sizeof(char));
buffertofill = conn->master_buffer; buffertofill = conn->master_buffer;
} }
else { else {
@ -796,7 +796,7 @@ int Curl_debug(struct Curl_easy *data, curl_infotype type,
char buffer[160]; char buffer[160];
const char *t=NULL; const char *t=NULL;
const char *w="Data"; const char *w="Data";
switch (type) { switch(type) {
case CURLINFO_HEADER_IN: case CURLINFO_HEADER_IN:
w = "Header"; w = "Header";
/* FALLTHROUGH */ /* FALLTHROUGH */

View File

@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -54,8 +54,8 @@ struct Curl_share {
long sessionage; long sessionage;
}; };
CURLSHcode Curl_share_lock (struct Curl_easy *, curl_lock_data, CURLSHcode Curl_share_lock(struct Curl_easy *, curl_lock_data,
curl_lock_access); curl_lock_access);
CURLSHcode Curl_share_unlock (struct Curl_easy *, curl_lock_data); CURLSHcode Curl_share_unlock(struct Curl_easy *, curl_lock_data);
#endif /* HEADER_CURL_SHARE_H */ #endif /* HEADER_CURL_SHARE_H */

View File

@ -292,7 +292,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
gss_release_name(&gss_status, &server); gss_release_name(&gss_status, &server);
/* Everything is good so far, user was authenticated! */ /* Everything is good so far, user was authenticated! */
gss_major_status = gss_inquire_context (&gss_minor_status, gss_context, gss_major_status = gss_inquire_context(&gss_minor_status, gss_context,
&gss_client_name, NULL, NULL, NULL, &gss_client_name, NULL, NULL, NULL,
NULL, NULL, NULL); NULL, NULL, NULL);
if(check_gss_err(data, gss_major_status, if(check_gss_err(data, gss_major_status,

View File

@ -239,7 +239,7 @@ kbd_callback(const char *name, int name_len, const char *instruction,
static CURLcode sftp_libssh2_error_to_CURLE(int err) static CURLcode sftp_libssh2_error_to_CURLE(int err)
{ {
switch (err) { switch(err) {
case LIBSSH2_FX_OK: case LIBSSH2_FX_OK:
return CURLE_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) static CURLcode libssh2_session_error_to_CURLE(int err)
{ {
switch (err) { switch(err) {
/* Ordered by order of appearance in libssh2.h */ /* Ordered by order of appearance in libssh2.h */
case LIBSSH2_ERROR_NONE: case LIBSSH2_ERROR_NONE:
return CURLE_OK; return CURLE_OK;
@ -2652,7 +2652,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
else if(rc < 0) { else if(rc < 0) {
infof(data, "Failed to disconnect from libssh2 agent\n"); 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; sshc->ssh_agent = NULL;
/* NB: there is no need to free identities, they are part of internal /* 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) static const char *sftp_libssh2_strerror(int err)
{ {
switch (err) { switch(err) {
case LIBSSH2_FX_NO_SUCH_FILE: case LIBSSH2_FX_NO_SUCH_FILE:
return "No such file or directory"; return "No such file or directory";

View File

@ -34,7 +34,7 @@ char Curl_raw_toupper(char in)
if(in >= 'a' && in <= 'z') if(in >= 'a' && in <= 'z')
return (char)('A' + in - 'a'); return (char)('A' + in - 'a');
#else #else
switch (in) { switch(in) {
case 'a': case 'a':
return 'A'; return 'A';
case 'b': case 'b':

View File

@ -53,7 +53,7 @@ const char *
curl_easy_strerror(CURLcode error) curl_easy_strerror(CURLcode error)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifndef CURL_DISABLE_VERBOSE_STRINGS
switch (error) { switch(error) {
case CURLE_OK: case CURLE_OK:
return "No error"; return "No error";
@ -348,7 +348,7 @@ const char *
curl_multi_strerror(CURLMcode error) curl_multi_strerror(CURLMcode error)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifndef CURL_DISABLE_VERBOSE_STRINGS
switch (error) { switch(error) {
case CURLM_CALL_MULTI_PERFORM: case CURLM_CALL_MULTI_PERFORM:
return "Please call curl_multi_perform() soon"; return "Please call curl_multi_perform() soon";
@ -393,7 +393,7 @@ const char *
curl_share_strerror(CURLSHcode error) curl_share_strerror(CURLSHcode error)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifndef CURL_DISABLE_VERBOSE_STRINGS
switch (error) { switch(error) {
case CURLSHE_OK: case CURLSHE_OK:
return "No error"; return "No error";
@ -435,7 +435,7 @@ get_winsock_error (int err, char *buf, size_t len)
const char *p; const char *p;
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifndef CURL_DISABLE_VERBOSE_STRINGS
switch (err) { switch(err) {
case WSAEINTR: case WSAEINTR:
p = "Call interrupted"; p = "Call interrupted";
break; break;
@ -609,7 +609,7 @@ get_winsock_error (int err, char *buf, size_t len)
else else
p = "error"; p = "error";
#endif #endif
strncpy (buf, p, len); strncpy(buf, p, len);
buf [len-1] = '\0'; buf [len-1] = '\0';
return buf; return buf;
} }
@ -750,7 +750,7 @@ const char *Curl_sspi_strerror (struct connectdata *conn, int err)
old_errno = ERRNO; old_errno = ERRNO;
switch (err) { switch(err) {
case SEC_E_OK: case SEC_E_OK:
txt = "No error"; txt = "No error";
break; break;

View File

@ -91,7 +91,7 @@
#ifdef USE_WINSOCK #ifdef USE_WINSOCK
typedef FARPROC WSOCK2_FUNC; typedef FARPROC WSOCK2_FUNC;
static CURLcode check_wsock2 (struct Curl_easy *data); static CURLcode check_wsock2(struct Curl_easy *data);
#endif #endif
static static
@ -935,7 +935,7 @@ static void suboption(struct connectdata *conn)
struct TELNET *tn = (struct TELNET *)data->req.protop; struct TELNET *tn = (struct TELNET *)data->req.protop;
printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn)+2); 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: case CURL_TELOPT_TTYPE:
len = strlen(tn->subopt_ttype) + 4 + 2; len = strlen(tn->subopt_ttype) + 4 + 2;
snprintf((char *)temp, sizeof(temp), snprintf((char *)temp, sizeof(temp),
@ -1009,7 +1009,7 @@ static void sendsuboption(struct connectdata *conn, int option)
struct Curl_easy *data = conn->data; struct Curl_easy *data = conn->data;
struct TELNET *tn = (struct TELNET *)data->req.protop; struct TELNET *tn = (struct TELNET *)data->req.protop;
switch (option) { switch(option) {
case CURL_TELOPT_NAWS: case CURL_TELOPT_NAWS:
/* We prepare data to be sent */ /* We prepare data to be sent */
CURL_SB_CLEAR(tn); CURL_SB_CLEAR(tn);
@ -1087,7 +1087,7 @@ CURLcode telrcv(struct connectdata *conn,
while(count--) { while(count--) {
c = inbuf[in]; c = inbuf[in];
switch (tn->telrcv_state) { switch(tn->telrcv_state) {
case CURL_TS_CR: case CURL_TS_CR:
tn->telrcv_state = CURL_TS_DATA; tn->telrcv_state = CURL_TS_DATA;
if(c == '\0') { if(c == '\0') {
@ -1111,7 +1111,7 @@ CURLcode telrcv(struct connectdata *conn,
case CURL_TS_IAC: case CURL_TS_IAC:
process_iac: process_iac:
DEBUGASSERT(startwrite < 0); DEBUGASSERT(startwrite < 0);
switch (c) { switch(c) {
case CURL_WILL: case CURL_WILL:
tn->telrcv_state = CURL_TS_WILL; tn->telrcv_state = CURL_TS_WILL;
break; break;
@ -1241,7 +1241,7 @@ static CURLcode send_telnet_data(struct connectdata *conn,
struct pollfd pfd[1]; struct pollfd pfd[1];
pfd[0].fd = conn->sock[FIRSTSOCKET]; pfd[0].fd = conn->sock[FIRSTSOCKET];
pfd[0].events = POLLOUT; pfd[0].events = POLLOUT;
switch (Curl_poll(pfd, 1, -1)) { switch(Curl_poll(pfd, 1, -1)) {
case -1: /* error, abort writing */ case -1: /* error, abort writing */
case 0: /* timeout (will never happen) */ case 0: /* timeout (will never happen) */
result = CURLE_SEND_ERROR; result = CURLE_SEND_ERROR;
@ -1576,7 +1576,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
} }
while(keepon) { while(keepon) {
switch (Curl_poll(pfd, poll_cnt, interval_ms)) { switch(Curl_poll(pfd, poll_cnt, interval_ms)) {
case -1: /* error, stop reading */ case -1: /* error, stop reading */
keepon = FALSE; keepon = FALSE;
continue; continue;

View File

@ -304,7 +304,7 @@ static unsigned short getrpacketblock(const tftp_packet_t *packet)
static size_t Curl_strnlen(const char *string, size_t maxlen) 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; 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 */ *type = 0; /* it was in the middle of the hostname */
command = Curl_raw_toupper(type[6]); command = Curl_raw_toupper(type[6]);
switch (command) { switch(command) {
case 'A': /* ASCII mode */ case 'A': /* ASCII mode */
case 'N': /* NETASCII mode */ case 'N': /* NETASCII mode */
data->set.prefer_ascii = TRUE; data->set.prefer_ascii = TRUE;

View File

@ -741,7 +741,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
Make sure that ALL_CONTENT_ENCODINGS contains all the Make sure that ALL_CONTENT_ENCODINGS contains all the
encodings handled here. */ encodings handled here. */
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
switch (conn->data->set.http_ce_skip ? switch(conn->data->set.http_ce_skip ?
IDENTITY : k->auto_decoding) { IDENTITY : k->auto_decoding) {
case IDENTITY: case IDENTITY:
#endif #endif
@ -775,7 +775,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
break; break;
default: default:
failf (data, "Unrecognized content encoding type. " failf(data, "Unrecognized content encoding type. "
"libcurl understands `identity', `deflate' and `gzip' " "libcurl understands `identity', `deflate' and `gzip' "
"content encodings."); "content encodings.");
result = CURLE_BAD_CONTENT_ENCODING; result = CURLE_BAD_CONTENT_ENCODING;

View File

@ -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 * 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: case 0:
data->set.proxy_transfer_mode = FALSE; data->set.proxy_transfer_mode = FALSE;
break; break;
@ -2890,10 +2890,10 @@ static void conn_reset_postponed_data(struct connectdata *conn, int num)
#endif /* DEBUGBUILD */ #endif /* DEBUGBUILD */
} }
else { else {
DEBUGASSERT (psnd->allocated_size == 0); DEBUGASSERT(psnd->allocated_size == 0);
DEBUGASSERT (psnd->recv_size == 0); DEBUGASSERT(psnd->recv_size == 0);
DEBUGASSERT (psnd->recv_processed == 0); DEBUGASSERT(psnd->recv_processed == 0);
DEBUGASSERT (psnd->bindsock == CURL_SOCKET_BAD); 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) && if(Curl_pipeline_wanted(data->multi, CURLPIPE_HTTP1) &&
!conn->master_buffer) { !conn->master_buffer) {
/* Allocate master_buffer to be used for HTTP/1 pipelining */ /* 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) if(!conn->master_buffer)
goto error; goto error;
} }

View File

@ -65,7 +65,7 @@ int Curl_axtls_cleanup(void)
static CURLcode map_error_to_curl(int axtls_err) static CURLcode map_error_to_curl(int axtls_err)
{ {
switch (axtls_err) { switch(axtls_err) {
case SSL_ERROR_NOT_SUPPORTED: case SSL_ERROR_NOT_SUPPORTED:
case SSL_ERROR_INVALID_VERSION: case SSL_ERROR_INVALID_VERSION:
case -70: /* protocol version alert from server */ 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) static void free_ssl_structs(struct ssl_connect_data *connssl)
{ {
if(connssl->ssl) { if(connssl->ssl) {
ssl_free (connssl->ssl); ssl_free(connssl->ssl);
connssl->ssl = NULL; connssl->ssl = NULL;
} }
if(connssl->ssl_ctx) { 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, if(!Curl_ssl_getsessionid(conn, (void **) &ssl_sessionid, &ssl_idsize,
sockindex)) { sockindex)) {
/* we got a session id, use it! */ /* 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 = ssl_client_new(ssl_ctx, conn->sock[sockindex],
ssl_sessionid, (uint8_t)ssl_idsize); ssl_sessionid, (uint8_t)ssl_idsize);
} }
@ -392,7 +392,7 @@ static CURLcode connect_finish(struct connectdata *conn, int sockindex)
Curl_ssl_sessionid_lock(conn); Curl_ssl_sessionid_lock(conn);
if(Curl_ssl_addsessionid(conn, (void *) ssl_sessionid, ssl_idsize, if(Curl_ssl_addsessionid(conn, (void *) ssl_sessionid, ssl_idsize,
sockindex) != CURLE_OK) 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); Curl_ssl_sessionid_unlock(conn);
} }
@ -440,7 +440,7 @@ CURLcode Curl_axtls_connect_nonblocking(
return CURLE_OK; 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; conn->ssl[sockindex].connecting_state = ssl_connect_3;
} }
@ -506,7 +506,7 @@ Curl_axtls_connect(struct connectdata *conn,
/* TODO: avoid polling */ /* TODO: avoid polling */
Curl_wait_ms(10); Curl_wait_ms(10);
} }
infof (conn->data, "handshake completed successfully\n"); infof(conn->data, "handshake completed successfully\n");
conn_step = connect_finish(conn, sockindex); conn_step = connect_finish(conn, sockindex);
if(conn_step != CURLE_OK) { if(conn_step != CURLE_OK) {

View File

@ -397,7 +397,7 @@ cyassl_connect_step1(struct connectdata *conn,
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
/* Informational message */ /* Informational message */
infof (data, "SSL re-using session ID\n"); infof(data, "SSL re-using session ID\n");
} }
Curl_ssl_sessionid_unlock(conn); Curl_ssl_sessionid_unlock(conn);
} }
@ -669,11 +669,11 @@ void Curl_cyassl_close(struct connectdata *conn, int sockindex)
if(conssl->handle) { if(conssl->handle) {
(void)SSL_shutdown(conssl->handle); (void)SSL_shutdown(conssl->handle);
SSL_free (conssl->handle); SSL_free(conssl->handle);
conssl->handle = NULL; conssl->handle = NULL;
} }
if(conssl->ctx) { if(conssl->ctx) {
SSL_CTX_free (conssl->ctx); SSL_CTX_free(conssl->ctx);
conssl->ctx = NULL; conssl->ctx = NULL;
} }
} }
@ -755,7 +755,7 @@ int Curl_cyassl_shutdown(struct connectdata *conn, int sockindex)
struct ssl_connect_data *connssl = &conn->ssl[sockindex]; struct ssl_connect_data *connssl = &conn->ssl[sockindex];
if(connssl->handle) { if(connssl->handle) {
SSL_free (connssl->handle); SSL_free(connssl->handle);
connssl->handle = NULL; connssl->handle = NULL;
} }
return retval; return retval;

View File

@ -221,7 +221,7 @@ static OSStatus SocketWrite(SSLConnectionRef connection,
CF_INLINE const char *SSLCipherNameForNumber(SSLCipherSuite cipher) CF_INLINE const char *SSLCipherNameForNumber(SSLCipherSuite cipher)
{ {
switch (cipher) { switch(cipher) {
/* SSL version 3.0 */ /* SSL version 3.0 */
case SSL_RSA_WITH_NULL_MD5: case SSL_RSA_WITH_NULL_MD5:
return "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, (void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx,
kSSLProtocolAll, kSSLProtocolAll,
false); false);
switch (conn->ssl_config.version) { switch(conn->ssl_config.version) {
case CURL_SSLVERSION_DEFAULT: case CURL_SSLVERSION_DEFAULT:
case CURL_SSLVERSION_TLSv1: case CURL_SSLVERSION_TLSv1:
(void)SSLSetProtocolVersionEnabled(connssl->ssl_ctx, (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); return sslerr_to_curlerr(data, ret);
} }
switch (trust_eval) { switch(trust_eval) {
case kSecTrustResultUnspecified: case kSecTrustResultUnspecified:
case kSecTrustResultProceed: case kSecTrustResultProceed:
return CURLE_OK; return CURLE_OK;
@ -1912,7 +1912,7 @@ darwinssl_connect_step2(struct connectdata *conn, int sockindex)
err = SSLHandshake(connssl->ssl_ctx); err = SSLHandshake(connssl->ssl_ctx);
if(err != noErr) { if(err != noErr) {
switch (err) { switch(err) {
case errSSLWouldBlock: /* they're not done with us yet */ case errSSLWouldBlock: /* they're not done with us yet */
connssl->connecting_state = connssl->ssl_direction ? connssl->connecting_state = connssl->ssl_direction ?
ssl_connect_2_writing : ssl_connect_2_reading; ssl_connect_2_writing : ssl_connect_2_reading;
@ -2002,7 +2002,7 @@ darwinssl_connect_step2(struct connectdata *conn, int sockindex)
/* Informational message */ /* Informational message */
(void)SSLGetNegotiatedCipher(connssl->ssl_ctx, &cipher); (void)SSLGetNegotiatedCipher(connssl->ssl_ctx, &cipher);
(void)SSLGetNegotiatedProtocolVersion(connssl->ssl_ctx, &protocol); (void)SSLGetNegotiatedProtocolVersion(connssl->ssl_ctx, &protocol);
switch (protocol) { switch(protocol) {
case kSSLProtocol2: case kSSLProtocol2:
infof(data, "SSL 2.0 connection using %s\n", infof(data, "SSL 2.0 connection using %s\n",
SSLCipherNameForNumber(cipher)); SSLCipherNameForNumber(cipher));
@ -2489,7 +2489,7 @@ static ssize_t darwinssl_send(struct connectdata *conn,
if(connssl->ssl_write_buffered_length) { if(connssl->ssl_write_buffered_length) {
/* Write the buffered data: */ /* Write the buffered data: */
err = SSLWrite(connssl->ssl_ctx, NULL, 0UL, &processed); err = SSLWrite(connssl->ssl_ctx, NULL, 0UL, &processed);
switch (err) { switch(err) {
case noErr: case noErr:
/* processed is always going to be 0 because we didn't write to /* processed is always going to be 0 because we didn't write to
the buffer, so return how much was written to the socket */ 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: */ /* We've got new data to write: */
err = SSLWrite(connssl->ssl_ctx, mem, len, &processed); err = SSLWrite(connssl->ssl_ctx, mem, len, &processed);
if(err != noErr) { if(err != noErr) {
switch (err) { switch(err) {
case errSSLWouldBlock: case errSSLWouldBlock:
/* Data was buffered but not sent, we have to tell the caller /* Data was buffered but not sent, we have to tell the caller
to try sending again, and remember how much was buffered */ 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); OSStatus err = SSLRead(connssl->ssl_ctx, buf, buffersize, &processed);
if(err != noErr) { if(err != noErr) {
switch (err) { switch(err) {
case errSSLWouldBlock: /* return how much we read (if anything) */ case errSSLWouldBlock: /* return how much we read (if anything) */
if(processed) if(processed)
return (ssize_t)processed; return (ssize_t)processed;

View File

@ -155,7 +155,7 @@ static const gskit_cipher ciphertable[] = {
static bool is_separator(char c) static bool is_separator(char c)
{ {
/* Return whether character is a cipher list separator. */ /* Return whether character is a cipher list separator. */
switch (c) { switch(c) {
case ' ': case ' ':
case '\t': case '\t':
case ':': case ':':
@ -171,7 +171,7 @@ static CURLcode gskit_status(struct Curl_easy *data, int rc,
const char *procname, CURLcode defcode) const char *procname, CURLcode defcode)
{ {
/* Process GSKit status and map it to a CURLcode. */ /* Process GSKit status and map it to a CURLcode. */
switch (rc) { switch(rc) {
case GSK_OK: case GSK_OK:
case GSK_OS400_ASYNCHRONOUS_SOC_INIT: case GSK_OS400_ASYNCHRONOUS_SOC_INIT:
return CURLE_OK; return CURLE_OK;
@ -194,7 +194,7 @@ static CURLcode gskit_status(struct Curl_easy *data, int rc,
case GSK_OS400_ERROR_NOT_REGISTERED: case GSK_OS400_ERROR_NOT_REGISTERED:
break; break;
case GSK_ERROR_IO: case GSK_ERROR_IO:
switch (errno) { switch(errno) {
case ENOMEM: case ENOMEM:
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
default: 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); int rc = gsk_attribute_set_enum(h, id, value);
switch (rc) { switch(rc) {
case GSK_OK: case GSK_OK:
return CURLE_OK; return CURLE_OK;
case GSK_ERROR_IO: 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); int rc = gsk_attribute_set_buffer(h, id, buffer, 0);
switch (rc) { switch(rc) {
case GSK_OK: case GSK_OK:
return CURLE_OK; return CURLE_OK;
case GSK_ERROR_IO: 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); int rc = gsk_attribute_set_numeric_value(h, id, value);
switch (rc) { switch(rc) {
case GSK_OK: case GSK_OK:
return CURLE_OK; return CURLE_OK;
case GSK_ERROR_IO: 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); int rc = gsk_attribute_set_callback(h, id, info);
switch (rc) { switch(rc) {
case GSK_OK: case GSK_OK:
return CURLE_OK; return CURLE_OK;
case GSK_ERROR_IO: case GSK_ERROR_IO:
@ -453,7 +453,7 @@ static CURLcode init_environment(struct Curl_easy *data,
/* Creates the GSKit environment. */ /* Creates the GSKit environment. */
rc = gsk_environment_open(&h); rc = gsk_environment_open(&h);
switch (rc) { switch(rc) {
case GSK_OK: case GSK_OK:
break; break;
case GSK_INSUFFICIENT_STORAGE: 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. */ /* Determine which SSL/TLS version should be enabled. */
sni = hostname; sni = hostname;
switch (ssl_version) { switch(ssl_version) {
case CURL_SSLVERSION_SSLv2: case CURL_SSLVERSION_SSLv2:
protoflags = CURL_GSKPROTO_SSLV2_MASK; protoflags = CURL_GSKPROTO_SSLV2_MASK;
sni = NULL; sni = NULL;
@ -996,7 +996,7 @@ static CURLcode gskit_connect_step2(struct connectdata *conn, int sockindex,
timeout_ms = 0; timeout_ms = 0;
stmv.tv_sec = timeout_ms / 1000; stmv.tv_sec = timeout_ms / 1000;
stmv.tv_usec = (timeout_ms - stmv.tv_sec * 1000) * 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. */ case 1: /* Operation complete. */
break; break;
case -1: /* An error occurred: handshake still in progress. */ 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"); infof(data, "Server certificate:\n");
p = cdev; p = cdev;
for(i = 0; i++ < cdec; p++) for(i = 0; i++ < cdec; p++)
switch (p->cert_data_id) { switch(p->cert_data_id) {
case CERT_BODY_DER: case CERT_BODY_DER:
cert = p->cert_data_p; cert = p->cert_data_p;
certend = cert + cdev->cert_data_l; certend = cert + cdev->cert_data_l;

View File

@ -235,7 +235,7 @@ static void showtime(struct Curl_easy *data,
infof(data, "%s\n", data->state.buffer); 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; FILE *f;
gnutls_datum_t loaded_file = { NULL, 0 }; gnutls_datum_t loaded_file = { NULL, 0 };
@ -567,7 +567,7 @@ gtls_connect_step1(struct connectdata *conn,
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
switch (SSL_CONN_CONFIG(version) { switch(SSL_CONN_CONFIG(version) {
case CURL_SSLVERSION_SSLv3: case CURL_SSLVERSION_SSLv3:
protocol_priority[0] = GNUTLS_SSL3; protocol_priority[0] = GNUTLS_SSL3;
break; 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 /* 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 * removed if a run-time error indicates that SRP is not supported by this
* GnuTLS version */ * GnuTLS version */
switch (SSL_CONN_CONFIG(version)) { switch(SSL_CONN_CONFIG(version)) {
case CURL_SSLVERSION_SSLv3: case CURL_SSLVERSION_SSLv3:
prioritylist = GNUTLS_CIPHERS ":-VERS-TLS-ALL:+VERS-SSL3.0"; prioritylist = GNUTLS_CIPHERS ":-VERS-TLS-ALL:+VERS-SSL3.0";
sni = false; sni = false;
@ -791,7 +791,7 @@ gtls_connect_step1(struct connectdata *conn,
gnutls_session_set_data(session, ssl_sessionid, ssl_idsize); gnutls_session_set_data(session, ssl_sessionid, ssl_idsize);
/* Informational message */ /* Informational message */
infof (data, "SSL re-using session ID\n"); infof(data, "SSL re-using session ID\n");
} }
Curl_ssl_sessionid_unlock(conn); Curl_ssl_sessionid_unlock(conn);
} }
@ -1374,7 +1374,7 @@ gtls_connect_common(struct connectdata *conn,
/* Initiate the connection, if not already done */ /* Initiate the connection, if not already done */
if(ssl_connect_1==connssl->connecting_state) { if(ssl_connect_1==connssl->connecting_state) {
rc = gtls_connect_step1 (conn, sockindex); rc = gtls_connect_step1(conn, sockindex);
if(rc) if(rc)
return rc; return rc;
} }
@ -1653,7 +1653,7 @@ void Curl_gtls_md5sum(unsigned char *tmp, /* input */
gcry_md_hd_t MD5pw; gcry_md_hd_t MD5pw;
gcry_md_open(&MD5pw, GCRY_MD_MD5, 0); gcry_md_open(&MD5pw, GCRY_MD_MD5, 0);
gcry_md_write(MD5pw, tmp, tmplen); 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); gcry_md_close(MD5pw);
#endif #endif
} }
@ -1672,7 +1672,7 @@ void Curl_gtls_sha256sum(const unsigned char *tmp, /* input */
gcry_md_hd_t SHA256pw; gcry_md_hd_t SHA256pw;
gcry_md_open(&SHA256pw, GCRY_MD_SHA256, 0); gcry_md_open(&SHA256pw, GCRY_MD_SHA256, 0);
gcry_md_write(SHA256pw, tmp, tmplen); 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); gcry_md_close(SHA256pw);
#endif #endif
} }

View File

@ -1515,7 +1515,7 @@ static CURLcode nss_init_sslver(SSLVersionRange *sslver,
struct Curl_easy *data, struct Curl_easy *data,
struct connectdata *conn) struct connectdata *conn)
{ {
switch (SSL_CONN_CONFIG(version)) { switch(SSL_CONN_CONFIG(version)) {
case CURL_SSLVERSION_DEFAULT: case CURL_SSLVERSION_DEFAULT:
/* map CURL_SSLVERSION_DEFAULT to NSS default */ /* map CURL_SSLVERSION_DEFAULT to NSS default */
if(SSL_VersionRangeGetDefault(ssl_variant_stream, sslver) != SECSuccess) if(SSL_VersionRangeGetDefault(ssl_variant_stream, sslver) != SECSuccess)

View File

@ -905,11 +905,11 @@ static void ossl_close(struct ssl_connect_data *connssl)
(void)SSL_shutdown(connssl->handle); (void)SSL_shutdown(connssl->handle);
SSL_set_connect_state(connssl->handle); SSL_set_connect_state(connssl->handle);
SSL_free (connssl->handle); SSL_free(connssl->handle);
connssl->handle = NULL; connssl->handle = NULL;
} }
if(connssl->ctx) { if(connssl->ctx) {
SSL_CTX_free (connssl->ctx); SSL_CTX_free(connssl->ctx);
connssl->ctx = NULL; connssl->ctx = NULL;
} }
} }
@ -1018,7 +1018,7 @@ int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)
#endif #endif
} }
SSL_free (connssl->handle); SSL_free(connssl->handle);
connssl->handle = NULL; connssl->handle = NULL;
} }
return retval; return retval;
@ -1416,7 +1416,7 @@ static const char *ssl_msg_type(int ssl_ver, int msg)
{ {
#ifdef SSL2_VERSION_MAJOR #ifdef SSL2_VERSION_MAJOR
if(ssl_ver == SSL2_VERSION_MAJOR) { if(ssl_ver == SSL2_VERSION_MAJOR) {
switch (msg) { switch(msg) {
case SSL2_MT_ERROR: case SSL2_MT_ERROR:
return "Error"; return "Error";
case SSL2_MT_CLIENT_HELLO: case SSL2_MT_CLIENT_HELLO:
@ -1440,7 +1440,7 @@ static const char *ssl_msg_type(int ssl_ver, int msg)
else else
#endif #endif
if(ssl_ver == SSL3_VERSION_MAJOR) { if(ssl_ver == SSL3_VERSION_MAJOR) {
switch (msg) { switch(msg) {
case SSL3_MT_HELLO_REQUEST: case SSL3_MT_HELLO_REQUEST:
return "Hello request"; return "Hello request";
case SSL3_MT_CLIENT_HELLO: case SSL3_MT_CLIENT_HELLO:
@ -2174,7 +2174,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
return CURLE_SSL_CONNECT_ERROR; return CURLE_SSL_CONNECT_ERROR;
} }
/* Informational message */ /* Informational message */
infof (data, "SSL re-using session ID\n"); infof(data, "SSL re-using session ID\n");
} }
Curl_ssl_sessionid_unlock(conn); Curl_ssl_sessionid_unlock(conn);
} }

View File

@ -267,7 +267,7 @@ utf8asn1str(char **to, int type, const char *from, const char *end)
string length. */ string length. */
*to = (char *) NULL; *to = (char *) NULL;
switch (type) { switch(type) {
case CURL_ASN1_BMP_STRING: case CURL_ASN1_BMP_STRING:
size = 2; size = 2;
break; break;
@ -302,7 +302,7 @@ utf8asn1str(char **to, int type, const char *from, const char *end)
else { else {
for(outlength = 0; from < end;) { for(outlength = 0; from < end;) {
wc = 0; wc = 0;
switch (size) { switch(size) {
case 4: case 4:
wc = (wc << 8) | *(const unsigned char *) from++; wc = (wc << 8) | *(const unsigned char *) from++;
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. */ /* Get seconds digits. */
sec1 = '0'; sec1 = '0';
switch (fracp - beg - 12) { switch(fracp - beg - 12) {
case 0: case 0:
sec2 = '0'; sec2 = '0';
break; break;
@ -519,7 +519,7 @@ static const char *UTime2str(const char *beg, const char *end)
; ;
/* Get the seconds. */ /* Get the seconds. */
sec = beg + 10; sec = beg + 10;
switch (tzp - sec) { switch(tzp - sec) {
case 0: case 0:
sec = "00"; sec = "00";
case 2: case 2:
@ -556,7 +556,7 @@ const char *Curl_ASN1tostr(curl_asn1Element *elem, int type)
if(!type) if(!type)
type = elem->tag; /* Type not forced: use element tag as type. */ type = elem->tag; /* Type not forced: use element tag as type. */
switch (type) { switch(type) {
case CURL_ASN1_BOOLEAN: case CURL_ASN1_BOOLEAN:
return bool2str(elem->beg, elem->end); return bool2str(elem->beg, elem->end);
case CURL_ASN1_INTEGER: case CURL_ASN1_INTEGER:
@ -1122,7 +1122,7 @@ CURLcode Curl_verifyhost(struct connectdata *conn,
/* Check all GeneralNames. */ /* Check all GeneralNames. */
for(q = elem.beg; matched != 1 && q < elem.end;) { for(q = elem.beg; matched != 1 && q < elem.end;) {
q = Curl_getASN1Element(&name, q, elem.end); q = Curl_getASN1Element(&name, q, elem.end);
switch (name.tag) { switch(name.tag) {
case 2: /* DNS name. */ case 2: /* DNS name. */
len = utf8asn1str(&dnsname, CURL_ASN1_IA5_STRING, len = utf8asn1str(&dnsname, CURL_ASN1_IA5_STRING,
name.beg, name.end); name.beg, name.end);
@ -1142,7 +1142,7 @@ CURLcode Curl_verifyhost(struct connectdata *conn,
} }
} }
switch (matched) { switch(matched) {
case 1: case 1:
/* an alternative name matched the server hostname */ /* an alternative name matched the server hostname */
infof(data, "\t subjectAltName: %s matched\n", dispname); infof(data, "\t subjectAltName: %s matched\n", dispname);

View File

@ -182,7 +182,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
} }
#endif /* CURL_DOES_CONVERSIONS */ #endif /* CURL_DOES_CONVERSIONS */
switch (type) { switch(type) {
case CURLINFO_TEXT: case CURLINFO_TEXT:
fprintf(output, "%s== Info: %s", timebuf, data); fprintf(output, "%s== Info: %s", timebuf, data);
default: /* in case a new one is introduced to shock us */ default: /* in case a new one is introduced to shock us */

View File

@ -431,7 +431,7 @@ SANITIZEcode msdosify(char **const sanitized, const char *file_name,
*d = 'x'; *d = 'x';
} }
else { else {
memcpy (d, "plus", 4); memcpy(d, "plus", 4);
d += 3; d += 3;
} }
} }

View File

@ -1628,7 +1628,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
break; break;
case 'L': case 'L':
config->followlocation = toggle; /* Follow Location: HTTP headers */ config->followlocation = toggle; /* Follow Location: HTTP headers */
switch (subletter) { switch(subletter) {
case 't': case 't':
/* Continue to send authentication (user+password) when following /* Continue to send authentication (user+password) when following
* locations, even when hostname changed */ * locations, even when hostname changed */

View File

@ -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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -46,7 +46,7 @@ static char *GetEnv(const char *variable, char do_expand)
} }
if(do_expand && strchr(variable, '%')) { if(do_expand && strchr(variable, '%')) {
/* buf2 == variable if not expanded */ /* buf2 == variable if not expanded */
rc = ExpandEnvironmentStrings (variable, buf2, sizeof(buf2)); rc = ExpandEnvironmentStrings(variable, buf2, sizeof(buf2));
if(rc > 0 && rc < sizeof(buf2) && if(rc > 0 && rc < sizeof(buf2) &&
!strchr(buf2, '%')) /* no vars still unexpanded */ !strchr(buf2, '%')) /* no vars still unexpanded */
env = buf2; env = buf2;

View File

@ -653,7 +653,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
infd = -1; infd = -1;
if(stat(uploadfile, &fileinfo) == 0) { if(stat(uploadfile, &fileinfo) == 0) {
fileinfo.st_size = VmsSpecialSize(uploadfile, &fileinfo); fileinfo.st_size = VmsSpecialSize(uploadfile, &fileinfo);
switch (fileinfo.st_fab_rfm) { switch(fileinfo.st_fab_rfm) {
case FAB$C_VAR: case FAB$C_VAR:
case FAB$C_VFC: case FAB$C_VFC:
case FAB$C_STMCR: case FAB$C_STMCR:

View File

@ -313,7 +313,7 @@ long proto2num(struct OperationConfig *config, long *val, const char *str)
for(pp=protos; pp->name; pp++) { for(pp=protos; pp->name; pp++) {
if(curl_strequal(token, pp->name)) { if(curl_strequal(token, pp->name)) {
switch (action) { switch(action) {
case deny: case deny:
*val &= ~(pp->bit); *val &= ~(pp->bit);
break; break;

View File

@ -516,7 +516,7 @@ CURLcode glob_next_url(char **globbed, URLGlob *glob)
for(i = 0; carry && (i < glob->size); i++) { for(i = 0; carry && (i < glob->size); i++) {
carry = FALSE; carry = FALSE;
pat = &glob->pattern[glob->size - 1 - i]; pat = &glob->pattern[glob->size - 1 - i];
switch (pat->type) { switch(pat->type) {
case UPTSet: case UPTSet:
if((pat->content.Set.elements) && if((pat->content.Set.elements) &&
(++pat->content.Set.ptr_s == pat->content.Set.size)) { (++pat->content.Set.ptr_s == pat->content.Set.size)) {
@ -631,7 +631,7 @@ CURLcode glob_match_url(char **result, char *filename, URLGlob *glob)
} }
if(pat) { if(pat) {
switch (pat->type) { switch(pat->type) {
case UPTSet: case UPTSet:
if(pat->content.Set.elements) { if(pat->content.Set.elements) {
appendthis = pat->content.Set.elements[pat->content.Set.ptr_s]; appendthis = pat->content.Set.elements[pat->content.Set.ptr_s];

View File

@ -78,7 +78,7 @@ void ourWriteEnv(CURL *curl)
double doubleinfo; double doubleinfo;
for(i=0; variables[i].name; i++) { for(i=0; variables[i].name; i++) {
switch (variables[i].type) { switch(variables[i].type) {
case writeenv_STRING: case writeenv_STRING:
if(curl_easy_getinfo(curl, variables[i].id, &string) == CURLE_OK) if(curl_easy_getinfo(curl, variables[i].id, &string) == CURLE_OK)
internalSetEnv(variables[i].name, string); internalSetEnv(variables[i].name, string);

View File

@ -295,7 +295,7 @@ void ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo)
curl_easy_getinfo(curl, CURLINFO_HTTP_VERSION, curl_easy_getinfo(curl, CURLINFO_HTTP_VERSION,
&longinfo)) { &longinfo)) {
const char *version = "0"; const char *version = "0";
switch (longinfo) { switch(longinfo) {
case CURL_HTTP_VERSION_1_0: case CURL_HTTP_VERSION_1_0:
version = "1.0"; version = "1.0";
break; break;

View File

@ -50,7 +50,7 @@ static void my_lock(CURL *handle, curl_lock_data data,
(void)handle; (void)handle;
(void)laccess; (void)laccess;
switch (data) { switch(data) {
case CURL_LOCK_DATA_SHARE: case CURL_LOCK_DATA_SHARE:
what = "share"; what = "share";
locknum = 0; locknum = 0;
@ -86,7 +86,7 @@ static void my_unlock(CURL *handle, curl_lock_data data, void *useptr)
struct userdata *user = (struct userdata *)useptr; struct userdata *user = (struct userdata *)useptr;
int locknum; int locknum;
(void)handle; (void)handle;
switch (data) { switch(data) {
case CURL_LOCK_DATA_SHARE: case CURL_LOCK_DATA_SHARE:
what = "share"; what = "share";
locknum = 0; locknum = 0;

View File

@ -65,7 +65,7 @@ int test(char *URL)
return TEST_ERR_MAJOR_BAD; return TEST_ERR_MAJOR_BAD;
} }
slist = curl_slist_append (NULL, "SYST"); slist = curl_slist_append(NULL, "SYST");
if(slist == NULL) { if(slist == NULL) {
free(newURL); free(newURL);
curl_easy_cleanup(curl); curl_easy_cleanup(curl);

View File

@ -89,7 +89,7 @@ int my_trace(CURL *handle, curl_infotype type,
const char *text; const char *text;
(void)handle; /* prevent compiler warning */ (void)handle; /* prevent compiler warning */
switch (type) { switch(type) {
case CURLINFO_TEXT: case CURLINFO_TEXT:
fprintf(stderr, "== Info: %s", (char *)data); fprintf(stderr, "== Info: %s", (char *)data);
default: /* in case a new one is introduced to shock us */ default: /* in case a new one is introduced to shock us */

View File

@ -45,7 +45,7 @@ static void my_lock(CURL *handle, curl_lock_data data,
(void)handle; (void)handle;
(void)laccess; (void)laccess;
switch (data) { switch(data) {
case CURL_LOCK_DATA_SHARE: case CURL_LOCK_DATA_SHARE:
what = "share"; what = "share";
break; break;
@ -72,7 +72,7 @@ static void my_unlock(CURL *handle, curl_lock_data data, void *useptr)
const char *what; const char *what;
struct userdata *user = (struct userdata *)useptr; struct userdata *user = (struct userdata *)useptr;
(void)handle; (void)handle;
switch ( data) { switch(data) {
case CURL_LOCK_DATA_SHARE: case CURL_LOCK_DATA_SHARE:
what = "share"; what = "share";
break; break;

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -110,7 +110,7 @@ int libtest_debug_cb(CURL *handle, curl_infotype type,
now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec); now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
} }
switch (type) { switch(type) {
case CURLINFO_TEXT: case CURLINFO_TEXT:
fprintf(stderr, "%s== Info: %s", timestr, (char *)data); fprintf(stderr, "%s== Info: %s", timestr, (char *)data);
default: /* in case a new one is introduced to shock us */ default: /* in case a new one is introduced to shock us */

View File

@ -1283,7 +1283,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock,
sclose(sock); sclose(sock);
return CURL_SOCKET_BAD; return CURL_SOCKET_BAD;
} }
switch (localaddr.sa.sa_family) { switch(localaddr.sa.sa_family) {
case AF_INET: case AF_INET:
*listenport = ntohs(localaddr.sa4.sin_port); *listenport = ntohs(localaddr.sa4.sin_port);
break; break;

View File

@ -135,7 +135,7 @@ void logmsg(const char *msg, ...)
#ifdef WIN32 #ifdef WIN32
/* use instead of perror() on generic windows */ /* use instead of perror() on generic windows */
void win32_perror (const char *msg) void win32_perror(const char *msg)
{ {
char buf[512]; char buf[512];
DWORD err = SOCKERRNO; DWORD err = SOCKERRNO;
@ -315,7 +315,7 @@ static char raw_toupper(char in)
if(in >= 'a' && in <= 'z') if(in >= 'a' && in <= 'z')
return (char)('A' + in - 'a'); return (char)('A' + in - 'a');
#else #else
switch (in) { switch(in) {
case 'a': case 'a':
return 'A'; return 'A';
case 'b': case 'b':

View File

@ -78,7 +78,7 @@ static Curl_addrinfo *fake_ai(void)
static Curl_addrinfo *ai; static Curl_addrinfo *ai;
int ss_size; int ss_size;
ss_size = sizeof (struct sockaddr_in); ss_size = sizeof(struct sockaddr_in);
if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL) if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL)
return NULL; return NULL;