diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-03-14 11:42:12 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-03-14 11:42:12 +0100 |
commit | cd475225e4fd83fcc16b77ea1294c11428447209 (patch) | |
tree | 173b2afdd9df62bcb0f8131403f187f4bdf6e0d9 /src/consensus | |
parent | e8aa266d849901eafbfc58ba116e1a39fb15ae02 (diff) | |
download | gnunet-cd475225e4fd83fcc16b77ea1294c11428447209.tar.gz gnunet-cd475225e4fd83fcc16b77ea1294c11428447209.zip |
fix misc clang compiler warnings
Diffstat (limited to 'src/consensus')
-rw-r--r-- | src/consensus/consensus_protocol.h | 18 | ||||
-rw-r--r-- | src/consensus/gnunet-service-consensus.c | 13 |
2 files changed, 19 insertions, 12 deletions
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 | |||
45 | struct GNUNET_CONSENSUS_RoundContextMessage | 45 | struct GNUNET_CONSENSUS_RoundContextMessage |
46 | { | 46 | { |
47 | /** | 47 | /** |
48 | * Type: GNUNET_MESSAGE_TYPE_CONSENSUS_P2P_ROUND_CONTEXT | 48 | * Type: #GNUNET_MESSAGE_TYPE_CONSENSUS_P2P_ROUND_CONTEXT |
49 | */ | 49 | */ |
50 | struct GNUNET_MessageHeader header; | 50 | struct GNUNET_MessageHeader header; |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * A value from 'enum PhaseKind'. | 53 | * A value from 'enum PhaseKind'. |
54 | */ | 54 | */ |
55 | uint16_t kind; | 55 | uint16_t kind GNUNET_PACKED; |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Number of the first peer | 58 | * Number of the first peer |
59 | * in canonical order. | 59 | * in canonical order. |
60 | */ | 60 | */ |
61 | int16_t peer1; | 61 | int16_t peer1 GNUNET_PACKED; |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Number of the second peer in canonical order. | 64 | * Number of the second peer in canonical order. |
65 | */ | 65 | */ |
66 | int16_t peer2; | 66 | int16_t peer2 GNUNET_PACKED; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Repetition of the gradecast phase. | 69 | * Repetition of the gradecast phase. |
70 | */ | 70 | */ |
71 | int16_t repetition; | 71 | int16_t repetition GNUNET_PACKED; |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * Leader in the gradecast phase. | 74 | * Leader in the gradecast phase. |
75 | * | 75 | * |
76 | * Can be different from both peer1 and peer2. | 76 | * Can be different from both peer1 and peer2. |
77 | */ | 77 | */ |
78 | int16_t leader; | 78 | int16_t leader GNUNET_PACKED; |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Non-zero if this set reconciliation | 81 | * Non-zero if this set reconciliation |
@@ -85,7 +85,7 @@ struct GNUNET_CONSENSUS_RoundContextMessage | |||
85 | * | 85 | * |
86 | * Ignored for set operations that are not within gradecasts. | 86 | * Ignored for set operations that are not within gradecasts. |
87 | */ | 87 | */ |
88 | uint16_t is_contested; | 88 | uint16_t is_contested GNUNET_PACKED; |
89 | }; | 89 | }; |
90 | 90 | ||
91 | 91 | ||
@@ -104,12 +104,12 @@ struct ConsensusElement | |||
104 | * Payload element_type, only valid | 104 | * Payload element_type, only valid |
105 | * if this is not a marker element. | 105 | * if this is not a marker element. |
106 | */ | 106 | */ |
107 | uint16_t payload_type; | 107 | uint16_t payload_type GNUNET_PACKED; |
108 | 108 | ||
109 | /** | 109 | /** |
110 | * Is this a marker element? | 110 | * Is this a marker element? |
111 | */ | 111 | */ |
112 | uint8_t marker; | 112 | uint8_t marker GNUNET_PACKED; |
113 | 113 | ||
114 | /* rest: element data */ | 114 | /* rest: element data */ |
115 | }; | 115 | }; |
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, | |||
1341 | if (PHASE_KIND_ALL_TO_ALL_2 == task->key.kind) | 1341 | if (PHASE_KIND_ALL_TO_ALL_2 == task->key.kind) |
1342 | { | 1342 | { |
1343 | struct GNUNET_SET_Element element; | 1343 | struct GNUNET_SET_Element element; |
1344 | struct ConsensusSizeElement cse = { 0 }; | 1344 | struct ConsensusSizeElement cse = { |
1345 | .size = 0, | ||
1346 | .sender_index = 0 | ||
1347 | }; | ||
1345 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "inserting size marker\n"); | 1348 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "inserting size marker\n"); |
1346 | cse.ce.marker = CONSENSUS_MARKER_SIZE; | 1349 | cse.ce.marker = CONSENSUS_MARKER_SIZE; |
1347 | cse.size = GNUNET_htonll (session->first_size); | 1350 | cse.size = GNUNET_htonll (session->first_size); |
@@ -1394,7 +1397,10 @@ commit_set (struct ConsensusSession *session, | |||
1394 | for (i = 0; i < evil.num; i++) | 1397 | for (i = 0; i < evil.num; i++) |
1395 | { | 1398 | { |
1396 | struct GNUNET_SET_Element element; | 1399 | struct GNUNET_SET_Element element; |
1397 | struct ConsensusStuffedElement se = { 0 }; | 1400 | struct ConsensusStuffedElement se = { |
1401 | .ce.payload_type = 0, | ||
1402 | .ce.marker = 0, | ||
1403 | }; | ||
1398 | element.data = &se; | 1404 | element.data = &se; |
1399 | element.size = sizeof (struct ConsensusStuffedElement); | 1405 | element.size = sizeof (struct ConsensusStuffedElement); |
1400 | element.element_type = GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT; | 1406 | element.element_type = GNUNET_BLOCK_TYPE_CONSENSUS_ELEMENT; |
@@ -2123,7 +2129,7 @@ task_start_reconcile (struct TaskEntry *task) | |||
2123 | 2129 | ||
2124 | if (task->key.peer1 == session->local_peer_idx) | 2130 | if (task->key.peer1 == session->local_peer_idx) |
2125 | { | 2131 | { |
2126 | struct GNUNET_CONSENSUS_RoundContextMessage rcm = { 0 }; | 2132 | struct GNUNET_CONSENSUS_RoundContextMessage rcm; |
2127 | 2133 | ||
2128 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2134 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2129 | "P%u: Looking up set {%s} to run remote union\n", | 2135 | "P%u: Looking up set {%s} to run remote union\n", |
@@ -2138,6 +2144,7 @@ task_start_reconcile (struct TaskEntry *task) | |||
2138 | rcm.peer2 = htons (task->key.peer2); | 2144 | rcm.peer2 = htons (task->key.peer2); |
2139 | rcm.leader = htons (task->key.leader); | 2145 | rcm.leader = htons (task->key.leader); |
2140 | rcm.repetition = htons (task->key.repetition); | 2146 | rcm.repetition = htons (task->key.repetition); |
2147 | rcm.is_contested = htons (0); | ||
2141 | 2148 | ||
2142 | GNUNET_assert (NULL == setop->op); | 2149 | GNUNET_assert (NULL == setop->op); |
2143 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%u: initiating set op with P%u, our set is %s\n", | 2150 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%u: initiating set op with P%u, our set is %s\n", |