From 5de8b1d6e35e4c802cc25f7cbca7ba1154965b13 Mon Sep 17 00:00:00 2001 From: "Schanzenbach, Martin" Date: Sun, 24 Jun 2018 18:48:33 +0200 Subject: fix https://gnunet.org/bugs/view.php?id=4904 --- src/ats/ats_api_performance.c | 8 ++++---- src/ats/plugin_ats_proportional.c | 2 +- src/datastore/plugin_datastore_sqlite.c | 3 ++- src/fs/fs_api.c | 2 +- src/include/gnunet_common.h | 6 ++++++ src/testbed/testbed_api_topology.c | 4 ++-- 6 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c index caa1da034..0c196ea43 100644 --- a/src/ats/ats_api_performance.c +++ b/src/ats/ats_api_performance.c @@ -849,7 +849,7 @@ GNUNET_ATS_performance_change_preference (struct GNUNET_ATS_PerformanceHandle *p count = 0; va_start(ap, peer); while (GNUNET_ATS_PREFERENCE_END != - (kind = va_arg (ap, enum GNUNET_ATS_PreferenceKind) )) + (kind = GNUNET_VA_ARG_ENUM (ap, GNUNET_ATS_PreferenceKind) )) { switch (kind) { @@ -875,7 +875,7 @@ GNUNET_ATS_performance_change_preference (struct GNUNET_ATS_PerformanceHandle *p count = 0; va_start(ap, peer); while (GNUNET_ATS_PREFERENCE_END != (kind = - va_arg (ap, enum GNUNET_ATS_PreferenceKind) )) + GNUNET_VA_ARG_ENUM (ap, GNUNET_ATS_PreferenceKind) )) { pi[count].preference_kind = htonl (kind); switch (kind) @@ -927,7 +927,7 @@ GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph, count = 0; va_start(ap, scope); while (GNUNET_ATS_PREFERENCE_END != - (kind = va_arg (ap, enum GNUNET_ATS_PreferenceKind) )) + (kind = GNUNET_VA_ARG_ENUM (ap, GNUNET_ATS_PreferenceKind) )) { switch (kind) { @@ -954,7 +954,7 @@ GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph, count = 0; va_start(ap, scope); while (GNUNET_ATS_PREFERENCE_END != (kind = - va_arg (ap, enum GNUNET_ATS_PreferenceKind) )) + GNUNET_VA_ARG_ENUM (ap, GNUNET_ATS_PreferenceKind) )) { pi[count].preference_kind = htonl (kind); switch (kind) diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c index b4ca70dc7..08fb7a9a7 100644 --- a/src/ats/plugin_ats_proportional.c +++ b/src/ats/plugin_ats_proportional.c @@ -1005,7 +1005,7 @@ GAS_proportional_address_property_changed (void *solver, static void GAS_proportional_address_add (void *solver, struct ATS_Address *address, - enum GNUNET_ATS_Network_Type network) + uint32_t network) { struct GAS_PROPORTIONAL_Handle *s = solver; struct Network *net; diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index 80960c676..fc1706400 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c @@ -855,9 +855,10 @@ sqlite_plugin_get_zero_anonymity (void *cls, void *proc_cls) { struct Plugin *plugin = cls; + uint32_t type32 = type; struct GNUNET_SQ_QueryParam params[] = { GNUNET_SQ_query_param_uint64 (&next_uid), - GNUNET_SQ_query_param_uint32 (&type), + GNUNET_SQ_query_param_uint32 (&type32), GNUNET_SQ_query_param_end }; diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c index 0857110b1..9b783ba93 100644 --- a/src/fs/fs_api.c +++ b/src/fs/fs_api.c @@ -3112,7 +3112,7 @@ GNUNET_FS_start (const struct GNUNET_CONFIGURATION_Handle *cfg, ret->max_parallel_requests = DEFAULT_MAX_PARALLEL_REQUESTS; ret->avg_block_latency = GNUNET_TIME_UNIT_MINUTES; /* conservative starting point */ va_start (ap, flags); - while (GNUNET_FS_OPTIONS_END != (opt = va_arg (ap, enum GNUNET_FS_OPTIONS))) + while (GNUNET_FS_OPTIONS_END != (opt = GNUNET_VA_ARG_ENUM (ap,GNUNET_FS_OPTIONS))) { switch (opt) { diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index ec91b35ad..b4bf5b0aa 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -24,6 +24,7 @@ * * @author Christian Grothoff * @author Nils Durner + * @author Martin Schanzenbach * * @defgroup logging Logging * @see [Documentation](https://gnunet.org/logging) @@ -111,6 +112,11 @@ extern "C" #endif #endif +/** + * wrap va_arg for enums + */ +#define GNUNET_VA_ARG_ENUM(va,X) ((enum X) va_arg (va, int)) + /** * @ingroup logging * define #GNUNET_EXTRA_LOGGING if using this header outside the GNUnet source diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c index 51a8b979a..114055a07 100644 --- a/src/testbed/testbed_api_topology.c +++ b/src/testbed/testbed_api_topology.c @@ -1391,7 +1391,7 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, } do { - secondary_option = va_arg (va, enum GNUNET_TESTBED_TopologyOption); + secondary_option = GNUNET_VA_ARG_ENUM (va, GNUNET_TESTBED_TopologyOption); switch (secondary_option) { @@ -1552,7 +1552,7 @@ GNUNET_TESTBED_underlay_construct_ (int num_peers, tc.type = TOPOLOGYCONTEXT_TYPE_UNDERLAY; underlay = &tc.u.underlay; va_start (vargs, cls); - topology = va_arg (vargs, enum GNUNET_TESTBED_TopologyOption); + topology = GNUNET_VA_ARG_ENUM (vargs, GNUNET_TESTBED_TopologyOption); switch (topology) { case GNUNET_TESTBED_TOPOLOGY_LINE: -- cgit v1.2.3