X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fpsycstore%2Ftest_psycstore.c;h=f9a7ce9cac88dd68de1bf402e14e8ab651f5d285;hb=3aab63d5c50db0eb784d3b65b2bd989d3458c960;hp=266ee5c1de6a27b00d40ccad01885e4ac67b3451;hpb=29e6158507a0758192075ac6ece7ba8e75ddc49a;p=oweals%2Fgnunet.git diff --git a/src/psycstore/test_psycstore.c b/src/psycstore/test_psycstore.c index 266ee5c1d..f9a7ce9ca 100644 --- a/src/psycstore/test_psycstore.c +++ b/src/psycstore/test_psycstore.c @@ -54,7 +54,7 @@ static struct GNUNET_PSYCSTORE_OperationHandle *op; /** * Handle for task for timeout termination. */ -static struct GNUNET_SCHEDULER_Task * end_badly_task; +static struct GNUNET_SCHEDULER_Task *end_badly_task; static struct GNUNET_CRYPTO_EddsaPrivateKey *channel_key; static struct GNUNET_CRYPTO_EcdsaPrivateKey *slave_key; @@ -141,7 +141,7 @@ end_normally (void *cls) static void end () { - if (end_badly_task != NULL) + if (NULL != end_badly_task) { GNUNET_SCHEDULER_cancel (end_badly_task); end_badly_task = NULL; @@ -151,12 +151,16 @@ end () } -void -state_reset_result (void *cls, int64_t result, - const char *err_msg, uint16_t err_msg_size) +static void +state_reset_result (void *cls, + int64_t result, + const char *err_msg, + uint16_t err_msg_size) { op = NULL; - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_reset_result:\t%d\n", result); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "state_reset_result:\t%d\n", + (int) result); GNUNET_assert (GNUNET_OK == result); op = GNUNET_PSYCSTORE_state_reset (h, &channel_pub_key, @@ -168,7 +172,10 @@ state_reset_result (void *cls, int64_t result, static int -state_result (void *cls, const char *name, const void *value, uint32_t value_size) +state_result (void *cls, + const char *name, + const void *value, + uint32_t value_size) { struct StateClosure *scls = cls; const char *nam = scls->name[scls->n]; @@ -179,7 +186,9 @@ state_result (void *cls, const char *name, const void *value, uint32_t value_siz && 0 == memcmp (value, val, val_size) && 0 == strcmp (name, nam)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " variable %s matches\n", name); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + " variable %s matches\n", + name); return GNUNET_YES; } else @@ -193,7 +202,7 @@ state_result (void *cls, const char *name, const void *value, uint32_t value_siz } -void +static void state_get_prefix_result (void *cls, int64_t result, const char *err_msg, uint16_t err_msg_size) { @@ -207,7 +216,7 @@ state_get_prefix_result (void *cls, int64_t result, } -void +static void state_get_result (void *cls, int64_t result, const char *err_msg, uint16_t err_msg_size) { @@ -231,7 +240,7 @@ state_get_result (void *cls, int64_t result, } -void +static void counters_result (void *cls, int status, uint64_t max_fragment_id, uint64_t max_message_id, uint64_t max_group_generation, uint64_t max_state_message_id) @@ -260,7 +269,7 @@ counters_result (void *cls, int status, uint64_t max_fragment_id, } -void +static void state_modify_result (void *cls, int64_t result, const char *err_msg, uint16_t err_msg_size) { @@ -273,7 +282,7 @@ state_modify_result (void *cls, int64_t result, } -void +static void state_sync_result (void *cls, int64_t result, const char *err_msg, uint16_t err_msg_size) { @@ -288,7 +297,7 @@ state_sync_result (void *cls, int64_t result, } -int +static int fragment_result (void *cls, struct GNUNET_MULTICAST_MessageHeader *msg, enum GNUNET_PSYCSTORE_MessageFlags flags) @@ -317,7 +326,7 @@ fragment_result (void *cls, } -void +static void message_get_latest_result (void *cls, int64_t result, const char *err_msg, uint16_t err_msg_size) { @@ -346,7 +355,7 @@ message_get_latest_result (void *cls, int64_t result, } -void +static void message_get_result (void *cls, int64_t result, const char *err_msg, uint16_t err_msg_size) { @@ -363,7 +372,7 @@ message_get_result (void *cls, int64_t result, } -void +static void message_get_fragment_result (void *cls, int64_t result, const char *err_msg, uint16_t err_msg_size) { @@ -382,7 +391,7 @@ message_get_fragment_result (void *cls, int64_t result, } -void +static void fragment_get_latest_result (void *cls, int64_t result, const char *err_msg, uint16_t err_msg_size) { @@ -401,13 +410,15 @@ fragment_get_latest_result (void *cls, int64_t result, } -void +static void fragment_get_result (void *cls, int64_t result, const char *err_msg, uint16_t err_msg_size) { struct FragmentClosure *fcls = cls; op = NULL; - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "fragment_get:\t%d\n", result); + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "fragment_get:\t%d\n", + (int) result); GNUNET_assert (0 < result && fcls->n == fcls->n_expected); fcls->n = 0; @@ -419,7 +430,7 @@ fragment_get_result (void *cls, int64_t result, } -void +static void fragment_store_result (void *cls, int64_t result, const char *err_msg, uint16_t err_msg_size) { @@ -440,7 +451,7 @@ fragment_store_result (void *cls, int64_t result, } -void +static void fragment_store () { struct GNUNET_MULTICAST_MessageHeader *msg; @@ -458,7 +469,7 @@ fragment_store () msg->group_generation = GNUNET_htonll (INT64_MAX - 3); msg->flags = htonl (GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT); - memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key)); + GNUNET_memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key)); msg->purpose.size = htonl (ntohs (msg->header.size) - sizeof (msg->header) @@ -473,7 +484,7 @@ fragment_store () fcls.flags[1] = GNUNET_PSYCSTORE_MESSAGE_STATE_APPLIED; fcls.msg[1] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key)); - memcpy (msg, fcls.msg[0], sizeof (*msg) + sizeof (channel_pub_key)); + GNUNET_memcpy (msg, fcls.msg[0], sizeof (*msg) + sizeof (channel_pub_key)); msg->fragment_id = GNUNET_htonll (INT64_MAX - 4); msg->fragment_offset = GNUNET_htonll (1024); @@ -482,7 +493,7 @@ fragment_store () fcls.flags[2] = GNUNET_PSYCSTORE_MESSAGE_STATE_HASH; fcls.msg[2] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key)); - memcpy (msg, fcls.msg[1], sizeof (*msg) + sizeof (channel_pub_key)); + GNUNET_memcpy (msg, fcls.msg[1], sizeof (*msg) + sizeof (channel_pub_key)); msg->fragment_id = GNUNET_htonll (INT64_MAX); msg->fragment_offset = GNUNET_htonll (16384); @@ -491,7 +502,7 @@ fragment_store () } -void +static void membership_test_result (void *cls, int64_t result, const char *err_msg, uint16_t err_msg_size) { @@ -503,7 +514,7 @@ membership_test_result (void *cls, int64_t result, } -void +static void membership_store_result (void *cls, int64_t result, const char *err_msg, uint16_t err_msg_size) {