gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated: Use type specifiers for printf()


From: gnunet
Subject: [libmicrohttpd] branch master updated: Use type specifiers for printf() from inttypes.h
Date: Fri, 17 Sep 2021 10:54:11 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new bf199323 Use type specifiers for printf() from inttypes.h
bf199323 is described below

commit bf1993237a6ad5b01f3e4b5051d15316fc8e03d7
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Sep 17 11:53:55 2021 +0300

    Use type specifiers for printf() from inttypes.h
    
    This should improve compatibility with various C libs.
---
 src/examples/benchmark.c                  |  9 ++++++++-
 src/examples/benchmark_https.c            |  9 ++++++++-
 src/examples/connection_close.c           | 15 +++++++++++----
 src/microhttpd/daemon.c                   | 16 ++++++++--------
 src/microhttpd/test_postprocessor_large.c |  2 +-
 src/microhttpd/test_postprocessor_md.c    |  4 ++--
 6 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/src/examples/benchmark.c b/src/examples/benchmark.c
index 8a12704c..ae3100bb 100644
--- a/src/examples/benchmark.c
+++ b/src/examples/benchmark.c
@@ -25,6 +25,13 @@
 #include "platform.h"
 #include <microhttpd.h>
 
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif /* HAVE_INTTYPES_H */
+#ifndef PRIu64
+#define PRIu64  "llu"
+#endif /* ! PRIu64 */
+
 #if defined(MHD_CPU_COUNT) && (MHD_CPU_COUNT + 0) < 2
 #undef MHD_CPU_COUNT
 #endif
@@ -87,7 +94,7 @@ completed_callback (void *cls,
   if (delta < SMALL)
     small_deltas[delta]++;
   else
-    fprintf (stdout, "D: %llu 1\n", (unsigned long long) delta);
+    fprintf (stdout, "D: %" PRIu64 " 1\n", delta);
   free (tv);
 }
 
diff --git a/src/examples/benchmark_https.c b/src/examples/benchmark_https.c
index a5403307..d5051088 100644
--- a/src/examples/benchmark_https.c
+++ b/src/examples/benchmark_https.c
@@ -25,6 +25,13 @@
 #include "platform.h"
 #include <microhttpd.h>
 
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif /* HAVE_INTTYPES_H */
+#ifndef PRIu64
+#define PRIu64  "llu"
+#endif /* ! PRIu64 */
+
 #if defined(MHD_CPU_COUNT) && (MHD_CPU_COUNT + 0) < 2
 #undef MHD_CPU_COUNT
 #endif
@@ -87,7 +94,7 @@ completed_callback (void *cls,
   if (delta < SMALL)
     small_deltas[delta]++;
   else
-    fprintf (stdout, "D: %llu 1\n", (unsigned long long) delta);
+    fprintf (stdout, "D: %" PRIu64 " 1\n", delta);
   free (tv);
 }
 
diff --git a/src/examples/connection_close.c b/src/examples/connection_close.c
index b0314dea..5629a687 100644
--- a/src/examples/connection_close.c
+++ b/src/examples/connection_close.c
@@ -25,6 +25,13 @@
 #include "platform.h"
 #include <microhttpd.h>
 
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif /* HAVE_INTTYPES_H */
+#ifndef PRIu64
+#define PRIu64  "llu"
+#endif /* ! PRIu64 */
+
 #define PAGE \
   "<html><head><title>libmicrohttpd demo</title></head><body>libmicrohttpd 
demo</body></html>"
 
@@ -72,8 +79,8 @@ request_completed (void *cls,
                    enum MHD_RequestTerminationCode toe)
 {
   fprintf (stderr,
-           "%llu - RC: %d\n",
-           (unsigned long long) __rdtsc (),
+           "%" PRIu64 " - RC: %d\n",
+           (uint64_t) __rdtsc (),
            toe);
 }
 
