aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-09-17 11:53:55 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2021-09-17 11:53:55 +0300
commitbf1993237a6ad5b01f3e4b5051d15316fc8e03d7 (patch)
tree4f1e8639487f61fdee19e67e0c891be32f9cf30f /src
parentbd3325c9240e65e556fd42f0fd6692ef60b558ff (diff)
downloadlibmicrohttpd-bf1993237a6ad5b01f3e4b5051d15316fc8e03d7.tar.gz
libmicrohttpd-bf1993237a6ad5b01f3e4b5051d15316fc8e03d7.zip
Use type specifiers for printf() from inttypes.h
This should improve compatibility with various C libs.
Diffstat (limited to 'src')
-rw-r--r--src/examples/benchmark.c9
-rw-r--r--src/examples/benchmark_https.c9
-rw-r--r--src/examples/connection_close.c15
-rw-r--r--src/microhttpd/daemon.c16
-rw-r--r--src/microhttpd/test_postprocessor_large.c2
-rw-r--r--src/microhttpd/test_postprocessor_md.c4
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 @@
25#include "platform.h" 25#include "platform.h"
26#include <microhttpd.h> 26#include <microhttpd.h>
27 27
28#ifdef HAVE_INTTYPES_H
29#include <inttypes.h>
30#endif /* HAVE_INTTYPES_H */
31#ifndef PRIu64
32#define PRIu64 "llu"
33#endif /* ! PRIu64 */
34
28#if defined(MHD_CPU_COUNT) && (MHD_CPU_COUNT + 0) < 2 35#if defined(MHD_CPU_COUNT) && (MHD_CPU_COUNT + 0) < 2
29#undef MHD_CPU_COUNT 36#undef MHD_CPU_COUNT
30#endif 37#endif
@@ -87,7 +94,7 @@ completed_callback (void *cls,
87 if (delta < SMALL) 94 if (delta < SMALL)
88 small_deltas[delta]++; 95 small_deltas[delta]++;
89 else 96 else
90 fprintf (stdout, "D: %llu 1\n", (unsigned long long) delta); 97 fprintf (stdout, "D: %" PRIu64 " 1\n", delta);
91 free (tv); 98 free (tv);
92} 99}
93 100
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 @@
25#include "platform.h" 25#include "platform.h"
26#include <microhttpd.h> 26#include <microhttpd.h>
27 27
28#ifdef HAVE_INTTYPES_H
29#include <inttypes.h>
30#endif /* HAVE_INTTYPES_H */
31#ifndef PRIu64
32#define PRIu64 "llu"
33#endif /* ! PRIu64 */
34
28#if defined(MHD_CPU_COUNT) && (MHD_CPU_COUNT + 0) < 2 35#if defined(MHD_CPU_COUNT) && (MHD_CPU_COUNT + 0) < 2
29#undef MHD_CPU_COUNT 36#undef MHD_CPU_COUNT
30#endif 37#endif
@@ -87,7 +94,7 @@ completed_callback (void *cls,
87 if (delta < SMALL) 94 if (delta < SMALL)
88 small_deltas[delta]++; 95 small_deltas[delta]++;
89 else 96 else
90 fprintf (stdout, "D: %llu 1\n", (unsigned long long) delta); 97 fprintf (stdout, "D: %" PRIu64 " 1\n", delta);
91 free (tv); 98 free (tv);
92} 99}
93 100
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 @@
25#include "platform.h" 25#include "platform.h"
26#include <microhttpd.h> 26#include <microhttpd.h>
27 27
28#ifdef HAVE_INTTYPES_H
29#include <inttypes.h>
30#endif /* HAVE_INTTYPES_H */
31#ifndef PRIu64
32#define PRIu64 "llu"
33#endif /* ! PRIu64 */
34
28#define PAGE \ 35#define PAGE \
29 "<html><head><title>libmicrohttpd demo</title></head><body>libmicrohttpd demo</body></html>" 36 "<html><head><title>libmicrohttpd demo</title></head><body>libmicrohttpd demo</body></html>"
30 37
@@ -72,8 +79,8 @@ request_completed (void *cls,
72 enum MHD_RequestTerminationCode toe) 79 enum MHD_RequestTerminationCode toe)
73{ 80{
74 fprintf (stderr, 81 fprintf (stderr,
75 "%llu - RC: %d\n", 82 "%" PRIu64 " - RC: %d\n",
76 (unsigned long long) __rdtsc (), 83 (uint64_t) __rdtsc (),
77 toe); 84 toe);
78} 85}
79 86
@@ -85,8 +92,8 @@ connection_completed (void *cls,
85 enum MHD_ConnectionNotificationCode toe) 92 enum MHD_ConnectionNotificationCode toe)
86{ 93{
87 fprintf (stderr, 94 fprintf (stderr,
88 "%llu - CC: %d\n", 95 "%" PRIu64 " - CC: %d\n",
89 (unsigned long long) __rdtsc (), 96 (uint64_t) __rdtsc (),
90 toe); 97 toe);
91} 98}
92 99
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)
1382#ifdef HAVE_MESSAGES 1382#ifdef HAVE_MESSAGES
1383 MHD_DLOG (daemon, 1383 MHD_DLOG (daemon,
1384 _ ("Failed to forward to application " 1384 _ ("Failed to forward to application "
1385 MHD_UNSIGNED_LONG_LONG_PRINTF \ 1385 "%" PRIu64 \
1386 " bytes of data received from remote side: application shut down socket.\n"), 1386 " bytes of data received from remote side: application shut down socket.\n"),
1387 (MHD_UNSIGNED_LONG_LONG) urh->in_buffer_used); 1387 (uint64_t) urh->in_buffer_used);
1388#endif 1388#endif
1389 1389
1390 } 1390 }
@@ -1550,9 +1550,9 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1550 MHD_DLOG (daemon, 1550 MHD_DLOG (daemon,
1551 _ ( 1551 _ (
1552 "Failed to forward to remote client " 1552 "Failed to forward to remote client "
1553 MHD_UNSIGNED_LONG_LONG_PRINTF \ 1553 "%" PRIu64 \
1554 " bytes of data received from application: %s\n"), 1554 " bytes of data received from application: %s\n"),
1555 (MHD_UNSIGNED_LONG_LONG) urh->out_buffer_used, 1555 (uint64_t) urh->out_buffer_used,
1556 gnutls_strerror (res)); 1556 gnutls_strerror (res));
1557#endif 1557#endif
1558 /* Discard any data unsent to remote. */ 1558 /* Discard any data unsent to remote. */
@@ -1620,9 +1620,9 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1620 MHD_DLOG (daemon, 1620 MHD_DLOG (daemon,
1621 _ ( 1621 _ (
1622 "Failed to forward to application " 1622 "Failed to forward to application "
1623 MHD_UNSIGNED_LONG_LONG_PRINTF \ 1623 "%" PRIu64 \
1624 " bytes of data received from remote side: %s\n"), 1624 " bytes of data received from remote side: %s\n"),
1625 (MHD_UNSIGNED_LONG_LONG) urh->in_buffer_used, 1625 (uint64_t) urh->in_buffer_used,
1626 MHD_socket_strerr_ (err)); 1626 MHD_socket_strerr_ (err));
1627#endif 1627#endif
1628 /* Discard any data received form remote. */ 1628 /* Discard any data received form remote. */
@@ -1676,9 +1676,9 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1676 MHD_DLOG (daemon, 1676 MHD_DLOG (daemon,
1677 _ ( 1677 _ (
1678 "Failed to forward to remote client " 1678 "Failed to forward to remote client "
1679 MHD_UNSIGNED_LONG_LONG_PRINTF \ 1679 "%" PRIu64 \
1680 " bytes of data received from application: daemon shut down.\n"), 1680 " bytes of data received from application: daemon shut down.\n"),
1681 (MHD_UNSIGNED_LONG_LONG) urh->out_buffer_used); 1681 (uint64_t) urh->out_buffer_used);
1682#endif 1682#endif
1683 /* Discard any data unsent to remote. */ 1683 /* Discard any data unsent to remote. */
1684 urh->out_buffer_used = 0; 1684 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,
47 (void) transfer_encoding; (void) data; (void) off; /* Unused. Silent compiler warning. */ 47 (void) transfer_encoding; (void) data; (void) off; /* Unused. Silent compiler warning. */
48#if 0 48#if 0
49 fprintf (stderr, 49 fprintf (stderr,
50 "VC: %llu %u `%s' `%s' `%s' `%s' `%.*s'\n", 50 "VC: %" PRIu64 " %u `%s' `%s' `%s' `%s' `%.*s'\n",
51 off, size, 51 off, size,
52 key, filename, content_type, transfer_encoding, size, data); 52 key, filename, content_type, transfer_encoding, size, data);
53#endif 53#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,
130 (void) content_type; (void) transfer_encoding; 130 (void) content_type; (void) transfer_encoding;
131 131
132#if DEBUG 132#if DEBUG
133 printf ("%s\t%s@ %llu\n", 133 printf ("%s\t%s@ %" PRIu64 "\n",
134 key, 134 key,
135 data, 135 data,
136 (unsigned long long) off); 136 off);
137#endif 137#endif
138 if (0 == strcmp (key, "text")) 138 if (0 == strcmp (key, "text"))
139 { 139 {