From b7513a90c350bc3f768c3b1e7a42228f272314dd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 30 Mar 2018 16:23:29 +0200 Subject: fix conversation ftbfs issues: --- src/conversation/test_conversation_api.c | 48 +++++++++++++---- src/conversation/test_conversation_api_reject.c | 38 +++++++++++-- src/conversation/test_conversation_api_twocalls.c | 66 +++++++++++++++++------ 3 files changed, 123 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/conversation/test_conversation_api.c b/src/conversation/test_conversation_api.c index 0bf173d2b..180f6619f 100644 --- a/src/conversation/test_conversation_api.c +++ b/src/conversation/test_conversation_api.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2013, 2014 GNUnet e.V. + Copyright (C) 2013, 2014, 2018 GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -78,6 +78,7 @@ phone_send (void *cls) static unsigned int i; char buf[32]; + (void) cls; GNUNET_assert (NULL != phone_rdc); GNUNET_snprintf (buf, sizeof (buf), "phone-%u", i++); phone_rdc (phone_rdc_cls, strlen (buf) + 1, buf); @@ -92,6 +93,7 @@ call_send (void *cls) static unsigned int i; char buf[32]; + (void) cls; GNUNET_assert (NULL != call_rdc); GNUNET_snprintf (buf, sizeof (buf), "call-%u", i++); call_rdc (call_rdc_cls, strlen (buf) + 1, buf); @@ -134,9 +136,15 @@ play (void *cls, char buf[32]; if (0 == strcmp (origin, "phone")) - GNUNET_snprintf (buf, sizeof (buf), "call-%u", call_i++); + GNUNET_snprintf (buf, + sizeof (buf), + "call-%u", + call_i++); else - GNUNET_snprintf (buf, sizeof (buf), "phone-%u", phone_i++); + GNUNET_snprintf (buf, + sizeof (buf), + "phone-%u", + phone_i++); if ( (data_size != strlen (buf) + 1) || (0 != strncmp (buf, data, data_size)) ) { @@ -274,6 +282,7 @@ static struct GNUNET_MICROPHONE_Handle phone_mic = { static void end_test (void *cls) { + (void) cls; GNUNET_SCHEDULER_shutdown (); if (NULL != op) { @@ -313,6 +322,7 @@ static void caller_event_handler (void *cls, enum GNUNET_CONVERSATION_CallerEventCode code) { + (void) cls; switch (code) { case GNUNET_CONVERSATION_EC_CALLER_SUSPEND: @@ -334,6 +344,8 @@ phone_event_handler (void *cls, static enum GNUNET_CONVERSATION_PhoneEventCode expect = GNUNET_CONVERSATION_EC_PHONE_RING; + (void) cls; + (void) caller_id; GNUNET_break (code == expect); switch (code) { @@ -369,6 +381,7 @@ call_event_handler (void *cls, static enum GNUNET_CONVERSATION_CallEventCode expect = GNUNET_CONVERSATION_EC_CALL_RINGING; + (void) cls; GNUNET_break (code == expect); switch (code) { @@ -405,6 +418,7 @@ static void caller_ego_create_cont (void *cls, const char *emsg) { + (void) cls; op = NULL; GNUNET_assert (NULL == emsg); } @@ -415,11 +429,15 @@ namestore_put_cont (void *cls, int32_t success, const char *emsg) { + (void) cls; qe = NULL; GNUNET_assert (GNUNET_YES == success); GNUNET_assert (NULL == emsg); GNUNET_assert (NULL == op); - op = GNUNET_IDENTITY_create (id, "caller-ego", &caller_ego_create_cont, NULL); + op = GNUNET_IDENTITY_create (id, + "caller-ego", + &caller_ego_create_cont, + NULL); } @@ -432,6 +450,8 @@ identity_cb (void *cls, struct GNUNET_GNSRECORD_Data rd; struct GNUNET_CRYPTO_EcdsaPublicKey pub; + (void) cls; + (void) ctx; if (NULL == name) return; if (NULL == ego) @@ -468,7 +488,6 @@ identity_cb (void *cls, "%s", GNUNET_GNSRECORD_pkey_to_zkey (&pub)); call = GNUNET_CONVERSATION_call_start (cfg, - ego, ego, gns_name, &call_speaker, @@ -484,6 +503,7 @@ static void phone_ego_create_cont (void *cls, const char *emsg) { + (void) cls; op = NULL; GNUNET_assert (NULL == emsg); } @@ -494,23 +514,33 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_TESTING_Peer *peer) { + (void) cls; + (void) peer; cfg = c; - GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_test, + GNUNET_SCHEDULER_add_delayed (TIMEOUT, + &end_test, NULL); id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); - op = GNUNET_IDENTITY_create (id, "phone-ego", &phone_ego_create_cont, NULL); + op = GNUNET_IDENTITY_create (id, + "phone-ego", + &phone_ego_create_cont, + NULL); ns = GNUNET_NAMESTORE_connect (cfg); } int -main (int argc, char *argv[]) +main (int argc, + char *argv[]) { + (void) argc; + (void) argv; if (0 != GNUNET_TESTING_peer_run ("test_conversation_api", "test_conversation.conf", - &run, NULL)) + &run, + NULL)) return 1; return ok; } diff --git a/src/conversation/test_conversation_api_reject.c b/src/conversation/test_conversation_api_reject.c index 9257764cf..284889e49 100644 --- a/src/conversation/test_conversation_api_reject.c +++ b/src/conversation/test_conversation_api_reject.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2013, 2014 GNUnet e.V. + Copyright (C) 2013, 2014, 2018 GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -59,6 +59,7 @@ static char *gns_caller_id; static int enable_speaker (void *cls) { + (void) cls; GNUNET_break (0); return GNUNET_SYSERR; } @@ -67,6 +68,7 @@ enable_speaker (void *cls) static void disable_speaker (void *cls) { + (void) cls; GNUNET_break (0); } @@ -76,6 +78,9 @@ play (void *cls, size_t data_size, const void *data) { + (void) cls; + (void) data_size; + (void) data; GNUNET_break (0); } @@ -83,6 +88,7 @@ play (void *cls, static void destroy_speaker (void *cls) { + (void) cls; } @@ -100,6 +106,9 @@ enable_mic (void *cls, GNUNET_MICROPHONE_RecordedDataCallback rdc, void *rdc_cls) { + (void) cls; + (void) rdc; + (void) rdc_cls; GNUNET_break (0); return GNUNET_SYSERR; } @@ -108,6 +117,7 @@ enable_mic (void *cls, static void disable_mic (void *cls) { + (void) cls; GNUNET_break (0); } @@ -115,6 +125,7 @@ disable_mic (void *cls) static void destroy_mic (void *cls) { + (void) cls; } @@ -134,6 +145,7 @@ static struct GNUNET_MICROPHONE_Handle call_mic = { static void end_test (void *cls) { + (void) cls; GNUNET_SCHEDULER_shutdown (); if (NULL != op) { @@ -179,6 +191,8 @@ phone_event_handler (void *cls, static enum GNUNET_CONVERSATION_PhoneEventCode expect = GNUNET_CONVERSATION_EC_PHONE_RING; + (void) cls; + (void) caller_id; GNUNET_break (code == expect); switch (code) { @@ -199,6 +213,7 @@ call_event_handler (void *cls, static enum GNUNET_CONVERSATION_CallEventCode expect = GNUNET_CONVERSATION_EC_CALL_RINGING; + (void) cls; GNUNET_break (code == expect); switch (code) { @@ -229,6 +244,7 @@ static void caller_ego_create_cont (void *cls, const char *emsg) { + (void) cls; op = NULL; GNUNET_assert (NULL == emsg); } @@ -239,12 +255,15 @@ namestore_put_cont (void *cls, int32_t success, const char *emsg) { + (void) cls; qe = NULL; GNUNET_assert (GNUNET_YES == success); GNUNET_assert (NULL == emsg); GNUNET_assert (NULL == op); - op = GNUNET_IDENTITY_create (id, "caller-ego", - &caller_ego_create_cont, NULL); + op = GNUNET_IDENTITY_create (id, + "caller-ego", + &caller_ego_create_cont, + NULL); } @@ -257,6 +276,8 @@ identity_cb (void *cls, struct GNUNET_GNSRECORD_Data rd; struct GNUNET_CRYPTO_EcdsaPublicKey pub; + (void) cls; + (void) ctx; if (NULL == name) return; if (NULL == ego) @@ -293,7 +314,6 @@ identity_cb (void *cls, "%s", GNUNET_GNSRECORD_pkey_to_zkey (&pub)); call = GNUNET_CONVERSATION_call_start (cfg, - ego, ego, gns_name, &call_speaker, @@ -309,6 +329,7 @@ static void phone_ego_create_cont (void *cls, const char *emsg) { + (void) cls; op = NULL; GNUNET_assert (NULL == emsg); } @@ -319,13 +340,18 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_TESTING_Peer *peer) { + (void) cls; + (void) peer; cfg = c; GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_test, NULL); id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); - op = GNUNET_IDENTITY_create (id, "phone-ego", &phone_ego_create_cont, NULL); + op = GNUNET_IDENTITY_create (id, + "phone-ego", + &phone_ego_create_cont, + NULL); ns = GNUNET_NAMESTORE_connect (cfg); } @@ -333,6 +359,8 @@ run (void *cls, int main (int argc, char *argv[]) { + (void) argc; + (void) argv; if (0 != GNUNET_TESTING_peer_run ("test_conversation_api", "test_conversation.conf", &run, NULL)) diff --git a/src/conversation/test_conversation_api_twocalls.c b/src/conversation/test_conversation_api_twocalls.c index 7d2705e70..ac3a87fad 100644 --- a/src/conversation/test_conversation_api_twocalls.c +++ b/src/conversation/test_conversation_api_twocalls.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2013 GNUnet e.V. + Copyright (C) 2013, 2018x GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -130,11 +130,15 @@ phone_send (void *cls) { char buf[32]; + (void) cls; GNUNET_assert (NULL != phone_rdc); GNUNET_snprintf (buf, sizeof (buf), "phone"); - phone_rdc (phone_rdc_cls, strlen (buf) + 1, buf); + phone_rdc (phone_rdc_cls, + strlen (buf) + 1, + buf); phone_task = GNUNET_SCHEDULER_add_delayed (FREQ, - &phone_send, NULL); + &phone_send, + NULL); } @@ -144,11 +148,17 @@ call_send (void *cls) struct MicContext *mc = cls; char buf[32]; + (void) cls; GNUNET_assert (NULL != mc->rdc); - GNUNET_snprintf (buf, sizeof (buf), "call"); - mc->rdc (mc->rdc_cls, strlen (buf) + 1, buf); + GNUNET_snprintf (buf, + sizeof (buf), + "call"); + mc->rdc (mc->rdc_cls, + strlen (buf) + 1, + buf); mc->call_task = GNUNET_SCHEDULER_add_delayed (FREQ, - &call_send, mc); + &call_send, + mc); } @@ -157,6 +167,7 @@ enable_speaker (void *cls) { const char *origin = CLS_STR (cls); + (void) cls; LOG_DEBUG ("Speaker %s enabled\n", origin); return GNUNET_OK; @@ -168,6 +179,7 @@ disable_speaker (void *cls) { const char *origin = CLS_STR (cls); + (void) cls; LOG_DEBUG ("Speaker %s disabled\n", origin); } @@ -181,6 +193,7 @@ play (void *cls, static unsigned int phone_i; static unsigned int call_i; + (void) cls; if (0 == strncmp ("call", data, data_size)) call_i++; else if (0 == strncmp ("phone", data, data_size)) @@ -348,6 +361,7 @@ static struct GNUNET_MICROPHONE_Handle phone_mic = { static void end_test (void *cls) { + (void) cls; timeout_task = NULL; fprintf (stderr, "Timeout!\n"); @@ -363,6 +377,7 @@ end_test (void *cls) static void do_shutdown (void *cls) { + (void) cls; if (NULL != timeout_task) { GNUNET_SCHEDULER_cancel (timeout_task); @@ -411,11 +426,14 @@ static void caller_event_handler (void *cls, enum GNUNET_CONVERSATION_CallerEventCode code) { + (void) cls; switch (code) { case GNUNET_CONVERSATION_EC_CALLER_SUSPEND: case GNUNET_CONVERSATION_EC_CALLER_RESUME: - LOG (GNUNET_ERROR_TYPE_WARNING, "Unexpected caller code: %d\n", code); + LOG (GNUNET_ERROR_TYPE_WARNING, + "Unexpected caller code: %d\n", + code); break; } } @@ -428,6 +446,8 @@ phone_event_handler (void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *caller_id) { const char *cid; + (void) cls; + (void) caller_id; switch (code) { @@ -470,7 +490,9 @@ phone_event_handler (void *cls, } break; default: - LOG (GNUNET_ERROR_TYPE_WARNING, "Unexpected phone code: %d\n", code); + LOG (GNUNET_ERROR_TYPE_WARNING, + "Unexpected phone code: %d\n", + code); break; } } @@ -521,6 +543,7 @@ static void caller_ego_create_cont (void *cls, const char *emsg) { + (void) cls; op = NULL; GNUNET_assert (NULL == emsg); } @@ -531,11 +554,15 @@ namestore_put_cont (void *cls, int32_t success, const char *emsg) { + (void) cls; qe = NULL; GNUNET_assert (GNUNET_YES == success); GNUNET_assert (NULL == emsg); GNUNET_assert (NULL == op); - op = GNUNET_IDENTITY_create (id, "caller-ego", &caller_ego_create_cont, NULL); + op = GNUNET_IDENTITY_create (id, + "caller-ego", + &caller_ego_create_cont, + NULL); } @@ -548,6 +575,8 @@ identity_cb (void *cls, struct GNUNET_GNSRECORD_Data rd; struct GNUNET_CRYPTO_EcdsaPublicKey pub; + (void) cls; + (void) ctx; if (NULL == name) return; if (NULL == ego) @@ -584,7 +613,6 @@ identity_cb (void *cls, "%s", GNUNET_GNSRECORD_pkey_to_zkey (&pub)); call1 = GNUNET_CONVERSATION_call_start (cfg, - ego, ego, gns_name, &call1_speaker, @@ -592,7 +620,6 @@ identity_cb (void *cls, &call_event_handler, (void *) "call1"); call2 = GNUNET_CONVERSATION_call_start (cfg, - ego, ego, gns_name, &call2_speaker, @@ -608,6 +635,7 @@ static void phone_ego_create_cont (void *cls, const char *emsg) { + (void) cls; op = NULL; GNUNET_assert (NULL == emsg); } @@ -618,6 +646,8 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_TESTING_Peer *peer) { + (void) cls; + (void) peer; cfg = c; timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_test, @@ -627,18 +657,24 @@ run (void *cls, id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); - op = GNUNET_IDENTITY_create (id, "phone-ego", &phone_ego_create_cont, NULL); + op = GNUNET_IDENTITY_create (id, + "phone-ego", + &phone_ego_create_cont, + NULL); ns = GNUNET_NAMESTORE_connect (cfg); } int -main (int argc, char *argv[]) +main (int argc, + char *argv[]) { - + (void) argc; + (void) argv; if (0 != GNUNET_TESTING_peer_run ("test_conversation_api_twocalls", "test_conversation.conf", - &run, NULL)) + &run, + NULL)) return 1; if (call1_finished && call2_finished) return 0; -- cgit v1.2.3