@@ -85,8 +92,8 @@ connection_completed (void *cls,
                       enum MHD_ConnectionNotificationCode toe)
 {
   fprintf (stderr,
-           "%llu - CC: %d\n",
-           (unsigned long long) __rdtsc (),
+           "%" PRIu64 " - CC: %d\n",
+           (uint64_t) __rdtsc (),
            toe);
 }
 
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 3eed6619..310a919e 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1382,9 +1382,9 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
 #ifdef HAVE_MESSAGES
       MHD_DLOG (daemon,
                 _ ("Failed to forward to application "
-                   MHD_UNSIGNED_LONG_LONG_PRINTF \
+                   "%" PRIu64 \
                    " bytes of data received from remote side: application shut 
down socket.\n"),
-                (MHD_UNSIGNED_LONG_LONG) urh->in_buffer_used);
+                (uint64_t) urh->in_buffer_used);
 #endif
 
     }
@@ -1550,9 +1550,9 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
           MHD_DLOG (daemon,
                     _ (
                       "Failed to forward to remote client "
-                      MHD_UNSIGNED_LONG_LONG_PRINTF \
+                      "%" PRIu64 \
                       " bytes of data received from application: %s\n"),
-                    (MHD_UNSIGNED_LONG_LONG) urh->out_buffer_used,
+                    (uint64_t) urh->out_buffer_used,
                     gnutls_strerror (res));
 #endif
           /* Discard any data unsent to remote. */
@@ -1620,9 +1620,9 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
           MHD_DLOG (daemon,
                     _ (
                       "Failed to forward to application "
-                      MHD_UNSIGNED_LONG_LONG_PRINTF \
+                      "%" PRIu64 \
                       " bytes of data received from remote side: %s\n"),
-                    (MHD_UNSIGNED_LONG_LONG) urh->in_buffer_used,
+                    (uint64_t) urh->in_buffer_used,
                     MHD_socket_strerr_ (err));
 #endif
           /* Discard any data received form remote. */
@@ -1676,9 +1676,9 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
       MHD_DLOG (daemon,
                 _ (
                   "Failed to forward to remote client "
-                  MHD_UNSIGNED_LONG_LONG_PRINTF \
+                  "%" PRIu64 \
                   " bytes of data received from application: daemon shut 
down.\n"),
-                (MHD_UNSIGNED_LONG_LONG) urh->out_buffer_used);
+                (uint64_t) urh->out_buffer_used);
 #endif
     /* Discard any data unsent to remote. */
     urh->out_buffer_used = 0;
diff --git a/src/microhttpd/test_postprocessor_large.c 
b/src/microhttpd/test_postprocessor_large.c
index 38fe650b..4d5f1ece 100644
--- a/src/microhttpd/test_postprocessor_large.c
+++ b/src/microhttpd/test_postprocessor_large.c
@@ -47,7 +47,7 @@ value_checker (void *cls,
   (void) transfer_encoding; (void) data; (void) off;             /* Unused. 
Silent compiler warning. */
 #if 0
   fprintf (stderr,
-           "VC: %llu %u `%s' `%s' `%s' `%s' `%.*s'\n",
+           "VC: %" PRIu64 " %u `%s' `%s' `%s' `%s' `%.*s'\n",
            off, size,
            key, filename, content_type, transfer_encoding, size, data);
 #endif
diff --git a/src/microhttpd/test_postprocessor_md.c 
b/src/microhttpd/test_postprocessor_md.c
index 65703b48..b803abf4 100644
--- a/src/microhttpd/test_postprocessor_md.c
+++ b/src/microhttpd/test_postprocessor_md.c
@@ -130,10 +130,10 @@ post_data_iterator2 (void *cls,
   (void) content_type; (void) transfer_encoding;
 
 #if DEBUG
-  printf ("%s\t%s@ %llu\n",
+  printf ("%s\t%s@ %" PRIu64 "\n",
           key,
           data,
-          (unsigned long long) off);
+          off);
 #endif
   if (0 == strcmp (key, "text"))
   {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]