[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 148/163: examples: fix -Wformat warnings
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 148/163: examples: fix -Wformat warnings |
Date: |
Sun, 05 Aug 2018 12:37:54 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 5bd8c389a3625e5c3eed265942d4c5b1e7e5d117
Author: Marcel Raad <address@hidden>
AuthorDate: Sun Jul 8 16:44:32 2018 +0200
examples: fix -Wformat warnings
When size_t is not a typedef for unsigned long (as usually the case on
Windows), GCC emits -Wformat warnings when using lu and lx format
specifiers with size_t. Silence them with explicit casts to
unsigned long.
Closes https://github.com/curl/curl/pull/2721
---
docs/examples/debug.c | 4 ++--
docs/examples/getinmemory.c | 2 +-
docs/examples/http2-download.c | 4 ++--
docs/examples/http2-serverpush.c | 8 ++++----
docs/examples/http2-upload.c | 4 ++--
docs/examples/multi-debugcallback.c | 4 ++--
6 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/docs/examples/debug.c b/docs/examples/debug.c
index 48a3fd5d0..79250146d 100644
--- a/docs/examples/debug.c
+++ b/docs/examples/debug.c
@@ -45,11 +45,11 @@ void dump(const char *text,
width = 0x40;
fprintf(stream, "%s, %10.10lu bytes (0x%8.8lx)\n",
- text, size, size);
+ text, (unsigned long)size, (unsigned long)size);
for(i = 0; i<size; i += width) {
- fprintf(stream, "%4.4lx: ", i);
+ fprintf(stream, "%4.4lx: ", (unsigned long)i);
if(!nohex) {
/* hex not disabled, show it */
diff --git a/docs/examples/getinmemory.c b/docs/examples/getinmemory.c
index 776bbd21a..f5e8942f8 100644
--- a/docs/examples/getinmemory.c
+++ b/docs/examples/getinmemory.c
@@ -100,7 +100,7 @@ int main(void)
* Do something nice with it!
*/
- printf("%lu bytes retrieved\n", chunk.size);
+ printf("%lu bytes retrieved\n", (unsigned long)chunk.size);
}
/* cleanup curl stuff */
diff --git a/docs/examples/http2-download.c b/docs/examples/http2-download.c
index cc9ff2b58..3425d302f 100644
--- a/docs/examples/http2-download.c
+++ b/docs/examples/http2-download.c
@@ -72,11 +72,11 @@ void dump(const char *text, int num, unsigned char *ptr,
size_t size,
width = 0x40;
fprintf(stderr, "%d %s, %lu bytes (0x%lx)\n",
- num, text, size, size);
+ num, text, (unsigned long)size, (unsigned long)size);
for(i = 0; i<size; i += width) {
- fprintf(stderr, "%4.4lx: ", i);
+ fprintf(stderr, "%4.4lx: ", (unsigned long)i);
if(!nohex) {
/* hex not disabled, show it */
diff --git a/docs/examples/http2-serverpush.c b/docs/examples/http2-serverpush.c
index 94c8db975..66abb0f9b 100644
--- a/docs/examples/http2-serverpush.c
+++ b/docs/examples/http2-serverpush.c
@@ -52,11 +52,11 @@ void dump(const char *text, unsigned char *ptr, size_t size,
width = 0x40;
fprintf(stderr, "%s, %lu bytes (0x%lx)\n",
- text, size, size);
+ text, (unsigned long)size, (unsigned long)size);
for(i = 0; i<size; i += width) {
- fprintf(stderr, "%4.4lx: ", i);
+ fprintf(stderr, "%4.4lx: ", (unsigned long)i);
if(!nohex) {
/* hex not disabled, show it */
@@ -181,11 +181,11 @@ static int server_push_callback(CURL *parent,
curl_easy_setopt(easy, CURLOPT_WRITEDATA, out);
fprintf(stderr, "**** push callback approves stream %u, got %lu headers!\n",
- count, num_headers);
+ count, (unsigned long)num_headers);
for(i = 0; i<num_headers; i++) {
headp = curl_pushheader_bynum(headers, i);
- fprintf(stderr, "**** header %lu: %s\n", i, headp);
+ fprintf(stderr, "**** header %lu: %s\n", (unsigned long)i, headp);
}
headp = curl_pushheader_byname(headers, ":path");
diff --git a/docs/examples/http2-upload.c b/docs/examples/http2-upload.c
index 827d172ed..06ff04091 100644
--- a/docs/examples/http2-upload.c
+++ b/docs/examples/http2-upload.c
@@ -73,11 +73,11 @@ void dump(const char *text, int num, unsigned char *ptr,
size_t size,
width = 0x40;
fprintf(stderr, "%d %s, %lu bytes (0x%lx)\n",
- num, text, size, size);
+ num, text, (unsigned long)size, (unsigned long)size);
for(i = 0; i<size; i += width) {
- fprintf(stderr, "%4.4lx: ", i);
+ fprintf(stderr, "%4.4lx: ", (unsigned long)i);
if(!nohex) {
/* hex not disabled, show it */
diff --git a/docs/examples/multi-debugcallback.c
b/docs/examples/multi-debugcallback.c
index 5de3ff3e5..11ab74b71 100644
--- a/docs/examples/multi-debugcallback.c
+++ b/docs/examples/multi-debugcallback.c
@@ -52,11 +52,11 @@ void dump(const char *text,
width = 0x40;
fprintf(stream, "%s, %10.10lu bytes (0x%8.8lx)\n",
- text, size, size);
+ text, (unsigned long)size, (unsigned long)size);
for(i = 0; i<size; i += width) {
- fprintf(stream, "%4.4lx: ", i);
+ fprintf(stream, "%4.4lx: ", (unsigned long)i);
if(!nohex) {
/* hex not disabled, show it */
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 140/163: libssh: include line number in state change debug messages, (continued)
- [GNUnet-SVN] [gnurl] 140/163: libssh: include line number in state change debug messages, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 106/163: CURLOPT_INTERFACE.3: interface names not supported on Windows, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 122/163: getnameinfo: not used, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 100/163: docs/RELEASE-PROCEDURE.md: renamed to use .md extension, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 111/163: multi: fix crash due to dangling entry in connect-pending list, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 116/163: include/README: remove "hacking" advice, not the right place, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 118/163: GOVERNANCE: add maintainer details/duties, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 113/163: netrc: use a larger buffer, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 103/163: maketgz: delete .bak files, fix indentation, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 97/163: CURLOPT_HTTPAUTH.3: CURLAUTH_BEARER was added in 7.61.0, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 148/163: examples: fix -Wformat warnings,
gnunet <=
- [GNUnet-SVN] [gnurl] 131/163: telnet: fix clang warnings, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 137/163: RELEASE-NOTES: synced, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 127/163: RELEASE-NOTES: synced, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 147/163: smtp: use the upload buffer size for scratch buffer malloc, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 125/163: CURLINFO_TLS_SSL_PTR.3: improve the example, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 160/163: gnurl: post-merge adjustments, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 152/163: schannel: fix -Wsign-compare warning, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 151/163: schannel: workaround for wrong function signature in w32api, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 158/163: release: 7.61.0, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 155/163: CMake: remove redundant and old end-of-block syntax, gnunet, 2018/08/05