From 6b84438d9a9220fb75cbaae9d6fe6c3edb6d425e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 9 Sep 2017 23:09:06 +0200 Subject: code style: use spaces around equals signs --- docs/examples/10-at-a-time.c | 4 +- docs/examples/anyauthput.c | 4 +- docs/examples/cacertinmem.c | 44 ++++++++++----------- docs/examples/curlx.c | 67 ++++++++++++++++--------------- docs/examples/debug.c | 12 +++--- docs/examples/evhiperfifo.c | 24 +++++------ docs/examples/fopen.c | 79 +++++++++++++++++++------------------ docs/examples/ftpget.c | 8 ++-- docs/examples/ftpsget.c | 8 ++-- docs/examples/ftpupload.c | 4 +- docs/examples/ghiper.c | 42 ++++++++++---------- docs/examples/hiperfifo.c | 22 +++++------ docs/examples/htmltidy.c | 6 +-- docs/examples/http2-download.c | 16 ++++---- docs/examples/http2-serverpush.c | 14 +++---- docs/examples/http2-upload.c | 16 ++++---- docs/examples/httpput.c | 4 +- docs/examples/multi-app.c | 10 ++--- docs/examples/multi-debugcallback.c | 12 +++--- docs/examples/multithread.c | 4 +- docs/examples/opensslthreadlock.c | 4 +- docs/examples/postinmemory.c | 4 +- docs/examples/sendrecv.c | 4 +- docs/examples/sftpget.c | 8 ++-- docs/examples/simplepost.c | 4 +- docs/examples/simplessl.c | 4 +- docs/examples/smooth-gtk-thread.c | 6 +-- docs/examples/synctime.c | 6 +-- docs/examples/threaded-ssl.c | 14 +++---- docs/examples/usercertinmem.c | 4 +- 30 files changed, 231 insertions(+), 227 deletions(-) (limited to 'docs/examples') 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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; j0) { - 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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=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 with extensive * reference to original curl example code @@ -58,9 +58,9 @@ #include 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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, , et al. + * Copyright (C) 1998 - 2015, 2017, Daniel Stenberg, , 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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=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=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=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, et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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; ieasy_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, et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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=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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , 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; iproxy_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 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 { -- cgit v1.2.3