aboutsummaryrefslogtreecommitdiff
path: root/docs/examples
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-09-09 23:55:08 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-09-11 09:29:50 +0200
commite5743f08e7efb387bb39c0dc28f36838ece3bc1e (patch)
treeb0237e17762f3be2bb6f8cf53fea1491a2c731ad /docs/examples
parentca86006debc4570bbb3eacb71965c9d59be14084 (diff)
code style: use spaces around pluses
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/10-at-a-time.c4
-rw-r--r--docs/examples/chkspeed.c4
-rw-r--r--docs/examples/curlx.c4
-rw-r--r--docs/examples/debug.c20
-rw-r--r--docs/examples/fopen.c4
-rw-r--r--docs/examples/ghiper.c2
-rw-r--r--docs/examples/http2-download.c22
-rw-r--r--docs/examples/http2-serverpush.c22
-rw-r--r--docs/examples/http2-upload.c22
-rw-r--r--docs/examples/imap-multi.c4
-rw-r--r--docs/examples/multi-app.c2
-rw-r--r--docs/examples/multi-debugcallback.c22
-rw-r--r--docs/examples/multi-double.c4
-rw-r--r--docs/examples/multi-post.c2
-rw-r--r--docs/examples/pop3-multi.c4
-rw-r--r--docs/examples/smtp-multi.c4
-rw-r--r--docs/examples/synctime.c4
17 files changed, 80 insertions, 70 deletions
diff --git a/docs/examples/10-at-a-time.c b/docs/examples/10-at-a-time.c
index f7b6f463d..1da0ee210 100644
--- a/docs/examples/10-at-a-time.c
+++ b/docs/examples/10-at-a-time.c
@@ -162,9 +162,9 @@ int main(void)
T.tv_sec = L/1000;
T.tv_usec = (L%1000)*1000;
- if(0 > select(M+1, &R, &W, &E, &T)) {
+ if(0 > select(M + 1, &R, &W, &E, &T)) {
fprintf(stderr, "E: select(%i,,,,%li): %i: %s\n",
- M+1, L, errno, strerror(errno));
+ M + 1, L, errno, strerror(errno));
return EXIT_FAILURE;
}
}
diff --git a/docs/examples/chkspeed.c b/docs/examples/chkspeed.c
index de2056717..f3dd1e944 100644
--- a/docs/examples/chkspeed.c
+++ b/docs/examples/chkspeed.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
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
prttime = 1;
}
else if(strncasecmp(*argv, "-M=", 3) == 0) {
- long m = strtol((*argv)+3, NULL, 10);
+ long m = strtol((*argv) + 3, NULL, 10);
switch(m) {
case 1:
url = URL_1M;
diff --git a/docs/examples/curlx.c b/docs/examples/curlx.c
index c358556dc..c36beedfa 100644
--- a/docs/examples/curlx.c
+++ b/docs/examples/curlx.c
@@ -492,8 +492,8 @@ int main(int argc, char **argv)
/* pass our list of custom made headers */
- contenttype = malloc(15+strlen(mimetype));
- snprintf(contenttype, 15+strlen(mimetype), "Content-type: %s", mimetype);
+ contenttype = malloc(15 + strlen(mimetype));
+ snprintf(contenttype, 15 + strlen(mimetype), "Content-type: %s", mimetype);
headers = curl_slist_append(headers, contenttype);
curl_easy_setopt(p.curl, CURLOPT_HTTPHEADER, headers);
diff --git a/docs/examples/debug.c b/docs/examples/debug.c
index 3171cf9f0..554eb3ec6 100644
--- a/docs/examples/debug.c
+++ b/docs/examples/debug.c
@@ -47,30 +47,32 @@ 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);
if(!nohex) {
/* hex not disabled, show it */
for(c = 0; c < width; c++)
- if(i+c < size)
- fprintf(stream, "%02x ", ptr[i+c]);
+ if(i + c < size)
+ fprintf(stream, "%02x ", ptr[i + c]);
else
fputs(" ", stream);
}
- for(c = 0; (c < width) && (i+c < size); c++) {
+ 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) {
- i+=(c+2-width);
+ 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) {
- i+=(c+3-width);
+ 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/fopen.c b/docs/examples/fopen.c
index 5a7e6ad5b..d115cf396 100644
--- a/docs/examples/fopen.c
+++ b/docs/examples/fopen.c
@@ -189,7 +189,7 @@ static int fill_buffer(URL_FILE *file, size_t want)
else {
/* Note that on some platforms 'timeout' may be modified by select().
If you need access to the original value save a copy beforehand. */
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
}
switch(rc) {
@@ -398,7 +398,7 @@ char *url_fgets(char *ptr, size_t size, URL_FILE *file)
/* look for newline or eof */
for(loop = 0;loop < want;loop++) {
if(file->buffer[loop] == '\n') {
- want = loop+1;/* include newline */
+ want = loop + 1;/* include newline */
break;
}
}
diff --git a/docs/examples/ghiper.c b/docs/examples/ghiper.c
index 91c99e808..fd643fc3a 100644
--- a/docs/examples/ghiper.c
+++ b/docs/examples/ghiper.c
@@ -345,7 +345,7 @@ static gboolean fifo_cb(GIOChannel *ch, GIOCondition condition, gpointer data)
g_free(buf);
}
else {
- buf = g_malloc(BUF_SIZE+1);
+ buf = g_malloc(BUF_SIZE + 1);
while(TRUE) {
buf[BUF_SIZE]='\0';
g_io_channel_read_chars(ch, buf, BUF_SIZE, &len, &err);
diff --git a/docs/examples/http2-download.c b/docs/examples/http2-download.c
index 45fc9ff58..8515663f1 100644
--- a/docs/examples/http2-download.c
+++ b/docs/examples/http2-download.c
@@ -74,30 +74,32 @@ 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);
if(!nohex) {
/* hex not disabled, show it */
for(c = 0; c < width; c++)
- if(i+c < size)
- fprintf(stderr, "%02x ", ptr[i+c]);
+ if(i + c < size)
+ fprintf(stderr, "%02x ", ptr[i + c]);
else
fputs(" ", stderr);
}
- for(c = 0; (c < width) && (i+c < size); c++) {
+ 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) {
- i+=(c+2-width);
+ 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) {
- i+=(c+3-width);
+ if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
+ ptr[i + c + 2] == 0x0A) {
+ i += (c + 3 - width);
break;
}
}
@@ -269,7 +271,7 @@ int main(int argc, char **argv)
else {
/* Note that on some platforms 'timeout' may be modified by select().
If you need access to the original value save a copy beforehand. */
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
}
switch(rc) {
diff --git a/docs/examples/http2-serverpush.c b/docs/examples/http2-serverpush.c
index 8e8007520..0162a8f8a 100644
--- a/docs/examples/http2-serverpush.c
+++ b/docs/examples/http2-serverpush.c
@@ -54,30 +54,32 @@ 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);
if(!nohex) {
/* hex not disabled, show it */
for(c = 0; c < width; c++)
- if(i+c < size)
- fprintf(stderr, "%02x ", ptr[i+c]);
+ if(i + c < size)
+ fprintf(stderr, "%02x ", ptr[i + c]);
else
fputs(" ", stderr);
}
- for(c = 0; (c < width) && (i+c < size); c++) {
+ 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) {
- i+=(c+2-width);
+ 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) {
- i+=(c+3-width);
+ if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
+ ptr[i + c + 2] == 0x0A) {
+ i += (c + 3 - width);
break;
}
}
@@ -281,7 +283,7 @@ int main(void)
else {
/* Note that on some platforms 'timeout' may be modified by select().
If you need access to the original value save a copy beforehand. */
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
}
switch(rc) {
diff --git a/docs/examples/http2-upload.c b/docs/examples/http2-upload.c
index 2e0ecb3ce..d7aa320ed 100644
--- a/docs/examples/http2-upload.c
+++ b/docs/examples/http2-upload.c
@@ -75,30 +75,32 @@ 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);
if(!nohex) {
/* hex not disabled, show it */
for(c = 0; c < width; c++)
- if(i+c < size)
- fprintf(stderr, "%02x ", ptr[i+c]);
+ if(i + c < size)
+ fprintf(stderr, "%02x ", ptr[i + c]);
else
fputs(" ", stderr);
}
- for(c = 0; (c < width) && (i+c < size); c++) {
+ 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) {
- i+=(c+2-width);
+ 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) {
- i+=(c+3-width);
+ if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
+ ptr[i + c + 2] == 0x0A) {
+ i += (c + 3 - width);
break;
}
}
@@ -333,7 +335,7 @@ int main(int argc, char **argv)
else {
/* Note that on some platforms 'timeout' may be modified by select().
If you need access to the original value save a copy beforehand. */
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
}
switch(rc) {
diff --git a/docs/examples/imap-multi.c b/docs/examples/imap-multi.c
index 8cd4858c7..07d1b8b5a 100644
--- a/docs/examples/imap-multi.c
+++ b/docs/examples/imap-multi.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
@@ -144,7 +144,7 @@ int main(void)
else {
/* Note that on some platforms 'timeout' may be modified by select().
If you need access to the original value save a copy beforehand. */
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
}
if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
diff --git a/docs/examples/multi-app.c b/docs/examples/multi-app.c
index b87e34dc2..74b2a9426 100644
--- a/docs/examples/multi-app.c
+++ b/docs/examples/multi-app.c
@@ -130,7 +130,7 @@ int main(void)
else {
/* Note that on some platforms 'timeout' may be modified by select().
If you need access to the original value save a copy beforehand. */
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
}
switch(rc) {
diff --git a/docs/examples/multi-debugcallback.c b/docs/examples/multi-debugcallback.c
index 850491fb0..abb0de685 100644
--- a/docs/examples/multi-debugcallback.c
+++ b/docs/examples/multi-debugcallback.c
@@ -54,30 +54,32 @@ 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);
if(!nohex) {
/* hex not disabled, show it */
for(c = 0; c < width; c++)
- if(i+c < size)
- fprintf(stream, "%02x ", ptr[i+c]);
+ if(i + c < size)
+ fprintf(stream, "%02x ", ptr[i + c]);
else
fputs(" ", stream);
}
- for(c = 0; (c < width) && (i+c < size); c++) {
+ 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) {
- i+=(c+2-width);
+ 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) {
- i+=(c+3-width);
+ if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
+ ptr[i + c + 2] == 0x0A) {
+ i += (c + 3 - width);
break;
}
}
@@ -204,7 +206,7 @@ int main(void)
else {
/* Note that on some platforms 'timeout' may be modified by select().
If you need access to the original value save a copy beforehand. */
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
}
switch(rc) {
diff --git a/docs/examples/multi-double.c b/docs/examples/multi-double.c
index 4e50c7687..343453939 100644
--- a/docs/examples/multi-double.c
+++ b/docs/examples/multi-double.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
@@ -119,7 +119,7 @@ int main(void)
else {
/* Note that on some platforms 'timeout' may be modified by select().
If you need access to the original value save a copy beforehand. */
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
}
switch(rc) {
diff --git a/docs/examples/multi-post.c b/docs/examples/multi-post.c
index f3e592e55..93c78e98d 100644
--- a/docs/examples/multi-post.c
+++ b/docs/examples/multi-post.c
@@ -135,7 +135,7 @@ int main(void)
else {
/* Note that on some platforms 'timeout' may be modified by select().
If you need access to the original value save a copy beforehand. */
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
}
switch(rc) {
diff --git a/docs/examples/pop3-multi.c b/docs/examples/pop3-multi.c
index f932918ea..4b8788667 100644
--- a/docs/examples/pop3-multi.c
+++ b/docs/examples/pop3-multi.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
@@ -144,7 +144,7 @@ int main(void)
else {
/* Note that on some platforms 'timeout' may be modified by select().
If you need access to the original value save a copy beforehand. */
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
}
if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
diff --git a/docs/examples/smtp-multi.c b/docs/examples/smtp-multi.c
index b8951772c..bd70bdbc5 100644
--- a/docs/examples/smtp-multi.c
+++ b/docs/examples/smtp-multi.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
@@ -211,7 +211,7 @@ int main(void)
else {
/* Note that on some platforms 'timeout' may be modified by select().
If you need access to the original value save a copy beforehand. */
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
}
if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
diff --git a/docs/examples/synctime.c b/docs/examples/synctime.c
index 9b3a73467..e5cdfed3d 100644
--- a/docs/examples/synctime.c
+++ b/docs/examples/synctime.c
@@ -94,7 +94,7 @@
#define MAX_STRING 256
-#define MAX_STRING1 MAX_STRING+1
+#define MAX_STRING1 MAX_STRING + 1
#define SYNCTIME_UA "synctime/1.0"
@@ -160,7 +160,7 @@ size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
SYSTime.wMilliseconds = 500; /* adjust to midpoint, 0.5 sec */
for(i = 0; i<12; i++) {
if(strcmp(MthStr[i], TmpStr2) == 0) {
- SYSTime.wMonth = i+1;
+ SYSTime.wMonth = i + 1;
break;
}
}