]> granicus.if.org Git - curl/commitdiff
examples: Fix format specifiers
authorRikard Falkeborn <rikard.falkeborn@gmail.com>
Sun, 6 May 2018 17:44:03 +0000 (19:44 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 14 May 2018 07:43:15 +0000 (09:43 +0200)
Closes #2561

docs/examples/debug.c
docs/examples/getinmemory.c
docs/examples/http2-download.c
docs/examples/http2-serverpush.c
docs/examples/http2-upload.c
docs/examples/multi-debugcallback.c
docs/examples/sessioninfo.c

index 554eb3ec6079eef5668d3a94c554f48176841b9b..48a3fd5d0d046eb76d827df772ed650bbd353fc2 100644 (file)
@@ -44,12 +44,12 @@ void dump(const char *text,
     /* without the hex output, we can fit more on screen */
     width = 0x40;
 
-  fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n",
-          text, (long)size, (long)size);
+  fprintf(stream, "%s, %10.10lu bytes (0x%8.8lx)\n",
+          text, size, size);
 
   for(i = 0; i<size; i += width) {
 
-    fprintf(stream, "%4.4lx: ", (long)i);
+    fprintf(stream, "%4.4lx: ", i);
 
     if(!nohex) {
       /* hex not disabled, show it */
index fb794783894c476c6e72974cd5168fa7e8d1a627..776bbd21aef1f6b2c08024165dfc397cf7375827 100644 (file)
@@ -100,7 +100,7 @@ int main(void)
      * Do something nice with it!
      */
 
-    printf("%lu bytes retrieved\n", (long)chunk.size);
+    printf("%lu bytes retrieved\n", chunk.size);
   }
 
   /* cleanup curl stuff */
index 8515663f1e929924dece2b8bb8b2eb09166d8f61..cc9ff2b5839448243074ce8d362f860d1001bb22 100644 (file)
@@ -71,12 +71,12 @@ void dump(const char *text, int num, unsigned char *ptr, size_t size,
     /* without the hex output, we can fit more on screen */
     width = 0x40;
 
-  fprintf(stderr, "%d %s, %ld bytes (0x%lx)\n",
-          num, text, (long)size, (long)size);
+  fprintf(stderr, "%d %s, %lu bytes (0x%lx)\n",
+          num, text, size, size);
 
   for(i = 0; i<size; i += width) {
 
-    fprintf(stderr, "%4.4lx: ", (long)i);
+    fprintf(stderr, "%4.4lx: ", i);
 
     if(!nohex) {
       /* hex not disabled, show it */
index 0162a8f8a39a71082532739357415a131748239b..94c8db975f6527a9e103555e7e48ed6d08e99ff0 100644 (file)
@@ -51,12 +51,12 @@ void dump(const char *text, unsigned char *ptr, size_t size,
     /* without the hex output, we can fit more on screen */
     width = 0x40;
 
-  fprintf(stderr, "%s, %ld bytes (0x%lx)\n",
-          text, (long)size, (long)size);
+  fprintf(stderr, "%s, %lu bytes (0x%lx)\n",
+          text, size, size);
 
   for(i = 0; i<size; i += width) {
 
-    fprintf(stderr, "%4.4lx: ", (long)i);
+    fprintf(stderr, "%4.4lx: ", i);
 
     if(!nohex) {
       /* hex not disabled, show it */
@@ -180,12 +180,12 @@ static int server_push_callback(CURL *parent,
   /* write to this file */
   curl_easy_setopt(easy, CURLOPT_WRITEDATA, out);
 
-  fprintf(stderr, "**** push callback approves stream %u, got %d headers!\n",
-          count, (int)num_headers);
+  fprintf(stderr, "**** push callback approves stream %u, got %lu headers!\n",
+          count, num_headers);
 
   for(i = 0; i<num_headers; i++) {
     headp = curl_pushheader_bynum(headers, i);
-    fprintf(stderr, "**** header %u: %s\n", (int)i, headp);
+    fprintf(stderr, "**** header %lu: %s\n", i, headp);
   }
 
   headp = curl_pushheader_byname(headers, ":path");
index 2a08b89db0fafa2f354f20e8b1ab6f52ce563d70..827d172ed5e8fd47e044df97fedcad28f1784359 100644 (file)
@@ -72,12 +72,12 @@ void dump(const char *text, int num, unsigned char *ptr, size_t size,
     /* without the hex output, we can fit more on screen */
     width = 0x40;
 
-  fprintf(stderr, "%d %s, %ld bytes (0x%lx)\n",
-          num, text, (long)size, (long)size);
+  fprintf(stderr, "%d %s, %lu bytes (0x%lx)\n",
+          num, text, size, size);
 
   for(i = 0; i<size; i += width) {
 
-    fprintf(stderr, "%4.4lx: ", (long)i);
+    fprintf(stderr, "%4.4lx: ", i);
 
     if(!nohex) {
       /* hex not disabled, show it */
index abb0de685a98853ff3764530731c065f6c30e742..5de3ff3e59ac12a821f2379d4fdd4c256abd9f19 100644 (file)
@@ -51,12 +51,12 @@ void dump(const char *text,
     /* without the hex output, we can fit more on screen */
     width = 0x40;
 
-  fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n",
-          text, (long)size, (long)size);
+  fprintf(stream, "%s, %10.10lu bytes (0x%8.8lx)\n",
+          text, size, size);
 
   for(i = 0; i<size; i += width) {
 
-    fprintf(stream, "%4.4lx: ", (long)i);
+    fprintf(stream, "%4.4lx: ", i);
 
     if(!nohex) {
       /* hex not disabled, show it */
index 024a0e12da99e6da7d9a9dd86b2d10d01ebc82a3..86a813a04b59dfceca4124586eba4b773bb8fee7 100644 (file)
@@ -63,7 +63,7 @@ static size_t wrfu(void *ptr, size_t size, size_t nmemb, void *stream)
                gnutls_x509_crt_import(cert, &chainp[i], GNUTLS_X509_FMT_DER)) {
               if(GNUTLS_E_SUCCESS ==
                  gnutls_x509_crt_print(cert, GNUTLS_CRT_PRINT_FULL, &dn)) {
-                fprintf(stderr, "Certificate #%d: %.*s", i, dn.size, dn.data);
+                fprintf(stderr, "Certificate #%u: %.*s", i, dn.size, dn.data);
 
                 gnutls_free(dn.data);
               }