From b9dee3a1d54637a8c8d0e3ef34bd6b8bfd0d1bac Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 5 Sep 2019 11:11:00 +0200 Subject: [PATCH] fix compiler warnings, add assertions --- src/pq/pq_query_helper.c | 22 ++++++++++++++++++++++ src/util/crypto.c | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c index 31336b796..574245d57 100644 --- a/src/pq/pq_query_helper.c +++ b/src/pq/pq_query_helper.c @@ -54,6 +54,10 @@ qconv_amount_nbo (void *cls, const struct TALER_AmountNBO *amount = data; unsigned int off = 0; + (void) cls; + (void) scratch; + (void) scratch_length; + GNUNET_assert (sizeof (struct TALER_AmountNBO) == data_len); GNUNET_assert (2 == param_length); param_values[off] = (void *) &amount->value; param_lengths[off] = sizeof (amount->value); @@ -112,6 +116,11 @@ qconv_amount (void *cls, const struct TALER_Amount *amount_hbo = data; struct TALER_AmountNBO *amount; + (void) cls; + (void) scratch; + (void) scratch_length; + GNUNET_assert (2 == param_length); + GNUNET_assert (sizeof (struct TALER_AmountNBO) == data_len); amount = GNUNET_new (struct TALER_AmountNBO); scratch[0] = amount; TALER_amount_hton (amount, @@ -175,6 +184,10 @@ qconv_json (void *cls, const json_t *json = data; char *str; + (void) cls; + (void) data_len; + GNUNET_assert (1 == param_length); + GNUNET_assert (scratch_length > 0); str = json_dumps (json, JSON_COMPACT); if (NULL == str) return -1; @@ -230,6 +243,10 @@ qconv_round_time (void *cls, struct GNUNET_TIME_Absolute tmp; struct GNUNET_TIME_AbsoluteNBO *buf; + (void) cls; + GNUNET_assert (1 == param_length); + GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len); + GNUNET_assert (scratch_length > 0); GNUNET_break (NULL == cls); if (1 != param_length) return -1; @@ -293,6 +310,11 @@ qconv_round_time_abs (void *cls, const struct GNUNET_TIME_AbsoluteNBO *at = data; struct GNUNET_TIME_Absolute tmp; + (void) cls; + (void) scratch; + (void) scratch_length; + GNUNET_assert (1 == param_length); + GNUNET_assert (sizeof (struct GNUNET_TIME_AbsoluteNBO) == data_len); GNUNET_break (NULL == cls); if (1 != param_length) return -1; diff --git a/src/util/crypto.c b/src/util/crypto.c index 4ddd86c1a..b21397914 100644 --- a/src/util/crypto.c +++ b/src/util/crypto.c @@ -45,6 +45,8 @@ fatal_error_handler (void *cls, int wtf, const char *msg) { + (void) cls; + (void) wtf; fprintf (stderr, "Fatal error in libgcrypt: %s\n", msg);