From cd475225e4fd83fcc16b77ea1294c11428447209 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 14 Mar 2017 11:42:12 +0100 Subject: fix misc clang compiler warnings --- src/consensus/consensus_protocol.h | 18 +++++++++--------- src/consensus/gnunet-service-consensus.c | 13 ++++++++++--- 2 files changed, 19 insertions(+), 12 deletions(-) (limited to 'src/consensus') diff --git a/src/consensus/consensus_protocol.h b/src/consensus/consensus_protocol.h index e0002de56..320d460c7 100644 --- a/src/consensus/consensus_protocol.h +++ b/src/consensus/consensus_protocol.h @@ -45,37 +45,37 @@ GNUNET_NETWORK_STRUCT_BEGIN struct GNUNET_CONSENSUS_RoundContextMessage { /** - * Type: GNUNET_MESSAGE_TYPE_CONSENSUS_P2P_ROUND_CONTEXT + * Type: #GNUNET_MESSAGE_TYPE_CONSENSUS_P2P_ROUND_CONTEXT */ struct GNUNET_MessageHeader header; /** * A value from 'enum PhaseKind'. */ - uint16_t kind; + uint16_t kind GNUNET_PACKED; /** * Number of the first peer * in canonical order. */ - int16_t peer1; + int16_t peer1 GNUNET_PACKED; /** * Number of the second peer in canonical order. */ - int16_t peer2; + int16_t peer2 GNUNET_PACKED; /** * Repetition of the gradecast phase. */ - int16_t repetition; + int16_t repetition GNUNET_PACKED; /** * Leader in the gradecast phase. * * Can be different from both peer1 and peer2. */ - int16_t leader; + int16_t leader GNUNET_PACKED; /** * Non-zero if this set reconciliation @@ -85,7 +85,7 @@ struct GNUNET_CONSENSUS_RoundContextMessage * * Ignored for set operations that are not within gradecasts. */ - uint16_t is_contested; + uint16_t is_contested GNUNET_PACKED; }; @@ -104,12 +104,12 @@ struct ConsensusElement * Payload element_type, only valid * if this is not a marker element. */ - uint16_t payload_type; + uint16_t payload_type GNUNET_PACKED; /** * Is this a marker element? */ - uint8_t marker; + uint8_t marker GNUNET_PACKED; /* rest: element data */ }; diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c index 7911db8b0..4af7199aa 100644 --- a/src/consensus/gnunet-service-consensus.c +++ b/src/consensus/gnunet-service-consensus.c @@ -1341,7 +1341,10 @@ commit_set (struct ConsensusSession *session, if (PHASE_KIND_ALL_TO_ALL_2 == task->key.kind) { struct GNUNET_SET_Element element; - struct ConsensusSizeElement cse = { 0 }; + struct ConsensusSizeElement cse = { + .size = 0, + .sender_index = 0 + }; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "inserting size marker\n"); cse.ce.marker = CONSENSUS_MARKER_SIZE; cse.size = GNUNET_htonll (session->first_size); @@ -1394,7 +1397,10 @@ commit_set (struct ConsensusSession *session, for (i = 0; i < evil.num; i++) { struct GNUNET_SET_Element element; - struct ConsensusStuffedElement se = { 0 }; + struct ConsensusStuffedElement se = { + .ce.payload_type = 0, + .ce.marker = 0, + }; element.data = &se; element.size = sizeof (struct ConsensusStuffedElement); element.element_type = GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT; @@ -2123,7 +2129,7 @@ task_start_reconcile (struct TaskEntry *task) if (task->key.peer1 == session->local_peer_idx) { - struct GNUNET_CONSENSUS_RoundContextMessage rcm = { 0 }; + struct GNUNET_CONSENSUS_RoundContextMessage rcm; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%u: Looking up set {%s} to run remote union\n", @@ -2138,6 +2144,7 @@ task_start_reconcile (struct TaskEntry *task) rcm.peer2 = htons (task->key.peer2); rcm.leader = htons (task->key.leader); rcm.repetition = htons (task->key.repetition); + rcm.is_contested = htons (0); GNUNET_assert (NULL == setop->op); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%u: initiating set op with P%u, our set is %s\n", -- cgit v1.2.3