cosmetics
authorChristian Grothoff <christian@grothoff.org>
Mon, 9 Jan 2017 16:48:27 +0000 (17:48 +0100)
committerChristian Grothoff <christian@grothoff.org>
Mon, 9 Jan 2017 20:18:47 +0000 (21:18 +0100)
src/dht/gnunet-service-dht_neighbours.c
src/dht/gnunet-service-dht_routing.c
src/dht/plugin_block_dht.c

index 574ed9ad020d7f325ed733af9dfd1842026d3074..0d3594d1ad9203d0dec8ffe342bc0925e0e53d6a 100644 (file)
@@ -1830,10 +1830,16 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender,
   /* first, check about our own HELLO */
   if (NULL != GDS_my_hello)
   {
-    GNUNET_BLOCK_mingle_hash (&my_identity_hash, bf_mutator, &mhash);
+    GNUNET_BLOCK_mingle_hash (&my_identity_hash,
+                             bf_mutator,
+                             &mhash);
     if ((NULL == bf) ||
         (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (bf, &mhash)))
     {
+      size_t hello_size;
+
+      hello_size = GNUNET_HELLO_size ((const struct GNUNET_HELLO_Message *) GDS_my_hello);
+      GNUNET_break (hello_size >= sizeof (struct GNUNET_MessageHeader));
       GDS_NEIGHBOURS_handle_reply (sender,
                                   GNUNET_BLOCK_TYPE_DHT_HELLO,
                                    GNUNET_TIME_relative_to_absolute
@@ -1844,9 +1850,7 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender,
                                   0,
                                   NULL,
                                   GDS_my_hello,
-                                   GNUNET_HELLO_size ((const struct
-                                                       GNUNET_HELLO_Message *)
-                                                      GDS_my_hello));
+                                   hello_size);
     }
     else
     {
index 48bece35e3a835c8c414a73968217dbc3439674b..38e5fc1c78ad9487f4c579dc7fccae7aee577003 100644 (file)
@@ -183,15 +183,17 @@ process (void *cls, const struct GNUNET_HashCode * key, void *value)
     gpl = 0;
     ppl = 0;
   }
-  if ((0 != (rr->options & GNUNET_DHT_RO_FIND_PEER)) &&
-      (pc->type == GNUNET_BLOCK_TYPE_DHT_HELLO))
+  if ( (0 != (rr->options & GNUNET_DHT_RO_FIND_PEER)) &&
+       (pc->type == GNUNET_BLOCK_TYPE_DHT_HELLO) )
   {
     /* key may not match HELLO, which is OK since
      * the search is approximate.  Still, the evaluation
      * would fail since the match is not exact.  So
      * we fake it by changing the key to the actual PID ... */
-    GNUNET_BLOCK_get_key (GDS_block_context, GNUNET_BLOCK_TYPE_DHT_HELLO,
-                          pc->data, pc->data_size, &hc);
+    GNUNET_BLOCK_get_key (GDS_block_context,
+                         GNUNET_BLOCK_TYPE_DHT_HELLO,
+                          pc->data, pc->data_size,
+                         &hc);
     eval_key = &hc;
   }
   else
index 17594efcb4308440c0ee142cb57938d1758a6501..4256a0fe64464bcd0bb0d7fb286d564558469527 100644 (file)
@@ -70,7 +70,7 @@ block_plugin_dht_evaluate (void *cls,
 
   if (type != GNUNET_BLOCK_TYPE_DHT_HELLO)
     return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED;
-  if (xquery_size != 0)
+  if (0 != xquery_size)
   {
     GNUNET_break_op (0);
     return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID;
@@ -121,14 +121,16 @@ block_plugin_dht_evaluate (void *cls,
  * @param type block type
  * @param block block to get the key for
  * @param block_size number of bytes @a block
- * @param key set to the key (query) for the given block
+ * @param[out] key set to the key (query) for the given block
  * @return #GNUNET_OK on success, #GNUNET_SYSERR if type not supported
  *         (or if extracting a key from a block of this type does not work)
  */
 static int
-block_plugin_dht_get_key (void *cls, enum GNUNET_BLOCK_Type type,
-                          const void *block, size_t block_size,
-                          struct GNUNET_HashCode * key)
+block_plugin_dht_get_key (void *cls,
+                         enum GNUNET_BLOCK_Type type,
+                          const void *block,
+                         size_t block_size,
+                          struct GNUNET_HashCode *key)
 {
   const struct GNUNET_MessageHeader *msg;
   const struct GNUNET_HELLO_Message *hello;