From e0ff55875db012dc8bc8daa02f1f71e872ccc347 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 13 Oct 2020 12:25:31 +0200 Subject: enable more format string warnings --- src/include/gnunet_common.h | 15 ++++++++++++--- src/util/client.c | 2 +- src/util/service.c | 4 +++- 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index fcaae1026..21b87b0f5 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -488,7 +488,8 @@ void GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, const char *comp, const char *message, - ...); + ...) +__attribute__ ((format (printf, 3, 4))); #if ! defined(GNUNET_CULL_LOGGING) #define GNUNET_log_from(kind, comp, ...) \ @@ -1445,6 +1446,7 @@ GNUNET_is_zero_ (const void *a, memcpy (&(arr1) [(len1) - (len2)], _a2, (len2) * sizeof (*arr1)); \ } while (0) + /** * @ingroup memory * Like snprintf, just aborts if the buffer is of insufficient size. @@ -1456,7 +1458,11 @@ GNUNET_is_zero_ (const void *a, * @return number of bytes written to buf or negative value on error */ int -GNUNET_snprintf (char *buf, size_t size, const char *format, ...); +GNUNET_snprintf (char *buf, + size_t size, + const char *format, + ...) +__attribute__ ((format (printf, 3, 4))); /** @@ -1469,7 +1475,10 @@ GNUNET_snprintf (char *buf, size_t size, const char *format, ...); * @return number of bytes in "*buf" excluding 0-termination */ int -GNUNET_asprintf (char **buf, const char *format, ...); +GNUNET_asprintf (char **buf, + const char *format, + ...) +__attribute__ ((format (printf, 2, 3))); /* ************** internal implementations, use macros above! ************** */ diff --git a/src/util/client.c b/src/util/client.c index 86dabe664..2df439175 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -654,7 +654,7 @@ try_connect_using_address (void *cls, "Trying to connect using address `%s:%u'\n", GNUNET_a2s (addr, addrlen), - cstate->port); + (unsigned int) cstate->port); ap = GNUNET_malloc (sizeof(struct AddressProbe) + addrlen); ap->addr = (const struct sockaddr *) &ap[1]; GNUNET_memcpy (&ap[1], diff --git a/src/util/service.c b/src/util/service.c index ddd31181d..4c647430d 100644 --- a/src/util/service.c +++ b/src/util/service.c @@ -2120,7 +2120,9 @@ GNUNET_SERVICE_run_ (int argc, { clock_offset = skew_offset - skew_variance; GNUNET_TIME_set_offset (clock_offset); - LOG (GNUNET_ERROR_TYPE_DEBUG, "Skewing clock by %dll ms\n", clock_offset); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Skewing clock by %lld ms\n", + (long long) clock_offset); } GNUNET_RESOLVER_connect (sh.cfg); -- cgit v1.2.3