fix misc clang compiler warnings
authorChristian Grothoff <christian@grothoff.org>
Tue, 14 Mar 2017 10:42:12 +0000 (11:42 +0100)
committerChristian Grothoff <christian@grothoff.org>
Tue, 14 Mar 2017 10:42:12 +0000 (11:42 +0100)
src/consensus/consensus_protocol.h
src/consensus/gnunet-service-consensus.c
src/dv/gnunet-service-dv.c

index e0002de5606b36bd2c2ff4ba45784f3ab6f3dd24..320d460c701d6e4c903babaa216539281ad1648b 100644 (file)
@@ -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 */
 };
index 7911db8b041d817e2cceae44fa7479baaf17cd5e..4af7199aa925e7cd03756c0fb503e9acb654e900 100644 (file)
@@ -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",
index 7d101c8ae46d2718ae4f4a72649699c1a489ab96..3fbd0cc030459710be5c81784a1197997342156d 100644 (file)
@@ -1530,7 +1530,7 @@ listen_set_union (void *cls,
                                        GNUNET_SET_OPERATION_UNION);
   neighbor->set_op = GNUNET_SET_accept (request,
                                        GNUNET_SET_RESULT_ADDED,
-                                        (struct GNUNET_SET_Option[]) { 0 },
+                                        (struct GNUNET_SET_Option[]) {{ 0 }},
                                        &handle_set_union_result,
                                        neighbor);
   neighbor->consensus_insertion_offset = 0;
@@ -1561,7 +1561,7 @@ initiate_set_union (void *cls)
                                          &neighbor->real_session_id,
                                          NULL,
                                          GNUNET_SET_RESULT_ADDED,
-                                         (struct GNUNET_SET_Option[]) { 0 },
+                                         (struct GNUNET_SET_Option[]) {{ 0 }},
                                          &handle_set_union_result,
                                          neighbor);
   neighbor->consensus_insertion_offset = 0;