diff options
81 files changed, 281 insertions, 260 deletions
diff --git a/docs/examples/curlx.c b/docs/examples/curlx.c index e0d709999..3b11ef737 100644 --- a/docs/examples/curlx.c +++ b/docs/examples/curlx.c @@ -293,7 +293,7 @@ int main(int argc, char **argv)    binaryptr = malloc(tabLength);    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); @@ -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())) {      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);      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);      goto err;    } @@ -505,7 +505,7 @@ int main(int argc, char **argv)    {      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;        if(i== tabLength) {          tabLength+=100; diff --git a/docs/examples/debug.c b/docs/examples/debug.c index f5d58bf19..cbf1c1106 100644 --- a/docs/examples/debug.c +++ b/docs/examples/debug.c @@ -88,7 +88,7 @@ int my_trace(CURL *handle, curl_infotype type,    const char *text;    (void)handle; /* prevent compiler warning */ -  switch (type) { +  switch(type) {    case CURLINFO_TEXT:      fprintf(stderr, "== Info: %s", data);    default: /* in case a new one is introduced to shock us */ diff --git a/docs/examples/evhiperfifo.c b/docs/examples/evhiperfifo.c index 52f682818..efe42475a 100644 --- a/docs/examples/evhiperfifo.c +++ b/docs/examples/evhiperfifo.c @@ -134,7 +134,7 @@ static void mcode_or_die(const char *where, CURLMcode code)  {    if(CURLM_OK != code) {      const char *s; -    switch (code) { +    switch(code) {      case CURLM_BAD_HANDLE:        s="CURLM_BAD_HANDLE";        break; @@ -317,8 +317,8 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)  /* CURLOPT_PROGRESSFUNCTION */ -static int prog_cb (void *p, double dltotal, double dlnow, double ult, -                    double uln) +static int prog_cb(void *p, double dltotal, double dlnow, double ult, +                   double uln)  {    ConnInfo *conn = (ConnInfo *)p;    (void)ult; @@ -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 */ -static int init_fifo (GlobalInfo *g) +static int init_fifo(GlobalInfo *g)  {    struct stat st;    static const char *fifo = "hiper.fifo"; @@ -399,18 +399,18 @@ static int init_fifo (GlobalInfo *g)      if((st.st_mode & S_IFMT) == S_IFREG) {        errno = EEXIST;        perror("lstat"); -      exit (1); +      exit(1);      }    }    unlink(fifo);    if(mkfifo (fifo, 0600) == -1) {      perror("mkfifo"); -    exit (1); +    exit(1);    }    sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0);    if(sockfd == -1) {      perror("open"); -    exit (1); +    exit(1);    }    g->input = fdopen(sockfd, "r"); diff --git a/docs/examples/ftpupload.c b/docs/examples/ftpupload.c index bba0c4d53..41e2d807c 100644 --- a/docs/examples/ftpupload.c +++ b/docs/examples/ftpupload.c @@ -127,7 +127,7 @@ int main(void)                curl_easy_strerror(res));      /* clean up the FTP commands list */ -    curl_slist_free_all (headerlist); +    curl_slist_free_all(headerlist);      /* always cleanup */      curl_easy_cleanup(curl); diff --git a/docs/examples/ghiper.c b/docs/examples/ghiper.c index c0fbd8246..a1af4c5a3 100644 --- a/docs/examples/ghiper.c +++ b/docs/examples/ghiper.c @@ -98,7 +98,7 @@ static void mcode_or_die(const char *where, CURLMcode code)  {    if(CURLM_OK != code) {      const char *s; -    switch (code) { +    switch(code) {      case     CURLM_BAD_HANDLE:         s="CURLM_BAD_HANDLE";         break;      case     CURLM_BAD_EASY_HANDLE:    s="CURLM_BAD_EASY_HANDLE";    break;      case     CURLM_OUT_OF_MEMORY:      s="CURLM_OUT_OF_MEMORY";      break; @@ -272,8 +272,8 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)  }  /* CURLOPT_PROGRESSFUNCTION */ -static int prog_cb (void *p, double dltotal, double dlnow, double ult, -                    double uln) +static int prog_cb(void *p, double dltotal, double dlnow, double ult, +                   double uln)  {    ConnInfo *conn = (ConnInfo *)p;    MSG_OUT("Progress: %s (%g/%g)\n", conn->url, dlnow, dltotal); @@ -318,7 +318,7 @@ static void new_conn(char *url, GlobalInfo *g)  }  /* 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    gsize len, tp; @@ -380,21 +380,21 @@ int init_fifo(void)      if((st.st_mode & S_IFMT) == S_IFREG) {        errno = EEXIST;        perror("lstat"); -      exit (1); +      exit(1);      }    } -  unlink (fifo); +  unlink(fifo);    if(mkfifo (fifo, 0600) == -1) {      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) {      perror("open"); -    exit (1); +    exit(1);    }    MSG_OUT("Now, pipe some URL's into > %s\n", fifo); diff --git a/docs/examples/hiperfifo.c b/docs/examples/hiperfifo.c index dce009c5b..f08fcda99 100644 --- a/docs/examples/hiperfifo.c +++ b/docs/examples/hiperfifo.c @@ -128,7 +128,7 @@ static void mcode_or_die(const char *where, CURLMcode code)  {    if(CURLM_OK != code) {      const char *s; -    switch (code) { +    switch(code) {        case     CURLM_BAD_HANDLE:         s="CURLM_BAD_HANDLE";         break;        case     CURLM_BAD_EASY_HANDLE:    s="CURLM_BAD_EASY_HANDLE";    break;        case     CURLM_OUT_OF_MEMORY:      s="CURLM_OUT_OF_MEMORY";      break; @@ -300,8 +300,8 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)  /* CURLOPT_PROGRESSFUNCTION */ -static int prog_cb (void *p, double dltotal, double dlnow, double ult, -                    double uln) +static int prog_cb(void *p, double dltotal, double dlnow, double ult, +                   double uln)  {    ConnInfo *conn = (ConnInfo *)p;    (void)ult; @@ -371,7 +371,7 @@ static void fifo_cb(int fd, short event, void *arg)  /* Create a named pipe and tell libevent to monitor it */  static const char *fifo = "hiper.fifo"; -static int init_fifo (GlobalInfo *g) +static int init_fifo(GlobalInfo *g)  {    struct stat st;    curl_socket_t sockfd; @@ -381,18 +381,18 @@ static int init_fifo (GlobalInfo *g)      if((st.st_mode & S_IFMT) == S_IFREG) {        errno = EEXIST;        perror("lstat"); -      exit (1); +      exit(1);      }    }    unlink(fifo);    if(mkfifo (fifo, 0600) == -1) {      perror("mkfifo"); -    exit (1); +    exit(1);    }    sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0);    if(sockfd == -1) {      perror("open"); -    exit (1); +    exit(1);    }    g->input = fdopen(sockfd, "r"); diff --git a/docs/examples/http2-download.c b/docs/examples/http2-download.c index 9e87a064e..c82fed285 100644 --- a/docs/examples/http2-download.c +++ b/docs/examples/http2-download.c @@ -114,7 +114,7 @@ int my_trace(CURL *handle, curl_infotype type,    int num = hnd2num(handle);    (void)handle; /* prevent compiler warning */    (void)userp; -  switch (type) { +  switch(type) {    case CURLINFO_TEXT:      fprintf(stderr, "== %d Info: %s", num, data);    default: /* in case a new one is introduced to shock us */ diff --git a/docs/examples/http2-serverpush.c b/docs/examples/http2-serverpush.c index 1a8c69b7d..ecd9cc5d4 100644 --- a/docs/examples/http2-serverpush.c +++ b/docs/examples/http2-serverpush.c @@ -93,7 +93,7 @@ int my_trace(CURL *handle, curl_infotype type,    const char *text;    (void)handle; /* prevent compiler warning */    (void)userp; -  switch (type) { +  switch(type) {    case CURLINFO_TEXT:      fprintf(stderr, "== Info: %s", data);    default: /* in case a new one is introduced to shock us */ diff --git a/docs/examples/http2-upload.c b/docs/examples/http2-upload.c index b6353713e..67e17f34b 100644 --- a/docs/examples/http2-upload.c +++ b/docs/examples/http2-upload.c @@ -133,7 +133,7 @@ int my_trace(CURL *handle, curl_infotype type,    snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld",             now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec); -  switch (type) { +  switch(type) {    case CURLINFO_TEXT:      fprintf(stderr, "%s [%d] Info: %s", timebuf, num, data);    default: /* in case a new one is introduced to shock us */ diff --git a/docs/examples/multi-app.c b/docs/examples/multi-app.c index f8447930a..9a8ecfeb8 100644 --- a/docs/examples/multi-app.c +++ b/docs/examples/multi-app.c @@ -156,7 +156,7 @@ int main(void)            break;        } -      switch (idx) { +      switch(idx) {        case HTTP_HANDLE:          printf("HTTP transfer completed with status %d\n", msg->data.result);          break; diff --git a/docs/examples/multi-debugcallback.c b/docs/examples/multi-debugcallback.c index d07cc3bb9..be241fc72 100644 --- a/docs/examples/multi-debugcallback.c +++ b/docs/examples/multi-debugcallback.c @@ -96,7 +96,7 @@ int my_trace(CURL *handle, curl_infotype type,    (void)userp;    (void)handle; /* prevent compiler warning */ -  switch (type) { +  switch(type) {    case CURLINFO_TEXT:      fprintf(stderr, "== Info: %s", data);    default: /* in case a new one is introduced to shock us */ diff --git a/docs/examples/multi-post.c b/docs/examples/multi-post.c index 5d9abc12f..cc2ca18e9 100644 --- a/docs/examples/multi-post.c +++ b/docs/examples/multi-post.c @@ -165,7 +165,7 @@ int main(void)      curl_formfree(formpost);      /* free slist */ -    curl_slist_free_all (headerlist); +    curl_slist_free_all(headerlist);    }    return 0;  } diff --git a/docs/examples/postit2.c b/docs/examples/postit2.c index 67e685f1e..ef50a66d9 100644 --- a/docs/examples/postit2.c +++ b/docs/examples/postit2.c @@ -101,7 +101,7 @@ int main(int argc, char *argv[])      /* then cleanup the formpost chain */      curl_formfree(formpost);      /* free slist */ -    curl_slist_free_all (headerlist); +    curl_slist_free_all(headerlist);    }    return 0;  } diff --git a/docs/examples/smooth-gtk-thread.c b/docs/examples/smooth-gtk-thread.c index 547cc0f30..713fcc6c3 100644 --- a/docs/examples/smooth-gtk-thread.c +++ b/docs/examples/smooth-gtk-thread.c @@ -105,7 +105,7 @@ void *pull_one_url(void *NaN)        curl_easy_cleanup(curl);      } -    g_free (http); +    g_free(http);      /* Adds more latency, testing the mutex.*/      sleep(1); @@ -118,7 +118,7 @@ void *pull_one_url(void *NaN)  gboolean pulse_bar(gpointer data)  {    gdk_threads_enter(); -  gtk_progress_bar_pulse (GTK_PROGRESS_BAR (data)); +  gtk_progress_bar_pulse(GTK_PROGRESS_BAR (data));    gdk_threads_leave();    /* Return true so the function will be called again; @@ -182,8 +182,8 @@ int main(int argc, char **argv)    /* Init thread */    g_thread_init(NULL); -  gdk_threads_init (); -  gdk_threads_enter (); +  gdk_threads_init(); +  gdk_threads_enter();    gtk_init(&argc, &argv); @@ -203,9 +203,9 @@ int main(int argc, char **argv)    /* Progress bar */    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 */ -  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",                      GINT_TO_POINTER(pulse_ref));    gtk_container_add(GTK_CONTAINER(inside_frame), progress_bar); diff --git a/docs/examples/synctime.c b/docs/examples/synctime.c index 1c787bb91..48377f527 100644 --- a/docs/examples/synctime.c +++ b/docs/examples/synctime.c @@ -152,9 +152,9 @@ size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,                                           TmpStr1 & 2? */          AutoSyncTime = 0;        else { -        RetVal = sscanf ((char *)(ptr), "Date: %s %hu %s %hu %hu:%hu:%hu", -                         TmpStr1, &SYSTime.wDay, TmpStr2, &SYSTime.wYear, -                         &SYSTime.wHour, &SYSTime.wMinute, &SYSTime.wSecond); +        RetVal = sscanf((char *)(ptr), "Date: %s %hu %s %hu %hu:%hu:%hu", +                        TmpStr1, &SYSTime.wDay, TmpStr2, &SYSTime.wYear, +                        &SYSTime.wHour, &SYSTime.wMinute, &SYSTime.wSecond);          if(RetVal == 7) {            SYSTime.wMilliseconds = 500;    /* adjust to midpoint, 0.5 sec */ diff --git a/include/curl/curl.h b/include/curl/curl.h index 331bec6e2..06bb7cb9b 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -1910,7 +1910,10 @@ typedef enum {  /* 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_strnequal)(const char *s1, const char *s2, size_t n); diff --git a/include/curl/stdcheaders.h b/include/curl/stdcheaders.h index 6f0f7f343..027b6f421 100644 --- a/include/curl/stdcheaders.h +++ b/include/curl/stdcheaders.h @@ -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   * you should have received as part of this distribution. The terms @@ -24,8 +24,8 @@  #include <sys/types.h> -size_t fread (void *, size_t, size_t, FILE *); -size_t fwrite (const 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 *);  int strcasecmp(const char *, const char *);  int strncasecmp(const char *, const char *, size_t); diff --git a/include/curl/typecheck-gcc.h b/include/curl/typecheck-gcc.h index d20c192df..4eb896eaa 100644 --- a/include/curl/typecheck-gcc.h +++ b/include/curl/typecheck-gcc.h @@ -40,7 +40,7 @@   */  #define curl_easy_setopt(handle, option, value)                               \  __extension__ ({                                                              \ -  __typeof__ (option) _curl_opt = option;                                     \ +  __typeof__(option) _curl_opt = option;                                     \    if(__builtin_constant_p(_curl_opt)) {                                       \      if(_curl_is_long_option(_curl_opt))                                       \        if(!_curl_is_long(value))                                               \ @@ -110,7 +110,7 @@ __extension__ ({                                                              \  /* FIXME: don't allow const pointers */  #define curl_easy_getinfo(handle, info, arg)                                  \  __extension__ ({                                                              \ -  __typeof__ (info) _curl_info = info;                                        \ +  __typeof__(info) _curl_info = info;                                        \    if(__builtin_constant_p(_curl_info)) {                                      \      if(_curl_is_string_info(_curl_info))                                      \        if(!_curl_is_arr((arg), char *))                                        \ 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: @@ -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); @@ -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;            } @@ -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); diff --git a/src/tool_cb_dbg.c b/src/tool_cb_dbg.c index 221eae67f..8e81f1be3 100644 --- a/src/tool_cb_dbg.c +++ b/src/tool_cb_dbg.c @@ -182,7 +182,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,    }  #endif /* CURL_DOES_CONVERSIONS */ -  switch (type) { +  switch(type) {    case CURLINFO_TEXT:      fprintf(output, "%s== Info: %s", timebuf, data);    default: /* in case a new one is introduced to shock us */ diff --git a/src/tool_doswin.c b/src/tool_doswin.c index eb3b29c46..48af3bfb8 100644 --- a/src/tool_doswin.c +++ b/src/tool_doswin.c @@ -431,7 +431,7 @@ SANITIZEcode msdosify(char **const sanitized, const char *file_name,              *d   = 'x';            }            else { -            memcpy (d, "plus", 4); +            memcpy(d, "plus", 4);              d += 3;            }          } diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 5b6f3bec9..247f8d38c 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -1628,7 +1628,7 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */        break;      case 'L':        config->followlocation = toggle; /* Follow Location: HTTP headers */ -      switch (subletter) { +      switch(subletter) {        case 't':          /* Continue to send authentication (user+password) when following           * locations, even when hostname changed */ diff --git a/src/tool_homedir.c b/src/tool_homedir.c index ccf04b596..26b6c535c 100644 --- a/src/tool_homedir.c +++ b/src/tool_homedir.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 @@ -46,7 +46,7 @@ static char *GetEnv(const char *variable, char do_expand)    }    if(do_expand && strchr(variable, '%')) {      /* buf2 == variable if not expanded */ -    rc = ExpandEnvironmentStrings (variable, buf2, sizeof(buf2)); +    rc = ExpandEnvironmentStrings(variable, buf2, sizeof(buf2));      if(rc > 0 && rc < sizeof(buf2) &&         !strchr(buf2, '%'))    /* no vars still unexpanded */        env = buf2; diff --git a/src/tool_operate.c b/src/tool_operate.c index 94d87fecf..2c9b4465a 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -653,7 +653,7 @@ static CURLcode operate_do(struct GlobalConfig *global,            infd = -1;            if(stat(uploadfile, &fileinfo) == 0) {              fileinfo.st_size = VmsSpecialSize(uploadfile, &fileinfo); -            switch (fileinfo.st_fab_rfm) { +            switch(fileinfo.st_fab_rfm) {              case FAB$C_VAR:              case FAB$C_VFC:              case FAB$C_STMCR: diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index 7de490525..09910a784 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -313,7 +313,7 @@ long proto2num(struct OperationConfig *config, long *val, const char *str)      for(pp=protos; pp->name; pp++) {        if(curl_strequal(token, pp->name)) { -        switch (action) { +        switch(action) {          case deny:            *val &= ~(pp->bit);            break; diff --git a/src/tool_urlglob.c b/src/tool_urlglob.c index e68e30e84..0edfac6f2 100644 --- a/src/tool_urlglob.c +++ b/src/tool_urlglob.c @@ -516,7 +516,7 @@ CURLcode glob_next_url(char **globbed, URLGlob *glob)      for(i = 0; carry && (i < glob->size); i++) {        carry = FALSE;        pat = &glob->pattern[glob->size - 1 - i]; -      switch (pat->type) { +      switch(pat->type) {        case UPTSet:          if((pat->content.Set.elements) &&             (++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) { -        switch (pat->type) { +        switch(pat->type) {          case UPTSet:            if(pat->content.Set.elements) {              appendthis = pat->content.Set.elements[pat->content.Set.ptr_s]; diff --git a/src/tool_writeenv.c b/src/tool_writeenv.c index 198847eef..0bc075aba 100644 --- a/src/tool_writeenv.c +++ b/src/tool_writeenv.c @@ -78,7 +78,7 @@ void ourWriteEnv(CURL *curl)    double doubleinfo;    for(i=0; variables[i].name; i++) { -    switch (variables[i].type) { +    switch(variables[i].type) {      case writeenv_STRING:        if(curl_easy_getinfo(curl, variables[i].id, &string) == CURLE_OK)          internalSetEnv(variables[i].name, string); diff --git a/src/tool_writeout.c b/src/tool_writeout.c index 3737df801..e1b7819ed 100644 --- a/src/tool_writeout.c +++ b/src/tool_writeout.c @@ -295,7 +295,7 @@ void ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo)                     curl_easy_getinfo(curl, CURLINFO_HTTP_VERSION,                                       &longinfo)) {                    const char *version = "0"; -                  switch (longinfo) { +                  switch(longinfo) {                    case CURL_HTTP_VERSION_1_0:                      version = "1.0";                      break; diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c index 8de30c20b..32995e1db 100644 --- a/tests/libtest/lib506.c +++ b/tests/libtest/lib506.c @@ -50,7 +50,7 @@ static void my_lock(CURL *handle, curl_lock_data data,    (void)handle;    (void)laccess; -  switch (data) { +  switch(data) {      case CURL_LOCK_DATA_SHARE:        what = "share";        locknum = 0; @@ -86,7 +86,7 @@ static void my_unlock(CURL *handle, curl_lock_data data, void *useptr)    struct userdata *user = (struct userdata *)useptr;    int locknum;    (void)handle; -  switch (data) { +  switch(data) {      case CURL_LOCK_DATA_SHARE:        what = "share";        locknum = 0; diff --git a/tests/libtest/lib539.c b/tests/libtest/lib539.c index ec4ea530e..beee91401 100644 --- a/tests/libtest/lib539.c +++ b/tests/libtest/lib539.c @@ -65,7 +65,7 @@ int test(char *URL)       return TEST_ERR_MAJOR_BAD;     } -   slist = curl_slist_append (NULL, "SYST"); +   slist = curl_slist_append(NULL, "SYST");     if(slist == NULL) {       free(newURL);       curl_easy_cleanup(curl); diff --git a/tests/libtest/lib552.c b/tests/libtest/lib552.c index 94c932527..ae2e691f1 100644 --- a/tests/libtest/lib552.c +++ b/tests/libtest/lib552.c @@ -89,7 +89,7 @@ int my_trace(CURL *handle, curl_infotype type,    const char *text;    (void)handle; /* prevent compiler warning */ -  switch (type) { +  switch(type) {    case CURLINFO_TEXT:      fprintf(stderr, "== Info: %s", (char *)data);    default: /* in case a new one is introduced to shock us */ diff --git a/tests/libtest/lib586.c b/tests/libtest/lib586.c index eb7cfa0a9..9b789eec7 100644 --- a/tests/libtest/lib586.c +++ b/tests/libtest/lib586.c @@ -45,7 +45,7 @@ static void my_lock(CURL *handle, curl_lock_data data,    (void)handle;    (void)laccess; -  switch (data) { +  switch(data) {      case CURL_LOCK_DATA_SHARE:        what = "share";        break; @@ -72,7 +72,7 @@ static void my_unlock(CURL *handle, curl_lock_data data, void *useptr)    const char *what;    struct userdata *user = (struct userdata *)useptr;    (void)handle; -  switch ( data) { +  switch(data) {      case CURL_LOCK_DATA_SHARE:        what = "share";        break; diff --git a/tests/libtest/testtrace.c b/tests/libtest/testtrace.c index 958719f61..5eeeeb65d 100644 --- a/tests/libtest/testtrace.c +++ b/tests/libtest/testtrace.c @@ -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   * 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);    } -  switch (type) { +  switch(type) {    case CURLINFO_TEXT:      fprintf(stderr, "%s== Info: %s", timestr, (char *)data);    default: /* in case a new one is introduced to shock us */ diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index 38aa51e67..e064b6c7d 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -1283,7 +1283,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock,        sclose(sock);        return CURL_SOCKET_BAD;      } -    switch (localaddr.sa.sa_family) { +    switch(localaddr.sa.sa_family) {      case AF_INET:        *listenport = ntohs(localaddr.sa4.sin_port);        break; diff --git a/tests/server/util.c b/tests/server/util.c index e65470786..8465cd9c3 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -135,7 +135,7 @@ void logmsg(const char *msg, ...)  #ifdef WIN32  /* use instead of perror() on generic windows */ -void win32_perror (const char *msg) +void win32_perror(const char *msg)  {    char buf[512];    DWORD err = SOCKERRNO; @@ -315,7 +315,7 @@ static char 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/tests/unit/unit1305.c b/tests/unit/unit1305.c index ad270f565..9af0727c3 100644 --- a/tests/unit/unit1305.c +++ b/tests/unit/unit1305.c @@ -78,7 +78,7 @@ static Curl_addrinfo *fake_ai(void)    static Curl_addrinfo *ai;    int ss_size; -  ss_size = sizeof (struct sockaddr_in); +  ss_size = sizeof(struct sockaddr_in);    if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL)      return NULL;  | 
