diff options
144 files changed, 995 insertions, 990 deletions
diff --git a/docs/examples/10-at-a-time.c b/docs/examples/10-at-a-time.c index 455529182..f7b6f463d 100644 --- a/docs/examples/10-at-a-time.c +++ b/docs/examples/10-at-a-time.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -114,7 +114,7 @@ int main(void) CURLM *cm; CURLMsg *msg; long L; - unsigned int C=0; + unsigned int C = 0; int M, Q, U = -1; fd_set R, W, E; struct timeval T; diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index 243a367a8..eb91d991b 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -106,7 +106,7 @@ int main(int argc, char **argv) if(argc < 3) return 1; - file= argv[1]; + file = argv[1]; url = argv[2]; /* get the file size of the local file */ diff --git a/docs/examples/cacertinmem.c b/docs/examples/cacertinmem.c index e3c49e02c..43bb901ac 100644 --- a/docs/examples/cacertinmem.c +++ b/docs/examples/cacertinmem.c @@ -37,7 +37,7 @@ size_t writefunction(void *ptr, size_t size, size_t nmemb, void *stream) static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) { X509_STORE *store; - X509 *cert=NULL; + X509 *cert = NULL; BIO *bio; char *mypem = /* www.cacert.org */ "-----BEGIN CERTIFICATE-----\n"\ @@ -82,7 +82,7 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) "omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD\n"\ "-----END CERTIFICATE-----\n"; /* get a BIO */ - bio=BIO_new_mem_buf(mypem, -1); + bio = BIO_new_mem_buf(mypem, -1); /* use it to read the PEM formatted certificate from memory into an X509 * structure that SSL can use */ @@ -91,10 +91,10 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) printf("PEM_read_bio_X509 failed...\n"); /* get a pointer to the X509 certificate store (which may be empty!) */ - store=SSL_CTX_get_cert_store((SSL_CTX *)sslctx); + store = SSL_CTX_get_cert_store((SSL_CTX *)sslctx); /* add our certificate to this store */ - if(X509_STORE_add_cert(store, cert)==0) + if(X509_STORE_add_cert(store, cert) == 0) printf("error adding certificate\n"); /* decrease reference counts */ @@ -110,24 +110,24 @@ int main(void) CURL *ch; CURLcode rv; - rv=curl_global_init(CURL_GLOBAL_ALL); - ch=curl_easy_init(); - rv=curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); - rv=curl_easy_setopt(ch, CURLOPT_HEADER, 0L); - rv=curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); - rv=curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); - rv=curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, *writefunction); - rv=curl_easy_setopt(ch, CURLOPT_WRITEDATA, stdout); - rv=curl_easy_setopt(ch, CURLOPT_HEADERFUNCTION, *writefunction); - rv=curl_easy_setopt(ch, CURLOPT_HEADERDATA, stderr); - rv=curl_easy_setopt(ch, CURLOPT_SSLCERTTYPE, "PEM"); - rv=curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 1L); - rv=curl_easy_setopt(ch, CURLOPT_URL, "https://www.example.com/"); + rv = curl_global_init(CURL_GLOBAL_ALL); + ch = curl_easy_init(); + rv = curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); + rv = curl_easy_setopt(ch, CURLOPT_HEADER, 0L); + rv = curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); + rv = curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); + rv = curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, *writefunction); + rv = curl_easy_setopt(ch, CURLOPT_WRITEDATA, stdout); + rv = curl_easy_setopt(ch, CURLOPT_HEADERFUNCTION, *writefunction); + rv = curl_easy_setopt(ch, CURLOPT_HEADERDATA, stderr); + rv = curl_easy_setopt(ch, CURLOPT_SSLCERTTYPE, "PEM"); + rv = curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 1L); + rv = curl_easy_setopt(ch, CURLOPT_URL, "https://www.example.com/"); /* first try: retrieve page without cacerts' certificate -> will fail */ - rv=curl_easy_perform(ch); - if(rv==CURLE_OK) + rv = curl_easy_perform(ch); + if(rv == CURLE_OK) printf("*** transfer succeeded ***\n"); else printf("*** transfer failed ***\n"); @@ -136,9 +136,9 @@ int main(void) * load the certificate by installing a function doing the necessary * "modifications" to the SSL CONTEXT just before link init */ - rv=curl_easy_setopt(ch, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); - rv=curl_easy_perform(ch); - if(rv==CURLE_OK) + rv = curl_easy_setopt(ch, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); + rv = curl_easy_perform(ch); + if(rv == CURLE_OK) printf("*** transfer succeeded ***\n"); else printf("*** transfer failed ***\n"); diff --git a/docs/examples/curlx.c b/docs/examples/curlx.c index db0ed24d9..c358556dc 100644 --- a/docs/examples/curlx.c +++ b/docs/examples/curlx.c @@ -195,7 +195,8 @@ static int ssl_app_verify_callback(X509_STORE_CTX *ctx, void *arg) if(p->verbose > 2) BIO_printf(p->errorbio, "entering ssl_app_verify_callback\n"); - if((ok= X509_verify_cert(ctx)) && ctx->cert) { + ok = X509_verify_cert(ctx); + if(ok && ctx->cert) { unsigned char *accessinfo; if(p->verbose > 1) X509_print_ex(p->errorbio, ctx->cert, 0, 0); @@ -268,16 +269,16 @@ static CURLcode sslctxfun(CURL *curl, void *sslctx, void *parm) int main(int argc, char **argv) { - BIO* in=NULL; - BIO* out=NULL; + BIO* in = NULL; + BIO* out = NULL; char *outfile = NULL; char *infile = NULL; - int tabLength=100; + int tabLength = 100; char *binaryptr; char *mimetype; - char *mimetypeaccept=NULL; + char *mimetypeaccept = NULL; char *contenttype; const char **pp; unsigned char *hostporturl = NULL; @@ -288,8 +289,8 @@ int main(int argc, char **argv) char *response; CURLcode res; - struct curl_slist *headers=NULL; - int badarg=0; + struct curl_slist *headers = NULL; + int badarg = 0; binaryptr = malloc(tabLength); @@ -307,75 +308,75 @@ int main(int argc, char **argv) while(*args && *args[0] == '-') { if(!strcmp (*args, "-in")) { if(args[1]) { - infile=*(++args); + infile = *(++args); } else - badarg=1; + badarg = 1; } else if(!strcmp (*args, "-out")) { if(args[1]) { - outfile=*(++args); + outfile = *(++args); } else - badarg=1; + badarg = 1; } else if(!strcmp (*args, "-p12")) { if(args[1]) { p.p12file = *(++args); } else - badarg=1; + badarg = 1; } else if(strcmp(*args, "-envpass") == 0) { if(args[1]) { p.pst = getenv(*(++args)); } else - badarg=1; + badarg = 1; } else if(strcmp(*args, "-connect") == 0) { if(args[1]) { hostporturl = *(++args); } else - badarg=1; + badarg = 1; } else if(strcmp(*args, "-mimetype") == 0) { if(args[1]) { mimetype = *(++args); } else - badarg=1; + badarg = 1; } else if(strcmp(*args, "-acceptmime") == 0) { if(args[1]) { mimetypeaccept = *(++args); } else - badarg=1; + badarg = 1; } else if(strcmp(*args, "-accesstype") == 0) { if(args[1]) { p.accesstype = OBJ_obj2nid(OBJ_txt2obj(*++args, 0)); if(p.accesstype == 0) - badarg=1; + badarg = 1; } else - badarg=1; + badarg = 1; } else if(strcmp(*args, "-verbose") == 0) { p.verbose++; } else - badarg=1; + badarg = 1; args++; } - if(mimetype==NULL || mimetypeaccept == NULL) + if(mimetype == NULL || mimetypeaccept == NULL) badarg = 1; if(badarg) { - for(pp=curlx_usage; (*pp != NULL); pp++) + for(pp = curlx_usage; (*pp != NULL); pp++) BIO_printf(p.errorbio, "%s\n", *pp); BIO_printf(p.errorbio, "\n"); goto err; @@ -383,7 +384,8 @@ int main(int argc, char **argv) /* set input */ - if((in=BIO_new(BIO_s_file())) == NULL) { + in = BIO_new(BIO_s_file()); + if(in == NULL) { BIO_printf(p.errorbio, "Error setting input bio\n"); goto err; } @@ -397,7 +399,8 @@ int main(int argc, char **argv) /* set output */ - if((out=BIO_new(BIO_s_file())) == NULL) { + out = BIO_new(BIO_s_file()); + if(out == NULL) { BIO_printf(p.errorbio, "Error setting output bio.\n"); goto err; } @@ -429,7 +432,7 @@ int main(int argc, char **argv) goto err; } - p.ca= NULL; + p.ca = NULL; if(!(PKCS12_parse (p.p12, p.pst, &(p.pkey), &(p.usercert), &(p.ca) ) )) { BIO_printf(p.errorbio, "Invalid P12 structure in %s\n", p.p12file); goto err; @@ -454,10 +457,10 @@ int main(int argc, char **argv) given access type */ serverurl = my_get_ext(p.usercert, p.accesstype, NID_info_access); if(!serverurl) { - int j=0; + int j = 0; BIO_printf(p.errorbio, "no service URL in user cert " "cherching in others certificats\n"); - for(j=0; j<sk_X509_num(p.ca); j++) { + for(j = 0; j<sk_X509_num(p.ca); j++) { serverurl = my_get_ext(sk_X509_value(p.ca, j), p.accesstype, NID_info_access); if(serverurl) @@ -512,12 +515,12 @@ int main(int argc, char **argv) curl_easy_setopt(p.curl, CURLOPT_SSL_CTX_DATA, &p); { - int lu; int i=0; + int lu; int i = 0; while((lu = BIO_read(in, &binaryptr[i], tabLength-i)) >0) { - i+=lu; - if(i== tabLength) { - tabLength+=100; - binaryptr=realloc(binaryptr, tabLength); /* should be more careful */ + i += lu; + if(i == tabLength) { + tabLength += 100; + binaryptr = realloc(binaryptr, tabLength); /* should be more careful */ } } tabLength = i; @@ -533,7 +536,7 @@ int main(int argc, char **argv) BIO_printf(p.errorbio, "%d %s %d\n", __LINE__, "curl_easy_perform", res = curl_easy_perform(p.curl)); { - int result =curl_easy_getinfo(p.curl, CURLINFO_CONTENT_TYPE, &response); + int result = curl_easy_getinfo(p.curl, CURLINFO_CONTENT_TYPE, &response); if(mimetypeaccept && p.verbose) if(!strcmp(mimetypeaccept, response)) BIO_printf(p.errorbio, "the response has a correct mimetype : %s\n", diff --git a/docs/examples/debug.c b/docs/examples/debug.c index e8a87ea4c..3171cf9f0 100644 --- a/docs/examples/debug.c +++ b/docs/examples/debug.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -38,7 +38,7 @@ void dump(const char *text, size_t i; size_t c; - unsigned int width=0x10; + unsigned int width = 0x10; if(nohex) /* without the hex output, we can fit more on screen */ @@ -47,7 +47,7 @@ void dump(const char *text, fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n", text, (long)size, (long)size); - for(i=0; i<size; i+= width) { + for(i = 0; i<size; i+= width) { fprintf(stream, "%4.4lx: ", (long)i); @@ -62,14 +62,14 @@ void dump(const char *text, for(c = 0; (c < width) && (i+c < size); c++) { /* check for 0D0A; if found, skip past and start a new line of output */ - if(nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) { + if(nohex && (i+c+1 < size) && ptr[i+c] == 0x0D && ptr[i+c+1] == 0x0A) { i+=(c+2-width); break; } fprintf(stream, "%c", - (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); + (ptr[i+c] >= 0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); /* check again for 0D0A, to avoid an extra \n if it's at width */ - if(nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) { + if(nohex && (i+c+2 < size) && ptr[i+c+1] == 0x0D && ptr[i+c+2] == 0x0A) { i+=(c+3-width); break; } diff --git a/docs/examples/evhiperfifo.c b/docs/examples/evhiperfifo.c index 9cb8eae47..257c127a7 100644 --- a/docs/examples/evhiperfifo.c +++ b/docs/examples/evhiperfifo.c @@ -136,28 +136,28 @@ static void mcode_or_die(const char *where, CURLMcode code) const char *s; switch(code) { case CURLM_BAD_HANDLE: - s="CURLM_BAD_HANDLE"; + s = "CURLM_BAD_HANDLE"; break; case CURLM_BAD_EASY_HANDLE: - s="CURLM_BAD_EASY_HANDLE"; + s = "CURLM_BAD_EASY_HANDLE"; break; case CURLM_OUT_OF_MEMORY: - s="CURLM_OUT_OF_MEMORY"; + s = "CURLM_OUT_OF_MEMORY"; break; case CURLM_INTERNAL_ERROR: - s="CURLM_INTERNAL_ERROR"; + s = "CURLM_INTERNAL_ERROR"; break; case CURLM_UNKNOWN_OPTION: - s="CURLM_UNKNOWN_OPTION"; + s = "CURLM_UNKNOWN_OPTION"; break; case CURLM_LAST: - s="CURLM_LAST"; + s = "CURLM_LAST"; break; default: - s="CURLM_unknown"; + s = "CURLM_unknown"; break; case CURLM_BAD_SOCKET: - s="CURLM_BAD_SOCKET"; + s = "CURLM_BAD_SOCKET"; fprintf(MSG_OUT, "ERROR: %s returns %s\n", where, s); /* ignore this error */ return; @@ -257,7 +257,7 @@ static void setsock(SockInfo *f, curl_socket_t s, CURL *e, int act, ev_io_stop(g->loop, &f->ev); ev_io_init(&f->ev, event_cb, f->sockfd, kind); f->ev.data = g; - f->evset=1; + f->evset = 1; ev_io_start(g->loop, &f->ev); } @@ -371,13 +371,13 @@ static void new_conn(char *url, GlobalInfo *g) static void fifo_cb(EV_P_ struct ev_io *w, int revents) { char s[1024]; - long int rv=0; - int n=0; + long int rv = 0; + int n = 0; GlobalInfo *g = (GlobalInfo *)w->data; do { s[0]='\0'; - rv=fscanf(g->input, "%1023s%n", s, &n); + rv = fscanf(g->input, "%1023s%n", s, &n); s[n]='\0'; if(n && s[0]) { new_conn(s, g); /* if we read a URL, go get it! */ diff --git a/docs/examples/fopen.c b/docs/examples/fopen.c index 1e0a09a0a..5a7e6ad5b 100644 --- a/docs/examples/fopen.c +++ b/docs/examples/fopen.c @@ -13,7 +13,7 @@ * See the main() function at the bottom that shows an app that retrieves from * a specified url using fgets() and fread() and saves as two output files. * - * Copyright (c) 2003 Simtec Electronics + * Copyright (c) 2003, 2017 Simtec Electronics * * Re-implemented by Vincent Sanders <vince@kyllikki.org> with extensive * reference to original curl example code @@ -58,9 +58,9 @@ #include <curl/curl.h> enum fcurl_type_e { - CFTYPE_NONE=0, - CFTYPE_FILE=1, - CFTYPE_CURL=2 + CFTYPE_NONE = 0, + CFTYPE_FILE = 1, + CFTYPE_CURL = 2 }; struct fcurl_data @@ -102,19 +102,19 @@ static size_t write_callback(char *buffer, URL_FILE *url = (URL_FILE *)userp; size *= nitems; - rembuff=url->buffer_len - url->buffer_pos; /* remaining space in buffer */ + rembuff = url->buffer_len - url->buffer_pos; /* remaining space in buffer */ if(size > rembuff) { /* not enough space in buffer */ - newbuff=realloc(url->buffer, url->buffer_len + (size - rembuff)); - if(newbuff==NULL) { + newbuff = realloc(url->buffer, url->buffer_len + (size - rembuff)); + if(newbuff == NULL) { fprintf(stderr, "callback buffer grow failed\n"); - size=rembuff; + size = rembuff; } else { /* realloc succeeded increase buffer size*/ - url->buffer_len+=size - rembuff; - url->buffer=newbuff; + url->buffer_len += size - rembuff; + url->buffer = newbuff; } } @@ -211,12 +211,12 @@ static int fill_buffer(URL_FILE *file, size_t want) static int use_buffer(URL_FILE *file, size_t want) { /* sort out buffer */ - if((file->buffer_pos - want) <=0) { + if((file->buffer_pos - want) <= 0) { /* ditch buffer - write will recreate */ free(file->buffer); - file->buffer=NULL; - file->buffer_pos=0; - file->buffer_len=0; + file->buffer = NULL; + file->buffer_pos = 0; + file->buffer_len = 0; } else { /* move rest down make it available for later */ @@ -243,7 +243,8 @@ URL_FILE *url_fopen(const char *url, const char *operation) memset(file, 0, sizeof(URL_FILE)); - if((file->handle.file=fopen(url, operation))) + file->handle.file = fopen(url, operation); + if(file->handle.file) file->type = CFTYPE_FILE; /* marked as URL */ else { @@ -282,11 +283,11 @@ URL_FILE *url_fopen(const char *url, const char *operation) int url_fclose(URL_FILE *file) { - int ret=0;/* default is good return */ + int ret = 0;/* default is good return */ switch(file->type) { case CFTYPE_FILE: - ret=fclose(file->handle.file); /* passthrough */ + ret = fclose(file->handle.file); /* passthrough */ break; case CFTYPE_CURL: @@ -298,8 +299,8 @@ int url_fclose(URL_FILE *file) break; default: /* unknown or supported type - oh dear */ - ret=EOF; - errno=EBADF; + ret = EOF; + errno = EBADF; break; } @@ -311,11 +312,11 @@ int url_fclose(URL_FILE *file) int url_feof(URL_FILE *file) { - int ret=0; + int ret = 0; switch(file->type) { case CFTYPE_FILE: - ret=feof(file->handle.file); + ret = feof(file->handle.file); break; case CFTYPE_CURL: @@ -324,8 +325,8 @@ int url_feof(URL_FILE *file) break; default: /* unknown or supported type - oh dear */ - ret=-1; - errno=EBADF; + ret = -1; + errno = EBADF; break; } return ret; @@ -337,7 +338,7 @@ size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file) switch(file->type) { case CFTYPE_FILE: - want=fread(ptr, size, nmemb, file->handle.file); + want = fread(ptr, size, nmemb, file->handle.file); break; case CFTYPE_CURL: @@ -363,8 +364,8 @@ size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file) break; default: /* unknown or supported type - oh dear */ - want=0; - errno=EBADF; + want = 0; + errno = EBADF; break; } @@ -395,24 +396,24 @@ char *url_fgets(char *ptr, size_t size, URL_FILE *file) /*buffer contains data */ /* look for newline or eof */ - for(loop=0;loop < want;loop++) { + for(loop = 0;loop < want;loop++) { if(file->buffer[loop] == '\n') { - want=loop+1;/* include newline */ + want = loop+1;/* include newline */ break; } } /* xfer data to caller */ memcpy(ptr, file->buffer, want); - ptr[want]=0;/* always null terminate */ + ptr[want] = 0;/* always null terminate */ use_buffer(file, want); break; default: /* unknown or supported type - oh dear */ - ptr=NULL; - errno=EBADF; + ptr = NULL; + errno = EBADF; break; } @@ -435,9 +436,9 @@ void url_rewind(URL_FILE *file) /* ditch buffer - write will recreate - resets stream pos*/ free(file->buffer); - file->buffer=NULL; - file->buffer_pos=0; - file->buffer_len=0; + file->buffer = NULL; + file->buffer_pos = 0; + file->buffer_len = 0; break; @@ -463,12 +464,12 @@ int main(int argc, char *argv[]) const char *url; if(argc < 2) - url="http://192.168.7.3/testfile";/* default to testurl */ + url = "http://192.168.7.3/testfile";/* default to testurl */ else - url=argv[1];/* use passed url */ + url = argv[1];/* use passed url */ /* copy from url line by line with fgets */ - outf=fopen(FGETSFILE, "wb+"); + outf = fopen(FGETSFILE, "wb+"); if(!outf) { perror("couldn't open fgets output file\n"); return 1; @@ -492,7 +493,7 @@ int main(int argc, char *argv[]) /* Copy from url with fread */ - outf=fopen(FREADFILE, "wb+"); + outf = fopen(FREADFILE, "wb+"); if(!outf) { perror("couldn't open fread output file\n"); return 1; @@ -516,7 +517,7 @@ int main(int argc, char *argv[]) /* Test rewind */ - outf=fopen(REWINDFILE, "wb+"); + outf = fopen(REWINDFILE, "wb+"); if(!outf) { perror("couldn't open fread output file\n"); return 1; diff --git a/docs/examples/ftpget.c b/docs/examples/ftpget.c index 9b7dc024d..a2a7da0ce 100644 --- a/docs/examples/ftpget.c +++ b/docs/examples/ftpget.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -35,10 +35,10 @@ struct FtpFile { static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) { - struct FtpFile *out=(struct FtpFile *)stream; + struct FtpFile *out = (struct FtpFile *)stream; if(out && !out->stream) { /* open file for writing */ - out->stream=fopen(out->filename, "wb"); + out->stream = fopen(out->filename, "wb"); if(!out->stream) return -1; /* failure, can't open file to write */ } @@ -50,7 +50,7 @@ int main(void) { CURL *curl; CURLcode res; - struct FtpFile ftpfile={ + struct FtpFile ftpfile = { "curl.tar.gz", /* name to store the file as if successful */ NULL }; diff --git a/docs/examples/ftpsget.c b/docs/examples/ftpsget.c index d53f08847..fb7489f03 100644 --- a/docs/examples/ftpsget.c +++ b/docs/examples/ftpsget.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2015, 2017, 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 @@ -37,10 +37,10 @@ struct FtpFile { static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) { - struct FtpFile *out=(struct FtpFile *)stream; + struct FtpFile *out = (struct FtpFile *)stream; if(out && !out->stream) { /* open file for writing */ - out->stream=fopen(out->filename, "wb"); + out->stream = fopen(out->filename, "wb"); if(!out->stream) return -1; /* failure, can't open file to write */ } @@ -52,7 +52,7 @@ int main(void) { CURL *curl; CURLcode res; - struct FtpFile ftpfile={ + struct FtpFile ftpfile = { "yourfile.bin", /* name to store the file as if successful */ NULL }; diff --git a/docs/examples/ftpupload.c b/docs/examples/ftpupload.c index 41e2d807c..5fc41ef81 100644 --- a/docs/examples/ftpupload.c +++ b/docs/examples/ftpupload.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -71,7 +71,7 @@ int main(void) struct stat file_info; curl_off_t fsize; - struct curl_slist *headerlist=NULL; + struct curl_slist *headerlist = NULL; static const char buf_1 [] = "RNFR " UPLOAD_FILE_AS; static const char buf_2 [] = "RNTO " RENAME_FILE_TO; diff --git a/docs/examples/ghiper.c b/docs/examples/ghiper.c index 505e90ab0..91c99e808 100644 --- a/docs/examples/ghiper.c +++ b/docs/examples/ghiper.c @@ -99,14 +99,14 @@ static void mcode_or_die(const char *where, CURLMcode code) if(CURLM_OK != code) { const char *s; 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; - case CURLM_INTERNAL_ERROR: s="CURLM_INTERNAL_ERROR"; break; - case CURLM_BAD_SOCKET: s="CURLM_BAD_SOCKET"; break; - case CURLM_UNKNOWN_OPTION: s="CURLM_UNKNOWN_OPTION"; break; - case CURLM_LAST: s="CURLM_LAST"; break; - default: s="CURLM_unknown"; + 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; + case CURLM_INTERNAL_ERROR: s = "CURLM_INTERNAL_ERROR"; break; + case CURLM_BAD_SOCKET: s = "CURLM_BAD_SOCKET"; break; + case CURLM_UNKNOWN_OPTION: s = "CURLM_UNKNOWN_OPTION"; break; + case CURLM_LAST: s = "CURLM_LAST"; break; + default: s = "CURLM_unknown"; } MSG_OUT("ERROR: %s returns %s\n", where, s); exit(code); @@ -156,7 +156,7 @@ static gboolean timer_cb(gpointer data) static int update_timeout_cb(CURLM *multi, long timeout_ms, void *userp) { struct timeval timeout; - GlobalInfo *g=(GlobalInfo *)userp; + GlobalInfo *g = (GlobalInfo *)userp; timeout.tv_sec = timeout_ms/1000; timeout.tv_usec = (timeout_ms%1000)*1000; @@ -181,7 +181,7 @@ static gboolean event_cb(GIOChannel *ch, GIOCondition condition, gpointer data) { GlobalInfo *g = (GlobalInfo*) data; CURLMcode rc; - int fd=g_io_channel_unix_get_fd(ch); + int fd = g_io_channel_unix_get_fd(ch); int action = (condition & G_IO_IN ? CURL_CSELECT_IN : 0) | @@ -228,7 +228,7 @@ static void setsock(SockInfo *f, curl_socket_t s, CURL *e, int act, if(f->ev) { g_source_remove(f->ev); } - f->ev=g_io_add_watch(f->ch, kind, event_cb, g); + f->ev = g_io_add_watch(f->ch, kind, event_cb, g); } /* Initialize a new SockInfo structure */ @@ -237,7 +237,7 @@ static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g) SockInfo *fdp = g_malloc0(sizeof(SockInfo)); fdp->global = g; - fdp->ch=g_io_channel_unix_new(s); + fdp->ch = g_io_channel_unix_new(s); setsock(fdp, s, easy, action, g); curl_multi_assign(g->multi, s, fdp); } @@ -319,7 +319,7 @@ static void new_conn(char *url, GlobalInfo *g) curl_easy_setopt(conn->easy, CURLOPT_LOW_SPEED_TIME, 30L); MSG_OUT("Adding easy %p to multi %p (%s)\n", conn->easy, g->multi, url); - rc =curl_multi_add_handle(g->multi, conn->easy); + rc = curl_multi_add_handle(g->multi, conn->easy); mcode_or_die("new_conn: curl_multi_add_handle", rc); /* note that the add_handle() will set a time-out to trigger very soon so @@ -331,11 +331,11 @@ static gboolean fifo_cb(GIOChannel *ch, GIOCondition condition, gpointer data) { #define BUF_SIZE 1024 gsize len, tp; - gchar *buf, *tmp, *all=NULL; + gchar *buf, *tmp, *all = NULL; GIOStatus rv; do { - GError *err=NULL; + GError *err = NULL; rv = g_io_channel_read_line(ch, &buf, &len, &tp, &err); if(buf) { if(tp) { @@ -352,8 +352,8 @@ static gboolean fifo_cb(GIOChannel *ch, GIOCondition condition, gpointer data) if(len) { buf[len]='\0'; if(all) { - tmp=all; - all=g_strdup_printf("%s%s", tmp, buf); + tmp = all; + all = g_strdup_printf("%s%s", tmp, buf); g_free(tmp); } else { @@ -417,12 +417,12 @@ int main(int argc, char **argv) GMainLoop*gmain; int fd; GIOChannel* ch; - g=g_malloc0(sizeof(GlobalInfo)); + g = g_malloc0(sizeof(GlobalInfo)); - fd=init_fifo(); - ch=g_io_channel_unix_new(fd); + fd = init_fifo(); + ch = g_io_channel_unix_new(fd); g_io_add_watch(ch, G_IO_IN, fifo_cb, g); - gmain=g_main_loop_new(NULL, FALSE); + gmain = g_main_loop_new(NULL, FALSE); g->multi = curl_multi_init(); curl_multi_setopt(g->multi, CURLMOPT_SOCKETFUNCTION, sock_cb); curl_multi_setopt(g->multi, CURLMOPT_SOCKETDATA, g); diff --git a/docs/examples/hiperfifo.c b/docs/examples/hiperfifo.c index 45b69b0d1..76bc6c1f6 100644 --- a/docs/examples/hiperfifo.c +++ b/docs/examples/hiperfifo.c @@ -137,15 +137,15 @@ static void mcode_or_die(const char *where, CURLMcode code) if(CURLM_OK != code) { const char *s; 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; - case CURLM_INTERNAL_ERROR: s="CURLM_INTERNAL_ERROR"; break; - case CURLM_UNKNOWN_OPTION: s="CURLM_UNKNOWN_OPTION"; break; - case CURLM_LAST: s="CURLM_LAST"; break; - default: s="CURLM_unknown"; + 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; + case CURLM_INTERNAL_ERROR: s = "CURLM_INTERNAL_ERROR"; break; + case CURLM_UNKNOWN_OPTION: s = "CURLM_UNKNOWN_OPTION"; break; + case CURLM_LAST: s = "CURLM_LAST"; break; + default: s = "CURLM_unknown"; break; - case CURLM_BAD_SOCKET: s="CURLM_BAD_SOCKET"; + case CURLM_BAD_SOCKET: s = "CURLM_BAD_SOCKET"; fprintf(MSG_OUT, "ERROR: %s returns %s\n", where, s); /* ignore this error */ return; @@ -359,15 +359,15 @@ static void new_conn(char *url, GlobalInfo *g) static void fifo_cb(int fd, short event, void *arg) { char s[1024]; - long int rv=0; - int n=0; + long int rv = 0; + int n = 0; GlobalInfo *g = (GlobalInfo *)arg; (void)fd; /* unused */ (void)event; /* unused */ do { s[0]='\0'; - rv=fscanf(g->input, "%1023s%n", s, &n); + rv = fscanf(g->input, "%1023s%n", s, &n); s[n]='\0'; if(n && s[0]) { new_conn(s, arg); /* if we read a URL, go get it! */ diff --git a/docs/examples/htmltidy.c b/docs/examples/htmltidy.c index 687e3f346..44af0c51e 100644 --- a/docs/examples/htmltidy.c +++ b/docs/examples/htmltidy.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -52,7 +52,7 @@ void dumpNode(TidyDoc doc, TidyNode tnod, int indent) TidyAttr attr; printf("%*.*s%s ", indent, indent, "<", name); /* walk the attribute list */ - for(attr=tidyAttrFirst(child); attr; attr=tidyAttrNext(attr) ) { + for(attr = tidyAttrFirst(child); attr; attr = tidyAttrNext(attr) ) { printf(tidyAttrName(attr)); tidyAttrValue(attr)?printf("=\"%s\" ", tidyAttrValue(attr)):printf(" "); @@ -95,7 +95,7 @@ int main(int argc, char **argv) tidyBufInit(&docbuf); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &docbuf); - err=curl_easy_perform(curl); + err = curl_easy_perform(curl); if(!err) { err = tidyParseBuffer(tdoc, &docbuf); /* parse the input */ if(err >= 0) { diff --git a/docs/examples/http2-download.c b/docs/examples/http2-download.c index 8e28eaa73..45fc9ff58 100644 --- a/docs/examples/http2-download.c +++ b/docs/examples/http2-download.c @@ -51,7 +51,7 @@ static int num_transfers; static int hnd2num(CURL *hnd) { int i; - for(i=0; i< num_transfers; i++) { + for(i = 0; i< num_transfers; i++) { if(curl_hnd[i] == hnd) return i; } @@ -65,7 +65,7 @@ void dump(const char *text, int num, unsigned char *ptr, size_t size, size_t i; size_t c; - unsigned int width=0x10; + unsigned int width = 0x10; if(nohex) /* without the hex output, we can fit more on screen */ @@ -74,7 +74,7 @@ void dump(const char *text, int num, unsigned char *ptr, size_t size, fprintf(stderr, "%d %s, %ld bytes (0x%lx)\n", num, text, (long)size, (long)size); - for(i=0; i<size; i+= width) { + for(i = 0; i<size; i+= width) { fprintf(stderr, "%4.4lx: ", (long)i); @@ -89,14 +89,14 @@ void dump(const char *text, int num, unsigned char *ptr, size_t size, for(c = 0; (c < width) && (i+c < size); c++) { /* check for 0D0A; if found, skip past and start a new line of output */ - if(nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) { + if(nohex && (i+c+1 < size) && ptr[i+c] == 0x0D && ptr[i+c+1] == 0x0A) { i+=(c+2-width); break; } fprintf(stderr, "%c", - (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); + (ptr[i+c] >= 0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); /* check again for 0D0A, to avoid an extra \n if it's at width */ - if(nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) { + if(nohex && (i+c+2 < size) && ptr[i+c+1] == 0x0D && ptr[i+c+2] == 0x0A) { i+=(c+3-width); break; } @@ -199,7 +199,7 @@ int main(int argc, char **argv) /* init a multi stack */ multi_handle = curl_multi_init(); - for(i=0; i<num_transfers; i++) { + for(i = 0; i<num_transfers; i++) { easy[i] = curl_easy_init(); /* set options */ setup(easy[i], i); @@ -286,7 +286,7 @@ int main(int argc, char **argv) curl_multi_cleanup(multi_handle); - for(i=0; i<num_transfers; i++) + for(i = 0; i<num_transfers; i++) curl_easy_cleanup(easy[i]); return 0; diff --git a/docs/examples/http2-serverpush.c b/docs/examples/http2-serverpush.c index b497e76a9..8e8007520 100644 --- a/docs/examples/http2-serverpush.c +++ b/docs/examples/http2-serverpush.c @@ -45,7 +45,7 @@ void dump(const char *text, unsigned char *ptr, size_t size, size_t i; size_t c; - unsigned int width=0x10; + unsigned int width = 0x10; if(nohex) /* without the hex output, we can fit more on screen */ @@ -54,7 +54,7 @@ void dump(const char *text, unsigned char *ptr, size_t size, fprintf(stderr, "%s, %ld bytes (0x%lx)\n", text, (long)size, (long)size); - for(i=0; i<size; i+= width) { + for(i = 0; i<size; i+= width) { fprintf(stderr, "%4.4lx: ", (long)i); @@ -69,14 +69,14 @@ void dump(const char *text, unsigned char *ptr, size_t size, for(c = 0; (c < width) && (i+c < size); c++) { /* check for 0D0A; if found, skip past and start a new line of output */ - if(nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) { + if(nohex && (i+c+1 < size) && ptr[i+c] == 0x0D && ptr[i+c+1] == 0x0A) { i+=(c+2-width); break; } fprintf(stderr, "%c", - (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); + (ptr[i+c] >= 0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); /* check again for 0D0A, to avoid an extra \n if it's at width */ - if(nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) { + if(nohex && (i+c+2 < size) && ptr[i+c+1] == 0x0D && ptr[i+c+2] == 0x0A) { i+=(c+3-width); break; } @@ -181,7 +181,7 @@ static int server_push_callback(CURL *parent, fprintf(stderr, "**** push callback approves stream %u, got %d headers!\n", count, (int)num_headers); - for(i=0; i<num_headers; i++) { + for(i = 0; i<num_headers; i++) { headp = curl_pushheader_bynum(headers, i); fprintf(stderr, "**** header %u: %s\n", (int)i, headp); } @@ -204,7 +204,7 @@ int main(void) CURL *easy; CURLM *multi_handle; int still_running; /* keep number of running handles */ - int transfers=1; /* we start with one */ + int transfers = 1; /* we start with one */ struct CURLMsg *m; /* init a multi stack */ diff --git a/docs/examples/http2-upload.c b/docs/examples/http2-upload.c index 43809ab69..2e0ecb3ce 100644 --- a/docs/examples/http2-upload.c +++ b/docs/examples/http2-upload.c @@ -53,7 +53,7 @@ static int num_transfers; static int hnd2num(CURL *hnd) { int i; - for(i=0; i< num_transfers; i++) { + for(i = 0; i< num_transfers; i++) { if(curl_hnd[i] == hnd) return i; } @@ -66,7 +66,7 @@ void dump(const char *text, int num, unsigned char *ptr, size_t size, { size_t i; size_t c; - unsigned int width=0x10; + unsigned int width = 0x10; if(nohex) /* without the hex output, we can fit more on screen */ @@ -75,7 +75,7 @@ void dump(const char *text, int num, unsigned char *ptr, size_t size, fprintf(stderr, "%d %s, %ld bytes (0x%lx)\n", num, text, (long)size, (long)size); - for(i=0; i<size; i+= width) { + for(i = 0; i<size; i+= width) { fprintf(stderr, "%4.4lx: ", (long)i); @@ -90,14 +90,14 @@ void dump(const char *text, int num, unsigned char *ptr, size_t size, for(c = 0; (c < width) && (i+c < size); c++) { /* check for 0D0A; if found, skip past and start a new line of output */ - if(nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) { + if(nohex && (i+c+1 < size) && ptr[i+c] == 0x0D && ptr[i+c+1] == 0x0A) { i+=(c+2-width); break; } fprintf(stderr, "%c", - (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); + (ptr[i+c] >= 0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); /* check again for 0D0A, to avoid an extra \n if it's at width */ - if(nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) { + if(nohex && (i+c+2 < size) && ptr[i+c+1] == 0x0D && ptr[i+c+2] == 0x0A) { i+=(c+3-width); break; } @@ -260,7 +260,7 @@ int main(int argc, char **argv) /* init a multi stack */ multi_handle = curl_multi_init(); - for(i=0; i<num_transfers; i++) { + for(i = 0; i<num_transfers; i++) { easy[i] = curl_easy_init(); /* set options */ setup(easy[i], i, filename); @@ -350,7 +350,7 @@ int main(int argc, char **argv) curl_multi_cleanup(multi_handle); - for(i=0; i<num_transfers; i++) + for(i = 0; i<num_transfers; i++) curl_easy_cleanup(easy[i]); return 0; diff --git a/docs/examples/httpput.c b/docs/examples/httpput.c index 4f8aece11..6be9b8dfe 100644 --- a/docs/examples/httpput.c +++ b/docs/examples/httpput.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -69,7 +69,7 @@ int main(int argc, char **argv) if(argc < 3) return 1; - file= argv[1]; + file = argv[1]; url = argv[2]; /* get the file size of the local file */ diff --git a/docs/examples/multi-app.c b/docs/examples/multi-app.c index 9a8ecfeb8..b87e34dc2 100644 --- a/docs/examples/multi-app.c +++ b/docs/examples/multi-app.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -55,7 +55,7 @@ int main(void) int msgs_left; /* how many messages are left */ /* Allocate one CURL handle per transfer */ - for(i=0; i<HANDLECOUNT; i++) + for(i = 0; i<HANDLECOUNT; i++) handles[i] = curl_easy_init(); /* set the options (I left out a few, you'll get the point anyway) */ @@ -68,7 +68,7 @@ int main(void) multi_handle = curl_multi_init(); /* add the individual transfers */ - for(i=0; i<HANDLECOUNT; i++) + for(i = 0; i<HANDLECOUNT; i++) curl_multi_add_handle(multi_handle, handles[i]); /* we start some action by calling perform right away */ @@ -150,7 +150,7 @@ int main(void) int idx, found = 0; /* Find out which handle this message is about */ - for(idx=0; idx<HANDLECOUNT; idx++) { + for(idx = 0; idx<HANDLECOUNT; idx++) { found = (msg->easy_handle == handles[idx]); if(found) break; @@ -170,7 +170,7 @@ int main(void) curl_multi_cleanup(multi_handle); /* Free the CURL handles */ - for(i=0; i<HANDLECOUNT; i++) + for(i = 0; i<HANDLECOUNT; i++) curl_easy_cleanup(handles[i]); return 0; diff --git a/docs/examples/multi-debugcallback.c b/docs/examples/multi-debugcallback.c index 07f044b4e..850491fb0 100644 --- a/docs/examples/multi-debugcallback.c +++ b/docs/examples/multi-debugcallback.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -45,7 +45,7 @@ void dump(const char *text, size_t i; size_t c; - unsigned int width=0x10; + unsigned int width = 0x10; if(nohex) /* without the hex output, we can fit more on screen */ @@ -54,7 +54,7 @@ void dump(const char *text, fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n", text, (long)size, (long)size); - for(i=0; i<size; i+= width) { + for(i = 0; i<size; i+= width) { fprintf(stream, "%4.4lx: ", (long)i); @@ -69,14 +69,14 @@ void dump(const char *text, for(c = 0; (c < width) && (i+c < size); c++) { /* check for 0D0A; if found, skip past and start a new line of output */ - if(nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) { + if(nohex && (i+c+1 < size) && ptr[i+c] == 0x0D && ptr[i+c+1] == 0x0A) { i+=(c+2-width); break; } fprintf(stream, "%c", - (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); + (ptr[i+c] >= 0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); /* check again for 0D0A, to avoid an extra \n if it's at width */ - if(nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) { + if(nohex && (i+c+2 < size) && ptr[i+c+1] == 0x0D && ptr[i+c+2] == 0x0A) { i+=(c+3-width); break; } diff --git a/docs/examples/multithread.c b/docs/examples/multithread.c index 26c40f5a1..e3ae8e671 100644 --- a/docs/examples/multithread.c +++ b/docs/examples/multithread.c @@ -74,7 +74,7 @@ int main(int argc, char **argv) /* Must initialize libcurl before any threads are started */ curl_global_init(CURL_GLOBAL_ALL); - for(i=0; i< NUMT; i++) { + for(i = 0; i< NUMT; i++) { error = pthread_create(&tid[i], NULL, /* default attributes please */ pull_one_url, @@ -86,7 +86,7 @@ int main(int argc, char **argv) } /* now wait for all threads to terminate */ - for(i=0; i< NUMT; i++) { + for(i = 0; i< NUMT; i++) { error = pthread_join(tid[i], NULL); fprintf(stderr, "Thread %d terminated\n", i); } diff --git a/docs/examples/opensslthreadlock.c b/docs/examples/opensslthreadlock.c index 6f86c7f70..649ef93a9 100644 --- a/docs/examples/opensslthreadlock.c +++ b/docs/examples/opensslthreadlock.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -50,7 +50,7 @@ void handle_error(const char *file, int lineno, const char *msg) } /* This array will store all of the mutexes available to OpenSSL. */ -static MUTEX_TYPE *mutex_buf= NULL; +static MUTEX_TYPE *mutex_buf = NULL; static void locking_function(int mode, int n, const char *file, int line) { diff --git a/docs/examples/postinmemory.c b/docs/examples/postinmemory.c index 9dd4cb637..488d227be 100644 --- a/docs/examples/postinmemory.c +++ b/docs/examples/postinmemory.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -58,7 +58,7 @@ int main(void) CURL *curl; CURLcode res; struct MemoryStruct chunk; - static const char *postthis="Field=1&Field=2&Field=3"; + static const char *postthis = "Field=1&Field=2&Field=3"; chunk.memory = malloc(1); /* will be grown as needed by realloc above */ chunk.size = 0; /* no data at this point */ diff --git a/docs/examples/sendrecv.c b/docs/examples/sendrecv.c index 2b9dc9b19..eedaf4cde 100644 --- a/docs/examples/sendrecv.c +++ b/docs/examples/sendrecv.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -36,7 +36,7 @@ static int wait_on_socket(curl_socket_t sockfd, int for_recv, long timeout_ms) int res; tv.tv_sec = timeout_ms / 1000; - tv.tv_usec= (timeout_ms % 1000) * 1000; + tv.tv_usec = (timeout_ms % 1000) * 1000; FD_ZERO(&infd); FD_ZERO(&outfd); diff --git a/docs/examples/sftpget.c b/docs/examples/sftpget.c index 1ca7448e2..44a3caf2e 100644 --- a/docs/examples/sftpget.c +++ b/docs/examples/sftpget.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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,10 +46,10 @@ struct FtpFile { static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) { - struct FtpFile *out=(struct FtpFile *)stream; + struct FtpFile *out = (struct FtpFile *)stream; if(out && !out->stream) { /* open file for writing */ - out->stream=fopen(out->filename, "wb"); + out->stream = fopen(out->filename, "wb"); if(!out->stream) return -1; /* failure, can't open file to write */ } @@ -61,7 +61,7 @@ int main(void) { CURL *curl; CURLcode res; - struct FtpFile ftpfile={ + struct FtpFile ftpfile = { "yourfile.bin", /* name to store the file as if successful */ NULL }; diff --git a/docs/examples/simplepost.c b/docs/examples/simplepost.c index 99df057dd..e366f001b 100644 --- a/docs/examples/simplepost.c +++ b/docs/examples/simplepost.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -32,7 +32,7 @@ int main(void) CURL *curl; CURLcode res; - static const char *postthis="moo mooo moo moo"; + static const char *postthis = "moo mooo moo moo"; curl = curl_easy_init(); if(curl) { diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index 81713ab89..fdc7cf15c 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -53,7 +53,7 @@ int main(void) const char *pPassphrase = NULL; static const char *pCertFile = "testcert.pem"; - static const char *pCACertFile="cacert.pem"; + static const char *pCACertFile = "cacert.pem"; static const char *pHeaderFile = "dumpit"; const char *pKeyName; diff --git a/docs/examples/smooth-gtk-thread.c b/docs/examples/smooth-gtk-thread.c index 713fcc6c3..8451743a6 100644 --- a/docs/examples/smooth-gtk-thread.c +++ b/docs/examples/smooth-gtk-thread.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -134,7 +134,7 @@ void *create_thread(void *progress_bar) int error; /* Make sure I don't create more threads than urls. */ - for(i=0; i < NUMT && i < num_urls ; i++) { + for(i = 0; i < NUMT && i < num_urls ; i++) { error = pthread_create(&tid[i], NULL, /* default attributes please */ pull_one_url, @@ -146,7 +146,7 @@ void *create_thread(void *progress_bar) } /* Wait for all threads to terminate. */ - for(i=0; i < NUMT && i < num_urls; i++) { + for(i = 0; i < NUMT && i < num_urls; i++) { error = pthread_join(tid[i], NULL); fprintf(stderr, "Thread %d terminated\n", i); } diff --git a/docs/examples/synctime.c b/docs/examples/synctime.c index 48377f527..9b3a73467 100644 --- a/docs/examples/synctime.c +++ b/docs/examples/synctime.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -158,7 +158,7 @@ size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb, if(RetVal == 7) { SYSTime.wMilliseconds = 500; /* adjust to midpoint, 0.5 sec */ - for(i=0; i<12; i++) { + for(i = 0; i<12; i++) { if(strcmp(MthStr[i], TmpStr2) == 0) { SYSTime.wMonth = i+1; break; @@ -243,7 +243,7 @@ int conf_init(conf_t *conf) int i; *conf->http_proxy = 0; - for(i=0; i<MAX_STRING1; i++) + for(i = 0; i<MAX_STRING1; i++) conf->proxy_user[i] = 0; /* Clean up password from memory */ *conf->timeserver = 0; return 1; diff --git a/docs/examples/threaded-ssl.c b/docs/examples/threaded-ssl.c index 16da37a80..adf46292a 100644 --- a/docs/examples/threaded-ssl.c +++ b/docs/examples/threaded-ssl.c @@ -63,7 +63,7 @@ static unsigned long thread_id(void) { unsigned long ret; - ret=(unsigned long)pthread_self(); + ret = (unsigned long)pthread_self(); return ret; } @@ -71,9 +71,9 @@ static void init_locks(void) { int i; - lockarray=(pthread_mutex_t *)OPENSSL_malloc(CRYPTO_num_locks() * - sizeof(pthread_mutex_t)); - for(i=0; i<CRYPTO_num_locks(); i++) { + lockarray = (pthread_mutex_t *)OPENSSL_malloc(CRYPTO_num_locks() * + sizeof(pthread_mutex_t)); + for(i = 0; i<CRYPTO_num_locks(); i++) { pthread_mutex_init(&(lockarray[i]), NULL); } @@ -86,7 +86,7 @@ static void kill_locks(void) int i; CRYPTO_set_locking_callback(NULL); - for(i=0; i<CRYPTO_num_locks(); i++) + for(i = 0; i<CRYPTO_num_locks(); i++) pthread_mutex_destroy(&(lockarray[i])); OPENSSL_free(lockarray); @@ -144,7 +144,7 @@ int main(int argc, char **argv) init_locks(); - for(i=0; i< NUMT; i++) { + for(i = 0; i< NUMT; i++) { error = pthread_create(&tid[i], NULL, /* default attributes please */ pull_one_url, @@ -156,7 +156,7 @@ int main(int argc, char **argv) } /* now wait for all threads to terminate */ - for(i=0; i< NUMT; i++) { + for(i = 0; i< NUMT; i++) { error = pthread_join(tid[i], NULL); fprintf(stderr, "Thread %d terminated\n", i); } diff --git a/docs/examples/usercertinmem.c b/docs/examples/usercertinmem.c index 77fde911c..40505b0c0 100644 --- a/docs/examples/usercertinmem.c +++ b/docs/examples/usercertinmem.c @@ -200,7 +200,7 @@ int main(void) /* first try: retrieve page without user certificate and key -> will fail */ rv = curl_easy_perform(ch); - if(rv==CURLE_OK) { + if(rv == CURLE_OK) { printf("*** transfer succeeded ***\n"); } else { @@ -213,7 +213,7 @@ int main(void) */ rv = curl_easy_setopt(ch, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); rv = curl_easy_perform(ch); - if(rv==CURLE_OK) { + if(rv == CURLE_OK) { printf("*** transfer succeeded ***\n"); } else { diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index 9b6515cda..87e70b4d9 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -260,7 +260,7 @@ static int waitperform(struct connectdata *conn, int timeout_ms) bitmask = ares_getsock((ares_channel)data->state.resolver, socks, ARES_GETSOCK_MAXNUM); - for(i=0; i < ARES_GETSOCK_MAXNUM; i++) { + for(i = 0; i < ARES_GETSOCK_MAXNUM; i++) { pfd[i].events = 0; pfd[i].revents = 0; if(ARES_GETSOCK_READABLE(bitmask, i)) { @@ -289,7 +289,7 @@ static int waitperform(struct connectdata *conn, int timeout_ms) ARES_SOCKET_BAD); else { /* move through the descriptors and ask for processing on them */ - for(i=0; i < num; i++) + for(i = 0; i < num; i++) ares_process_fd((ares_channel)data->state.resolver, pfd[i].revents & (POLLRDNORM|POLLIN)? pfd[i].fd:ARES_SOCKET_BAD, diff --git a/lib/connect.c b/lib/connect.c index 927ff7cec..2cebb3081 100755 --- a/lib/connect.c +++ b/lib/connect.c @@ -249,7 +249,7 @@ static CURLcode bindlocal(struct connectdata *conn, struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&sa; #endif - struct Curl_dns_entry *h=NULL; + struct Curl_dns_entry *h = NULL; unsigned short port = data->set.localport; /* use this port number, 0 for "random" */ /* how many port numbers to try to bind to, increasing one at a time */ @@ -748,7 +748,7 @@ CURLcode Curl_is_connected(struct connectdata *conn, return CURLE_OPERATION_TIMEDOUT; } - for(i=0; i<2; i++) { + for(i = 0; i<2; i++) { const int other = i ^ 1; if(conn->tempsock[i] == CURL_SOCKET_BAD) continue; @@ -900,7 +900,7 @@ void Curl_tcpnodelay(struct connectdata *conn, curl_socket_t sockfd) static void nosigpipe(struct connectdata *conn, curl_socket_t sockfd) { - struct Curl_easy *data= conn->data; + struct Curl_easy *data = conn->data; int onoff = 1; if(setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&onoff, sizeof(onoff)) < 0) @@ -1333,7 +1333,7 @@ CURLcode Curl_socket(struct connectdata *conn, addr->family = ai->ai_family; addr->socktype = conn->socktype; - addr->protocol = conn->socktype==SOCK_DGRAM?IPPROTO_UDP:ai->ai_protocol; + addr->protocol = conn->socktype == SOCK_DGRAM?IPPROTO_UDP:ai->ai_protocol; addr->addrlen = ai->ai_addrlen; if(addr->addrlen > sizeof(struct Curl_sockaddr_storage)) diff --git a/lib/cookie.c b/lib/cookie.c index eba2536ef..f7dd403cb 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -377,7 +377,7 @@ Curl_cookie_add(struct Curl_easy *data, struct Cookie *clist; char name[MAX_NAME]; struct Cookie *co; - struct Cookie *lastc=NULL; + struct Cookie *lastc = NULL; time_t now = time(NULL); bool replace_old = FALSE; bool badcookie = FALSE; /* cookies are good by default. mmmmm yummy */ @@ -407,7 +407,7 @@ Curl_cookie_add(struct Curl_easy *data, return NULL; } - semiptr=strchr(lineptr, ';'); /* first, find a semicolon */ + semiptr = strchr(lineptr, ';'); /* first, find a semicolon */ while(*lineptr && ISBLANK(*lineptr)) lineptr++; @@ -415,7 +415,7 @@ Curl_cookie_add(struct Curl_easy *data, ptr = lineptr; do { /* we have a <what>=<this> pair or a stand-alone word here */ - name[0]=what[0]=0; /* init the buffers */ + name[0] = what[0] = 0; /* init the buffers */ if(1 <= sscanf(ptr, "%" MAX_NAME_TXT "[^;\r\n=] =%" MAX_COOKIE_LINE_TXT "[^;\r\n]", name, what)) { @@ -425,7 +425,7 @@ Curl_cookie_add(struct Curl_easy *data, const char *whatptr; bool done = FALSE; bool sep; - size_t len=strlen(what); + size_t len = strlen(what); size_t nlen = strlen(name); const char *endofn = &ptr[ nlen ]; @@ -440,18 +440,18 @@ Curl_cookie_add(struct Curl_easy *data, endofn--; nlen--; } - name[nlen]=0; /* new end of name */ + name[nlen] = 0; /* new end of name */ } } /* Strip off trailing whitespace from the 'what' */ while(len && ISBLANK(what[len-1])) { - what[len-1]=0; + what[len-1] = 0; len--; } /* Skip leading whitespace from the 'what' */ - whatptr=what; + whatptr = what; while(*whatptr && ISBLANK(*whatptr)) whatptr++; @@ -510,7 +510,7 @@ Curl_cookie_add(struct Curl_easy *data, /* check for more dots */ dotp = strchr(whatptr, '.'); if(!dotp && !strcasecompare("localhost", whatptr)) - domain=":"; + domain = ":"; } #endif @@ -525,14 +525,14 @@ Curl_cookie_add(struct Curl_easy *data, break; } if(!is_ip) - co->tailmatch=TRUE; /* we always do that if the domain name was - given */ + co->tailmatch = TRUE; /* we always do that if the domain name was + given */ } else { /* we did not get a tailmatch and then the attempted set domain is not a domain to which the current host belongs. Mark as bad. */ - badcookie=TRUE; + badcookie = TRUE; infof(data, "skipped cookie with bad tailmatch domain: %s\n", whatptr); } @@ -581,20 +581,20 @@ Curl_cookie_add(struct Curl_easy *data, continue; } - ptr=semiptr+1; + ptr = semiptr+1; while(*ptr && ISBLANK(*ptr)) ptr++; - semiptr=strchr(ptr, ';'); /* now, find the next semicolon */ + semiptr = strchr(ptr, ';'); /* now, find the next semicolon */ if(!semiptr && *ptr) /* There are no more semicolons, but there's a final name=value pair coming up */ - semiptr=strchr(ptr, '\0'); + semiptr = strchr(ptr, '\0'); } while(semiptr); if(co->maxage) { CURLofft offt; - offt = curlx_strtoofft((*co->maxage=='\"')? + offt = curlx_strtoofft((*co->maxage == '\"')? &co->maxage[1]:&co->maxage[0], NULL, 10, &co->expires); if(offt == CURL_OFFT_FLOW) @@ -625,7 +625,7 @@ Curl_cookie_add(struct Curl_easy *data, if(!badcookie && !co->domain) { if(domain) { /* no domain was given in the header line, set the default */ - co->domain=strdup(domain); + co->domain = strdup(domain); if(!co->domain) badcookie = TRUE; } @@ -646,10 +646,10 @@ Curl_cookie_add(struct Curl_easy *data, endslash = memrchr(path, '/', (size_t)(queryp - path)); if(endslash) { size_t pathlen = (size_t)(endslash-path+1); /* include ending slash */ - co->path=malloc(pathlen+1); /* one extra for the zero byte */ + co->path = malloc(pathlen+1); /* one extra for the zero byte */ if(co->path) { memcpy(co->path, path, pathlen); - co->path[pathlen]=0; /* zero terminate */ + co->path[pathlen] = 0; /* zero terminate */ co->spath = sanitize_cookie_path(co->path); if(!co->spath) badcookie = TRUE; /* out of memory bad */ @@ -674,7 +674,7 @@ Curl_cookie_add(struct Curl_easy *data, reading the odd netscape cookies-file format here */ char *ptr; char *firstptr; - char *tok_buf=NULL; + char *tok_buf = NULL; int fields; /* IE introduced HTTP-only cookies to prevent XSS attacks. Cookies @@ -695,19 +695,19 @@ Curl_cookie_add(struct Curl_easy *data, return NULL; } /* strip off the possible end-of-line characters */ - ptr=strchr(lineptr, '\r'); + ptr = strchr(lineptr, '\r'); if(ptr) - *ptr=0; /* clear it */ - ptr=strchr(lineptr, '\n'); + *ptr = 0; /* clear it */ + ptr = strchr(lineptr, '\n'); if(ptr) - *ptr=0; /* clear it */ + *ptr = 0; /* clear it */ - firstptr=strtok_r(lineptr, "\t", &tok_buf); /* tokenize it on the TAB */ + firstptr = strtok_r(lineptr, "\t", &tok_buf); /* tokenize it on the TAB */ /* Now loop through the fields and init the struct we already have allocated */ - for(ptr=firstptr, fields=0; ptr && !badcookie; - ptr=strtok_r(NULL, "\t", &tok_buf), fields++) { + for(ptr = firstptr, fields = 0; ptr && !badcookie; + ptr = strtok_r(NULL, "\t", &tok_buf), fields++) { switch(fields) { case 0: if(ptr[0]=='.') /* skip preceding dots */ @@ -835,7 +835,7 @@ Curl_cookie_add(struct Curl_easy *data, if(strcasecompare(clist->domain, co->domain) && (clist->tailmatch == co->tailmatch)) /* The domains are identical */ - replace_old=TRUE; + replace_old = TRUE; } else if(!clist->domain && !co->domain) replace_old = TRUE; @@ -964,7 +964,7 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data, { struct CookieInfo *c; FILE *fp = NULL; - bool fromfile=TRUE; + bool fromfile = TRUE; char *line = NULL; if(NULL == inc) { @@ -984,7 +984,7 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data, if(file && !strcmp(file, "-")) { fp = stdin; - fromfile=FALSE; + fromfile = FALSE; } else if(file && !*file) { /* points to a "" string */ @@ -1005,12 +1005,12 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data, while(get_line(line, MAX_COOKIE_LINE, fp)) { if(checkprefix("Set-Cookie:", line)) { /* This is a cookie line, get it! */ - lineptr=&line[11]; - headerline=TRUE; + lineptr = &line[11]; + headerline = TRUE; } else { - lineptr=line; - headerline=FALSE; + lineptr = line; + headerline = FALSE; } while(*lineptr && ISBLANK(*lineptr)) lineptr++; @@ -1120,7 +1120,7 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c, struct Cookie *newco; struct Cookie *co; time_t now = time(NULL); - struct Cookie *mainco=NULL; + struct Cookie *mainco = NULL; size_t matches = 0; bool is_ip; @@ -1192,7 +1192,7 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c, co = mainco; - for(i=0; co; co = co->next) + for(i = 0; co; co = co->next) array[i++] = co; /* now sort the cookie pointers in path length order */ @@ -1201,7 +1201,7 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c, /* remake the linked list order according to the new order */ mainco = array[0]; /* start here */ - for(i=0; i<matches-1; i++) + for(i = 0; i<matches-1; i++) array[i]->next = array[i+1]; array[matches-1]->next = NULL; /* terminate the list */ @@ -1342,7 +1342,7 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere) { struct Cookie *co; FILE *out; - bool use_stdout=FALSE; + bool use_stdout = FALSE; char *format_ptr; if((NULL == c) || (0 == c->numcookies)) @@ -1356,7 +1356,7 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere) if(!strcmp("-", dumphere)) { /* use stdout */ out = stdout; - use_stdout=TRUE; + use_stdout = TRUE; } else { out = fopen(dumphere, FOPEN_WRITETEXT); diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 1adf3198a..6eb28bbcb 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -286,7 +286,7 @@ Curl_he2ai(const struct hostent *he, int port) DEBUGASSERT((he->h_name != NULL) && (he->h_addr_list != NULL)); - for(i=0; (curr = he->h_addr_list[i]) != NULL; i++) { + for(i = 0; (curr = he->h_addr_list[i]) != NULL; i++) { size_t ss_size; #ifdef ENABLE_IPV6 @@ -570,9 +570,9 @@ curl_dogetaddrinfo(const char *hostname, int line, const char *source) { #ifdef USE_LWIPSOCK - int res=lwip_getaddrinfo(hostname, service, hints, result); + int res = lwip_getaddrinfo(hostname, service, hints, result); #else - int res=(getaddrinfo)(hostname, service, hints, result); + int res = (getaddrinfo)(hostname, service, hints, result); #endif if(0 == res) /* success */ diff --git a/lib/curl_ntlm_wb.c b/lib/curl_ntlm_wb.c index 9e9586cc3..ac0e12456 100644 --- a/lib/curl_ntlm_wb.c +++ b/lib/curl_ntlm_wb.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -357,7 +357,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, /* not set means empty */ if(!userp) - userp=""; + userp = ""; switch(ntlm->state) { case NTLMSTATE_TYPE1: @@ -413,7 +413,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, /* connection is already authenticated, * don't send a header in future requests */ free(*allocuserpwd); - *allocuserpwd=NULL; + *allocuserpwd = NULL; authp->done = TRUE; break; } diff --git a/lib/dict.c b/lib/dict.c index 81d89fc48..4fc85521d 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -98,7 +98,7 @@ static char *unescape_word(struct Curl_easy *data, const char *inputbuff) char *ptr; size_t len; char ch; - int olen=0; + int olen = 0; CURLcode result = Curl_urldecode(data, inputbuff, 0, &newp, &len, FALSE); if(!newp || result) @@ -117,7 +117,7 @@ static char *unescape_word(struct Curl_easy *data, const char *inputbuff) } dictp[olen++] = ch; } - dictp[olen]=0; + dictp[olen] = 0; } free(newp); return dictp; @@ -132,8 +132,8 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) char *strategy = NULL; char *nthdef = NULL; /* This is not part of the protocol, but required by RFC 2229 */ - CURLcode result=CURLE_OK; - struct Curl_easy *data=conn->data; + CURLcode result = CURLE_OK; + struct Curl_easy *data = conn->data; curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; char *path = data->state.path; @@ -168,7 +168,7 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) if((word == NULL) || (*word == (char)0)) { infof(data, "lookup word is missing\n"); - word=(char *)"default"; + word = (char *)"default"; } if((database == NULL) || (*database == (char)0)) { database = (char *)"!"; @@ -222,7 +222,7 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) if((word == NULL) || (*word == (char)0)) { infof(data, "lookup word is missing\n"); - word=(char *)"default"; + word = (char *)"default"; } if((database == NULL) || (*database == (char)0)) { database = (char *)"!"; diff --git a/lib/dotdot.c b/lib/dotdot.c index 20603bcab..af5195fe0 100644 --- a/lib/dotdot.c +++ b/lib/dotdot.c @@ -92,25 +92,25 @@ char *Curl_dedotdotify(const char *input) remove that prefix from the input buffer; otherwise, */ if(!strncmp("./", clone, 2)) { - clone+=2; - clen-=2; + clone += 2; + clen -= 2; } else if(!strncmp("../", clone, 3)) { - clone+=3; - clen-=3; + clone += 3; + clen -= 3; } /* B. if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise, */ else if(!strncmp("/./", clone, 3)) { - clone+=2; - clen-=2; + clone += 2; + clen -= 2; } else if(!strcmp("/.", clone)) { clone[1]='/'; clone++; - clen-=1; + clen -= 1; } /* C. if the input buffer begins with a prefix of "/../" or "/..", where @@ -119,8 +119,8 @@ char *Curl_dedotdotify(const char *input) any) from the output buffer; otherwise, */ else if(!strncmp("/../", clone, 4)) { - clone+=3; - clen-=3; + clone += 3; + clen -= 3; /* remove the last segment from the output buffer */ while(outptr > out) { outptr--; @@ -131,8 +131,8 @@ char *Curl_dedotdotify(const char *input) } else if(!strcmp("/..", clone)) { clone[2]='/'; - clone+=2; - clen-=2; + clone += 2; + clen -= 2; /* remove the last segment from the output buffer */ while(outptr > out) { outptr--; @@ -146,8 +146,8 @@ char *Curl_dedotdotify(const char *input) that from the input buffer; otherwise, */ else if(!strcmp(".", clone) || !strcmp("..", clone)) { - *clone=0; - *out=0; + *clone = 0; + *out = 0; } else { diff --git a/lib/easy.c b/lib/easy.c index 66ec38a5e..5328f9c2d 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -433,7 +433,7 @@ static int events_timer(struct Curl_multi *multi, /* multi handle */ */ static int poll2cselect(int pollmask) { - int omask=0; + int omask = 0; if(pollmask & POLLIN) omask |= CURL_CSELECT_IN; if(pollmask & POLLOUT) @@ -450,7 +450,7 @@ static int poll2cselect(int pollmask) */ static short socketcb2poll(int pollmask) { - short omask=0; + short omask = 0; if(pollmask & CURL_POLL_IN) omask |= POLLIN; if(pollmask & CURL_POLL_OUT) @@ -473,7 +473,7 @@ static int events_socket(struct Curl_easy *easy, /* easy handle */ { struct events *ev = userp; struct socketmonitor *m; - struct socketmonitor *prev=NULL; + struct socketmonitor *prev = NULL; #if defined(CURL_DISABLE_VERBOSE_STRINGS) (void) easy; @@ -569,14 +569,14 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev) struct socketmonitor *m; struct pollfd *f; struct pollfd fds[4]; - int numfds=0; + int numfds = 0; int pollrc; int i; struct curltime before; struct curltime after; /* populate the fds[] array */ - for(m = ev->list, f=&fds[0]; m; m = m->next) { + for(m = ev->list, f = &fds[0]; m; m = m->next) { f->fd = m->socket.fd; f->events = m->socket.events; f->revents = 0; @@ -655,7 +655,7 @@ static CURLcode easy_events(struct Curl_multi *multi) { /* this struct is made static to allow it to be used after this function returns and curl_multi_remove_handle() is called */ - static struct events evs= {2, FALSE, 0, NULL, 0}; + static struct events evs = {2, FALSE, 0, NULL, 0}; /* if running event-based, do some further multi inits */ events_setup(multi, &evs); @@ -1027,13 +1027,13 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action) struct tempbuf writebuf[3]; /* there can only be three */ /* copy the structs to allow for immediate re-pausing */ - for(i=0; i < data->state.tempcount; i++) { + for(i = 0; i < data->state.tempcount; i++) { writebuf[i] = data->state.tempwrite[i]; data->state.tempwrite[i].buf = NULL; } data->state.tempcount = 0; - for(i=0; i < count; i++) { + for(i = 0; i < count; i++) { /* even if one function returns error, this loops through and frees all buffers */ if(!result) diff --git a/lib/escape.c b/lib/escape.c index 973aeb6ea..00c10b14a 100644 --- a/lib/escape.c +++ b/lib/escape.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -84,7 +84,7 @@ char *curl_easy_escape(struct Curl_easy *data, const char *string, char *testing_ptr = NULL; unsigned char in; /* we need to treat the characters unsigned */ size_t newlen; - size_t strindex=0; + size_t strindex = 0; size_t length; CURLcode result; @@ -104,7 +104,7 @@ char *curl_easy_escape(struct Curl_easy *data, const char *string, if(Curl_isunreserved(in)) /* just copy this */ - ns[strindex++]=in; + ns[strindex++] = in; else { /* encode it */ newlen += 2; /* the size grows with two, since this'll become a %XX */ @@ -125,11 +125,11 @@ char *curl_easy_escape(struct Curl_easy *data, const char *string, snprintf(&ns[strindex], 4, "%%%02X", in); - strindex+=3; + strindex += 3; } string++; } - ns[strindex]=0; /* terminate it */ + ns[strindex] = 0; /* terminate it */ return ns; } @@ -151,7 +151,7 @@ CURLcode Curl_urldecode(struct Curl_easy *data, size_t alloc = (length?length:strlen(string))+1; char *ns = malloc(alloc); unsigned char in; - size_t strindex=0; + size_t strindex = 0; unsigned long hex; CURLcode result; @@ -180,8 +180,8 @@ CURLcode Curl_urldecode(struct Curl_easy *data, return result; } - string+=2; - alloc-=2; + string += 2; + alloc -= 2; } if(reject_ctrl && (in < 0x20)) { @@ -192,7 +192,7 @@ CURLcode Curl_urldecode(struct Curl_easy *data, ns[strindex++] = in; string++; } - ns[strindex]=0; /* terminate it */ + ns[strindex] = 0; /* terminate it */ if(olen) /* store output size */ diff --git a/lib/file.c b/lib/file.c index a8f29f2ca..2ef096ba4 100644 --- a/lib/file.c +++ b/lib/file.c @@ -133,7 +133,7 @@ static CURLcode file_setup_connection(struct connectdata *conn) static CURLcode file_range(struct connectdata *conn) { curl_off_t from, to; - curl_off_t totalsize=-1; + curl_off_t totalsize = -1; char *ptr; char *ptr2; struct Curl_easy *data = conn->data; @@ -144,7 +144,7 @@ static CURLcode file_range(struct connectdata *conn) from_t = curlx_strtoofft(data->state.range, &ptr, 0, &from); if(from_t == CURL_OFFT_FLOW) return CURLE_RANGE_ERROR; - while(*ptr && (ISSPACE(*ptr) || (*ptr=='-'))) + while(*ptr && (ISSPACE(*ptr) || (*ptr == '-'))) ptr++; to_t = curlx_strtoofft(ptr, &ptr2, 0, &to); if(to_t == CURL_OFFT_FLOW) @@ -228,7 +228,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done) } /* change path separators from '/' to '\\' for DOS, Windows and OS/2 */ - for(i=0; i < real_path_len; ++i) + for(i = 0; i < real_path_len; ++i) if(actual_path[i] == '/') actual_path[i] = '\\'; else if(!actual_path[i]) { /* binary zero */ @@ -430,9 +430,9 @@ static CURLcode file_do(struct connectdata *conn, bool *done) struct_stat statbuf; /* struct_stat instead of struct stat just to allow the Windows version to have a different struct without having to redefine the simple word 'stat' */ - curl_off_t expected_size=0; + curl_off_t expected_size = 0; bool size_known; - bool fstated=FALSE; + bool fstated = FALSE; ssize_t nread; struct Curl_easy *data = conn->data; char *buf = data->state.buffer; diff --git a/lib/formdata.c b/lib/formdata.c index 61ae78d91..bfa01c88e 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -192,7 +192,7 @@ static const char *ContentTypeForFilename(const char *filename, contenttype = HTTPPOST_CONTENTTYPE_DEFAULT; if(filename) { /* in case a NULL was passed in */ - for(i=0; i<sizeof(ctts)/sizeof(ctts[0]); i++) { + for(i = 0; i<sizeof(ctts)/sizeof(ctts[0]); i++) { if(strlen(filename) >= strlen(ctts[i].extension)) { if(strcasecompare(filename + strlen(filename) - strlen(ctts[i].extension), @@ -267,7 +267,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, struct curl_httppost *post = NULL; CURLformoption option; struct curl_forms *forms = NULL; - char *array_value=NULL; /* value read from an array */ + char *array_value = NULL; /* value read from an array */ /* This is a state variable, that if TRUE means that we're parsing an array that we got passed to us. If FALSE we're parsing the input @@ -795,7 +795,7 @@ void curl_formfree(struct curl_httppost *form) return; do { - next=form->next; /* the following form line */ + next = form->next; /* the following form line */ /* recurse to sub-contents */ curl_formfree(form->more); @@ -239,9 +239,9 @@ static void freedirs(struct ftp_conn *ftpc) { int i; if(ftpc->dirs) { - for(i=0; i < ftpc->dirdepth; i++) { + for(i = 0; i < ftpc->dirdepth; i++) { free(ftpc->dirs[i]); - ftpc->dirs[i]=NULL; + ftpc->dirs[i] = NULL; } free(ftpc->dirs); ftpc->dirs = NULL; @@ -288,7 +288,7 @@ static CURLcode AcceptServerConnect(struct connectdata *conn) if(0 == getsockname(sock, (struct sockaddr *) &add, &size)) { size = sizeof(add); - s=accept(sock, (struct sockaddr *) &add, &size); + s = accept(sock, (struct sockaddr *) &add, &size); } Curl_closesocket(conn, sock); /* close the first socket */ @@ -457,7 +457,7 @@ static CURLcode InitiateTransfer(struct connectdata *conn) } if(conn->proto.ftpc.state_saved == FTP_STOR) { - *(ftp->bytecountp)=0; + *(ftp->bytecountp) = 0; /* When we know we're uploading a specified file, we can get the file size prior to the actual upload. */ @@ -592,7 +592,7 @@ static CURLcode ftp_readresp(curl_socket_t sockfd, #endif /* store the latest code for later retrieval */ - data->info.httpcode=code; + data->info.httpcode = code; if(ftpcode) *ftpcode = code; @@ -640,8 +640,8 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */ struct ftp_conn *ftpc = &conn->proto.ftpc; struct pingpong *pp = &ftpc->pp; size_t nread; - int cache_skip=0; - int value_to_be_ignored=0; + int cache_skip = 0; + int value_to_be_ignored = 0; if(ftpcode) *ftpcode = 0; /* 0 for errors */ @@ -649,13 +649,13 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */ /* make the pointer point to something for the rest of this function */ ftpcode = &value_to_be_ignored; - *nreadp=0; + *nreadp = 0; while(!*ftpcode && !result) { /* check and reset timeout value every lap */ timeout = Curl_pp_state_timeout(pp); - if(timeout <=0) { + if(timeout <= 0) { failf(data, "FTP response timeout"); return CURLE_OPERATION_TIMEDOUT; /* already too little time */ } @@ -713,7 +713,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */ else /* when we got data or there is no cache left, we reset the cache skip counter */ - cache_skip=0; + cache_skip = 0; *nreadp += nread; @@ -848,7 +848,7 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks, int i; /* PORT is used to tell the server to connect to us, and during that we don't do happy eyeballs, but we do if we connect to the server */ - for(s=1, i=0; i<2; i++) { + for(s = 1, i = 0; i<2; i++) { if(conn->tempsock[i] != CURL_SOCKET_BAD) { socks[s] = conn->tempsock[i]; bits |= GETSOCK_WRITESOCK(s++); @@ -885,7 +885,7 @@ static CURLcode ftp_state_cwd(struct connectdata *conn) /* count3 is set to allow a MKD to fail once. In the case when first CWD fails and then MKD fails (due to another session raced it to create the dir) this then allows for a second try to CWD to it */ - ftpc->count3 = (conn->data->set.ftp_create_missing_dirs==2)?1:0; + ftpc->count3 = (conn->data->set.ftp_create_missing_dirs == 2)?1:0; if((conn->data->set.ftp_filemethod == FTPFILE_NOCWD) && !ftpc->cwdcount) /* No CWD necessary */ @@ -928,15 +928,15 @@ static CURLcode ftp_state_use_port(struct connectdata *conn, { CURLcode result = CURLE_OK; struct ftp_conn *ftpc = &conn->proto.ftpc; - struct Curl_easy *data=conn->data; - curl_socket_t portsock= CURL_SOCKET_BAD; + struct Curl_easy *data = conn->data; + curl_socket_t portsock = CURL_SOCKET_BAD; char myhost[256] = ""; struct Curl_sockaddr_storage ss; Curl_addrinfo *res, *ai; curl_socklen_t sslen; char hbuf[NI_MAXHOST]; - struct sockaddr *sa=(struct sockaddr *)&ss; + struct sockaddr *sa = (struct sockaddr *)&ss; struct sockaddr_in * const sa4 = (void *)sa; #ifdef ENABLE_IPV6 struct sockaddr_in6 * const sa6 = (void *)sa; @@ -947,7 +947,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn, int error; char *host = NULL; char *string_ftpport = data->set.str[STRING_FTPPORT]; - struct Curl_dns_entry *h=NULL; + struct Curl_dns_entry *h = NULL; unsigned short port_min = 0; unsigned short port_max = 0; unsigned short port; @@ -1262,7 +1262,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn, /* translate x.x.x.x to x,x,x,x */ while(source && *source) { if(*source == '.') - *dest=','; + *dest = ','; else *dest = *source; dest++; @@ -1622,7 +1622,7 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn, } if(seekerr != CURL_SEEKFUNC_OK) { - curl_off_t passed=0; + curl_off_t passed = 0; if(seekerr != CURL_SEEKFUNC_CANTSEEK) { failf(data, "Could not seek stream"); return CURLE_FTP_COULDNT_USE_REST; @@ -1684,7 +1684,7 @@ static CURLcode ftp_state_quote(struct connectdata *conn, struct Curl_easy *data = conn->data; struct FTP *ftp = data->req.protop; struct ftp_conn *ftpc = &conn->proto.ftpc; - bool quote=FALSE; + bool quote = FALSE; struct curl_slist *item; switch(instate) { @@ -1821,11 +1821,11 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, { struct ftp_conn *ftpc = &conn->proto.ftpc; CURLcode result; - struct Curl_easy *data=conn->data; - struct Curl_dns_entry *addr=NULL; + struct Curl_easy *data = conn->data; + struct Curl_dns_entry *addr = NULL; int rc; unsigned short connectport; /* the local port connect() should use! */ - char *str=&data->state.buffer[4]; /* start on the first letter */ + char *str = &data->state.buffer[4]; /* start on the first letter */ /* if we come here again, make sure the former name is cleared */ Curl_safefree(ftpc->newhost); @@ -1849,9 +1849,9 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, /* The four separators should be identical, or else this is an oddly formatted reply and we bail out immediately. */ - for(i=1; i<4; i++) { + for(i = 1; i<4; i++) { if(separator[i] != sep1) { - ptr=NULL; /* set to NULL to signal error */ + ptr = NULL; /* set to NULL to signal error */ break; } } @@ -1867,7 +1867,7 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, } } else - ptr=NULL; + ptr = NULL; } if(!ptr) { failf(data, "Weirdly formatted EPSV reply"); @@ -2041,7 +2041,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn, int ftpcode) { CURLcode result = CURLE_OK; - struct Curl_easy *data=conn->data; + struct Curl_easy *data = conn->data; struct FTP *ftp = data->req.protop; struct ftp_conn *ftpc = &conn->proto.ftpc; @@ -2055,7 +2055,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn, &year, &month, &day, &hour, &minute, &second)) { /* we have a time, reformat it */ char timebuf[24]; - time_t secs=time(NULL); + time_t secs = time(NULL); snprintf(timebuf, sizeof(timebuf), "%04d%02d%02d %02d:%02d:%02d GMT", @@ -2071,7 +2071,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn, if(data->set.opt_no_body && ftpc->file && data->set.get_filetime && - (data->info.filetime>=0) ) { + (data->info.filetime >= 0) ) { char headerbuf[128]; time_t filetime = (time_t)data->info.filetime; struct tm buffer; @@ -2147,7 +2147,7 @@ static CURLcode ftp_state_type_resp(struct connectdata *conn, ftpstate instate) { CURLcode result = CURLE_OK; - struct Curl_easy *data=conn->data; + struct Curl_easy *data = conn->data; if(ftpcode/100 != 2) { /* "sasserftpd" and "(u)r(x)bot ftpd" both responds with 226 after a @@ -2176,7 +2176,7 @@ static CURLcode ftp_state_retr(struct connectdata *conn, curl_off_t filesize) { CURLcode result = CURLE_OK; - struct Curl_easy *data=conn->data; + struct Curl_easy *data = conn->data; struct FTP *ftp = data->req.protop; struct ftp_conn *ftpc = &conn->proto.ftpc; @@ -2259,7 +2259,7 @@ static CURLcode ftp_state_size_resp(struct connectdata *conn, ftpstate instate) { CURLcode result = CURLE_OK; - struct Curl_easy *data=conn->data; + struct Curl_easy *data = conn->data; curl_off_t filesize = -1; char *buf = data->state.buffer; @@ -2336,7 +2336,7 @@ static CURLcode ftp_state_stor_resp(struct connectdata *conn, CURLcode result = CURLE_OK; struct Curl_easy *data = conn->data; - if(ftpcode>=400) { + if(ftpcode >= 400) { failf(data, "Failed FTP upload: %0d", ftpcode); state(conn, FTP_STOP); /* oops, we never close the sockets! */ @@ -2394,7 +2394,7 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn, E: 125 Data connection already open; Transfer starting. */ - curl_off_t size=-1; /* default unknown size */ + curl_off_t size = -1; /* default unknown size */ /* @@ -2418,9 +2418,9 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn, * Example D above makes this parsing a little tricky */ char *bytes; char *buf = data->state.buffer; - bytes=strstr(buf, " bytes"); + bytes = strstr(buf, " bytes"); if(bytes--) { - long in=(long)(bytes-buf); + long in = (long)(bytes-buf); /* this is a hint there is size information in there! ;-) */ while(--in) { /* scan for the left parenthesis and break there */ @@ -2428,7 +2428,7 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn, break; /* skip only digits */ if(!ISDIGIT(*bytes)) { - bytes=NULL; + bytes = NULL; break; } /* one more estep backwards */ @@ -2600,7 +2600,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) { CURLcode result; curl_socket_t sock = conn->sock[FIRSTSOCKET]; - struct Curl_easy *data=conn->data; + struct Curl_easy *data = conn->data; int ftpcode; struct ftp_conn *ftpc = &conn->proto.ftpc; struct pingpong *pp = &ftpc->pp; @@ -2652,7 +2652,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) /* We don't have a SSL/TLS connection yet, but FTPS is requested. Try a FTPS connection now */ - ftpc->count3=0; + ftpc->count3 = 0; switch(data->set.ftpsslauth) { case CURLFTPAUTH_DEFAULT: case CURLFTPAUTH_SSL: @@ -2775,7 +2775,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) case FTP_PWD: if(ftpcode == 257) { - char *ptr=&data->state.buffer[4]; /* start on the first letter */ + char *ptr = &data->state.buffer[4]; /* start on the first letter */ const size_t buf_size = data->set.buffer_size; char *dir; char *store; @@ -2866,7 +2866,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) case FTP_SYST: if(ftpcode == 215) { - char *ptr=&data->state.buffer[4]; /* start on the first letter */ + char *ptr = &data->state.buffer[4]; /* start on the first letter */ char *os; char *store; @@ -2957,7 +2957,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) } else { /* success */ - ftpc->count2=0; + ftpc->count2 = 0; if(++ftpc->cwdcount <= ftpc->dirdepth) { /* send next CWD */ PPSENDF(&ftpc->pp, "CWD %s", ftpc->dirs[ftpc->cwdcount - 1]); @@ -3202,11 +3202,11 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status, ftpc->prevpath = path; if(flen) /* if 'path' is not the whole string */ - ftpc->prevpath[dlen]=0; /* terminate */ + ftpc->prevpath[dlen] = 0; /* terminate */ } else { /* we never changed dir */ - ftpc->prevpath=strdup(""); + ftpc->prevpath = strdup(""); free(path); } if(ftpc->prevpath) @@ -3478,7 +3478,7 @@ static CURLcode ftp_range(struct connectdata *conn) from_t = curlx_strtoofft(data->state.range, &ptr, 0, &from); if(from_t == CURL_OFFT_FLOW) return CURLE_RANGE_ERROR; - while(*ptr && (ISSPACE(*ptr) || (*ptr=='-'))) + while(*ptr && (ISSPACE(*ptr) || (*ptr == '-'))) ptr++; to_t = curlx_strtoofft(ptr, NULL, 0, &to); if(to_t == CURL_OFFT_FLOW) @@ -3529,7 +3529,7 @@ static CURLcode ftp_range(struct connectdata *conn) static CURLcode ftp_do_more(struct connectdata *conn, int *completep) { - struct Curl_easy *data=conn->data; + struct Curl_easy *data = conn->data; struct ftp_conn *ftpc = &conn->proto.ftpc; CURLcode result = CURLE_OK; bool connected = FALSE; @@ -3696,7 +3696,7 @@ CURLcode ftp_perform(struct connectdata *conn, bool *dophase_done) { /* this is FTP and no proxy */ - CURLcode result=CURLE_OK; + CURLcode result = CURLE_OK; DEBUGF(infof(conn->data, "DO phase starts\n")); @@ -3989,7 +3989,7 @@ CURLcode Curl_ftpsend(struct connectdata *conn, const char *cmd) #define SBUF_SIZE 1024 char s[SBUF_SIZE]; size_t write_len; - char *sptr=s; + char *sptr = s; CURLcode result = CURLE_OK; #ifdef HAVE_GSSAPI enum protection_level data_sec = conn->data_prot; @@ -4000,9 +4000,8 @@ CURLcode Curl_ftpsend(struct connectdata *conn, const char *cmd) return CURLE_BAD_FUNCTION_ARGUMENT; strcpy(&s[write_len], "\r\n"); /* append a trailing CRLF */ - write_len +=2; - - bytes_written=0; + write_len += 2; + bytes_written = 0; result = Curl_convert_to_network(conn->data, s, write_len); /* Curl_convert_to_network calls failf if unsuccessful */ @@ -4080,7 +4079,7 @@ static CURLcode ftp_quit(struct connectdata *conn) */ static CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection) { - struct ftp_conn *ftpc= &conn->proto.ftpc; + struct ftp_conn *ftpc = &conn->proto.ftpc; struct pingpong *pp = &ftpc->pp; /* We cannot send quit unconditionally. If this connection is stale or @@ -4176,7 +4175,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn) ftpc->dirdepth = 0; break; } - slash_pos=strrchr(cur_pos, '/'); + slash_pos = strrchr(cur_pos, '/'); if(slash_pos || !*cur_pos) { size_t dirlen = slash_pos-cur_pos; CURLcode result; @@ -4281,8 +4280,8 @@ CURLcode ftp_parse_url_path(struct connectdata *conn) } } else - ftpc->file=NULL; /* instead of point to a zero byte, we make it a NULL - pointer */ + ftpc->file = NULL; /* instead of point to a zero byte, we make it a NULL + pointer */ if(data->set.upload && !ftpc->file && (ftp->transfer == FTPTRANSFER_BODY)) { /* We need a file name when uploading. Return error! */ @@ -4378,8 +4377,8 @@ static CURLcode ftp_regular_transfer(struct connectdata *conn, bool *dophase_done) { - CURLcode result=CURLE_OK; - bool connected=FALSE; + CURLcode result = CURLE_OK; + bool connected = FALSE; struct Curl_easy *data = conn->data; struct ftp_conn *ftpc = &conn->proto.ftpc; data->req.size = -1; /* make sure this is unknown at this point */ diff --git a/lib/gopher.c b/lib/gopher.c index 836f72550..b7c31b695 100644 --- a/lib/gopher.c +++ b/lib/gopher.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -73,8 +73,8 @@ const struct Curl_handler Curl_handler_gopher = { static CURLcode gopher_do(struct connectdata *conn, bool *done) { - CURLcode result=CURLE_OK; - struct Curl_easy *data=conn->data; + CURLcode result = CURLE_OK; + struct Curl_easy *data = conn->data; curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; curl_off_t *bytecount = &data->req.bytecount; @@ -97,11 +97,11 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done) /* Otherwise, drop / and the first character (i.e., item type) ... */ newp = path; - newp+=2; + newp += 2; /* ... then turn ? into TAB for search servers, Veronica, etc. ... */ j = strlen(newp); - for(i=0; i<j; i++) + for(i = 0; i<j; i++) if(newp[i] == '?') newp[i] = '\x09'; diff --git a/lib/hostcheck.c b/lib/hostcheck.c index 156091ca8..d8148e3f3 100644 --- a/lib/hostcheck.c +++ b/lib/hostcheck.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -73,10 +73,10 @@ static int hostmatch(char *hostname, char *pattern) /* normalize pattern and hostname by stripping off trailing dots */ size_t len = strlen(hostname); if(hostname[len-1]=='.') - hostname[len-1]=0; + hostname[len-1] = 0; len = strlen(pattern); if(pattern[len-1]=='.') - pattern[len-1]=0; + pattern[len-1] = 0; pattern_wildcard = strchr(pattern, '*'); if(pattern_wildcard == NULL) @@ -137,7 +137,7 @@ int Curl_cert_hostcheck(const char *match_pattern, const char *hostname) hostp = strdup(hostname); if(hostp) { if(hostmatch(hostp, matchp) == CURL_HOST_MATCH) - res= 1; + res = 1; free(hostp); } free(matchp); diff --git a/lib/hostip6.c b/lib/hostip6.c index 4ebfc2dcf..edeebec9e 100644 --- a/lib/hostip6.c +++ b/lib/hostip6.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -212,7 +212,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, if(port) { snprintf(sbuf, sizeof(sbuf), "%d", port); - sbufptr=sbuf; + sbufptr = sbuf; } error = Curl_getaddrinfo_ex(hostname, sbufptr, &hints, &res); diff --git a/lib/http.c b/lib/http.c index e7f6872d5..025cb2da1 100644 --- a/lib/http.c +++ b/lib/http.c @@ -190,7 +190,7 @@ char *Curl_checkProxyheaders(const struct connectdata *conn, for(head = (conn->bits.proxy && data->set.sep_headers) ? data->set.proxyheaders : data->set.headers; - head; head=head->next) { + head; head = head->next) { if(strncasecompare(head->data, thisheader, thislen)) return head->data; } @@ -592,7 +592,7 @@ output_auth_headers(struct connectdata *conn, #endif #if defined(USE_NTLM) && defined(NTLM_WB_ENABLED) if(authstatus->picked == CURLAUTH_NTLM_WB) { - auth="NTLM_WB"; + auth = "NTLM_WB"; result = Curl_output_ntlm_wb(conn, proxy); if(result) return result; @@ -1004,7 +1004,7 @@ static size_t readmoredata(char *buffer, http->sending++; /* move one step up */ - http->backup.postsize=0; + http->backup.postsize = 0; } else http->postsize = 0; @@ -1321,7 +1321,7 @@ Curl_compareheader(const char *headerline, /* line to check */ clen = strlen(content); /* length of the word to find */ /* find the content string in the rest of the line */ - for(;len>=clen;len--, start++) { + for(;len >= clen;len--, start++) { if(strncasecompare(start, content, clen)) return TRUE; /* match! */ } @@ -1562,7 +1562,7 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn, char *ptr; struct curl_slist *h[2]; struct curl_slist *headers; - int numlists=1; /* by default */ + int numlists = 1; /* by default */ struct Curl_easy *data = conn->data; int i; @@ -1594,7 +1594,7 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn, } /* loop through one or two lists */ - for(i=0; i < numlists; i++) { + for(i = 0; i < numlists; i++) { headers = h[i]; while(headers) { @@ -1859,7 +1859,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) here. */ if(Curl_checkheaders(conn, "User-Agent:")) { free(conn->allocptr.uagent); - conn->allocptr.uagent=NULL; + conn->allocptr.uagent = NULL; } /* setup the authentication headers */ @@ -2184,7 +2184,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) } if(seekerr != CURL_SEEKFUNC_OK) { - curl_off_t passed=0; + curl_off_t passed = 0; if(seekerr != CURL_SEEKFUNC_CANTSEEK) { failf(data, "Could not seek stream"); @@ -2255,7 +2255,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) } else if(data->state.resume_from) { /* This is because "resume" was selected */ - curl_off_t total_expected_size= + curl_off_t total_expected_size = data->state.resume_from + data->state.infilesize; conn->allocptr.rangeline = aprintf("Content-Range: bytes %s%" CURL_FORMAT_CURL_OFF_T @@ -2365,8 +2365,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) #if !defined(CURL_DISABLE_COOKIES) if(data->cookies || addcookies) { - struct Cookie *co=NULL; /* no cookies from start */ - int count=0; + struct Cookie *co = NULL; /* no cookies from start */ + int count = 0; if(data->cookies) { Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); @@ -2379,7 +2379,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); } if(co) { - struct Cookie *store=co; + struct Cookie *store = co; /* now loop through all cookies that matched */ while(co) { if(co->value) { @@ -2881,14 +2881,14 @@ static CURLcode header_append(struct Curl_easy *data, return CURLE_OUT_OF_MEMORY; } - newsize=CURLMAX((k->hbuflen+ length)*3/2, data->state.headersize*2); + newsize = CURLMAX((k->hbuflen+ length)*3/2, data->state.headersize*2); hbufp_index = k->hbufp - data->state.headerbuff; newbuff = realloc(data->state.headerbuff, newsize); if(!newbuff) { failf(data, "Failed to alloc memory for big header!"); return CURLE_OUT_OF_MEMORY; } - data->state.headersize=newsize; + data->state.headersize = newsize; data->state.headerbuff = newbuff; k->hbufp = data->state.headerbuff + hbufp_index; } @@ -3349,7 +3349,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data, separator = ' '; } - if((nc==4) && (' ' == separator)) { + if((nc == 4) && (' ' == separator)) { conn->httpversion += 10 * httpversion_major; if(k->upgr101 == UPGR101_RECEIVED) { @@ -3362,7 +3362,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data, /* this is the real world, not a Nirvana NCSA 1.5.x returns this crap when asked for HTTP/1.1 */ - nc=sscanf(HEADER1, " HTTP %3d", &k->httpcode); + nc = sscanf(HEADER1, " HTTP %3d", &k->httpcode); conn->httpversion = 10; /* If user has set option HTTP200ALIASES, @@ -3387,7 +3387,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data, &rtspversion_major, &conn->rtspversion, &k->httpcode); - if(nc==3) { + if(nc == 3) { conn->rtspversion += 10 * rtspversion_major; conn->httpversion = 11; /* For us, RTSP acts like HTTP 1.1 */ } @@ -3419,7 +3419,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data, ((k->httpcode != 407) || !conn->bits.proxy_user_passwd) ) { if(data->state.resume_from && - (data->set.httpreq==HTTPREQ_GET) && + (data->set.httpreq == HTTPREQ_GET) && (k->httpcode == 416)) { /* "Requested Range Not Satisfiable", just proceed and pretend this is no error */ @@ -3475,8 +3475,8 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data, * fields. */ if(data->set.timecondition) data->info.timecond = TRUE; - k->size=0; - k->maxdownload=0; + k->size = 0; + k->maxdownload = 0; k->ignorecl = TRUE; /* ignore Content-Length headers */ break; default: @@ -3724,7 +3724,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data, #endif else if(checkprefix("Last-Modified:", k->p) && (data->set.timecondition || data->set.get_filetime) ) { - time_t secs=time(NULL); + time_t secs = time(NULL); k->timeofdoc = curl_getdate(k->p+strlen("Last-Modified:"), &secs); if(data->set.get_filetime) diff --git a/lib/http2.c b/lib/http2.c index d466ccaa0..e4d66eb31 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -384,7 +384,7 @@ char *curl_pushheader_byname(struct curl_pushheaders *h, const char *header) struct HTTP *stream = h->data->req.protop; size_t len = strlen(header); size_t i; - for(i=0; i<stream->push_headers_used; i++) { + for(i = 0; i<stream->push_headers_used; i++) { if(!strncmp(header, stream->push_headers[i], len)) { /* sub-match, make sure that it is followed by a colon */ if(stream->push_headers[i][len] != ':') @@ -464,7 +464,7 @@ static int push_promise(struct Curl_easy *data, data->multi->push_userp); /* free the headers again */ - for(i=0; i<stream->push_headers_used; i++) + for(i = 0; i<stream->push_headers_used; i++) free(stream->push_headers[i]); free(stream->push_headers); stream->push_headers = NULL; diff --git a/lib/http_chunks.c b/lib/http_chunks.c index fce00c21e..92d773112 100644 --- a/lib/http_chunks.c +++ b/lib/http_chunks.c @@ -86,8 +86,8 @@ static bool Curl_isxdigit(char digit) void Curl_httpchunk_init(struct connectdata *conn) { struct Curl_chunker *chunk = &conn->chunk; - chunk->hexindex=0; /* start at 0 */ - chunk->dataleft=0; /* no data left yet! */ + chunk->hexindex = 0; /* start at 0 */ + chunk->dataleft = 0; /* no data left yet! */ chunk->state = CHUNK_HEX; /* we get hex first! */ } @@ -107,7 +107,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, ssize_t datalen, ssize_t *wrotep) { - CURLcode result=CURLE_OK; + CURLcode result = CURLE_OK; struct Curl_easy *data = conn->data; struct Curl_chunker *ch = &conn->chunk; struct SingleRequest *k = &data->req; @@ -147,7 +147,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, return CHUNKE_ILLEGAL_HEX; /* length and datap are unmodified */ - ch->hexbuffer[ch->hexindex]=0; + ch->hexbuffer[ch->hexindex] = 0; /* convert to host encoding before calling strtoul */ result = Curl_convert_from_network(conn->data, ch->hexbuffer, @@ -170,7 +170,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, /* we're now expecting data to come, unless size was zero! */ if(0 == ch->datasize) { ch->state = CHUNK_TRAILER; /* now check for trailers */ - conn->trlPos=0; + conn->trlPos = 0; } else ch->state = CHUNK_DATA; @@ -257,9 +257,9 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, if(conn->trlPos) { /* we allocate trailer with 3 bytes extra room to fit this */ - conn->trailer[conn->trlPos++]=0x0d; - conn->trailer[conn->trlPos++]=0x0a; - conn->trailer[conn->trlPos]=0; + conn->trailer[conn->trlPos++] = 0x0d; + conn->trailer[conn->trlPos++] = 0x0a; + conn->trailer[conn->trlPos] = 0; /* Convert to host encoding before calling Curl_client_write */ result = Curl_convert_from_network(conn->data, conn->trailer, @@ -275,7 +275,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, if(result) return CHUNKE_WRITE_ERROR; } - conn->trlPos=0; + conn->trlPos = 0; ch->state = CHUNK_TRAILER_CR; if(*datap == 0x0a) /* already on the LF */ @@ -299,7 +299,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, ptr = realloc(conn->trailer, conn->trlMax + 3); } else { - conn->trlMax=128; + conn->trlMax = 128; ptr = malloc(conn->trlMax + 3); } if(!ptr) diff --git a/lib/http_proxy.c b/lib/http_proxy.c index 77532e38d..dff9d230a 100644 --- a/lib/http_proxy.c +++ b/lib/http_proxy.c @@ -163,10 +163,10 @@ static CURLcode connect_init(struct connectdata *conn, bool reinit) s = conn->connect_state; } s->tunnel_state = TUNNEL_INIT; - s->keepon=TRUE; + s->keepon = TRUE; s->line_start = s->connect_buffer; s->ptr = s->line_start; - s->cl=0; + s->cl = 0; return CURLE_OK; } @@ -182,8 +182,8 @@ static CURLcode CONNECT(struct connectdata *conn, const char *hostname, int remote_port) { - int subversion=0; - struct Curl_easy *data=conn->data; + int subversion = 0; + struct Curl_easy *data = conn->data; struct SingleRequest *k = &data->req; CURLcode result; curl_socket_t tunnelsocket = conn->sock[sockindex]; @@ -234,8 +234,8 @@ static CURLcode CONNECT(struct connectdata *conn, if(!result) { char *host = NULL; - const char *proxyconn=""; - const char *useragent=""; + const char *proxyconn = ""; + const char *useragent = ""; const char *http = (conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0) ? "1.0" : "1.1"; bool ipv6_ip = conn->bits.ipv6_ip; @@ -244,7 +244,7 @@ static CURLcode CONNECT(struct connectdata *conn, /* the hostname may be different */ if(hostname != conn->host.name) ipv6_ip = (strchr(hostname, ':') != NULL); - hostheader= /* host:port with IPv6 support */ + hostheader = /* host:port with IPv6 support */ aprintf("%s%s%s:%hu", ipv6_ip?"[":"", hostname, ipv6_ip?"]":"", remote_port); if(!hostheader) { diff --git a/lib/if2ip.c b/lib/if2ip.c index a91b6d2ab..2568d84ff 100644 --- a/lib/if2ip.c +++ b/lib/if2ip.c @@ -103,7 +103,7 @@ bool Curl_if_is_interface_name(const char *interf) struct ifaddrs *iface, *head; if(getifaddrs(&head) >= 0) { - for(iface=head; iface != NULL; iface=iface->ifa_next) { + for(iface = head; iface != NULL; iface = iface->ifa_next) { if(strcasecompare(iface->ifa_name, interf)) { result = TRUE; break; @@ -131,7 +131,7 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope, #endif if(getifaddrs(&head) >= 0) { - for(iface = head; iface != NULL; iface=iface->ifa_next) { + for(iface = head; iface != NULL; iface = iface->ifa_next) { if(iface->ifa_addr != NULL) { if(iface->ifa_addr->sa_family == af) { if(strcasecompare(iface->ifa_name, interf)) { diff --git a/lib/ldap.c b/lib/ldap.c index 435b990ab..040641cf8 100644 --- a/lib/ldap.c +++ b/lib/ldap.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -267,7 +267,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done) LDAPMessage *ldapmsg = NULL; LDAPMessage *entryIterator; int num = 0; - struct Curl_easy *data=conn->data; + struct Curl_easy *data = conn->data; int ldap_proto = LDAP_VERSION3; int ldap_ssl = 0; char *val_b64 = NULL; diff --git a/lib/memdebug.c b/lib/memdebug.c index 8c9fe9502..b93b8c0c0 100644 --- a/lib/memdebug.c +++ b/lib/memdebug.c @@ -225,9 +225,9 @@ char *curl_dostrdup(const char *str, int line, const char *source) if(countcheck("strdup", line, source)) return NULL; - len=strlen(str)+1; + len = strlen(str)+1; - mem=curl_domalloc(len, 0, NULL); /* NULL prevents logging */ + mem = curl_domalloc(len, 0, NULL); /* NULL prevents logging */ if(mem) memcpy(mem, str, len); @@ -269,7 +269,7 @@ wchar_t *curl_dowcsdup(const wchar_t *str, int line, const char *source) void *curl_dorealloc(void *ptr, size_t wantedsize, int line, const char *source) { - struct memdebug *mem=NULL; + struct memdebug *mem = NULL; size_t size = sizeof(struct memdebug)+wantedsize; @@ -407,7 +407,7 @@ void curl_mark_sclose(curl_socket_t sockfd, int line, const char *source) /* this is our own defined way to close sockets on *ALL* platforms */ int curl_sclose(curl_socket_t sockfd, int line, const char *source) { - int res=sclose(sockfd); + int res = sclose(sockfd); curl_mark_sclose(sockfd, line, source); return res; } @@ -415,7 +415,7 @@ int curl_sclose(curl_socket_t sockfd, int line, const char *source) FILE *curl_fopen(const char *file, const char *mode, int line, const char *source) { - FILE *res=fopen(file, mode); + FILE *res = fopen(file, mode); if(source) curl_memlog("FILE %s:%d fopen(\"%s\",\"%s\") = %p\n", @@ -428,7 +428,7 @@ FILE *curl_fopen(const char *file, const char *mode, FILE *curl_fdopen(int filedes, const char *mode, int line, const char *source) { - FILE *res=fdopen(filedes, mode); + FILE *res = fdopen(filedes, mode); if(source) curl_memlog("FILE %s:%d fdopen(\"%d\",\"%s\") = %p\n", @@ -444,7 +444,7 @@ int curl_fclose(FILE *file, int line, const char *source) DEBUGASSERT(file != NULL); - res=fclose(file); + res = fclose(file); if(source) curl_memlog("FILE %s:%d fclose(%p)\n", diff --git a/lib/mime.c b/lib/mime.c index 74b653649..de8bae585 100644 --- a/lib/mime.c +++ b/lib/mime.c @@ -247,8 +247,8 @@ static char *Curl_basename(char *path) char *s1; char *s2; - s1=strrchr(path, '/'); - s2=strrchr(path, '\\'); + s1 = strrchr(path, '/'); + s2 = strrchr(path, '\\'); if(s1 && s2) { path = (s1 > s2? s1 : s2)+1; diff --git a/lib/mprintf.c b/lib/mprintf.c index 9920a0d3c..1e5f807b0 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -177,7 +177,7 @@ struct asprintf { static long dprintf_DollarString(char *input, char **end) { - int number=0; + int number = 0; while(ISDIGIT(*input)) { number *= 10; number += *input-'0'; @@ -233,7 +233,7 @@ static int dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos, long width; long precision; int flags; - long max_param=0; + long max_param = 0; long i; while(*fmt) { @@ -376,7 +376,7 @@ static int dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos, else width = param_num; if(width > max_param) - max_param=width; + max_param = width; break; default: break; @@ -482,7 +482,7 @@ static int dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos, } /* Read the arg list parameters into our data list */ - for(i=0; i<max_param; i++) { + for(i = 0; i<max_param; i++) { /* Width/precision arguments must be read before the main argument they are attached to */ if(vto[i].flags & FLAGS_WIDTHPARAM) { @@ -569,7 +569,7 @@ static int dprintf_formatf( int done = 0; long param; /* current parameter to read */ - long param_num=0; /* parameter counter */ + long param_num = 0; /* parameter counter */ va_stack_t vto[MAX_PARAMETERS]; char *endpos[MAX_PARAMETERS]; @@ -639,7 +639,7 @@ static int dprintf_formatf( /* If this is a positional parameter, the position must follow immediately after the %, thus create a %<num>$ sequence */ - param=dprintf_DollarString(f, &f); + param = dprintf_DollarString(f, &f); if(!param) param = param_num; @@ -948,7 +948,7 @@ static int dprintf_formatf( output characters */ (sprintf)(work, formatbuf, p->data.dnum); DEBUGASSERT(strlen(work) <= sizeof(work)); - for(fptr=work; *fptr; fptr++) + for(fptr = work; *fptr; fptr++) OUTCHAR(*fptr); } break; @@ -980,7 +980,7 @@ static int dprintf_formatf( /* fputc() look-alike */ static int addbyter(int output, FILE *data) { - struct nsprintf *infop=(struct nsprintf *)data; + struct nsprintf *infop = (struct nsprintf *)data; unsigned char outc = (unsigned char)output; if(infop->length < infop->max) { @@ -1028,7 +1028,7 @@ int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...) /* fputc() look-alike */ static int alloc_addbyter(int output, FILE *data) { - struct asprintf *infop=(struct asprintf *)data; + struct asprintf *infop = (struct asprintf *)data; unsigned char outc = (unsigned char)output; if(!infop->buffer) { @@ -1038,7 +1038,7 @@ static int alloc_addbyter(int output, FILE *data) return -1; /* fail */ } infop->alloc = 32; - infop->len =0; + infop->len = 0; } else if(infop->len+1 >= infop->alloc) { char *newptr = NULL; @@ -1129,7 +1129,7 @@ int curl_msprintf(char *buffer, const char *format, ...) va_start(ap_save, format); retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save); va_end(ap_save); - *buffer=0; /* we terminate this with a zero byte */ + *buffer = 0; /* we terminate this with a zero byte */ return retcode; } @@ -1158,7 +1158,7 @@ int curl_mvsprintf(char *buffer, const char *format, va_list ap_save) { int retcode; retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save); - *buffer=0; /* we terminate this with a zero byte */ + *buffer = 0; /* we terminate this with a zero byte */ return retcode; } diff --git a/lib/multi.c b/lib/multi.c index d5bc532ea..dc58acc68 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -592,7 +592,7 @@ static CURLcode multi_done(struct connectdata **connp, /* if the transfer was completed in a paused state there can be buffered data left to free */ - for(i=0; i < data->state.tempcount; i++) { + for(i = 0; i < data->state.tempcount; i++) { free(data->state.tempwrite[i].buf); } data->state.tempcount = 0; @@ -802,8 +802,8 @@ static int waitconnect_getsock(struct connectdata *conn, int numsocks) { int i; - int s=0; - int rc=0; + int s = 0; + int rc = 0; if(!numsocks) return GETSOCK_BLANK; @@ -813,7 +813,7 @@ static int waitconnect_getsock(struct connectdata *conn, return Curl_ssl_getsock(conn, sock, numsocks); #endif - for(i=0; i<2; i++) { + for(i = 0; i<2; i++) { if(conn->tempsock[i] != CURL_SOCKET_BAD) { sock[s] = conn->tempsock[i]; rc |= GETSOCK_WRITESOCK(s++); @@ -924,7 +924,7 @@ CURLMcode curl_multi_fdset(struct Curl_multi *multi, Some easy handles may not have connected to the remote host yet, and then we must make sure that is done. */ struct Curl_easy *data; - int this_max_fd=-1; + int this_max_fd = -1; curl_socket_t sockbunch[MAX_SOCKSPEREASYHANDLE]; int bitmap; int i; @@ -933,11 +933,11 @@ CURLMcode curl_multi_fdset(struct Curl_multi *multi, if(!GOOD_MULTI_HANDLE(multi)) return CURLM_BAD_HANDLE; - data=multi->easyp; + data = multi->easyp; while(data) { bitmap = multi_getsock(data, sockbunch, MAX_SOCKSPEREASYHANDLE); - for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) { + for(i = 0; i< MAX_SOCKSPEREASYHANDLE; i++) { curl_socket_t s = CURL_SOCKET_BAD; if((bitmap & GETSOCK_READSOCK(i)) && VALID_SOCK((sockbunch[i]))) { @@ -994,11 +994,11 @@ CURLMcode curl_multi_wait(struct Curl_multi *multi, timeout_ms = (int)timeout_internal; /* Count up how many fds we have from the multi handle */ - data=multi->easyp; + data = multi->easyp; while(data) { bitmap = multi_getsock(data, sockbunch, MAX_SOCKSPEREASYHANDLE); - for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) { + for(i = 0; i< MAX_SOCKSPEREASYHANDLE; i++) { curl_socket_t s = CURL_SOCKET_BAD; if(bitmap & GETSOCK_READSOCK(i)) { @@ -1041,11 +1041,11 @@ CURLMcode curl_multi_wait(struct Curl_multi *multi, if(curlfds) { /* Add the curl handles to our pollfds first */ - data=multi->easyp; + data = multi->easyp; while(data) { bitmap = multi_getsock(data, sockbunch, MAX_SOCKSPEREASYHANDLE); - for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) { + for(i = 0; i< MAX_SOCKSPEREASYHANDLE; i++) { curl_socket_t s = CURL_SOCKET_BAD; if(bitmap & GETSOCK_READSOCK(i)) { @@ -1229,7 +1229,7 @@ static CURLcode multi_reconnect_request(struct connectdata **connp) */ static void do_complete(struct connectdata *conn) { - conn->data->req.chunk=FALSE; + conn->data->req.chunk = FALSE; conn->data->req.maxfd = (conn->sockfd>conn->writesockfd? conn->sockfd:conn->writesockfd)+1; Curl_pgrsTime(conn->data, TIMER_PRETRANSFER); @@ -1237,7 +1237,7 @@ static void do_complete(struct connectdata *conn) static CURLcode multi_do(struct connectdata **connp, bool *done) { - CURLcode result=CURLE_OK; + CURLcode result = CURLE_OK; struct connectdata *conn = *connp; struct Curl_easy *data = conn->data; @@ -1286,7 +1286,7 @@ static CURLcode multi_do(struct connectdata **connp, bool *done) static CURLcode multi_do_more(struct connectdata *conn, int *complete) { - CURLcode result=CURLE_OK; + CURLcode result = CURLE_OK; *complete = 0; @@ -1415,7 +1415,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, switch(data->mstate) { case CURLM_STATE_INIT: /* init this transfer. */ - result=Curl_pretransfer(data); + result = Curl_pretransfer(data); if(!result) { /* after init, go CONNECT */ @@ -1697,7 +1697,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, * back to the CONNECT phase so we can try again. */ char *newurl = NULL; - followtype follow=FOLLOW_NONE; + followtype follow = FOLLOW_NONE; CURLcode drc; bool retry = FALSE; @@ -1783,7 +1783,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, if(control) { /* if positive, advance to DO_DONE if negative, go back to DOING */ - multistate(data, control==1? + multistate(data, control == 1? CURLM_STATE_DO_DONE: CURLM_STATE_DOING); rc = CURLM_CALL_MULTI_PERFORM; @@ -1938,7 +1938,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, multi_done(&data->easy_conn, result, TRUE); } else if(done) { - followtype follow=FOLLOW_NONE; + followtype follow = FOLLOW_NONE; /* call this even if the readwrite function returned error */ Curl_posttransfer(data); @@ -2144,14 +2144,14 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, CURLMcode curl_multi_perform(struct Curl_multi *multi, int *running_handles) { struct Curl_easy *data; - CURLMcode returncode=CURLM_OK; + CURLMcode returncode = CURLM_OK; struct Curl_tree *t; struct curltime now = Curl_tvnow(); if(!GOOD_MULTI_HANDLE(multi)) return CURLM_BAD_HANDLE; - data=multi->easyp; + data = multi->easyp; while(data) { CURLMcode result; SIGPIPE_VARIABLE(pipe_st); @@ -2246,7 +2246,7 @@ CURLMcode curl_multi_cleanup(struct Curl_multi *multi) /* remove all easy handles */ data = multi->easyp; while(data) { - nextdata=data->next; + nextdata = data->next; if(data->dns.hostcachetype == HCACHE_MULTI) { /* clear out the usage of the shared DNS cache */ Curl_hostcache_clean(data, data->dns.hostcache); @@ -2326,7 +2326,7 @@ static void singlesocket(struct Curl_multi *multi, int num; unsigned int curraction; - for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) + for(i = 0; i< MAX_SOCKSPEREASYHANDLE; i++) socks[i] = CURL_SOCKET_BAD; /* Fill in the 'current' struct with the state as it is now: what sockets to @@ -2338,7 +2338,7 @@ static void singlesocket(struct Curl_multi *multi, longer supervised ones and add new ones */ /* walk over the sockets we got right now */ - for(i=0; (i< MAX_SOCKSPEREASYHANDLE) && + for(i = 0; (i< MAX_SOCKSPEREASYHANDLE) && (curraction & (GETSOCK_READSOCK(i) | GETSOCK_WRITESOCK(i))); i++) { int action = CURL_POLL_NONE; @@ -2382,10 +2382,10 @@ static void singlesocket(struct Curl_multi *multi, /* when we've walked over all the sockets we should have right now, we must make sure to detect sockets that are removed */ - for(i=0; i< data->numsocks; i++) { + for(i = 0; i< data->numsocks; i++) { int j; s = data->sockets[i]; - for(j=0; j<num; j++) { + for(j = 0; j<num; j++) { if(s == socks[j]) { /* this is still supervised */ s = CURL_SOCKET_BAD; @@ -2558,7 +2558,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi, /* walk through each easy handle and do the socket state change magic and callbacks */ if(result != CURLM_BAD_HANDLE) { - data=multi->easyp; + data = multi->easyp; while(data) { singlesocket(multi, data); data = data->next; @@ -2795,7 +2795,7 @@ static CURLMcode multi_timeout(struct Curl_multi *multi, * processors while the diff is still present but less than one * millisecond! instead we return 1 until the time is ripe. */ - *timeout_ms=1; + *timeout_ms = 1; } else /* 0 means immediately */ @@ -2831,7 +2831,7 @@ static int update_timer(struct Curl_multi *multi) return -1; } if(timeout_ms < 0) { - static const struct curltime none={0, 0}; + static const struct curltime none = {0, 0}; if(Curl_splaycomparekeys(none, multi->timer_lastcall)) { multi->timer_lastcall = none; /* there's no timeout now but there was one previously, tell the app to @@ -3115,13 +3115,13 @@ void Curl_multi_dump(struct Curl_multi *multi) int i; fprintf(stderr, "* Multi status: %d handles, %d alive\n", multi->num_easy, multi->num_alive); - for(data=multi->easyp; data; data = data->next) { + for(data = multi->easyp; data; data = data->next) { if(data->mstate < CURLM_STATE_COMPLETED) { /* only display handles that are not completed */ fprintf(stderr, "handle %p, state %s, %d sockets\n", (void *)data, statename[data->mstate], data->numsocks); - for(i=0; i < data->numsocks; i++) { + for(i = 0; i < data->numsocks; i++) { curl_socket_t s = data->sockets[i]; struct Curl_sh_entry *entry = sh_getentry(&multi->sockhash, s); diff --git a/lib/netrc.c b/lib/netrc.c index 6e4858b3f..dbcc59ac9 100644 --- a/lib/netrc.c +++ b/lib/netrc.c @@ -56,14 +56,15 @@ int Curl_parsenetrc(const char *host, char *netrcfile) { FILE *file; - int retcode=1; + int retcode = 1; int specific_login = (*loginp && **loginp != 0); bool netrc_alloc = FALSE; - enum host_lookup_state state=NOTHING; + enum host_lookup_state state = NOTHING; - char state_login=0; /* Found a login keyword */ - char state_password=0; /* Found a password keyword */ - int state_our_login=FALSE; /* With specific_login, found *our* login name */ + char state_login = 0; /* Found a login keyword */ + char state_password = 0; /* Found a password keyword */ + int state_our_login = FALSE; /* With specific_login, found *our* login + name */ #define NETRC DOT_CHAR "netrc" @@ -88,7 +89,7 @@ int Curl_parsenetrc(const char *host, } else { struct passwd *pw; - pw= getpwuid(geteuid()); + pw = getpwuid(geteuid()); if(pw) { home = pw->pw_dir; } @@ -113,19 +114,19 @@ int Curl_parsenetrc(const char *host, if(file) { char *tok; char *tok_buf; - bool done=FALSE; + bool done = FALSE; char netrcbuffer[256]; int netrcbuffsize = (int)sizeof(netrcbuffer); while(!done && fgets(netrcbuffer, netrcbuffsize, file)) { - tok=strtok_r(netrcbuffer, " \t\n", &tok_buf); + tok = strtok_r(netrcbuffer, " \t\n", &tok_buf); if(tok && *tok == '#') /* treat an initial hash as a comment line */ continue; while(!done && tok) { if((*loginp && **loginp) && (*passwordp && **passwordp)) { - done=TRUE; + done = TRUE; break; } @@ -136,22 +137,22 @@ int Curl_parsenetrc(const char *host, delimiter that starts the stuff entered for this machine, after this we need to search for 'login' and 'password'. */ - state=HOSTFOUND; + state = HOSTFOUND; } else if(strcasecompare("default", tok)) { - state=HOSTVALID; - retcode=0; /* we did find our host */ + state = HOSTVALID; + retcode = 0; /* we did find our host */ } break; case HOSTFOUND: if(strcasecompare(host, tok)) { /* and yes, this is our host! */ - state=HOSTVALID; - retcode=0; /* we did find our host */ + state = HOSTVALID; + retcode = 0; /* we did find our host */ } else /* not our host */ - state=NOTHING; + state = NOTHING; break; case HOSTVALID: /* we are now parsing sub-keywords concerning "our" host */ @@ -167,7 +168,7 @@ int Curl_parsenetrc(const char *host, goto out; } } - state_login=0; + state_login = 0; } else if(state_password) { if(state_our_login || !specific_login) { @@ -178,12 +179,12 @@ int Curl_parsenetrc(const char *host, goto out; } } - state_password=0; + state_password = 0; } else if(strcasecompare("login", tok)) - state_login=1; + state_login = 1; else if(strcasecompare("password", tok)) - state_password=1; + state_password = 1; else if(strcasecompare("machine", tok)) { /* ok, there's machine here go => */ state = HOSTFOUND; diff --git a/lib/openldap.c b/lib/openldap.c index 369309cf5..4f10dbb7d 100644 --- a/lib/openldap.c +++ b/lib/openldap.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2010, Howard Chu, <hyc@openldap.org> + * Copyright (C) 2010, 2017, Howard Chu, <hyc@openldap.org> * Copyright (C) 2011 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which @@ -152,7 +152,7 @@ static CURLcode ldap_setup_connection(struct connectdata *conn) { ldapconninfo *li; LDAPURLDesc *lud; - struct Curl_easy *data=conn->data; + struct Curl_easy *data = conn->data; int rc, proto; CURLcode status; @@ -354,7 +354,7 @@ static CURLcode ldap_do(struct connectdata *conn, bool *done) int rc = 0; LDAPURLDesc *ludp = NULL; int msgid; - struct Curl_easy *data=conn->data; + struct Curl_easy *data = conn->data; connkeep(conn, "OpenLDAP do"); @@ -519,7 +519,7 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf, else binary = 0; - for(i=0; bvals[i].bv_val != NULL; i++) { + for(i = 0; bvals[i].bv_val != NULL; i++) { int binval = 0; writeerr = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\t", 1); if(writeerr) { @@ -549,7 +549,7 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf, else { /* check for unprintable characters */ unsigned int j; - for(j=0; j<bvals[i].bv_len; j++) + for(j = 0; j<bvals[i].bv_len; j++) if(!ISPRINT(bvals[i].bv_val[j])) { binval = 1; break; diff --git a/lib/parsedate.c b/lib/parsedate.c index 609fd5363..a13e080ef 100644 --- a/lib/parsedate.c +++ b/lib/parsedate.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -205,14 +205,14 @@ static int checkday(const char *check, size_t len) { int i; const char * const *what; - bool found= FALSE; + bool found = FALSE; if(len > 3) what = &weekday[0]; else what = &Curl_wkday[0]; - for(i=0; i<7; i++) { + for(i = 0; i<7; i++) { if(strcasecompare(check, what[0])) { - found=TRUE; + found = TRUE; break; } what++; @@ -224,12 +224,12 @@ static int checkmonth(const char *check) { int i; const char * const *what; - bool found= FALSE; + bool found = FALSE; what = &Curl_month[0]; - for(i=0; i<12; i++) { + for(i = 0; i<12; i++) { if(strcasecompare(check, what[0])) { - found=TRUE; + found = TRUE; break; } what++; @@ -244,12 +244,12 @@ static int checktz(const char *check) { unsigned int i; const struct tzinfo *what; - bool found= FALSE; + bool found = FALSE; what = tz; - for(i=0; i< sizeof(tz)/sizeof(tz[0]); i++) { + for(i = 0; i< sizeof(tz)/sizeof(tz[0]); i++) { if(strcasecompare(check, what->name)) { - found=TRUE; + found = TRUE; break; } what++; @@ -331,21 +331,21 @@ static time_t my_timegm(struct my_tm *tm) static int parsedate(const char *date, time_t *output) { time_t t = 0; - int wdaynum=-1; /* day of the week number, 0-6 (mon-sun) */ - int monnum=-1; /* month of the year number, 0-11 */ - int mdaynum=-1; /* day of month, 1 - 31 */ - int hournum=-1; - int minnum=-1; - int secnum=-1; - int yearnum=-1; - int tzoff=-1; + int wdaynum = -1; /* day of the week number, 0-6 (mon-sun) */ + int monnum = -1; /* month of the year number, 0-11 */ + int mdaynum = -1; /* day of month, 1 - 31 */ + int hournum = -1; + int minnum = -1; + int secnum = -1; + int yearnum = -1; + int tzoff = -1; struct my_tm tm; enum assume dignext = DATE_MDAY; const char *indate = date; /* save the original pointer */ int part = 0; /* max 6 parts */ while(*date && (part < 6)) { - bool found=FALSE; + bool found = FALSE; skip(&date); @@ -386,7 +386,7 @@ static int parsedate(const char *date, time_t *output) /* a digit */ int val; char *end; - int len=0; + int len = 0; if((secnum == -1) && (3 == sscanf(date, "%02d:%02d:%02d%n", &hournum, &minnum, &secnum, &len))) { diff --git a/lib/pingpong.c b/lib/pingpong.c index 5ed79b718..c7ae8afed 100644 --- a/lib/pingpong.c +++ b/lib/pingpong.c @@ -47,10 +47,10 @@ time_t Curl_pp_state_timeout(struct pingpong *pp) { struct connectdata *conn = pp->conn; - struct Curl_easy *data=conn->data; + struct Curl_easy *data = conn->data; time_t timeout_ms; /* in milliseconds */ time_t timeout2_ms; /* in milliseconds */ - long response_time= (data->set.server_response_timeout)? + long response_time = (data->set.server_response_timeout)? data->set.server_response_timeout: pp->response_time; /* if CURLOPT_SERVER_RESPONSE_TIMEOUT is set, use that to determine @@ -85,10 +85,10 @@ CURLcode Curl_pp_statemach(struct pingpong *pp, bool block) int rc; time_t interval_ms; time_t timeout_ms = Curl_pp_state_timeout(pp); - struct Curl_easy *data=conn->data; + struct Curl_easy *data = conn->data; CURLcode result = CURLE_OK; - if(timeout_ms <=0) { + if(timeout_ms <= 0) { failf(data, "server response timeout"); return CURLE_OPERATION_TIMEDOUT; /* already too little time */ } @@ -270,7 +270,7 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd, size_t *size) /* size of the response */ { ssize_t perline; /* count bytes per line */ - bool keepon=TRUE; + bool keepon = TRUE; ssize_t gotbytes; char *ptr; struct connectdata *conn = pp->conn; @@ -281,7 +281,7 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd, *code = 0; /* 0 for errors or not done */ *size = 0; - ptr=buf + pp->nread_resp; + ptr = buf + pp->nread_resp; /* number of bytes in the current line, so far */ perline = (ssize_t)(ptr-pp->linestart_resp); @@ -351,7 +351,7 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd, pp->nread_resp += gotbytes; for(i = 0; i < gotbytes; ptr++, i++) { perline++; - if(*ptr=='\n') { + if(*ptr == '\n') { /* a newline is CRLF in pp-talk, so the CR is ignored as the line isn't really terminated until the LF comes */ @@ -378,8 +378,8 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd, start of the buffer and zero terminate, for old times sake */ size_t n = ptr - pp->linestart_resp; memmove(buf, pp->linestart_resp, n); - buf[n]=0; /* zero terminate */ - keepon=FALSE; + buf[n] = 0; /* zero terminate */ + keepon = FALSE; pp->linestart_resp = ptr+1; /* advance pointer */ i++; /* skip this before getting out */ @@ -387,7 +387,7 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd, pp->nread_resp = 0; /* restart */ break; } - perline=0; /* line starts over here */ + perline = 0; /* line starts over here */ pp->linestart_resp = ptr+1; } } @@ -490,7 +490,7 @@ CURLcode Curl_pp_flushsend(struct pingpong *pp) } else { free(pp->sendthis); - pp->sendthis=NULL; + pp->sendthis = NULL; pp->sendleft = pp->sendsize = 0; pp->response = Curl_tvnow(); } diff --git a/lib/progress.c b/lib/progress.c index 2f80704ae..00609d9ee 100644 --- a/lib/progress.c +++ b/lib/progress.c @@ -134,7 +134,7 @@ int Curl_pgrsDone(struct connectdata *conn) { int rc; struct Curl_easy *data = conn->data; - data->progress.lastshow=0; + data->progress.lastshow = 0; rc = Curl_pgrsUpdate(conn); /* the final (forced) update */ if(rc) return rc; @@ -352,9 +352,9 @@ int Curl_pgrsUpdate(struct connectdata *conn) struct curltime now; int result; char max5[6][10]; - curl_off_t dlpercen=0; - curl_off_t ulpercen=0; - curl_off_t total_percen=0; + curl_off_t dlpercen = 0; + curl_off_t ulpercen = 0; + curl_off_t total_percen = 0; curl_off_t total_transfer; curl_off_t total_expected_transfer; curl_off_t timespent; @@ -365,10 +365,10 @@ int Curl_pgrsUpdate(struct connectdata *conn) char time_left[10]; char time_total[10]; char time_spent[10]; - curl_off_t ulestimate=0; - curl_off_t dlestimate=0; + curl_off_t ulestimate = 0; + curl_off_t dlestimate = 0; curl_off_t total_estimate; - bool shownow=FALSE; + bool shownow = FALSE; now = Curl_tvnow(); /* what time is it */ @@ -408,7 +408,7 @@ int Curl_pgrsUpdate(struct connectdata *conn) array. With N_ENTRIES filled in, we have about N_ENTRIES-1 seconds of transfer. Imagine, after one second we have filled in two entries, after two seconds we've filled in three entries etc. */ - countindex = ((data->progress.speeder_c>=CURR_TIME)? + countindex = ((data->progress.speeder_c >= CURR_TIME)? CURR_TIME:data->progress.speeder_c) - 1; /* first of all, we don't do this if there's no counted seconds yet */ @@ -418,14 +418,14 @@ int Curl_pgrsUpdate(struct connectdata *conn) /* Get the index position to compare with the 'nowindex' position. Get the oldest entry possible. While we have less than CURR_TIME entries, the first entry will remain the oldest. */ - checkindex = (data->progress.speeder_c>=CURR_TIME)? + checkindex = (data->progress.speeder_c >= CURR_TIME)? data->progress.speeder_c%CURR_TIME:0; /* Figure out the exact time for the time span */ span_ms = Curl_tvdiff(now, data->progress.speeder_time[checkindex]); if(0 == span_ms) - span_ms=1; /* at least one millisecond MUST have passed */ + span_ms = 1; /* at least one millisecond MUST have passed */ /* Calculate the average speed the last 'span_ms' milliseconds */ { @@ -455,22 +455,22 @@ int Curl_pgrsUpdate(struct connectdata *conn) if(data->set.fxferinfo) { /* There's a callback set, call that */ - result= data->set.fxferinfo(data->set.progress_client, - data->progress.size_dl, - data->progress.downloaded, - data->progress.size_ul, - data->progress.uploaded); + result = data->set.fxferinfo(data->set.progress_client, + data->progress.size_dl, + data->progress.downloaded, + data->progress.size_ul, + data->progress.uploaded); if(result) failf(data, "Callback aborted"); return result; } if(data->set.fprogress) { /* The older deprecated callback is set, call that */ - result= data->set.fprogress(data->set.progress_client, - (double)data->progress.size_dl, - (double)data->progress.downloaded, - (double)data->progress.size_ul, - (double)data->progress.uploaded); + result = data->set.fprogress(data->set.progress_client, + (double)data->progress.size_dl, + (double)data->progress.downloaded, + (double)data->progress.size_ul, + (double)data->progress.uploaded); if(result) failf(data, "Callback aborted"); return result; diff --git a/lib/rtsp.c b/lib/rtsp.c index 4bca11459..99ec5f4dc 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -250,7 +250,7 @@ static CURLcode rtsp_done(struct connectdata *conn, static CURLcode rtsp_do(struct connectdata *conn, bool *done) { struct Curl_easy *data = conn->data; - CURLcode result=CURLE_OK; + CURLcode result = CURLE_OK; Curl_RtspReq rtspreq = data->set.rtspreq; struct RTSP *rtsp = data->req.protop; struct HTTP *http; diff --git a/lib/security.c b/lib/security.c index f4a876341..9b989681f 100644 --- a/lib/security.c +++ b/lib/security.c @@ -7,7 +7,7 @@ * rewrite to work around the paragraph 2 in the BSD licenses as explained * below. * - * Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1998, 1999, 2017 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * * Copyright (C) 2001 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. @@ -115,7 +115,7 @@ static char level_to_char(int level) static int ftp_send_command(struct connectdata *conn, const char *message, ...) { int ftp_code; - ssize_t nread=0; + ssize_t nread = 0; va_list args; char print_buffer[50]; diff --git a/lib/sendf.c b/lib/sendf.c index 595c36177..6bb85521f 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -279,7 +279,7 @@ CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn, if(!s) return CURLE_OUT_OF_MEMORY; /* failure */ - bytes_written=0; + bytes_written = 0; write_len = strlen(s); sptr = s; @@ -387,7 +387,7 @@ ssize_t Curl_send_plain(struct connectdata *conn, int num, #endif ) { /* this is just a case of EWOULDBLOCK */ - bytes_written=0; + bytes_written = 0; *code = CURLE_AGAIN; } else { @@ -480,7 +480,7 @@ static CURLcode pausewrite(struct Curl_easy *data, bool newtype = TRUE; if(s->tempcount) { - for(i=0; i< s->tempcount; i++) { + for(i = 0; i< s->tempcount; i++) { if(s->tempwrite[i].type == type) { /* data for this type exists */ newtype = FALSE; @@ -704,7 +704,7 @@ CURLcode Curl_read(struct connectdata *conn, /* connection data */ us use the correct ssl handle. */ int num = (sockfd == conn->sock[SECONDARYSOCKET]); - *n=0; /* reset amount to zero */ + *n = 0; /* reset amount to zero */ /* If session can pipeline, check connection buffer */ if(pipelining) { @@ -823,8 +823,8 @@ int Curl_debug(struct Curl_easy *data, curl_infotype type, int rc; if(data->set.printhost && conn && conn->host.dispname) { char buffer[160]; - const char *t=NULL; - const char *w="Data"; + const char *t = NULL; + const char *w = "Data"; switch(type) { case CURLINFO_HEADER_IN: w = "Header"; diff --git a/lib/socks.c b/lib/socks.c index 000cd9c2d..8b219329f 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -154,7 +154,7 @@ CURLcode Curl_SOCKS4(const char *proxy_user, /* DNS resolve only for SOCKS4, not SOCKS4a */ if(!protocol4a) { struct Curl_dns_entry *dns; - Curl_addrinfo *hp=NULL; + Curl_addrinfo *hp = NULL; int rc; rc = Curl_resolv(conn, hostname, remote_port, &dns); @@ -171,7 +171,7 @@ CURLcode Curl_SOCKS4(const char *proxy_user, * returns a Curl_addrinfo pointer that may not always look the same. */ if(dns) - hp=dns->addr; + hp = dns->addr; if(hp) { char buf[64]; Curl_printable_address(hp, buf, sizeof(buf)); @@ -483,7 +483,7 @@ CURLcode Curl_SOCKS5(const char *proxy_user, (void)curlx_nonblock(sock, FALSE); - result=Curl_blockread_all(conn, sock, (char *)socksreq, 2, &actualread); + result = Curl_blockread_all(conn, sock, (char *)socksreq, 2, &actualread); if(result || (actualread != 2)) { failf(data, "Unable to receive initial SOCKS5 response."); return CURLE_COULDNT_CONNECT; @@ -542,7 +542,7 @@ CURLcode Curl_SOCKS5(const char *proxy_user, return CURLE_COULDNT_CONNECT; } - result=Curl_blockread_all(conn, sock, (char *)socksreq, 2, &actualread); + result = Curl_blockread_all(conn, sock, (char *)socksreq, 2, &actualread); if(result || (actualread != 2)) { failf(data, "Unable to receive SOCKS5 sub-negotiation response."); return CURLE_COULDNT_CONNECT; @@ -615,7 +615,7 @@ CURLcode Curl_SOCKS5(const char *proxy_user, * returns a Curl_addrinfo pointer that may not always look the same. */ if(dns) - hp=dns->addr; + hp = dns->addr; if(hp) { int i; char buf[64]; diff --git a/lib/socks_gssapi.c b/lib/socks_gssapi.c index 54d063504..3a668304a 100644 --- a/lib/socks_gssapi.c +++ b/lib/socks_gssapi.c @@ -5,8 +5,8 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2009, 2011, Markus Moeller, <markus_moeller@compuserve.com> - * Copyright (C) 2012 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2009, Markus Moeller, <markus_moeller@compuserve.com> + * Copyright (C) 2012 - 2017, 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 @@ -119,7 +119,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, gss_name_t server = GSS_C_NO_NAME; gss_name_t gss_client_name = GSS_C_NO_NAME; unsigned short us_length; - char *user=NULL; + char *user = NULL; unsigned char socksreq[4]; /* room for GSS-API exchange header only */ const char *serviceptr = data->set.str[STRING_PROXY_SERVICE_NAME] ? data->set.str[STRING_PROXY_SERVICE_NAME] : "rcmd"; @@ -236,7 +236,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, * +----+------+-----+----------------+ */ - result=Curl_blockread_all(conn, sock, (char *)socksreq, 4, &actualread); + result = Curl_blockread_all(conn, sock, (char *)socksreq, 4, &actualread); if(result || (actualread != 4)) { failf(data, "Failed to receive GSS-API authentication response."); gss_release_name(&gss_status, &server); @@ -264,8 +264,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, memcpy(&us_length, socksreq+2, sizeof(short)); us_length = ntohs(us_length); - gss_recv_token.length=us_length; - gss_recv_token.value=malloc(us_length); + gss_recv_token.length = us_length; + gss_recv_token.value = malloc(us_length); if(!gss_recv_token.value) { failf(data, "Could not allocate memory for GSS-API authentication " @@ -275,8 +275,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, return CURLE_OUT_OF_MEMORY; } - result=Curl_blockread_all(conn, sock, (char *)gss_recv_token.value, - gss_recv_token.length, &actualread); + result = Curl_blockread_all(conn, sock, (char *)gss_recv_token.value, + gss_recv_token.length, &actualread); if(result || (actualread != us_length)) { failf(data, "Failed to receive GSS-API authentication token."); @@ -312,7 +312,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, failf(data, "Failed to determine user name."); return CURLE_COULDNT_CONNECT; } - user=malloc(gss_send_token.length+1); + user = malloc(gss_send_token.length+1); if(!user) { gss_delete_sec_context(&gss_status, &gss_context, NULL); gss_release_name(&gss_status, &gss_client_name); @@ -326,7 +326,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, gss_release_buffer(&gss_status, &gss_send_token); infof(data, "SOCKS5 server authencticated user %s with GSS-API.\n",user); free(user); - user=NULL; + user = NULL; /* Do encryption */ socksreq[0] = 1; /* GSS-API subnegotiation version */ @@ -341,7 +341,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, gss_enc = 1; infof(data, "SOCKS5 server supports GSS-API %s data protection.\n", - (gss_enc==0)?"no":((gss_enc==1)?"integrity":"confidentiality")); + (gss_enc == 0)?"no":((gss_enc==1)?"integrity":"confidentiality")); /* force for the moment to no data protection */ gss_enc = 0; /* @@ -433,7 +433,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, gss_release_buffer(&gss_status, &gss_w_token); } - result=Curl_blockread_all(conn, sock, (char *)socksreq, 4, &actualread); + result = Curl_blockread_all(conn, sock, (char *)socksreq, 4, &actualread); if(result || (actualread != 4)) { failf(data, "Failed to receive GSS-API encryption response."); gss_delete_sec_context(&gss_status, &gss_context, NULL); @@ -458,14 +458,14 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, memcpy(&us_length, socksreq+2, sizeof(short)); us_length = ntohs(us_length); - gss_recv_token.length= us_length; - gss_recv_token.value=malloc(gss_recv_token.length); + gss_recv_token.length = us_length; + gss_recv_token.value = malloc(gss_recv_token.length); if(!gss_recv_token.value) { gss_delete_sec_context(&gss_status, &gss_context, NULL); return CURLE_OUT_OF_MEMORY; } - result=Curl_blockread_all(conn, sock, (char *)gss_recv_token.value, - gss_recv_token.length, &actualread); + result = Curl_blockread_all(conn, sock, (char *)gss_recv_token.value, + gss_recv_token.length, &actualread); if(result || (actualread != us_length)) { failf(data, "Failed to receive GSS-API encryptrion type."); @@ -513,8 +513,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, } infof(data, "SOCKS5 access with%s protection granted.\n", - (socksreq[0]==0)?"out GSS-API data": - ((socksreq[0]==1)?" GSS-API integrity":" GSS-API confidentiality")); + (socksreq[0] == 0)?"out GSS-API data": + ((socksreq[0] == 1)?" GSS-API integrity":" GSS-API confidentiality")); conn->socks5_gssapi_enctype = socksreq[0]; if(socksreq[0] == 0) diff --git a/lib/socks_sspi.c b/lib/socks_sspi.c index edc73ad2e..a8b4aa8c8 100644 --- a/lib/socks_sspi.c +++ b/lib/socks_sspi.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2012 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2012 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 2009, 2011, Markus Moeller, <markus_moeller@compuserve.com> * * This software is licensed as described in the file COPYING, which @@ -341,7 +341,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, gss_enc = 1; infof(data, "SOCKS5 server supports GSS-API %s data protection.\n", - (gss_enc==0)?"no":((gss_enc==1)?"integrity":"confidentiality") ); + (gss_enc == 0)?"no":((gss_enc == 1)?"integrity":"confidentiality") ); /* force to no data protection, avoid encryption/decryption for now */ gss_enc = 0; /* @@ -588,8 +588,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, } infof(data, "SOCKS5 access with%s protection granted.\n", - (socksreq[0]==0)?"out GSS-API data": - ((socksreq[0]==1)?" GSS-API integrity":" GSS-API confidentiality")); + (socksreq[0] == 0)?"out GSS-API data": + ((socksreq[0] == 1)?" GSS-API integrity":" GSS-API confidentiality")); /* For later use if encryption is required conn->socks5_gssapi_enctype = socksreq[0]; diff --git a/lib/splay.c b/lib/splay.c index 68ff9c5db..69af446eb 100644 --- a/lib/splay.c +++ b/lib/splay.c @@ -110,7 +110,7 @@ struct Curl_tree *Curl_splayinsert(struct curltime i, if(t != NULL) { t = Curl_splay(i, t); - if(compare(i, t->key)==0) { + if(compare(i, t->key) == 0) { /* There already exists a node in the tree with the very same key. Build a doubly-linked circular list of nodes. We add the new 'node' struct to the end of this list. */ @@ -1813,7 +1813,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) zero even though libssh2_sftp_open() failed previously! We need to work around that! */ sshc->actualcode = CURLE_SSH; - err=-1; + err = -1; } failf(data, "Upload failed: %s (%d/%d)", err>= LIBSSH2_FX_OK?sftp_libssh2_strerror(err):"ssh error", @@ -1831,7 +1831,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) } if(seekerr != CURL_SEEKFUNC_OK) { - curl_off_t passed=0; + curl_off_t passed = 0; if(seekerr != CURL_SEEKFUNC_CANTSEEK) { failf(data, "Could not seek stream"); @@ -2239,7 +2239,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) from_t = curlx_strtoofft(conn->data->state.range, &ptr, 0, &from); if(from_t == CURL_OFFT_FLOW) return CURLE_RANGE_ERROR; - while(*ptr && (ISSPACE(*ptr) || (*ptr=='-'))) + while(*ptr && (ISSPACE(*ptr) || (*ptr == '-'))) ptr++; to_t = curlx_strtoofft(ptr, &ptr2, 0, &to); if(to_t == CURL_OFFT_FLOW) @@ -3045,8 +3045,8 @@ static CURLcode ssh_do(struct connectdata *conn, bool *done) data->req.size = -1; /* make sure this is unknown at this point */ sshc->actualcode = CURLE_OK; /* reset error code */ - sshc->secondCreateDirs =0; /* reset the create dir attempt state - variable */ + sshc->secondCreateDirs = 0; /* reset the create dir attempt state + variable */ Curl_pgrsSetUploadCounter(data, 0); Curl_pgrsSetDownloadCounter(data, 0); diff --git a/lib/telnet.c b/lib/telnet.c index 3dec95907..500d47f99 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -296,7 +296,7 @@ static void negotiate(struct connectdata *conn) struct TELNET *tn = (struct TELNET *) conn->data->req.protop; for(i = 0;i < CURL_NTELOPTS;i++) { - if(i==CURL_TELOPT_ECHO) + if(i == CURL_TELOPT_ECHO) continue; if(tn->us_preferred[i] == CURL_YES) @@ -843,7 +843,7 @@ static CURLcode check_telnet_options(struct connectdata *conn) tn->us_preferred[CURL_TELOPT_NEW_ENVIRON] = CURL_YES; } - for(head = data->set.telnet_options; head; head=head->next) { + for(head = data->set.telnet_options; head; head = head->next) { if(sscanf(head->data, "%127[^= ]%*[ =]%255s", option_keyword, option_arg) == 2) { @@ -890,8 +890,8 @@ static CURLcode check_telnet_options(struct connectdata *conn) /* To take care or not of the 8th bit in data exchange */ if(strcasecompare(option_keyword, "BINARY")) { - binary_option=atoi(option_arg); - if(binary_option!=1) { + binary_option = atoi(option_arg); + if(binary_option != 1) { tn->us_preferred[CURL_TELOPT_BINARY] = CURL_NO; tn->him_preferred[CURL_TELOPT_BINARY] = CURL_NO; } @@ -1019,8 +1019,8 @@ static void sendsuboption(struct connectdata *conn, int option) CURL_SB_ACCUM(tn, CURL_TELOPT_NAWS); /* We must deal either with litte or big endian processors */ /* Window size must be sent according to the 'network order' */ - x=htons(tn->subopt_wsx); - y=htons(tn->subopt_wsy); + x = htons(tn->subopt_wsx); + y = htons(tn->subopt_wsy); uc1 = (unsigned char *)&x; uc2 = (unsigned char *)&y; CURL_SB_ACCUM(tn, uc1[0]); @@ -1064,7 +1064,7 @@ CURLcode telrcv(struct connectdata *conn, unsigned char c; CURLcode result; int in = 0; - int startwrite=-1; + int startwrite = -1; struct Curl_easy *data = conn->data; struct TELNET *tn = (struct TELNET *)data->req.protop; diff --git a/lib/tftp.c b/lib/tftp.c index 6477e64ed..6078d0141 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -76,12 +76,12 @@ #define TFTP_OPTION_INTERVAL "timeout" typedef enum { - TFTP_MODE_NETASCII=0, + TFTP_MODE_NETASCII = 0, TFTP_MODE_OCTET } tftp_mode_t; typedef enum { - TFTP_STATE_START=0, + TFTP_STATE_START = 0, TFTP_STATE_RX, TFTP_STATE_TX, TFTP_STATE_FIN @@ -100,7 +100,7 @@ typedef enum { } tftp_event_t; typedef enum { - TFTP_ERR_UNDEF=0, + TFTP_ERR_UNDEF = 0, TFTP_ERR_NOTFOUND, TFTP_ERR_PERM, TFTP_ERR_DISKFULL, @@ -232,7 +232,7 @@ static CURLcode tftp_set_timeouts(tftp_state_data_t *state) /* Compute the re-start interval to suit the timeout */ state->retry_time = (int)timeout/state->retry_max; if(state->retry_time<1) - state->retry_time=1; + state->retry_time = 1; } else { @@ -251,15 +251,15 @@ static CURLcode tftp_set_timeouts(tftp_state_data_t *state) } /* But bound the total number */ if(state->retry_max<3) - state->retry_max=3; + state->retry_max = 3; if(state->retry_max>50) - state->retry_max=50; + state->retry_max = 50; /* Compute the re-ACK interval to suit the timeout */ state->retry_time = (int)(timeout/state->retry_max); if(state->retry_time<1) - state->retry_time=1; + state->retry_time = 1; infof(state->conn->data, "set timeouts for state %d; Total %ld, retry %d maxtry %d\n", @@ -1113,7 +1113,7 @@ static CURLcode tftp_receive_packet(struct connectdata *conn) 0, (struct sockaddr *)&fromaddr, &fromlen); - if(state->remote_addrlen==0) { + if(state->remote_addrlen == 0) { memcpy(&state->remote_addr, &fromaddr, fromlen); state->remote_addrlen = fromlen; } diff --git a/lib/transfer.c b/lib/transfer.c index b36de2803..ad4622500 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -96,7 +96,7 @@ char *Curl_checkheaders(const struct connectdata *conn, size_t thislen = strlen(thisheader); struct Curl_easy *data = conn->data; - for(head = data->set.headers;head; head=head->next) { + for(head = data->set.headers; head; head = head->next) { if(strncasecompare(head->data, thisheader, thislen)) return head->data; } @@ -599,7 +599,7 @@ static CURLcode readwrite_data(struct Curl_easy *data, infof(data, "Ignoring the response-body\n"); } if(data->state.resume_from && !k->content_range && - (data->set.httpreq==HTTPREQ_GET) && + (data->set.httpreq == HTTPREQ_GET) && !k->ignorebody) { if(k->size == data->state.resume_from) { @@ -954,7 +954,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data, /* this is a paused transfer */ break; } - if(nread<=0) { + if(nread <= 0) { result = done_sending(conn, k); if(result) return result; @@ -1094,7 +1094,7 @@ CURLcode Curl_readwrite(struct connectdata *conn, { struct SingleRequest *k = &data->req; CURLcode result; - int didwhat=0; + int didwhat = 0; curl_socket_t fd_read; curl_socket_t fd_write; @@ -1342,7 +1342,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) if(result) return result; - data->set.followlocation=0; /* reset the location-follow counter */ + data->set.followlocation = 0; /* reset the location-follow counter */ data->state.this_is_a_follow = FALSE; /* reset this */ data->state.errorbuf = FALSE; /* no error has occurred */ data->state.httpversion = 0; /* don't assume any particular server version */ @@ -1466,14 +1466,14 @@ static const char *find_host_sep(const char *url) static size_t strlen_url(const char *url, bool relative) { const unsigned char *ptr; - size_t newlen=0; - bool left=TRUE; /* left side of the ? */ + size_t newlen = 0; + bool left = TRUE; /* left side of the ? */ const unsigned char *host_sep = (const unsigned char *) url; if(!relative) host_sep = (const unsigned char *) find_host_sep(url); - for(ptr=(unsigned char *)url; *ptr; ptr++) { + for(ptr = (unsigned char *)url; *ptr; ptr++) { if(ptr < host_sep) { ++newlen; @@ -1482,7 +1482,7 @@ static size_t strlen_url(const char *url, bool relative) switch(*ptr) { case '?': - left=FALSE; + left = FALSE; /* fall through */ default: if(*ptr >= 0x80) @@ -1491,7 +1491,7 @@ static size_t strlen_url(const char *url, bool relative) break; case ' ': if(left) - newlen+=3; + newlen += 3; else newlen++; break; @@ -1508,7 +1508,7 @@ static size_t strlen_url(const char *url, bool relative) static void strcpy_url(char *output, const char *url, bool relative) { /* we must add this with whitespace-replacing */ - bool left=TRUE; + bool left = TRUE; const unsigned char *iptr; char *optr = output; const unsigned char *host_sep = (const unsigned char *) url; @@ -1527,7 +1527,7 @@ static void strcpy_url(char *output, const char *url, bool relative) switch(*iptr) { case '?': - left=FALSE; + left = FALSE; /* fall through */ default: if(*iptr >= 0x80) { @@ -1548,7 +1548,7 @@ static void strcpy_url(char *output, const char *url, bool relative) break; } } - *optr=0; /* zero terminate output buffer */ + *optr = 0; /* zero terminate output buffer */ } @@ -1587,26 +1587,26 @@ static char *concat_url(const char *base, const char *relurl) /* we must make our own copy of the URL to play with, as it may point to read-only data */ - char *url_clone=strdup(base); + char *url_clone = strdup(base); if(!url_clone) return NULL; /* skip out of this NOW */ /* protsep points to the start of the host name */ - protsep=strstr(url_clone, "//"); + protsep = strstr(url_clone, "//"); if(!protsep) - protsep=url_clone; + protsep = url_clone; else - protsep+=2; /* pass the slashes */ + protsep += 2; /* pass the slashes */ if('/' != relurl[0]) { - int level=0; + int level = 0; /* First we need to find out if there's a ?-letter in the URL, and cut it and the right-side of that off */ pathsep = strchr(protsep, '?'); if(pathsep) - *pathsep=0; + *pathsep = 0; /* we have a relative path to append to the last slash if there's one available, or if the new URL is just a query string (starts with a @@ -1615,7 +1615,7 @@ static char *concat_url(const char *base, const char *relurl) if(useurl[0] != '?') { pathsep = strrchr(protsep, '/'); if(pathsep) - *pathsep=0; + *pathsep = 0; } /* Check if there's any slash after the host name, and if so, remember @@ -1630,13 +1630,13 @@ static char *concat_url(const char *base, const char *relurl) and act accordingly */ if((useurl[0] == '.') && (useurl[1] == '/')) - useurl+=2; /* just skip the "./" */ + useurl += 2; /* just skip the "./" */ while((useurl[0] == '.') && (useurl[1] == '.') && (useurl[2] == '/')) { level++; - useurl+=3; /* pass the "../" */ + useurl += 3; /* pass the "../" */ } if(protsep) { @@ -1644,9 +1644,9 @@ static char *concat_url(const char *base, const char *relurl) /* cut off one more level from the right of the original URL */ pathsep = strrchr(protsep, '/'); if(pathsep) - *pathsep=0; + *pathsep = 0; else { - *protsep=0; + *protsep = 0; break; } } @@ -1658,7 +1658,7 @@ static char *concat_url(const char *base, const char *relurl) if((relurl[0] == '/') && (relurl[1] == '/')) { /* the new URL starts with //, just keep the protocol part from the original one */ - *protsep=0; + *protsep = 0; useurl = &relurl[2]; /* we keep the slashes from the original, so we skip the new ones */ host_changed = TRUE; @@ -1674,7 +1674,7 @@ static char *concat_url(const char *base, const char *relurl) char *sep = strchr(protsep, '?'); if(sep && (sep < pathsep)) pathsep = sep; - *pathsep=0; + *pathsep = 0; } else { /* There was no slash. Now, since we might be operating on a badly @@ -1683,7 +1683,7 @@ static char *concat_url(const char *base, const char *relurl) ?-letter as well! */ pathsep = strchr(protsep, '?'); if(pathsep) - *pathsep=0; + *pathsep = 0; } } } @@ -285,7 +285,7 @@ void Curl_freeset(struct Curl_easy *data) { /* Free all dynamic strings stored in the data->set substructure. */ enum dupstring i; - for(i=(enum dupstring)0; i < STRING_LAST; i++) { + for(i = (enum dupstring)0; i < STRING_LAST; i++) { Curl_safefree(data->set.str[i]); } @@ -372,7 +372,7 @@ CURLcode Curl_dupset(struct Curl_easy *dst, struct Curl_easy *src) memset(dst->set.str, 0, STRING_LAST * sizeof(char *)); /* duplicate all strings */ - for(i=(enum dupstring)0; i< STRING_LASTZEROTERMINATED; i++) { + for(i = (enum dupstring)0; i< STRING_LASTZEROTERMINATED; i++) { result = setstropt(&dst->set.str[i], src->set.str[i]); if(result) return result; @@ -681,7 +681,7 @@ CURLcode Curl_open(struct Curl_easy **curl) else { result = Curl_init_userdefined(&data->set); - data->state.headersize=HEADERSIZE; + data->state.headersize = HEADERSIZE; Curl_convert_init(data); @@ -1677,28 +1677,28 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option, * The low speed limit that if transfers are below this for * CURLOPT_LOW_SPEED_TIME, the transfer is aborted. */ - data->set.low_speed_limit=va_arg(param, long); + data->set.low_speed_limit = va_arg(param, long); break; case CURLOPT_MAX_SEND_SPEED_LARGE: /* * When transfer uploads are faster then CURLOPT_MAX_SEND_SPEED_LARGE * bytes per second the transfer is throttled.. */ - data->set.max_send_speed=va_arg(param, curl_off_t); + data->set.max_send_speed = va_arg(param, curl_off_t); break; case CURLOPT_MAX_RECV_SPEED_LARGE: /* * When receiving data faster than CURLOPT_MAX_RECV_SPEED_LARGE bytes per * second the transfer is throttled.. */ - data->set.max_recv_speed=va_arg(param, curl_off_t); + data->set.max_recv_speed = va_arg(param, curl_off_t); break; case CURLOPT_LOW_SPEED_TIME: /* * The low speed time that if transfers are below the set * CURLOPT_LOW_SPEED_LIMIT during this time, the transfer is aborted. */ - data->set.low_speed_time=va_arg(param, long); + data->set.low_speed_time = va_arg(param, long); break; case CURLOPT_URL: /* @@ -2935,7 +2935,7 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option, return CURLE_NOT_BUILT_IN; #else arg = va_arg(param, long); - if((arg>=1) && (arg <= 256)) + if((arg >= 1) && (arg <= 256)) data->set.stream_weight = (int)arg; break; #endif @@ -3301,7 +3301,7 @@ Curl_oldest_idle_connection(struct Curl_easy *data) struct curl_hash_iterator iter; struct curl_llist_element *curr; struct curl_hash_element *he; - time_t highscore=-1; + time_t highscore =- 1; time_t score; struct curltime now; struct connectdata *conn_candidate = NULL; @@ -3364,7 +3364,7 @@ find_oldest_idle_connection_in_bundle(struct Curl_easy *data, struct connectbundle *bundle) { struct curl_llist_element *curr; - time_t highscore=-1; + time_t highscore = -1; time_t score; struct curltime now; struct connectdata *conn_candidate = NULL; @@ -3995,7 +3995,7 @@ int Curl_doing_getsock(struct connectdata *conn, CURLcode Curl_protocol_connecting(struct connectdata *conn, bool *done) { - CURLcode result=CURLE_OK; + CURLcode result = CURLE_OK; if(conn && conn->handler->connecting) { *done = FALSE; @@ -4014,7 +4014,7 @@ CURLcode Curl_protocol_connecting(struct connectdata *conn, CURLcode Curl_protocol_doing(struct connectdata *conn, bool *done) { - CURLcode result=CURLE_OK; + CURLcode result = CURLE_OK; if(conn && conn->handler->doing) { *done = FALSE; @@ -4034,7 +4034,7 @@ CURLcode Curl_protocol_doing(struct connectdata *conn, bool *done) CURLcode Curl_protocol_connect(struct connectdata *conn, bool *protocol_done) { - CURLcode result=CURLE_OK; + CURLcode result = CURLE_OK; *protocol_done = FALSE; @@ -4121,7 +4121,7 @@ static void fix_hostname(struct connectdata *conn, struct hostname *host) if(len && (host->name[len-1] == '.')) /* strip off a single trailing dot if present, primarily for SNI but there's no use for it */ - host->name[len-1]=0; + host->name[len-1] = 0; /* Check name for non-ASCII and convert hostname to ACE form if we can */ if(!is_ASCII_name(host->name)) { @@ -4537,7 +4537,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data, else { /* clear path */ char slashbuf[4]; - path[0]=0; + path[0] = 0; rc = sscanf(data->change.url, "%15[^\n/:]:%3[/]%[^\n/?#]%[^\n]", @@ -4648,7 +4648,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data, path[0]='/'; /* prepend the missing slash */ rebuild_url = TRUE; - *query=0; /* now cut off the hostname at the ? */ + *query = 0; /* now cut off the hostname at the ? */ } else if(!path[0]) { /* if there's no path set, use a single slash */ @@ -5040,7 +5040,7 @@ static char *detect_proxy(struct connectdata *conn) strcpy(envp, "_proxy"); /* read the protocol proxy: */ - prox=curl_getenv(proxy_env); + prox = curl_getenv(proxy_env); /* * We don't try the uppercase version of HTTP_PROXY because of @@ -5057,7 +5057,7 @@ static char *detect_proxy(struct connectdata *conn) if(!prox && !strcasecompare("http_proxy", proxy_env)) { /* There was no lowercase variable, try the uppercase version: */ Curl_strntoupper(proxy_env, proxy_env, sizeof(proxy_env)); - prox=curl_getenv(proxy_env); + prox = curl_getenv(proxy_env); } if(prox) @@ -5065,7 +5065,7 @@ static char *detect_proxy(struct connectdata *conn) else { proxy = curl_getenv("all_proxy"); /* default proxy to use */ if(!proxy) - proxy=curl_getenv("ALL_PROXY"); + proxy = curl_getenv("ALL_PROXY"); } return proxy; @@ -5813,7 +5813,7 @@ static CURLcode parse_remote_port(struct Curl_easy *data, char *rest; long port; - port=strtol(portptr+1, &rest, 10); /* Port number must be decimal */ + port = strtol(portptr+1, &rest, 10); /* Port number must be decimal */ if((port < 0) || (port > 0xffff)) { /* Single unix standard says port numbers are 16 bits long */ @@ -6169,7 +6169,7 @@ static CURLcode resolve_server(struct Curl_easy *data, struct connectdata *conn, bool *async) { - CURLcode result=CURLE_OK; + CURLcode result = CURLE_OK; time_t timeout_ms = Curl_timeleft(data, NULL, TRUE); /************************************************************* @@ -6332,7 +6332,7 @@ static void reuse_conn(struct connectdata *old_conn, free_fixed_hostname(&conn->conn_to_host); Curl_safefree(conn->host.rawalloc); Curl_safefree(conn->conn_to_host.rawalloc); - conn->host=old_conn->host; + conn->host = old_conn->host; conn->bits.conn_to_host = old_conn->bits.conn_to_host; conn->conn_to_host = old_conn->conn_to_host; conn->bits.conn_to_port = old_conn->bits.conn_to_port; @@ -6435,9 +6435,9 @@ static CURLcode create_conn(struct Curl_easy *data, * other parts of the code will rely on this fact ***********************************************************/ #define LEAST_PATH_ALLOC 256 - urllen=strlen(data->change.url); + urllen = strlen(data->change.url); if(urllen < LEAST_PATH_ALLOC) - urllen=LEAST_PATH_ALLOC; + urllen = LEAST_PATH_ALLOC; /* * We malloc() the buffers below urllen+2 to make room for 2 possibilities: @@ -7088,7 +7088,7 @@ CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn) k->buf = data->state.buffer; k->hbufp = data->state.headerbuff; - k->ignorebody=FALSE; + k->ignorebody = FALSE; Curl_speedinit(data); diff --git a/lib/vtls/axtls.c b/lib/vtls/axtls.c index 3531296bb..6b42708d8 100644 --- a/lib/vtls/axtls.c +++ b/lib/vtls/axtls.c @@ -204,7 +204,7 @@ static CURLcode connect_prep(struct connectdata *conn, int sockindex) /* Load client certificate */ if(SSL_SET_OPTION(cert)) { - i=0; + i = 0; /* Instead of trying to analyze cert type here, let axTLS try them all. */ while(cert_types[i] != 0) { ssl_fcn_return = ssl_obj_load(ssl_ctx, cert_types[i], @@ -228,7 +228,7 @@ static CURLcode connect_prep(struct connectdata *conn, int sockindex) If a pkcs12 file successfully loaded a cert, then there's nothing to do because the key has already been loaded. */ if(SSL_SET_OPTION(key) && cert_types[i] != SSL_OBJ_PKCS12) { - i=0; + i = 0; /* Instead of trying to analyze key type here, let axTLS try them all. */ while(key_types[i] != 0) { ssl_fcn_return = ssl_obj_load(ssl_ctx, key_types[i], @@ -444,7 +444,7 @@ static CURLcode Curl_axtls_connect_nonblocking(struct connectdata *conn, /* Loop to perform more work in between sleeps. This is work around the fact that axtls does not expose any knowledge about when work needs to be performed. This can save ~25% of time on SSL handshakes. */ - for(i=0; i<5; i++) { + for(i = 0; i<5; i++) { ssl_fcn_return = ssl_read(BACKEND->ssl, NULL); if(ssl_fcn_return < 0) { Curl_axtls_close(conn, sockindex); diff --git a/lib/vtls/cyassl.c b/lib/vtls/cyassl.c index 910ca15cf..ba5ee1548 100644 --- a/lib/vtls/cyassl.c +++ b/lib/vtls/cyassl.c @@ -828,7 +828,7 @@ cyassl_connect_common(struct connectdata *conn, return CURLE_OK; } - if(ssl_connect_1==connssl->connecting_state) { + if(ssl_connect_1 == connssl->connecting_state) { /* Find out how much more time we're allowed */ timeout_ms = Curl_timeleft(data, NULL, TRUE); @@ -860,9 +860,9 @@ cyassl_connect_common(struct connectdata *conn, if(connssl->connecting_state == ssl_connect_2_reading || connssl->connecting_state == ssl_connect_2_writing) { - curl_socket_t writefd = ssl_connect_2_writing== + curl_socket_t writefd = ssl_connect_2_writing == connssl->connecting_state?sockfd:CURL_SOCKET_BAD; - curl_socket_t readfd = ssl_connect_2_reading== + curl_socket_t readfd = ssl_connect_2_reading == connssl->connecting_state?sockfd:CURL_SOCKET_BAD; what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd, diff --git a/lib/vtls/darwinssl.c b/lib/vtls/darwinssl.c index ab3224c50..a98f43307 100644 --- a/lib/vtls/darwinssl.c +++ b/lib/vtls/darwinssl.c @@ -1045,7 +1045,7 @@ static OSStatus CopyIdentityWithLabel(char *label, keys_list_count = CFArrayGetCount(keys_list); *out_cert_and_key = NULL; status = 1; - for(i=0; i<keys_list_count; i++) { + for(i = 0; i<keys_list_count; i++) { OSStatus err = noErr; SecCertificateRef cert = NULL; SecIdentityRef identity = @@ -2499,7 +2499,7 @@ darwinssl_connect_common(struct connectdata *conn, return CURLE_OK; } - if(ssl_connect_1==connssl->connecting_state) { + if(ssl_connect_1 == connssl->connecting_state) { /* Find out how much more time we're allowed */ timeout_ms = Curl_timeleft(data, NULL, TRUE); diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c index 07de85d8f..a844915ef 100644 --- a/lib/vtls/gtls.c +++ b/lib/vtls/gtls.c @@ -306,9 +306,9 @@ static CURLcode handshake(struct connectdata *conn, if(connssl->connecting_state == ssl_connect_2_reading || connssl->connecting_state == ssl_connect_2_writing) { - curl_socket_t writefd = ssl_connect_2_writing== + curl_socket_t writefd = ssl_connect_2_writing == connssl->connecting_state?sockfd:CURL_SOCKET_BAD; - curl_socket_t readfd = ssl_connect_2_reading== + curl_socket_t readfd = ssl_connect_2_reading == connssl->connecting_state?sockfd:CURL_SOCKET_BAD; what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd, @@ -1208,7 +1208,7 @@ gtls_connect_step3(struct connectdata *conn, SSL_SET_OPTION(issuercert)?SSL_SET_OPTION(issuercert):"none"); } - size=sizeof(certbuf); + size = sizeof(certbuf); rc = gnutls_x509_crt_get_dn_by_oid(x509_cert, GNUTLS_OID_X520_COMMON_NAME, 0, /* the first and only one */ FALSE, @@ -1248,7 +1248,7 @@ gtls_connect_step3(struct connectdata *conn, #endif if(addrlen) { - for(i=0; ; i++) { + for(i = 0; ; i++) { certaddrlen = sizeof(certaddr); ret = gnutls_x509_crt_get_subject_alt_name(x509_cert, i, certaddr, &certaddrlen, NULL); @@ -1481,7 +1481,7 @@ gtls_connect_common(struct connectdata *conn, struct ssl_connect_data *connssl = &conn->ssl[sockindex]; /* 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); if(rc) return rc; @@ -1493,13 +1493,13 @@ gtls_connect_common(struct connectdata *conn, return rc; /* Finish connecting once the handshake is done */ - if(ssl_connect_1==connssl->connecting_state) { + if(ssl_connect_1 == connssl->connecting_state) { rc = gtls_connect_step3(conn, sockindex); if(rc) return rc; } - *done = ssl_connect_1==connssl->connecting_state; + *done = ssl_connect_1 == connssl->connecting_state; return CURLE_OK; } diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c index 262f72531..ce1f8eba8 100644 --- a/lib/vtls/mbedtls.c +++ b/lib/vtls/mbedtls.c @@ -253,7 +253,7 @@ mbed_connect_step1(struct connectdata *conn, const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port; int ret = -1; char errorbuf[128]; - errorbuf[0]=0; + errorbuf[0] = 0; /* mbedTLS only supports SSLv3 and TLSv1 */ if(SSL_CONN_CONFIG(version) == CURL_SSLVERSION_SSLv2) { @@ -829,7 +829,7 @@ static CURLcode Curl_mbedtls_random(struct Curl_easy *data, mbedtls_ctr_drbg_context ctr_drbg; mbedtls_entropy_init(&ctr_entropy); mbedtls_ctr_drbg_init(&ctr_drbg); - errorbuf[0]=0; + errorbuf[0] = 0; ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &ctr_entropy, NULL, 0); @@ -887,7 +887,7 @@ mbed_connect_common(struct connectdata *conn, return CURLE_OK; } - if(ssl_connect_1==connssl->connecting_state) { + if(ssl_connect_1 == connssl->connecting_state) { /* Find out how much more time we're allowed */ timeout_ms = Curl_timeleft(data, NULL, TRUE); @@ -918,9 +918,9 @@ mbed_connect_common(struct connectdata *conn, if(connssl->connecting_state == ssl_connect_2_reading || connssl->connecting_state == ssl_connect_2_writing) { - curl_socket_t writefd = ssl_connect_2_writing== + curl_socket_t writefd = ssl_connect_2_writing == connssl->connecting_state?sockfd:CURL_SOCKET_BAD; - curl_socket_t readfd = ssl_connect_2_reading== + curl_socket_t readfd = ssl_connect_2_reading == connssl->connecting_state?sockfd:CURL_SOCKET_BAD; what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd, @@ -960,13 +960,13 @@ mbed_connect_common(struct connectdata *conn, } /* repeat step2 until all transactions are done. */ - if(ssl_connect_3==connssl->connecting_state) { + if(ssl_connect_3 == connssl->connecting_state) { retcode = mbed_connect_step3(conn, sockindex); if(retcode) return retcode; } - if(ssl_connect_done==connssl->connecting_state) { + if(ssl_connect_done == connssl->connecting_state) { connssl->state = ssl_connection_complete; conn->recv[sockindex] = mbed_recv; conn->send[sockindex] = mbed_send; diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c index d06b8c8ae..c0b7e63ab 100644 --- a/lib/vtls/nss.c +++ b/lib/vtls/nss.c @@ -281,7 +281,7 @@ static SECStatus set_ciphers(struct Curl_easy *data, PRFileDesc * model, found = PR_FALSE; - for(i=0; i<NUM_OF_CIPHERS; i++) { + for(i = 0; i<NUM_OF_CIPHERS; i++) { if(strcasecompare(cipher, cipherlist[i].name)) { cipher_state[i] = PR_TRUE; found = PR_TRUE; @@ -300,7 +300,7 @@ static SECStatus set_ciphers(struct Curl_easy *data, PRFileDesc * model, } /* Finally actually enable the selected ciphers */ - for(i=0; i<NUM_OF_CIPHERS; i++) { + for(i = 0; i<NUM_OF_CIPHERS; i++) { if(!cipher_state[i]) continue; @@ -321,7 +321,7 @@ static bool any_cipher_enabled(void) { unsigned int i; - for(i=0; i<NUM_OF_CIPHERS; i++) { + for(i = 0; i<NUM_OF_CIPHERS; i++) { PRInt32 policy = 0; SSL_CipherPolicyGet(cipherlist[i].num, &policy); if(policy) @@ -1002,7 +1002,7 @@ static SECStatus check_issuer_cert(PRFileDesc *sock, char *issuer_nickname) { CERTCertificate *cert, *cert_issuer, *issuer; - SECStatus res=SECSuccess; + SECStatus res = SECSuccess; void *proto_win = NULL; cert = SSL_PeerCertificate(sock); @@ -1014,7 +1014,7 @@ static SECStatus check_issuer_cert(PRFileDesc *sock, if((!cert_issuer) || (!issuer)) res = SECFailure; else if(SECITEM_CompareItem(&cert_issuer->derCert, - &issuer->derCert)!=SECEqual) + &issuer->derCert) != SECEqual) res = SECFailure; CERT_DestroyCertificate(cert); diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 3472c2492..92ca22489 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -459,7 +459,7 @@ static CURLcode Curl_ossl_seed(struct Curl_easy *data) } while(!rand_enough()); /* generates a default path for the random seed file */ - fname[0]=0; /* blank it first */ + fname[0] = 0; /* blank it first */ RAND_file_name(fname, sizeof(fname)); if(fname[0]) { /* we got a file name to try */ @@ -755,7 +755,7 @@ int cert_stuff(struct connectdata *conn, break; if(!key_file) /* cert & key can only be in PEM case in the same file */ - key_file=cert_file; + key_file = cert_file; /* FALLTHROUGH */ case SSL_FILETYPE_ASN1: if(SSL_CTX_use_PrivateKey_file(ctx, key_file, file_type) != 1) { @@ -818,13 +818,13 @@ int cert_stuff(struct connectdata *conn, return 0; } - ssl=SSL_new(ctx); + ssl = SSL_new(ctx); if(!ssl) { failf(data, "unable to create an SSL structure"); return 0; } - x509=SSL_get_certificate(ssl); + x509 = SSL_get_certificate(ssl); /* This version was provided by Evan Jordan and is supposed to not leak memory as the previous version: */ @@ -872,7 +872,7 @@ static int x509_name_oneline(X509_NAME *a, char *buf, size_t size) size--; /* don't overwrite the buffer end */ memcpy(buf, biomem->data, size); - buf[size]=0; + buf[size] = 0; BIO_free(bio_out); @@ -1357,7 +1357,7 @@ static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert) numalts = sk_GENERAL_NAME_num(altnames); /* loop through all alternatives - until a dnsmatch */ - for(i=0; (i < numalts) && !dnsmatched; i++) { + for(i = 0; (i < numalts) && !dnsmatched; i++) { /* get a handle to alternative name number i */ const GENERAL_NAME *check = sk_GENERAL_NAME_value(altnames, i); @@ -1426,7 +1426,7 @@ static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert) else { /* we have to look to the last occurrence of a commonName in the distinguished one to get the most significant one. */ - int j, i=-1; + int j, i = -1; /* The following is done because of a bug in 0.9.6b */ @@ -1435,14 +1435,14 @@ static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert) X509_NAME *name = X509_get_subject_name(server_cert); if(name) - while((j = X509_NAME_get_index_by_NID(name, NID_commonName, i))>=0) - i=j; + while((j = X509_NAME_get_index_by_NID(name, NID_commonName, i)) >= 0) + i = j; /* we have the name entry and we will now convert this to a string that we can use for comparison. Doing this we support BMPstring, UTF8 etc. */ - if(i>=0) { + if(i >= 0) { ASN1_STRING *tmp = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name, i)); @@ -2351,7 +2351,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex) if(ssl_crlfile) { /* tell SSL where to find CRL file that is used to check certificate * revocation */ - lookup=X509_STORE_add_lookup(SSL_CTX_get_cert_store(BACKEND->ctx), + lookup = X509_STORE_add_lookup(SSL_CTX_get_cert_store(BACKEND->ctx), X509_LOOKUP_file()); if(!lookup || (!X509_load_crl_file(lookup, ssl_crlfile, X509_FILETYPE_PEM)) ) { @@ -2631,7 +2631,7 @@ static int asn1_object_dump(ASN1_OBJECT *a, char *buf, size_t len) do { \ long info_len = BIO_get_mem_data(mem, &ptr); \ Curl_ssl_push_certinfo_len(data, _num, _label, ptr, info_len); \ - if(1!=BIO_reset(mem)) \ + if(1 != BIO_reset(mem)) \ break; \ } WHILE_FALSE @@ -2679,12 +2679,12 @@ static int X509V3_ext(struct Curl_easy *data, /* no extensions, bail out */ return 1; - for(i=0; i < (int)sk_X509_EXTENSION_num(exts); i++) { + for(i = 0; i < (int)sk_X509_EXTENSION_num(exts); i++) { ASN1_OBJECT *obj; X509_EXTENSION *ext = sk_X509_EXTENSION_value(exts, i); BUF_MEM *biomem; char buf[512]; - char *ptr=buf; + char *ptr = buf; char namebuf[128]; BIO *bio_out = BIO_new(BIO_s_mem()); @@ -2701,16 +2701,16 @@ static int X509V3_ext(struct Curl_easy *data, BIO_get_mem_ptr(bio_out, &biomem); for(j = 0; j < (size_t)biomem->length; j++) { - const char *sep=""; + const char *sep = ""; if(biomem->data[j] == '\n') { - sep=", "; + sep = ", "; j++; /* skip the newline */ }; while((j<(size_t)biomem->length) && (biomem->data[j] == ' ')) j++; if(j<(size_t)biomem->length) - ptr+=snprintf(ptr, sizeof(buf)-(ptr-buf), "%s%c", sep, - biomem->data[j]); + ptr += snprintf(ptr, sizeof(buf)-(ptr-buf), "%s%c", sep, + biomem->data[j]); } Curl_ssl_push_certinfo(data, certnum, namebuf, buf); @@ -2749,7 +2749,7 @@ static CURLcode get_cert_chain(struct connectdata *conn, for(i = 0; i < numcerts; i++) { ASN1_INTEGER *num; X509 *x = sk_X509_value(sk, i); - EVP_PKEY *pubkey=NULL; + EVP_PKEY *pubkey = NULL; int j; char *ptr; const ASN1_BIT_STRING *psig = NULL; @@ -3281,9 +3281,9 @@ static CURLcode ossl_connect_common(struct connectdata *conn, if(connssl->connecting_state == ssl_connect_2_reading || connssl->connecting_state == ssl_connect_2_writing) { - curl_socket_t writefd = ssl_connect_2_writing== + curl_socket_t writefd = ssl_connect_2_writing == connssl->connecting_state?sockfd:CURL_SOCKET_BAD; - curl_socket_t readfd = ssl_connect_2_reading== + curl_socket_t readfd = ssl_connect_2_reading == connssl->connecting_state?sockfd:CURL_SOCKET_BAD; what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd, @@ -3502,9 +3502,9 @@ static size_t Curl_ossl_version(char *buffer, size_t size) unsigned long ssleay_value; sub[2]='\0'; sub[1]='\0'; - ssleay_value=OpenSSL_version_num(); + ssleay_value = OpenSSL_version_num(); if(ssleay_value < 0x906000) { - ssleay_value=SSLEAY_VERSION_NUMBER; + ssleay_value = SSLEAY_VERSION_NUMBER; sub[0]='\0'; } else { diff --git a/lib/vtls/polarssl.c b/lib/vtls/polarssl.c index 0d70027a1..fc0644f89 100644 --- a/lib/vtls/polarssl.c +++ b/lib/vtls/polarssl.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2012 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2012 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 2010 - 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com> * * This software is licensed as described in the file COPYING, which @@ -227,7 +227,7 @@ polarssl_connect_step1(struct connectdata *conn, const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port; int ret = -1; char errorbuf[128]; - errorbuf[0]=0; + errorbuf[0] = 0; /* PolarSSL only supports SSLv3 and TLSv1 */ if(SSL_CONN_CONFIG(version) == CURL_SSLVERSION_SSLv2) { @@ -777,9 +777,9 @@ polarssl_connect_common(struct connectdata *conn, if(connssl->connecting_state == ssl_connect_2_reading || connssl->connecting_state == ssl_connect_2_writing) { - curl_socket_t writefd = ssl_connect_2_writing== + curl_socket_t writefd = ssl_connect_2_writing == connssl->connecting_state?sockfd:CURL_SOCKET_BAD; - curl_socket_t readfd = ssl_connect_2_reading== + curl_socket_t readfd = ssl_connect_2_reading == connssl->connecting_state?sockfd:CURL_SOCKET_BAD; what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd, diff --git a/lib/vtls/polarssl_threadlock.c b/lib/vtls/polarssl_threadlock.c index b1eb7b746..dd5fbd7ec 100644 --- a/lib/vtls/polarssl_threadlock.c +++ b/lib/vtls/polarssl_threadlock.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2013-2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2013-2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 2010, 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com> * * This software is licensed as described in the file COPYING, which @@ -114,7 +114,7 @@ int Curl_polarsslthreadlock_lock_function(int n) } #elif defined(HAVE_PROCESS_H) if(n < NUMT) { - ret = (WaitForSingleObject(mutex_buf[n], INFINITE)==WAIT_FAILED?1:0); + ret = (WaitForSingleObject(mutex_buf[n], INFINITE) == WAIT_FAILED?1:0); if(ret) { DEBUGF(fprintf(stderr, "Error: polarsslthreadlock_lock_function failed\n")); diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index 52f922841..5d0985783 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -147,7 +147,7 @@ int Curl_ssl_backend(void) #ifdef USE_SSL /* "global" init done? */ -static bool init_ssl=FALSE; +static bool init_ssl = FALSE; /** * Global SSL init @@ -383,7 +383,7 @@ void Curl_ssl_kill_session(struct curl_ssl_session *session) void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid) { size_t i; - struct Curl_easy *data=conn->data; + struct Curl_easy *data = conn->data; for(i = 0; i < data->set.general_ssl.max_ssl_sessions; i++) { struct curl_ssl_session *check = &data->state.session[i]; @@ -407,9 +407,9 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn, int sockindex) { size_t i; - struct Curl_easy *data=conn->data; /* the mother of all structs */ + struct Curl_easy *data = conn->data; /* the mother of all structs */ struct curl_ssl_session *store = &data->state.session[0]; - long oldest_age=data->state.session[0].age; /* zero if unused */ + long oldest_age = data->state.session[0].age; /* zero if unused */ char *clone_host; char *clone_conn_to_host; int conn_to_port; @@ -643,7 +643,7 @@ void Curl_ssl_free_certinfo(struct Curl_easy *data) if(ci->num_of_certs) { /* free all individual lists used */ - for(i=0; i<ci->num_of_certs; i++) { + for(i = 0; i<ci->num_of_certs; i++) { curl_slist_free_all(ci->certinfo[i]); ci->certinfo[i] = NULL; } diff --git a/src/tool_easysrc.c b/src/tool_easysrc.c index 602409d14..cb30e404b 100644 --- a/src/tool_easysrc.c +++ b/src/tool_easysrc.c @@ -141,11 +141,11 @@ CURLcode easysrc_perform(void) const char *c; CHKRET(easysrc_add(&easysrc_code, "")); /* Preamble comment */ - for(i=0; ((c = srchard[i]) != NULL); i++) + for(i = 0; ((c = srchard[i]) != NULL); i++) CHKRET(easysrc_add(&easysrc_code, c)); /* Each unconverted option */ if(easysrc_toohard) { - for(ptr=easysrc_toohard->first; ptr; ptr = ptr->next) + for(ptr = easysrc_toohard->first; ptr; ptr = ptr->next) CHKRET(easysrc_add(&easysrc_code, ptr->data)); } CHKRET(easysrc_add(&easysrc_code, "")); @@ -189,12 +189,12 @@ void dumpeasysrc(struct GlobalConfig *config) int i; const char *c; - for(i=0; ((c = srchead[i]) != NULL); i++) + for(i = 0; ((c = srchead[i]) != NULL); i++) fprintf(out, "%s\n", c); /* Declare variables used for complex setopt values */ if(easysrc_decl) { - for(ptr=easysrc_decl->first; ptr; ptr = ptr->next) + for(ptr = easysrc_decl->first; ptr; ptr = ptr->next) fprintf(out, " %s\n", ptr->data); } @@ -202,13 +202,13 @@ void dumpeasysrc(struct GlobalConfig *config) if(easysrc_data) { fprintf(out, "\n"); - for(ptr=easysrc_data->first; ptr; ptr = ptr->next) + for(ptr = easysrc_data->first; ptr; ptr = ptr->next) fprintf(out, " %s\n", ptr->data); } fprintf(out, "\n"); if(easysrc_code) { - for(ptr=easysrc_code->first; ptr; ptr = ptr->next) { + for(ptr = easysrc_code->first; ptr; ptr = ptr->next) { if(ptr->data[0]) { fprintf(out, " %s\n", ptr->data); } @@ -219,11 +219,11 @@ void dumpeasysrc(struct GlobalConfig *config) } if(easysrc_clean) { - for(ptr=easysrc_clean->first; ptr; ptr = ptr->next) + for(ptr = easysrc_clean->first; ptr; ptr = ptr->next) fprintf(out, " %s\n", ptr->data); } - for(i=0; ((c = srcend[i]) != NULL); i++) + for(i = 0; ((c = srcend[i]) != NULL); i++) fprintf(out, "%s\n", c); if(fopened) diff --git a/src/tool_formparse.c b/src/tool_formparse.c index 95e0980d1..091885877 100644 --- a/src/tool_formparse.c +++ b/src/tool_formparse.c @@ -77,7 +77,7 @@ static char *get_param_word(char **str, char **end_pos) while(ptr < *end_pos); *end_pos = ptr2; } - while(*ptr && NULL==strchr(end_chars, *ptr)) + while(*ptr && NULL == strchr(end_chars, *ptr)) ++ptr; *str = ptr; return word_begin+1; @@ -88,7 +88,7 @@ static char *get_param_word(char **str, char **end_pos) ptr = word_begin; } - while(*ptr && NULL==strchr(end_chars, *ptr)) + while(*ptr && NULL == strchr(end_chars, *ptr)) ++ptr; *str = *end_pos = ptr; return word_begin; diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 31fc7a1ff..1a3facf11 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -492,7 +492,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ if(!longopt) { letter = (char)*parse; - subletter='\0'; + subletter = '\0'; } else { letter = parse[0]; @@ -1190,7 +1190,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ config->resume_from_current = TRUE; config->resume_from = 0; } - config->use_resume=TRUE; + config->use_resume = TRUE; break; case 'd': /* postfield data */ @@ -1608,7 +1608,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ nextarg, &config->mimepost, &config->mimecurrent, - (subletter=='s')?TRUE:FALSE)) /* 's' means literal string */ + (subletter == 's')?TRUE:FALSE)) /* 's' is literal string */ return PARAM_BAD_USE; if(SetHTTPrequest(config, HTTPREQ_MIMEPOST, &config->httpreq)) return PARAM_BAD_USE; @@ -2053,7 +2053,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ break; } now = time(NULL); - config->condtime=curl_getdate(nextarg, &now); + config->condtime = curl_getdate(nextarg, &now); if(-1 == (int)config->condtime) { /* now let's see if it is a file name to get the time from instead! */ struct_stat statbuf; diff --git a/src/tool_operate.c b/src/tool_operate.c index 25ea9c4e6..ef15ed136 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -525,7 +525,7 @@ static CURLcode operate_do(struct GlobalConfig *global, urlnum = 1; /* without globbing, this is a single URL */ /* if multiple files extracted to stdout, insert separators! */ - separator= ((!outfiles || !strcmp(outfiles, "-")) && urlnum > 1); + separator = ((!outfiles || !strcmp(outfiles, "-")) && urlnum > 1); /* Here's looping around each globbed URL */ for(li = 0 ; li < urlnum; li++) { @@ -822,7 +822,7 @@ static CURLcode operate_do(struct GlobalConfig *global, if(strchr(pc, '?')) /* Ouch, there's already a question mark in the URL string, we then append the data with an ampersand separator instead! */ - sep='&'; + sep = '&'; } /* * Then append ? followed by the get fields to the url. diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index 80d47573f..3a2949fa8 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -334,7 +334,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)) { switch(action) { case deny: diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c index 93814f454..540bdb18a 100644 --- a/src/tool_parsecfg.c +++ b/src/tool_parsecfg.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -131,7 +131,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global) while(NULL != (aline = my_get_line(file))) { lineno++; line = aline; - alloced_param=FALSE; + alloced_param = FALSE; /* line with # in the first non-blank column is a comment! */ while(*line && ISSPACE(*line)) diff --git a/src/tool_setopt.c b/src/tool_setopt.c index a8e205938..fd9bba4d6 100644 --- a/src/tool_setopt.c +++ b/src/tool_setopt.c @@ -229,24 +229,24 @@ static char *c_escape(const char *str, size_t len) return NULL; e = escaped; - for(s=str; (c=*s) != '\0'; s++) { - if(c=='\n') { + for(s = str; (c = *s) != '\0'; s++) { + if(c == '\n') { strcpy(e, "\\n"); e += 2; } - else if(c=='\r') { + else if(c == '\r') { strcpy(e, "\\r"); e += 2; } - else if(c=='\t') { + else if(c == '\t') { strcpy(e, "\\t"); e += 2; } - else if(c=='\\') { + else if(c == '\\') { strcpy(e, "\\\\"); e += 2; } - else if(c=='"') { + else if(c == '"') { strcpy(e, "\\\""); e += 2; } @@ -276,7 +276,7 @@ CURLcode tool_setopt_enum(CURL *curl, struct GlobalConfig *config, if(config->libcurl && !skip && !ret) { /* we only use this for real if --libcurl was used */ const NameValue *nv = NULL; - for(nv=nvlist; nv->name; nv++) { + for(nv = nvlist; nv->name; nv++) { if(nv->value == lval) break; /* found it */ } if(! nv->name) { @@ -313,7 +313,7 @@ CURLcode tool_setopt_flags(CURL *curl, struct GlobalConfig *config, const NameValue *nv = NULL; snprintf(preamble, sizeof(preamble), "curl_easy_setopt(hnd, %s, ", name); - for(nv=nvlist; nv->name; nv++) { + for(nv = nvlist; nv->name; nv++) { if((nv->value & ~ rest) == 0) { /* all value flags contained in rest */ rest &= ~ nv->value; /* remove bits handled here */ @@ -356,7 +356,7 @@ CURLcode tool_setopt_bitmask(CURL *curl, struct GlobalConfig *config, const NameValueUnsigned *nv = NULL; snprintf(preamble, sizeof(preamble), "curl_easy_setopt(hnd, %s, ", name); - for(nv=nvlist; nv->name; nv++) { + for(nv = nvlist; nv->name; nv++) { if((nv->value & ~ rest) == 0) { /* all value flags contained in rest */ rest &= ~ nv->value; /* remove bits handled here */ @@ -632,7 +632,7 @@ CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *config, long lval = va_arg(arg, long); long defval = 0L; const NameValue *nv = NULL; - for(nv=setopt_nv_CURLNONZERODEFAULTS; nv->name; nv++) { + for(nv = setopt_nv_CURLNONZERODEFAULTS; nv->name; nv++) { if(!strcmp(name, nv->name)) { defval = nv->value; break; /* found it */ diff --git a/src/tool_urlglob.c b/src/tool_urlglob.c index d56dcd912..42cb086db 100644 --- a/src/tool_urlglob.c +++ b/src/tool_urlglob.c @@ -259,7 +259,7 @@ static CURLcode glob_range(URLGlob *glob, char **patternp, errno = 0; min_n = strtoul(pattern, &endp, 10); if(errno || (endp == pattern)) - endp=NULL; + endp = NULL; else { if(*endp != '-') endp = NULL; @@ -287,7 +287,7 @@ static CURLcode glob_range(URLGlob *glob, char **patternp, else step_n = 1; if(endp && (*endp == ']')) { - pattern= endp+1; + pattern = endp+1; } else endp = NULL; @@ -444,7 +444,7 @@ CURLcode glob_url(URLGlob **glob, char *url, unsigned long *urlnum, glob_buffer = malloc(strlen(url) + 1); if(!glob_buffer) return CURLE_OUT_OF_MEMORY; - glob_buffer[0]=0; + glob_buffer[0] = 0; glob_expand = calloc(1, sizeof(URLGlob)); if(!glob_expand) { @@ -623,12 +623,12 @@ CURLcode glob_match_url(char **result, char *filename, URLGlob *glob) unsigned long i; char *ptr = filename; unsigned long num = strtoul(&filename[1], &filename, 10); - URLPattern *pat =NULL; + URLPattern *pat = NULL; if(num < glob->size) { num--; /* make it zero based */ /* find the correct glob entry */ - for(i=0; i<glob->size; i++) { + for(i = 0; i<glob->size; i++) { if(glob->pattern[i].globindex == (int)num) { pat = &glob->pattern[i]; break; diff --git a/tests/libtest/first.c b/tests/libtest/first.c index 72140e314..706d853ca 100644 --- a/tests/libtest/first.c +++ b/tests/libtest/first.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -72,8 +72,8 @@ void wait_ms(int ms) select_wrapper(0, NULL, NULL, NULL, &t); } -char *libtest_arg2=NULL; -char *libtest_arg3=NULL; +char *libtest_arg2 = NULL; +char *libtest_arg3 = NULL; int test_argc; char **test_argv; @@ -123,7 +123,7 @@ char *hexdump(const unsigned char *buffer, size_t len) size_t i; if(len > 200) return NULL; - for(i=0; i<len; i++, p += 3) + for(i = 0; i<len; i++, p += 3) snprintf(p, 4, "%02x ", buffer[i]); return dump; } @@ -162,10 +162,10 @@ int main(int argc, char **argv) test_argv = argv; if(argc>2) - libtest_arg2=argv[2]; + libtest_arg2 = argv[2]; if(argc>3) - libtest_arg3=argv[3]; + libtest_arg3 = argv[3]; URL = argv[1]; /* provide this to the rest */ diff --git a/tests/libtest/lib1506.c b/tests/libtest/lib1506.c index 47fc335ce..687437636 100644 --- a/tests/libtest/lib1506.c +++ b/tests/libtest/lib1506.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2013, Linus Nielsen Feltzing <linus@haxx.se> + * Copyright (C) 2013, 2017, Linus Nielsen Feltzing <linus@haxx.se> * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -45,7 +45,7 @@ int test(char *URL) (void)URL; /* Create fake DNS entries for serverX.example.com for all handles */ - for(i=0; i < NUM_HANDLES; i++) { + for(i = 0; i < NUM_HANDLES; i++) { snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1, port, address); printf("%s\n", dnsentry); @@ -66,7 +66,7 @@ int test(char *URL) multi_setopt(m, CURLMOPT_MAXCONNECTS, 3L); /* get NUM_HANDLES easy handles */ - for(i=0; i < NUM_HANDLES; i++) { + for(i = 0; i < NUM_HANDLES; i++) { /* get an easy handle */ easy_init(curl[i]); /* specify target */ @@ -85,7 +85,7 @@ int test(char *URL) fprintf(stderr, "Start at URL 0\n"); - for(i=0; i < NUM_HANDLES; i++) { + for(i = 0; i < NUM_HANDLES; i++) { /* add handle to multi */ multi_add_handle(m, curl[i]); @@ -123,7 +123,7 @@ test_cleanup: /* proper cleanup sequence - type PB */ - for(i=0; i < NUM_HANDLES; i++) { + for(i = 0; i < NUM_HANDLES; i++) { curl_multi_remove_handle(m, curl[i]); curl_easy_cleanup(curl[i]); } diff --git a/tests/libtest/lib1510.c b/tests/libtest/lib1510.c index 25e9fed31..d72749b24 100644 --- a/tests/libtest/lib1510.c +++ b/tests/libtest/lib1510.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2013, Linus Nielsen Feltzing <linus@haxx.se> + * Copyright (C) 2013, 2017, Linus Nielsen Feltzing <linus@haxx.se> * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -43,7 +43,7 @@ int test(char *URL) (void)URL; /* Create fake DNS entries for serverX.example.com for all handles */ - for(i=0; i < NUM_URLS; i++) { + for(i = 0; i < NUM_URLS; i++) { snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1, port, address); printf("%s\n", dnsentry); @@ -72,7 +72,7 @@ int test(char *URL) easy_setopt(curl, CURLOPT_MAXCONNECTS, 3L); /* get NUM_HANDLES easy handles */ - for(i=0; i < NUM_URLS; i++) { + for(i = 0; i < NUM_URLS; i++) { /* specify target */ snprintf(target_url, sizeof(target_url), "http://server%d.example.com:%s/path/1510%04i", diff --git a/tests/libtest/lib1512.c b/tests/libtest/lib1512.c index f4091b45a..5e794b293 100644 --- a/tests/libtest/lib1512.c +++ b/tests/libtest/lib1512.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2013 - 2016, Linus Nielsen Feltzing <linus@haxx.se> + * Copyright (C) 2013 - 2017, Linus Nielsen Feltzing <linus@haxx.se> * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -55,7 +55,7 @@ int test(char *URL) slist = curl_slist_append(slist, dnsentry); /* get NUM_HANDLES easy handles */ - for(i=0; i < NUM_HANDLES; i++) { + for(i = 0; i < NUM_HANDLES; i++) { /* get an easy handle */ easy_init(curl[i]); /* specify target */ @@ -76,7 +76,7 @@ int test(char *URL) easy_setopt(curl[0], CURLOPT_RESOLVE, slist); /* run NUM_HANDLES transfers */ - for(i=0; (i < NUM_HANDLES) && !res; i++) + for(i = 0; (i < NUM_HANDLES) && !res; i++) res = curl_easy_perform(curl[i]); test_cleanup: diff --git a/tests/libtest/lib1513.c b/tests/libtest/lib1513.c index d0123f1f6..932ca7208 100644 --- a/tests/libtest/lib1513.c +++ b/tests/libtest/lib1513.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2015, 2017, 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 @@ -48,7 +48,7 @@ static int progressKiller(void *arg, int test(char *URL) { CURL *curl; - int res=0; + int res = 0; global_init(CURL_GLOBAL_ALL); diff --git a/tests/libtest/lib1517.c b/tests/libtest/lib1517.c index e270ed74d..ea622b046 100644 --- a/tests/libtest/lib1517.c +++ b/tests/libtest/lib1517.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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,7 +54,7 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) int test(char *URL) { CURL *curl; - CURLcode res=CURLE_OK; + CURLcode res = CURLE_OK; struct WriteThis pooh; diff --git a/tests/libtest/lib1538.c b/tests/libtest/lib1538.c index e4e16f203..91481e88d 100644 --- a/tests/libtest/lib1538.c +++ b/tests/libtest/lib1538.c @@ -37,13 +37,14 @@ int test(char *URL) curl_easy_strerror(-INT_MAX); curl_multi_strerror(-INT_MAX); curl_share_strerror(-INT_MAX); - for(easyret=CURLE_OK; easyret <= CURL_LAST; easyret++) { + for(easyret = CURLE_OK; easyret <= CURL_LAST; easyret++) { printf("e%d: %s\n", (int)easyret, curl_easy_strerror(easyret)); } - for(multiret=CURLM_CALL_MULTI_PERFORM; multiret <= CURLM_LAST; multiret++) { + for(multiret = CURLM_CALL_MULTI_PERFORM; multiret <= CURLM_LAST; + multiret++) { printf("m%d: %s\n", (int)multiret, curl_multi_strerror(multiret)); } - for(shareret=CURLSHE_OK; shareret <= CURLSHE_LAST; shareret++) { + for(shareret = CURLSHE_OK; shareret <= CURLSHE_LAST; shareret++) { printf("s%d: %s\n", (int)shareret, curl_share_strerror(shareret)); } diff --git a/tests/libtest/lib500.c b/tests/libtest/lib500.c index d17b24b20..677ab73a7 100644 --- a/tests/libtest/lib500.c +++ b/tests/libtest/lib500.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -61,7 +61,7 @@ int test(char *URL) { CURLcode res; CURL *curl; - char *ipstr=NULL; + char *ipstr = NULL; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib505.c b/tests/libtest/lib505.c index ad5d214c6..cc7463bde 100644 --- a/tests/libtest/lib505.c +++ b/tests/libtest/lib505.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -43,7 +43,7 @@ int test(char *URL) struct_stat file_info; struct curl_slist *hl; - struct curl_slist *headerlist=NULL; + struct curl_slist *headerlist = NULL; const char *buf_1 = "RNFR 505"; const char *buf_2 = "RNTO 505-forreal"; diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c index d26252b6f..1b522be64 100644 --- a/tests/libtest/lib506.c +++ b/tests/libtest/lib506.c @@ -131,7 +131,7 @@ static void *fire(void *ptr) struct curl_slist *headers; struct Tdata *tdata = (struct Tdata*)ptr; CURL *curl; - int i=0; + int i = 0; curl = curl_easy_init(); if(!curl) { @@ -261,7 +261,7 @@ int test(char *URL) res = 0; /* start treads */ - for(i=1; i<=THREADS; i++) { + for(i = 1; i <= THREADS; i++) { /* set thread data */ tdata.url = suburl(URL, i); /* must be curl_free()d */ @@ -349,7 +349,7 @@ int test(char *URL) /* try to free share, expect to fail because share is in use*/ printf("try SHARE_CLEANUP...\n"); scode = curl_share_cleanup(share); - if(scode==CURLSHE_OK) { + if(scode == CURLSHE_OK) { fprintf(stderr, "curl_share_cleanup succeed but error expected\n"); share = NULL; } @@ -368,7 +368,7 @@ test_cleanup: /* free share */ printf("SHARE_CLEANUP\n"); scode = curl_share_cleanup(share); - if(scode!=CURLSHE_OK) + if(scode != CURLSHE_OK) fprintf(stderr, "curl_share_cleanup failed, code errno %d\n", (int)scode); diff --git a/tests/libtest/lib508.c b/tests/libtest/lib508.c index 1f6c6838a..30705e46a 100644 --- a/tests/libtest/lib508.c +++ b/tests/libtest/lib508.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -50,7 +50,7 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) int test(char *URL) { CURL *curl; - CURLcode res=CURLE_OK; + CURLcode res = CURLE_OK; struct WriteThis pooh; diff --git a/tests/libtest/lib510.c b/tests/libtest/lib510.c index 4c290f1ef..4d568df44 100644 --- a/tests/libtest/lib510.c +++ b/tests/libtest/lib510.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -62,7 +62,7 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) int test(char *URL) { CURL *curl; - CURLcode res=CURLE_OK; + CURLcode res = CURLE_OK; struct curl_slist *slist = NULL; struct WriteThis pooh; pooh.counter = 0; diff --git a/tests/libtest/lib513.c b/tests/libtest/lib513.c index 7c34bc4db..c6a98cca2 100644 --- a/tests/libtest/lib513.c +++ b/tests/libtest/lib513.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -35,7 +35,7 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) int test(char *URL) { CURL *curl; - CURLcode res=CURLE_OK; + CURLcode res = CURLE_OK; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib514.c b/tests/libtest/lib514.c index 7b33d52f9..702058b19 100644 --- a/tests/libtest/lib514.c +++ b/tests/libtest/lib514.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -26,7 +26,7 @@ int test(char *URL) { CURL *curl; - CURLcode res=CURLE_OK; + CURLcode res = CURLE_OK; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c index 6fb178720..9f29d43c9 100644 --- a/tests/libtest/lib515.c +++ b/tests/libtest/lib515.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -26,7 +26,7 @@ int test(char *URL) { CURL *curl; - CURLcode res=CURLE_OK; + CURLcode res = CURLE_OK; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib516.c b/tests/libtest/lib516.c index 00c54c450..6d83e218c 100644 --- a/tests/libtest/lib516.c +++ b/tests/libtest/lib516.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -26,7 +26,7 @@ int test(char *URL) { CURL *curl; - CURLcode res=CURLE_OK; + CURLcode res = CURLE_OK; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib517.c b/tests/libtest/lib517.c index 22162ff1e..af7b2aa7a 100644 --- a/tests/libtest/lib517.c +++ b/tests/libtest/lib517.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -131,7 +131,7 @@ int test(char *URL) (void)URL; /* not used */ - for(i=0; dates[i]; i++) { + for(i = 0; dates[i]; i++) { printf("%d: %s => %ld\n", i, dates[i], (long)curl_getdate(dates[i], NULL)); } diff --git a/tests/libtest/lib526.c b/tests/libtest/lib526.c index 522cd7422..5e41cc0a1 100644 --- a/tests/libtest/lib526.c +++ b/tests/libtest/lib526.c @@ -59,7 +59,7 @@ int test(char *URL) int current = 0; int i; - for(i=0; i < NUM_HANDLES; i++) + for(i = 0; i < NUM_HANDLES; i++) curl[i] = NULL; start_test_timing(); @@ -67,7 +67,7 @@ int test(char *URL) global_init(CURL_GLOBAL_ALL); /* get NUM_HANDLES easy handles */ - for(i=0; i < NUM_HANDLES; i++) { + for(i = 0; i < NUM_HANDLES; i++) { easy_init(curl[i]); /* specify target */ easy_setopt(curl[i], CURLOPT_URL, URL); @@ -145,7 +145,7 @@ test_cleanup: /* test 526 and 528 */ /* proper cleanup sequence - type PB */ - for(i=0; i < NUM_HANDLES; i++) { + for(i = 0; i < NUM_HANDLES; i++) { curl_multi_remove_handle(m, curl[i]); curl_easy_cleanup(curl[i]); } @@ -162,7 +162,7 @@ test_cleanup: will be leaked, let's use undocumented cleanup sequence - type UB */ if(res) - for(i=0; i < NUM_HANDLES; i++) + for(i = 0; i < NUM_HANDLES; i++) curl_easy_cleanup(curl[i]); curl_multi_cleanup(m); @@ -173,7 +173,7 @@ test_cleanup: /* test 532 */ /* undocumented cleanup sequence - type UB */ - for(i=0; i < NUM_HANDLES; i++) + for(i = 0; i < NUM_HANDLES; i++) curl_easy_cleanup(curl[i]); curl_multi_cleanup(m); curl_global_cleanup(); diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c index 82bfab36c..e7726fbc3 100644 --- a/tests/libtest/lib530.c +++ b/tests/libtest/lib530.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -39,7 +39,7 @@ int test(char *URL) char target_url[256]; int handles_added = 0; - for(i=0; i < NUM_HANDLES; i++) + for(i = 0; i < NUM_HANDLES; i++) curl[i] = NULL; start_test_timing(); @@ -49,7 +49,7 @@ int test(char *URL) multi_init(m); /* get NUM_HANDLES easy handles */ - for(i=0; i < NUM_HANDLES; i++) { + for(i = 0; i < NUM_HANDLES; i++) { /* get an easy handle */ easy_init(curl[i]); /* specify target */ @@ -110,7 +110,7 @@ test_cleanup: /* proper cleanup sequence - type PB */ - for(i=0; i < NUM_HANDLES; i++) { + for(i = 0; i < NUM_HANDLES; i++) { curl_multi_remove_handle(m, curl[i]); curl_easy_cleanup(curl[i]); } diff --git a/tests/libtest/lib533.c b/tests/libtest/lib533.c index 706b269fe..ceb71bf7b 100644 --- a/tests/libtest/lib533.c +++ b/tests/libtest/lib533.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2011, 2017, 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 @@ -37,7 +37,7 @@ int test(char *URL) CURL *curl = NULL; int running; CURLM *m = NULL; - int current=0; + int current = 0; start_test_timing(); diff --git a/tests/libtest/lib540.c b/tests/libtest/lib540.c index ac862092f..61f635f69 100644 --- a/tests/libtest/lib540.c +++ b/tests/libtest/lib540.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -165,7 +165,7 @@ static int loop(int num, CURLM *cm, const char *url, const char *userpwd, curl_easy_strerror(msg->data.result)); curl_multi_remove_handle(cm, e); curl_easy_cleanup(e); - for(i=0; i < NUM_HANDLES; i++) { + for(i = 0; i < NUM_HANDLES; i++) { if(eh[i] == e) { eh[i] = NULL; break; @@ -192,7 +192,7 @@ int test(char *URL) int res = 0; int i; - for(i=0; i < NUM_HANDLES; i++) + for(i = 0; i < NUM_HANDLES; i++) eh[i] = NULL; start_test_timing(); @@ -234,7 +234,7 @@ test_cleanup: /* proper cleanup sequence - type PB */ - for(i=0; i < NUM_HANDLES; i++) { + for(i = 0; i < NUM_HANDLES; i++) { curl_multi_remove_handle(cm, eh[i]); curl_easy_cleanup(eh[i]); } diff --git a/tests/libtest/lib544.c b/tests/libtest/lib544.c index 28eacdaf6..1f832d2a6 100644 --- a/tests/libtest/lib544.c +++ b/tests/libtest/lib544.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -40,7 +40,7 @@ static char teststring[] = int test(char *URL) { CURL *curl; - CURLcode res=CURLE_OK; + CURLcode res = CURLE_OK; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib547.c b/tests/libtest/lib547.c index ce967c085..3db4890de 100644 --- a/tests/libtest/lib547.c +++ b/tests/libtest/lib547.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -82,7 +82,7 @@ int test(char *URL) CURLcode res; CURL *curl; #ifndef LIB548 - int counter=0; + int counter = 0; #endif if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { diff --git a/tests/libtest/lib552.c b/tests/libtest/lib552.c index 9cae45993..e42ba34f9 100644 --- a/tests/libtest/lib552.c +++ b/tests/libtest/lib552.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -40,7 +40,7 @@ void dump(const char *text, size_t i; size_t c; - unsigned int width=0x10; + unsigned int width = 0x10; if(nohex) /* without the hex output, we can fit more on screen */ @@ -48,7 +48,7 @@ void dump(const char *text, fprintf(stream, "%s, %d bytes (0x%x)\n", text, (int)size, (int)size); - for(i=0; i<size; i+= width) { + for(i = 0; i<size; i+= width) { fprintf(stream, "%04x: ", (int)i); @@ -63,14 +63,14 @@ void dump(const char *text, for(c = 0; (c < width) && (i+c < size); c++) { /* check for 0D0A; if found, skip past and start a new line of output */ - if(nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) { + if(nohex && (i+c+1 < size) && ptr[i+c] == 0x0D && ptr[i+c+1] == 0x0A) { i+=(c+2-width); break; } fprintf(stream, "%c", - (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); + (ptr[i+c] >= 0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); /* check again for 0D0A, to avoid an extra \n if it's at width */ - if(nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) { + if(nohex && (i+c+2 < size) && ptr[i+c+1] == 0x0D && ptr[i+c+2] == 0x0A) { i+=(c+3-width); break; } @@ -182,7 +182,7 @@ int test(char *URL) test_setopt(curl, CURLOPT_VERBOSE, 1L); /* setup repeated data string */ - for(i=0; i < sizeof(databuf); ++i) + for(i = 0; i < sizeof(databuf); ++i) databuf[i] = fill[i % sizeof fill]; /* Post */ diff --git a/tests/libtest/lib553.c b/tests/libtest/lib553.c index 288f4c1d1..c06561e1d 100644 --- a/tests/libtest/lib553.c +++ b/tests/libtest/lib553.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -32,7 +32,7 @@ static size_t myreadfunc(void *ptr, size_t size, size_t nmemb, void *stream) { - static size_t total=POSTLEN; + static size_t total = POSTLEN; static char buf[1024]; (void)stream; @@ -60,7 +60,7 @@ int test(char *URL) CURL *curl; CURLcode res = CURLE_FAILED_INIT; int i; - struct curl_slist *headerlist=NULL, *hl; + struct curl_slist *headerlist = NULL, *hl; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); @@ -77,7 +77,7 @@ int test(char *URL) for(i = 0; i < NUM_HEADERS; i++) { int len = snprintf(buf, sizeof(buf), "Header%d: ", i); memset(&buf[len], 'A', SIZE_HEADERS); - buf[len + SIZE_HEADERS]=0; /* zero terminate */ + buf[len + SIZE_HEADERS] = 0; /* zero terminate */ hl = curl_slist_append(headerlist, buf); if(!hl) goto test_cleanup; diff --git a/tests/libtest/lib554.c b/tests/libtest/lib554.c index 083746243..936d0a10a 100644 --- a/tests/libtest/lib554.c +++ b/tests/libtest/lib554.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -67,11 +67,11 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) static int once(char *URL, bool oldstyle) { CURL *curl; - CURLcode res=CURLE_OK; + CURLcode res = CURLE_OK; CURLFORMcode formrc; - struct curl_httppost *formpost=NULL; - struct curl_httppost *lastptr=NULL; + struct curl_httppost *formpost = NULL; + struct curl_httppost *lastptr = NULL; struct WriteThis pooh; struct WriteThis pooh2; diff --git a/tests/libtest/lib555.c b/tests/libtest/lib555.c index 8156a95e7..464f6e0b0 100644 --- a/tests/libtest/lib555.c +++ b/tests/libtest/lib555.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -77,9 +77,9 @@ int test(char *URL) { int res = 0; CURL *curl = NULL; - int counter=0; + int counter = 0; CURLM *m = NULL; - int running=1; + int running = 1; start_test_timing(); diff --git a/tests/libtest/lib557.c b/tests/libtest/lib557.c index c718be4ee..df63d9c6b 100644 --- a/tests/libtest/lib557.c +++ b/tests/libtest/lib557.c @@ -129,7 +129,7 @@ static int test_unsigned_short_formatting(void) #if (SIZEOF_SHORT == 1) - i=1; us_test[i].num = 0xFFU; us_test[i].expected = "256"; + i = 1; us_test[i].num = 0xFFU; us_test[i].expected = "256"; i++; us_test[i].num = 0xF0U; us_test[i].expected = "240"; i++; us_test[i].num = 0x0FU; us_test[i].expected = "15"; @@ -146,7 +146,7 @@ static int test_unsigned_short_formatting(void) #elif (SIZEOF_SHORT == 2) - i=1; us_test[i].num = 0xFFFFU; us_test[i].expected = "65535"; + i = 1; us_test[i].num = 0xFFFFU; us_test[i].expected = "65535"; i++; us_test[i].num = 0xFF00U; us_test[i].expected = "65280"; i++; us_test[i].num = 0x00FFU; us_test[i].expected = "255"; @@ -167,7 +167,7 @@ static int test_unsigned_short_formatting(void) #elif (SIZEOF_SHORT == 4) - i=1; us_test[i].num = 0xFFFFFFFFU; us_test[i].expected = "4294967295"; + i = 1; us_test[i].num = 0xFFFFFFFFU; us_test[i].expected = "4294967295"; i++; us_test[i].num = 0xFFFF0000U; us_test[i].expected = "4294901760"; i++; us_test[i].num = 0x0000FFFFU; us_test[i].expected = "65535"; @@ -201,9 +201,9 @@ static int test_unsigned_short_formatting(void) #endif - for(i=1; i<=num_ushort_tests; i++) { + for(i = 1; i <= num_ushort_tests; i++) { - for(j=0; j<BUFSZ; j++) + for(j = 0; j<BUFSZ; j++) us_test[i].result[j] = 'X'; us_test[i].result[BUFSZ-1] = '\0'; @@ -236,7 +236,7 @@ static int test_signed_short_formatting(void) #if (SIZEOF_SHORT == 1) - i=1; ss_test[i].num = 0x7F; ss_test[i].expected = "127"; + i = 1; ss_test[i].num = 0x7F; ss_test[i].expected = "127"; i++; ss_test[i].num = 0x70; ss_test[i].expected = "112"; i++; ss_test[i].num = 0x07; ss_test[i].expected = "7"; @@ -261,7 +261,7 @@ static int test_signed_short_formatting(void) #elif (SIZEOF_SHORT == 2) - i=1; ss_test[i].num = 0x7FFF; ss_test[i].expected = "32767"; + i = 1; ss_test[i].num = 0x7FFF; ss_test[i].expected = "32767"; i++; ss_test[i].num = 0x7FFE; ss_test[i].expected = "32766"; i++; ss_test[i].num = 0x7FFD; ss_test[i].expected = "32765"; i++; ss_test[i].num = 0x7F00; ss_test[i].expected = "32512"; @@ -304,7 +304,7 @@ static int test_signed_short_formatting(void) #elif (SIZEOF_SHORT == 4) - i=1; ss_test[i].num = 0x7FFFFFFF; ss_test[i].expected = "2147483647"; + i = 1; ss_test[i].num = 0x7FFFFFFF; ss_test[i].expected = "2147483647"; i++; ss_test[i].num = 0x7FFFFFFE; ss_test[i].expected = "2147483646"; i++; ss_test[i].num = 0x7FFFFFFD; ss_test[i].expected = "2147483645"; i++; ss_test[i].num = 0x7FFF0000; ss_test[i].expected = "2147418112"; @@ -371,9 +371,9 @@ static int test_signed_short_formatting(void) #endif - for(i=1; i<=num_sshort_tests; i++) { + for(i = 1; i <= num_sshort_tests; i++) { - for(j=0; j<BUFSZ; j++) + for(j = 0; j<BUFSZ; j++) ss_test[i].result[j] = 'X'; ss_test[i].result[BUFSZ-1] = '\0'; @@ -406,7 +406,7 @@ static int test_unsigned_int_formatting(void) #if (SIZEOF_INT == 2) - i=1; ui_test[i].num = 0xFFFFU; ui_test[i].expected = "65535"; + i = 1; ui_test[i].num = 0xFFFFU; ui_test[i].expected = "65535"; i++; ui_test[i].num = 0xFF00U; ui_test[i].expected = "65280"; i++; ui_test[i].num = 0x00FFU; ui_test[i].expected = "255"; @@ -427,7 +427,7 @@ static int test_unsigned_int_formatting(void) #elif (SIZEOF_INT == 4) - i=1; ui_test[i].num = 0xFFFFFFFFU; ui_test[i].expected = "4294967295"; + i = 1; ui_test[i].num = 0xFFFFFFFFU; ui_test[i].expected = "4294967295"; i++; ui_test[i].num = 0xFFFF0000U; ui_test[i].expected = "4294901760"; i++; ui_test[i].num = 0x0000FFFFU; ui_test[i].expected = "65535"; @@ -462,7 +462,7 @@ static int test_unsigned_int_formatting(void) #elif (SIZEOF_INT == 8) /* !checksrc! disable LONGLINE all */ - i=1; ui_test[i].num = 0xFFFFFFFFFFFFFFFFU; ui_test[i].expected = "18446744073709551615"; + i = 1; ui_test[i].num = 0xFFFFFFFFFFFFFFFFU; ui_test[i].expected = "18446744073709551615"; i++; ui_test[i].num = 0xFFFFFFFF00000000U; ui_test[i].expected = "18446744069414584320"; i++; ui_test[i].num = 0x00000000FFFFFFFFU; ui_test[i].expected = "4294967295"; @@ -521,9 +521,9 @@ static int test_unsigned_int_formatting(void) #endif - for(i=1; i<=num_uint_tests; i++) { + for(i = 1; i <= num_uint_tests; i++) { - for(j=0; j<BUFSZ; j++) + for(j = 0; j<BUFSZ; j++) ui_test[i].result[j] = 'X'; ui_test[i].result[BUFSZ-1] = '\0'; @@ -556,7 +556,7 @@ static int test_signed_int_formatting(void) #if (SIZEOF_INT == 2) - i=1; si_test[i].num = 0x7FFF; si_test[i].expected = "32767"; + i = 1; si_test[i].num = 0x7FFF; si_test[i].expected = "32767"; i++; si_test[i].num = 0x7FFE; si_test[i].expected = "32766"; i++; si_test[i].num = 0x7FFD; si_test[i].expected = "32765"; i++; si_test[i].num = 0x7F00; si_test[i].expected = "32512"; @@ -599,7 +599,7 @@ static int test_signed_int_formatting(void) #elif (SIZEOF_INT == 4) - i=1; si_test[i].num = 0x7FFFFFFF; si_test[i].expected = "2147483647"; + i = 1; si_test[i].num = 0x7FFFFFFF; si_test[i].expected = "2147483647"; i++; si_test[i].num = 0x7FFFFFFE; si_test[i].expected = "2147483646"; i++; si_test[i].num = 0x7FFFFFFD; si_test[i].expected = "2147483645"; i++; si_test[i].num = 0x7FFF0000; si_test[i].expected = "2147418112"; @@ -666,7 +666,7 @@ static int test_signed_int_formatting(void) #elif (SIZEOF_INT == 8) - i=1; si_test[i].num = 0x7FFFFFFFFFFFFFFF; si_test[i].expected = "9223372036854775807"; + i = 1; si_test[i].num = 0x7FFFFFFFFFFFFFFF; si_test[i].expected = "9223372036854775807"; i++; si_test[i].num = 0x7FFFFFFFFFFFFFFE; si_test[i].expected = "9223372036854775806"; i++; si_test[i].num = 0x7FFFFFFFFFFFFFFD; si_test[i].expected = "9223372036854775805"; i++; si_test[i].num = 0x7FFFFFFF00000000; si_test[i].expected = "9223372032559808512"; @@ -749,9 +749,9 @@ static int test_signed_int_formatting(void) #endif - for(i=1; i<=num_sint_tests; i++) { + for(i = 1; i <= num_sint_tests; i++) { - for(j=0; j<BUFSZ; j++) + for(j = 0; j<BUFSZ; j++) si_test[i].result[j] = 'X'; si_test[i].result[BUFSZ-1] = '\0'; @@ -784,7 +784,7 @@ static int test_unsigned_long_formatting(void) #if (SIZEOF_LONG == 2) - i=1; ul_test[i].num = 0xFFFFUL; ul_test[i].expected = "65535"; + i = 1; ul_test[i].num = 0xFFFFUL; ul_test[i].expected = "65535"; i++; ul_test[i].num = 0xFF00UL; ul_test[i].expected = "65280"; i++; ul_test[i].num = 0x00FFUL; ul_test[i].expected = "255"; @@ -805,7 +805,7 @@ static int test_unsigned_long_formatting(void) #elif (SIZEOF_LONG == 4) - i=1; ul_test[i].num = 0xFFFFFFFFUL; ul_test[i].expected = "4294967295"; + i = 1; ul_test[i].num = 0xFFFFFFFFUL; ul_test[i].expected = "4294967295"; i++; ul_test[i].num = 0xFFFF0000UL; ul_test[i].expected = "4294901760"; i++; ul_test[i].num = 0x0000FFFFUL; ul_test[i].expected = "65535"; @@ -839,7 +839,7 @@ static int test_unsigned_long_formatting(void) #elif (SIZEOF_LONG == 8) - i=1; ul_test[i].num = 0xFFFFFFFFFFFFFFFFUL; ul_test[i].expected = "18446744073709551615"; + i = 1; ul_test[i].num = 0xFFFFFFFFFFFFFFFFUL; ul_test[i].expected = "18446744073709551615"; i++; ul_test[i].num = 0xFFFFFFFF00000000UL; ul_test[i].expected = "18446744069414584320"; i++; ul_test[i].num = 0x00000000FFFFFFFFUL; ul_test[i].expected = "4294967295"; @@ -898,9 +898,9 @@ static int test_unsigned_long_formatting(void) #endif - for(i=1; i<=num_ulong_tests; i++) { + for(i = 1; i <= num_ulong_tests; i++) { - for(j=0; j<BUFSZ; j++) + for(j = 0; j<BUFSZ; j++) ul_test[i].result[j] = 'X'; ul_test[i].result[BUFSZ-1] = '\0'; @@ -933,7 +933,7 @@ static int test_signed_long_formatting(void) #if (SIZEOF_LONG == 2) - i=1; sl_test[i].num = 0x7FFFL; sl_test[i].expected = "32767"; + i = 1; sl_test[i].num = 0x7FFFL; sl_test[i].expected = "32767"; i++; sl_test[i].num = 0x7FFEL; sl_test[i].expected = "32766"; i++; sl_test[i].num = 0x7FFDL; sl_test[i].expected = "32765"; i++; sl_test[i].num = 0x7F00L; sl_test[i].expected = "32512"; @@ -976,7 +976,7 @@ static int test_signed_long_formatting(void) #elif (SIZEOF_LONG == 4) - i=1; sl_test[i].num = 0x7FFFFFFFL; sl_test[i].expected = "2147483647"; + i = 1; sl_test[i].num = 0x7FFFFFFFL; sl_test[i].expected = "2147483647"; i++; sl_test[i].num = 0x7FFFFFFEL; sl_test[i].expected = "2147483646"; i++; sl_test[i].num = 0x7FFFFFFDL; sl_test[i].expected = "2147483645"; i++; sl_test[i].num = 0x7FFF0000L; sl_test[i].expected = "2147418112"; @@ -1043,7 +1043,7 @@ static int test_signed_long_formatting(void) #elif (SIZEOF_LONG == 8) - i=1; sl_test[i].num = 0x7FFFFFFFFFFFFFFFL; sl_test[i].expected = "9223372036854775807"; + i = 1; sl_test[i].num = 0x7FFFFFFFFFFFFFFFL; sl_test[i].expected = "9223372036854775807"; i++; sl_test[i].num = 0x7FFFFFFFFFFFFFFEL; sl_test[i].expected = "9223372036854775806"; i++; sl_test[i].num = 0x7FFFFFFFFFFFFFFDL; sl_test[i].expected = "9223372036854775805"; i++; sl_test[i].num = 0x7FFFFFFF00000000L; sl_test[i].expected = "9223372032559808512"; @@ -1126,9 +1126,9 @@ static int test_signed_long_formatting(void) #endif - for(i=1; i<=num_slong_tests; i++) { + for(i = 1; i <= num_slong_tests; i++) { - for(j=0; j<BUFSZ; j++) + for(j = 0; j<BUFSZ; j++) sl_test[i].result[j] = 'X'; sl_test[i].result[BUFSZ-1] = '\0'; @@ -1161,7 +1161,7 @@ static int test_curl_off_t_formatting(void) #if (SIZEOF_CURL_OFF_T == 2) - i=1; co_test[i].num = MPRNT_OFF_T_C(0x7FFF); co_test[i].expected = "32767"; + i = 1; co_test[i].num = MPRNT_OFF_T_C(0x7FFF); co_test[i].expected = "32767"; i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFE); co_test[i].expected = "32766"; i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFD); co_test[i].expected = "32765"; i++; co_test[i].num = MPRNT_OFF_T_C(0x7F00); co_test[i].expected = "32512"; @@ -1204,7 +1204,7 @@ static int test_curl_off_t_formatting(void) #elif (SIZEOF_CURL_OFF_T == 4) - i=1; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFF); co_test[i].expected = "2147483647"; + i = 1; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFF); co_test[i].expected = "2147483647"; i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFE); co_test[i].expected = "2147483646"; i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFD); co_test[i].expected = "2147483645"; i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFF0000); co_test[i].expected = "2147418112"; @@ -1271,7 +1271,7 @@ static int test_curl_off_t_formatting(void) #elif (SIZEOF_CURL_OFF_T == 8) - i=1; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFFFFFFFFFF); co_test[i].expected = "9223372036854775807"; + i = 1; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFFFFFFFFFF); co_test[i].expected = "9223372036854775807"; i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFFFFFFFFFE); co_test[i].expected = "9223372036854775806"; i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFFFFFFFFFD); co_test[i].expected = "9223372036854775805"; i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFF00000000); co_test[i].expected = "9223372032559808512"; @@ -1354,9 +1354,9 @@ static int test_curl_off_t_formatting(void) #endif - for(i=1; i<=num_cofft_tests; i++) { + for(i = 1; i <= num_cofft_tests; i++) { - for(j=0; j<BUFSZ; j++) + for(j = 0; j<BUFSZ; j++) co_test[i].result[j] = 'X'; co_test[i].result[BUFSZ-1] = '\0'; diff --git a/tests/libtest/lib567.c b/tests/libtest/lib567.c index f9f55e3c0..64fb29afb 100644 --- a/tests/libtest/lib567.c +++ b/tests/libtest/lib567.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -30,7 +30,7 @@ int test(char *URL) { CURLcode res; CURL *curl; - struct curl_slist *custom_headers=NULL; + struct curl_slist *custom_headers = NULL; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib568.c b/tests/libtest/lib568.c index 0cdef812b..3bb53f61e 100644 --- a/tests/libtest/lib568.c +++ b/tests/libtest/lib568.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -47,8 +47,8 @@ int test(char *URL) FILE *sdpf = NULL; struct_stat file_info; char *stream_uri = NULL; - int request=1; - struct curl_slist *custom_headers=NULL; + int request = 1; + struct curl_slist *custom_headers = NULL; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib569.c b/tests/libtest/lib569.c index d7381d9a2..c18c882b9 100644 --- a/tests/libtest/lib569.c +++ b/tests/libtest/lib569.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -37,7 +37,7 @@ int test(char *URL) CURL *curl; char *stream_uri = NULL; char *rtsp_session_id; - int request=1; + int request = 1; int i; FILE *idfile = NULL; diff --git a/tests/libtest/lib570.c b/tests/libtest/lib570.c index 9d9b5a134..1756a8615 100644 --- a/tests/libtest/lib570.c +++ b/tests/libtest/lib570.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -32,7 +32,7 @@ int test(char *URL) { int res; CURL *curl; - int request=1; + int request = 1; char *stream_uri = NULL; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { diff --git a/tests/libtest/lib571.c b/tests/libtest/lib571.c index f19b643ff..21aa267b7 100644 --- a/tests/libtest/lib571.c +++ b/tests/libtest/lib571.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -103,7 +103,7 @@ int test(char *URL) int res; CURL *curl; char *stream_uri = NULL; - int request=1; + int request = 1; FILE *protofile = NULL; protofile = fopen(libtest_arg2, "wb"); diff --git a/tests/libtest/lib572.c b/tests/libtest/lib572.c index 47a9da535..a78c9358d 100644 --- a/tests/libtest/lib572.c +++ b/tests/libtest/lib572.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -47,8 +47,8 @@ int test(char *URL) FILE *paramsf = NULL; struct_stat file_info; char *stream_uri = NULL; - int request=1; - struct curl_slist *custom_headers=NULL; + int request = 1; + struct curl_slist *custom_headers = NULL; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib578.c b/tests/libtest/lib578.c index 41b23db34..1b4ee526c 100644 --- a/tests/libtest/lib578.c +++ b/tests/libtest/lib578.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -51,7 +51,7 @@ static int progress_callback(void *clientp, double dltotal, double dlnow, int test(char *URL) { CURL *curl; - CURLcode res=CURLE_OK; + CURLcode res = CURLE_OK; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib579.c b/tests/libtest/lib579.c index 61aa4f5df..cba4b1cb4 100644 --- a/tests/libtest/lib579.c +++ b/tests/libtest/lib579.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -87,7 +87,7 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) int test(char *URL) { CURL *curl; - CURLcode res=CURLE_OK; + CURLcode res = CURLE_OK; struct curl_slist *slist = NULL; struct WriteThis pooh; pooh.counter = 0; diff --git a/tests/libtest/lib586.c b/tests/libtest/lib586.c index 859ef3430..669f71c15 100644 --- a/tests/libtest/lib586.c +++ b/tests/libtest/lib586.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -99,7 +99,7 @@ static void *fire(void *ptr) CURLcode code; struct Tdata *tdata = (struct Tdata*)ptr; CURL *curl; - int i=0; + int i = 0; curl = curl_easy_init(); if(!curl) { @@ -185,7 +185,7 @@ int test(char *URL) res = 0; /* start treads */ - for(i=1; i<=THREADS; i++) { + for(i = 1; i <= THREADS; i++) { /* set thread data */ tdata.url = URL; @@ -218,7 +218,7 @@ int test(char *URL) /* try to free share, expect to fail because share is in use*/ printf("try SHARE_CLEANUP...\n"); scode = curl_share_cleanup(share); - if(scode==CURLSHE_OK) { + if(scode == CURLSHE_OK) { fprintf(stderr, "curl_share_cleanup succeed but error expected\n"); share = NULL; } @@ -235,7 +235,7 @@ test_cleanup: /* free share */ printf("SHARE_CLEANUP\n"); scode = curl_share_cleanup(share); - if(scode!=CURLSHE_OK) + if(scode != CURLSHE_OK) fprintf(stderr, "curl_share_cleanup failed, code errno %d\n", (int)scode); diff --git a/tests/libtest/lib589.c b/tests/libtest/lib589.c index 1e5ebb1e4..667459d0d 100644 --- a/tests/libtest/lib589.c +++ b/tests/libtest/lib589.c @@ -26,7 +26,7 @@ int test(char *URL) { CURL *curl; - CURLcode res=CURLE_OK; + CURLcode res = CURLE_OK; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); diff --git a/tests/libtest/lib599.c b/tests/libtest/lib599.c index 843fb2121..0e05977b5 100644 --- a/tests/libtest/lib599.c +++ b/tests/libtest/lib599.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -42,7 +42,7 @@ static int progress_callback(void *clientp, double dltotal, int test(char *URL) { CURL *curl; - CURLcode res=CURLE_OK; + CURLcode res = CURLE_OK; double content_length = 0.0; if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { diff --git a/tests/libtest/mk-lib1521.pl b/tests/libtest/mk-lib1521.pl index fe7e65d7a..6ded47220 100644 --- a/tests/libtest/mk-lib1521.pl +++ b/tests/libtest/mk-lib1521.pl @@ -143,9 +143,9 @@ int test(char *URL) void *conv_to_network_cb = NULL; void *conv_from_utf8_cb = NULL; void *interleavecb = NULL; - char *stringpointerextra=(char *)"moooo"; - struct curl_slist *slist=NULL; - struct curl_httppost *httppost=NULL; + char *stringpointerextra = (char *)"moooo"; + struct curl_slist *slist = NULL; + struct curl_httppost *httppost = NULL; curl_mime *mimepost = NULL; FILE *stream = stderr; struct data object; diff --git a/tests/server/fake_ntlm.c b/tests/server/fake_ntlm.c index 0d1b3e1b6..2d547ffae 100644 --- a/tests/server/fake_ntlm.c +++ b/tests/server/fake_ntlm.c @@ -78,7 +78,7 @@ static char *printable(char *inbuf, size_t inlength) return outbuf; } - for(i=0; i<inlength; i++) { + for(i = 0; i<inlength; i++) { if(o > outsize - (HEX_STR_LEN + 1)) { newsize = outsize + outincr; @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) } filename = test2file(testnum); - stream=fopen(filename, "rb"); + stream = fopen(filename, "rb"); if(!stream) { error = errno; logmsg("fopen() failed with error: %d %s", error, strerror(error)); @@ -204,7 +204,7 @@ int main(int argc, char *argv[]) } } - stream=fopen(filename, "rb"); + stream = fopen(filename, "rb"); if(!stream) { error = errno; logmsg("fopen() failed with error: %d %s", error, strerror(error)); @@ -224,7 +224,7 @@ int main(int argc, char *argv[]) while(fgets(buf, sizeof(buf), stdin)) { if(strcmp(buf, type1_input) == 0) { - stream=fopen(filename, "rb"); + stream = fopen(filename, "rb"); if(!stream) { error = errno; logmsg("fopen() failed with error: %d %s", error, strerror(error)); @@ -246,7 +246,7 @@ int main(int argc, char *argv[]) fflush(stdout); } else if(strncmp(buf, type3_input, strlen(type3_input)) == 0) { - stream=fopen(filename, "rb"); + stream = fopen(filename, "rb"); if(!stream) { error = errno; logmsg("fopen() failed with error: %d %s", error, strerror(error)); diff --git a/tests/server/resolve.c b/tests/server/resolve.c index 34f14e066..4cbdba6ec 100644 --- a/tests/server/resolve.c +++ b/tests/server/resolve.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -57,11 +57,11 @@ static bool use_ipv6 = FALSE; static const char *ipv_inuse = "IPv4"; -const char *serverlogfile=""; /* for a util.c function we don't use */ +const char *serverlogfile = ""; /* for a util.c function we don't use */ int main(int argc, char *argv[]) { - int arg=1; + int arg = 1; const char *host = NULL; int rc = 0; diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c index 120d65d52..8f004e120 100644 --- a/tests/server/rtspd.c +++ b/tests/server/rtspd.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -70,11 +70,11 @@ static int serverlogslocked = 0; #define REQBUFSIZ 150000 #define REQBUFSIZ_TXT "149999" -static long prevtestno=-1; /* previous test number we served */ -static long prevpartno=-1; /* previous part number we served */ -static bool prevbounce=FALSE; /* instructs the server to increase the part - number for a test in case the identical - testno+partno request shows up again */ +static long prevtestno = -1; /* previous test number we served */ +static long prevpartno = -1; /* previous part number we served */ +static bool prevbounce = FALSE; /* instructs the server to increase the part + number for a test in case the identical + testno+partno request shows up again */ #define RCMD_NORMALREQ 0 /* default request, use the tests file normally */ #define RCMD_IDLE 1 /* told to sit idle */ @@ -156,7 +156,7 @@ enum { DOCNUMBER_NOTHING = -7, DOCNUMBER_QUIT = -6, DOCNUMBER_BADCONNECT = -5, - DOCNUMBER_INTERNAL= -4, + DOCNUMBER_INTERNAL = -4, DOCNUMBER_CONNECT = -3, DOCNUMBER_WERULEZ = -2, DOCNUMBER_404 = -1 @@ -332,7 +332,7 @@ static void restore_signal_handlers(void) static int ProcessRequest(struct httprequest *req) { - char *line=&req->reqbuf[req->checkindex]; + char *line = &req->reqbuf[req->checkindex]; bool chunked = FALSE; static char request[REQUEST_KEYWORD_SIZE]; static char doc[MAXDOCNAMELEN]; @@ -421,7 +421,7 @@ static int ProcessRequest(struct httprequest *req) filename = test2file(req->testno); - stream=fopen(filename, "rb"); + stream = fopen(filename, "rb"); if(!stream) { error = errno; logmsg("fopen() failed with error: %d %s", error, strerror(error)); @@ -433,7 +433,7 @@ static int ProcessRequest(struct httprequest *req) else { char *cmd = NULL; size_t cmdsize = 0; - int num=0; + int num = 0; int rtp_channel = 0; int rtp_size = 0; @@ -596,7 +596,7 @@ static int ProcessRequest(struct httprequest *req) if(got_exit_signal) return 1; /* done */ - if((req->cl==0) && strncasecompare("Content-Length:", line, 15)) { + if((req->cl == 0) && strncasecompare("Content-Length:", line, 15)) { /* If we don't ignore content-length, we read it and we read the whole request including the body before we return. If we've been told to ignore the content-length, we will return as soon as all headers @@ -896,10 +896,10 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) ssize_t written; size_t count; const char *buffer; - char *ptr=NULL; + char *ptr = NULL; FILE *stream; - char *cmd=NULL; - size_t cmdsize=0; + char *cmd = NULL; + size_t cmdsize = 0; FILE *dump; bool persistant = TRUE; bool sendfailure = FALSE; @@ -988,7 +988,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) if(0 != req->partno) snprintf(partbuf, sizeof(partbuf), "data%ld", req->partno); - stream=fopen(filename, "rb"); + stream = fopen(filename, "rb"); if(!stream) { error = errno; logmsg("fopen() failed with error: %d %s", error, strerror(error)); @@ -1012,7 +1012,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) } /* re-open the same file again */ - stream=fopen(filename, "rb"); + stream = fopen(filename, "rb"); if(!stream) { error = errno; logmsg("fopen() failed with error: %d %s", error, strerror(error)); @@ -1140,7 +1140,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) char command[32]; int quarters; int num; - ptr=cmd; + ptr = cmd; do { if(2 == sscanf(ptr, "%31s %d", command, &num)) { if(!strcmp("wait", command)) { @@ -1194,7 +1194,7 @@ int main(int argc, char *argv[]) struct httprequest req; int rc; int error; - int arg=1; + int arg = 1; long pid; memset(&req, 0, sizeof(req)); diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index 6695d8486..f13ef208d 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -478,26 +478,26 @@ static void lograw(unsigned char *buffer, ssize_t len) ssize_t i; unsigned char *ptr = buffer; char *optr = data; - ssize_t width=0; + ssize_t width = 0; int left = sizeof(data); - for(i=0; i<len; i++) { + for(i = 0; i<len; i++) { switch(ptr[i]) { case '\n': snprintf(optr, left, "\\n"); width += 2; optr += 2; - left-=2; + left -= 2; break; case '\r': snprintf(optr, left, "\\r"); width += 2; optr += 2; - left-=2; + left -= 2; break; default: snprintf(optr, left, "%c", (ISGRAPH(ptr[i]) || - ptr[i]==0x20) ?ptr[i]:'.'); + ptr[i] == 0x20) ?ptr[i]:'.'); width++; optr++; left--; @@ -1200,7 +1200,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, int rc; int totdelay = 0; int maxretr = 10; - int delay= 20; + int delay = 20; int attempt = 0; int error = 0; @@ -1343,7 +1343,7 @@ int main(int argc, char *argv[]) bool juggle_again; int rc; int error; - int arg=1; + int arg = 1; enum sockmode mode = PASSIVE_LISTEN; /* default */ const char *addr = NULL; diff --git a/tests/server/sws.c b/tests/server/sws.c index bff30f212..5fcd6732b 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -81,11 +81,11 @@ static bool is_proxy = FALSE; #define REQBUFSIZ 150000 #define REQBUFSIZ_TXT "149999" -static long prevtestno=-1; /* previous test number we served */ -static long prevpartno=-1; /* previous part number we served */ -static bool prevbounce=FALSE; /* instructs the server to increase the part - number for a test in case the identical - testno+partno request shows up again */ +static long prevtestno = -1; /* previous test number we served */ +static long prevpartno = -1; /* previous part number we served */ +static bool prevbounce = FALSE; /* instructs the server to increase the part + number for a test in case the identical + testno+partno request shows up again */ #define RCMD_NORMALREQ 0 /* default request, use the tests file normally */ #define RCMD_IDLE 1 /* told to sit idle */ @@ -359,7 +359,7 @@ static int parse_servercmd(struct httprequest *req) filename = test2file(req->testno); - stream=fopen(filename, "rb"); + stream = fopen(filename, "rb"); if(!stream) { error = errno; logmsg("fopen() failed with error: %d %s", error, strerror(error)); @@ -372,7 +372,7 @@ static int parse_servercmd(struct httprequest *req) char *orgcmd = NULL; char *cmd = NULL; size_t cmdsize = 0; - int num=0; + int num = 0; /* get the custom server control "commands" */ error = getpart(&orgcmd, &cmdsize, "reply", "servercmd", stream); @@ -456,7 +456,7 @@ static int parse_servercmd(struct httprequest *req) static int ProcessRequest(struct httprequest *req) { - char *line=&req->reqbuf[req->checkindex]; + char *line = &req->reqbuf[req->checkindex]; bool chunked = FALSE; static char request[REQUEST_KEYWORD_SIZE]; static char doc[MAXDOCNAMELEN]; @@ -552,7 +552,7 @@ static int ProcessRequest(struct httprequest *req) if(sscanf(req->reqbuf, "CONNECT %" MAXDOCNAMELEN_TXT "s HTTP/%d.%d", doc, &prot_major, &prot_minor) == 3) { char *portp = NULL; - unsigned long part=0; + unsigned long part = 0; snprintf(logbuf, sizeof(logbuf), "Received a CONNECT %s HTTP/%d.%d request", @@ -711,7 +711,7 @@ static int ProcessRequest(struct httprequest *req) if(got_exit_signal) return 1; /* done */ - if((req->cl==0) && strncasecompare("Content-Length:", line, 15)) { + if((req->cl == 0) && strncasecompare("Content-Length:", line, 15)) { /* If we don't ignore content-length, we read it and we read the whole request including the body before we return. If we've been told to ignore the content-length, we will return as soon as all headers @@ -858,7 +858,7 @@ static void storerequest(const char *reqbuf, size_t totalsize) size_t written; size_t writeleft; FILE *dump; - const char *dumpfile=is_proxy?REQUEST_PROXY_DUMP:REQUEST_DUMP; + const char *dumpfile = is_proxy?REQUEST_PROXY_DUMP:REQUEST_DUMP; if(reqbuf == NULL) return; @@ -1044,10 +1044,10 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) ssize_t written; size_t count; const char *buffer; - char *ptr=NULL; + char *ptr = NULL; FILE *stream; - char *cmd=NULL; - size_t cmdsize=0; + char *cmd = NULL; + size_t cmdsize = 0; FILE *dump; bool persistant = TRUE; bool sendfailure = FALSE; @@ -1118,7 +1118,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) /* select the <data> tag for "normal" requests and the <connect> one for CONNECT requests (within the <reply> section) */ - const char *section= req->connect_request?"connect":"data"; + const char *section = req->connect_request?"connect":"data"; if(req->partno) snprintf(partbuf, sizeof(partbuf), "%s%ld", section, req->partno); @@ -1127,7 +1127,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) logmsg("Send response test%ld section <%s>", req->testno, partbuf); - stream=fopen(filename, "rb"); + stream = fopen(filename, "rb"); if(!stream) { error = errno; logmsg("fopen() failed with error: %d %s", error, strerror(error)); @@ -1150,7 +1150,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) } /* re-open the same file again */ - stream=fopen(filename, "rb"); + stream = fopen(filename, "rb"); if(!stream) { error = errno; logmsg("fopen() failed with error: %d %s", error, strerror(error)); @@ -1266,7 +1266,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) char command[32]; int quarters; int num; - ptr=cmd; + ptr = cmd; do { if(2 == sscanf(ptr, "%31s %d", command, &num)) { if(!strcmp("wait", command)) { @@ -1436,7 +1436,7 @@ static void http_connect(curl_socket_t *infdp, int max_tunnel_idx; /* CTRL or DATA */ int loop; int i; - int timeout_count=0; + int timeout_count = 0; /* primary tunnel client endpoint already connected */ clientfd[CTRL] = *infdp; @@ -1526,7 +1526,7 @@ static void http_connect(curl_socket_t *infdp, if(rc > 0) { /* socket action */ bool tcp_fin_wr; - timeout_count=0; + timeout_count = 0; if(got_exit_signal) break; @@ -1974,7 +1974,7 @@ int main(int argc, char *argv[]) struct httprequest req; int rc = 0; int error; - int arg=1; + int arg = 1; long pid; const char *connecthost = "127.0.0.1"; const char *socket_type = "IPv4"; @@ -2319,7 +2319,7 @@ int main(int argc, char *argv[]) logmsg("====> Client disconnect %d", req.connmon); if(req.connmon) { - const char *keepopen="[DISCONNECT]\n"; + const char *keepopen = "[DISCONNECT]\n"; storerequest(keepopen, strlen(keepopen)); } diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index df01eb782..1932ea411 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -515,7 +515,7 @@ static void read_ahead(struct testcase *test, } else { if(test->rcount) { - c=test->rptr[0]; + c = test->rptr[0]; test->rptr++; test->rcount--; } @@ -571,9 +571,9 @@ static ssize_t write_behind(struct testcase *test, int convert) char outfile[256]; snprintf(outfile, sizeof(outfile), "log/upload.%ld", test->testno); #ifdef WIN32 - test->ofile=open(outfile, O_CREAT|O_RDWR|O_BINARY, 0777); + test->ofile = open(outfile, O_CREAT|O_RDWR|O_BINARY, 0777); #else - test->ofile=open(outfile, O_CREAT|O_RDWR, 0777); + test->ofile = open(outfile, O_CREAT|O_RDWR, 0777); #endif if(test->ofile == -1) { logmsg("Couldn't create and/or open file %s for upload!", outfile); @@ -1074,7 +1074,7 @@ static int parse_servercmd(struct testcase *req) filename = test2file(req->testno); - stream=fopen(filename, "rb"); + stream = fopen(filename, "rb"); if(!stream) { error = errno; logmsg("fopen() failed with error: %d %s", error, strerror(error)); @@ -1086,7 +1086,7 @@ static int parse_servercmd(struct testcase *req) char *orgcmd = NULL; char *cmd = NULL; size_t cmdsize = 0; - int num=0; + int num = 0; /* get the custom server control "commands" */ error = getpart(&orgcmd, &cmdsize, "reply", "servercmd", stream); @@ -1192,7 +1192,7 @@ static int validate_access(struct testcase *test, snprintf(partbuf, sizeof(partbuf), "data%ld", partno); if(file) { - FILE *stream=fopen(file, "rb"); + FILE *stream = fopen(file, "rb"); if(!stream) { error = errno; logmsg("fopen() failed with error: %d %s", error, strerror(error)); diff --git a/tests/server/util.c b/tests/server/util.c index 42e585349..1bbd89a3c 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -81,15 +81,15 @@ char *data_to_hex(char *data, size_t len) if(len > 255) len = 255; - for(i=0; i < len; i++) { + for(i = 0; i < len; i++) { if((data[i] >= 0x20) && (data[i] < 0x7f)) *optr++ = *iptr++; else { snprintf(optr, 4, "%%%02x", *iptr++); - optr+=3; + optr += 3; } } - *optr=0; /* in case no sprintf was used */ + *optr = 0; /* in case no sprintf was used */ return buf; } @@ -189,7 +189,7 @@ void win32_cleanup(void) #endif /* USE_WINSOCK */ /* set by the main code to point to where the test dir is */ -const char *path="."; +const char *path = "."; char *test2file(long testno) { diff --git a/tests/unit/unit1300.c b/tests/unit/unit1300.c index 8ec32a8c9..c64fadef9 100644 --- a/tests/unit/unit1300.c +++ b/tests/unit/unit1300.c @@ -145,7 +145,7 @@ UNITTEST_START * 3: "new" head's previous will be NULL */ - head=llist.head; + head = llist.head; abort_unless(head, "llist.head is NULL"); element_next = head->next; llist_size = Curl_llist_count(&llist); diff --git a/tests/unit/unit1303.c b/tests/unit/unit1303.c index 13fb0e05c..75a8e59c2 100644 --- a/tests/unit/unit1303.c +++ b/tests/unit/unit1303.c @@ -138,7 +138,7 @@ UNITTEST_START data->progress.t_startop.tv_sec = BASE; data->progress.t_startop.tv_usec = 0; - for(i=0; i < sizeof(run)/sizeof(run[0]); i++) { + for(i = 0; i < sizeof(run)/sizeof(run[0]); i++) { NOW(run[i].now_s, run[i].now_us); TIMEOUTS(run[i].timeout_ms, run[i].connecttimeout_ms); timeout = Curl_timeleft(data, &now, run[i].connecting); diff --git a/tests/unit/unit1309.c b/tests/unit/unit1309.c index 9d1e70d27..cb533e70b 100644 --- a/tests/unit/unit1309.c +++ b/tests/unit/unit1309.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2011, 2017, 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 @@ -43,7 +43,7 @@ static void splayprint(struct Curl_tree * t, int d, char output) return; splayprint(t->larger, d+1, output); - for(i=0; i<d; i++) + for(i = 0; i<d; i++) if(output) printf(" "); @@ -52,7 +52,7 @@ static void splayprint(struct Curl_tree * t, int d, char output) (long)t->key.tv_usec, i); } - for(count=0, node = t->samen; node != t; node = node->samen, count++) + for(count = 0, node = t->samen; node != t; node = node->samen, count++) ; if(output) { diff --git a/tests/unit/unit1323.c b/tests/unit/unit1323.c index 65dd3d287..7bb4cca40 100644 --- a/tests/unit/unit1323.c +++ b/tests/unit/unit1323.c @@ -49,7 +49,7 @@ UNITTEST_START }; size_t i; - for(i=0; i < sizeof(tests)/sizeof(tests[0]); i++) { + for(i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) { time_t result = curlx_tvdiff(tests[i].first, tests[i].second); if(result != tests[i].result) { printf("%d.%06u to %d.%06u got %d, but expected %d\n", diff --git a/tests/unit/unit1395.c b/tests/unit/unit1395.c index 13ea97bc4..527f28142 100644 --- a/tests/unit/unit1395.c +++ b/tests/unit/unit1395.c @@ -43,7 +43,7 @@ struct dotdot { UNITTEST_START unsigned int i; - int fails=0; + int fails = 0; const struct dotdot pairs[] = { { "/a/b/c/./../../g", "/a/g" }, { "mid/content=5/../6", "mid/6" }, @@ -74,7 +74,7 @@ UNITTEST_START { ".", "" }, }; - for(i=0; i < sizeof(pairs)/sizeof(pairs[0]); i++) { + for(i = 0; i < sizeof(pairs)/sizeof(pairs[0]); i++) { char *out = Curl_dedotdotify(pairs[i].input); abort_unless(out != NULL, "returned NULL!"); diff --git a/tests/unit/unit1396.c b/tests/unit/unit1396.c index 9fba1f634..4dd25b40d 100644 --- a/tests/unit/unit1396.c +++ b/tests/unit/unit1396.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -81,7 +81,7 @@ UNITTEST_START hnd = curl_easy_init(); abort_unless(hnd != NULL, "returned NULL!"); - for(i=0; list1[i].in; i++) { + for(i = 0; list1[i].in; i++) { int outlen; char *out = curl_easy_unescape(hnd, list1[i].in, list1[i].inlen, @@ -97,7 +97,7 @@ UNITTEST_START curl_free(out); } - for(i=0; list2[i].in; i++) { + for(i = 0; list2[i].in; i++) { int outlen; char *out = curl_easy_escape(hnd, list2[i].in, list2[i].inlen); abort_unless(out != NULL, "returned NULL!"); diff --git a/tests/unit/unit1398.c b/tests/unit/unit1398.c index 9491c46c5..b7260195a 100644 --- a/tests/unit/unit1398.c +++ b/tests/unit/unit1398.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, 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 @@ -30,7 +30,7 @@ UNITTEST_START int rc; char buf[3] = {'b', 'u', 'g'}; -const char *str="bug"; +const char *str = "bug"; int width = 3; char output[24]; |