gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: -fix misc compiler warnings


From: gnunet
Subject: [gnunet] branch master updated: -fix misc compiler warnings
Date: Sun, 20 Dec 2020 11:51:46 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new e60f76eab -fix misc compiler warnings
e60f76eab is described below

commit e60f76eab3447fba5982d30f0e4e7ebecf4edc0b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Dec 20 11:51:11 2020 +0100

    -fix misc compiler warnings
---
 src/transport/test_communicator_basic.c | 124 +++++++++++++++++++-------------
 1 file changed, 74 insertions(+), 50 deletions(-)

diff --git a/src/transport/test_communicator_basic.c 
b/src/transport/test_communicator_basic.c
index 10c942daa..fcdbb4b0e 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -133,12 +133,12 @@ static struct GNUNET_TIME_Relative duration;
 
 
 static void
-communicator_available_cb (void *cls,
-                           struct
-                           GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle
-                           *tc_h,
-                           enum GNUNET_TRANSPORT_CommunicatorCharacteristics 
cc,
-                           char *address_prefix)
+communicator_available_cb (
+  void *cls,
+  struct
+  GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h,
+  enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc,
+  char *address_prefix)
 {
   LOG (GNUNET_ERROR_TYPE_INFO,
        "Communicator available. (cc: %u, prefix: %s)\n",
@@ -146,10 +146,11 @@ communicator_available_cb (void *cls,
        address_prefix);
 }
 
+
 static void
 open_queue (void *cls)
 {
-  char *address = cls;
+  const char *address = cls;
 
   if (NULL != tc_hs[PEER_A]->c_mq)
   {
@@ -162,30 +163,32 @@ open_queue (void *cls)
   {
     GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
                                   &open_queue,
-                                  address);
+                                  (void *) address);
   }
 }
 
+
 static void
-add_address_cb (void *cls,
-                struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *
-                tc_h,
-                const char *address,
-                struct GNUNET_TIME_Relative expiration,
-                uint32_t aid,
-                enum GNUNET_NetworkType nt)
+add_address_cb (
+  void *cls,
+  struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h,
+  const char *address,
+  struct GNUNET_TIME_Relative expiration,
+  uint32_t aid,
+  enum GNUNET_NetworkType nt)
 {
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "New address. (addr: %s, expir: %" PRIu32 ", ID: %" PRIu32 ", nt: %u\n",
+       "New address. (addr: %s, expir: %s, ID: %" PRIu32 ", nt: %u\n",
        address,
-       expiration.rel_value_us,
+       GNUNET_STRINGS_relative_time_to_string (expiration,
+                                               GNUNET_NO),
        aid,
-       nt);
+       (int) nt);
   // addresses[1] = GNUNET_strdup (address);
   if ((0 == strcmp ((char*) cls, cfg_peers_name[PEER_B])) &&
       (GNUNET_NO == queue_est))
   {
-    open_queue (address);
+    open_queue ((void *) address);
   }
 }
 
@@ -202,12 +205,13 @@ add_address_cb (void *cls,
  *                #GNUNET_NO if queue will not be established (bogous address)
  */
 static void
-queue_create_reply_cb (void *cls,
-                       struct
-                       GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *
-                       tc_h,
-                       int will_try)
+queue_create_reply_cb (
+  void *cls,
+  struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h,
+  int will_try)
 {
+  (void) cls;
+  (void) tc_h;
   if (GNUNET_YES == will_try)
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Queue will be established!\n");
@@ -223,6 +227,9 @@ handle_backchannel_cb (void *cls,
                        struct GNUNET_PeerIdentity *pid)
 {
   struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls;
+
+  (void) tc_h;
+  (void) msg;
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Handling BC message...\n");
   if (0 == memcmp (&peer_id[PEER_A], pid, sizeof (*pid)))
     return tc_hs[PEER_A];
@@ -267,6 +274,9 @@ latency_timeout (void *cls)
 
   switch (phase)
   {
+  case TP_INIT:
+    GNUNET_assert (0);
+    break;
   case TP_BURST_SHORT:
     num_sent = num_sent_short;
     num_received = num_received_short;
@@ -287,6 +297,7 @@ latency_timeout (void *cls)
   GNUNET_SCHEDULER_shutdown ();
 }
 
+
 /*static void
   size_test (void *cls);*/
 
@@ -298,7 +309,7 @@ size_test (void *cls)
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "size_test_cb %u\n",
-       num_sent_size);
+       (unsigned int) num_sent_size);
   GNUNET_assert (TP_SIZE_CHECK == phase);
   if (LONG_MESSAGE_SIZE != long_message_size)
     max_size = long_message_size;
@@ -320,6 +331,7 @@ size_test (void *cls)
                                                 TIMEOUT_MULTIPLIER));
 }
 
+
 /*static void
 size_test (void *cls)
 {
@@ -338,8 +350,8 @@ long_test_cb (void *cls)
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "long_test_cb %u/%u\n",
-       num_sent_long,
-       num_received_long);
+       (unsigned int) num_sent_long,
+       (unsigned int) num_received_long);
   payload = make_payload (long_message_size);
   num_sent_long++;
   GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
@@ -359,6 +371,7 @@ long_test_cb (void *cls)
                                                 TIMEOUT_MULTIPLIER));
 }
 
+
 static void
 long_test (void *cls)
 {
@@ -370,6 +383,7 @@ long_test (void *cls)
                                 NULL);
 }
 
+
 static void
 short_test (void *cls);
 
@@ -380,27 +394,26 @@ short_test_cb (void *cls)
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "short_test_cb %u/%u\n",
-       num_sent_short,
-       num_received_short);
+       (unsigned int) num_sent_short,
+       (unsigned int) num_received_short);
   payload = make_payload (SHORT_MESSAGE_SIZE);
   num_sent_short++;
-  GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
-                                                        ((BURST_PACKETS
-                                                          * 0.91 ==
-                                                          num_received_short) 
||
-                                                         (BURST_PACKETS ==
-                                                          num_sent_short))
-                                                        ? NULL
-                                                        : &short_test,
-                                                        NULL,
-                                                        payload,
-                                                        SHORT_MESSAGE_SIZE);
+  GNUNET_TRANSPORT_TESTING_transport_communicator_send (
+    my_tc,
+    ( (BURST_PACKETS * 0.91 == num_received_short) ||
+      (BURST_PACKETS == num_sent_short) )
+    ? NULL
+    : &short_test,
+    NULL,
+    payload,
+    SHORT_MESSAGE_SIZE);
   GNUNET_free (payload);
   timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply (
                                                 GNUNET_TIME_UNIT_SECONDS,
                                                 TIMEOUT_MULTIPLIER));
 }
 
+
 static void
 short_test (void *cls)
 {
@@ -496,10 +509,14 @@ update_avg_latency (const char*payload)
   ts = GNUNET_TIME_absolute_ntoh (*ts_n);
   latency = GNUNET_TIME_absolute_get_duration (ts);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Latency of received packet: %u\n",
-       latency);
+       "Latency of received packet: %s\n",
+       GNUNET_STRINGS_relative_time_to_string (latency,
+                                               GNUNET_YES));
   switch (phase)
   {
+  case TP_INIT:
+    GNUNET_assert (0);
+    break;
   case TP_BURST_SHORT:
     num_received = num_received_short;
     break;
@@ -518,6 +535,8 @@ update_avg_latency (const char*payload)
 
 }
 
+
+static void
 process_statistics_box_done (void *cls, int success)
 {
   if (NULL != box_stats)
@@ -530,6 +549,8 @@ process_statistics_box_done (void *cls, int success)
   }
 }
 
+
+static void
 process_statistics_rekey_done (void *cls, int success)
 {
   if (NULL != rekey_stats)
@@ -542,6 +563,7 @@ process_statistics_rekey_done (void *cls, int success)
   }
 }
 
+
 static int
 process_statistics (void *cls,
                     const char *subsystem,
@@ -562,7 +584,7 @@ process_statistics (void *cls,
                 "No successful rekeying!\n");
     GNUNET_SCHEDULER_shutdown ();
   }
-  if ((0 == strcmp ("backchannel", test_name))  &&
+  if ((0 == strcmp ("backchannel", test_name)) &&
       (0 == strcmp (
          "# messages decrypted with BOX",
          name))
@@ -573,7 +595,7 @@ process_statistics (void *cls,
                 "Not enough BOX messages!\n");
     GNUNET_SCHEDULER_shutdown ();
   }
-  if ((0 == strcmp ("rekey", test_name))  &&
+  if ((0 == strcmp ("rekey", test_name)) &&
       (0 == strcmp (
          "# messages decrypted with BOX",
          name))
@@ -587,6 +609,7 @@ process_statistics (void *cls,
   return GNUNET_OK;
 }
 
+
 /**
  * @brief Handle an incoming message
  *
@@ -723,8 +746,8 @@ incoming_message_cb (void *cls,
           short_test (NULL);
           break;
         }
-        if ((0 == strcmp ("rekey", test_name))||(0 == strcmp ("backchannel",
-                                                              test_name)) )
+        if ((0 == strcmp ("rekey", test_name)) || (0 == strcmp ("backchannel",
+                                                                test_name)) )
         {
           if (NULL != box_stats)
             GNUNET_STATISTICS_get_cancel (box_stats);
@@ -743,7 +766,8 @@ incoming_message_cb (void *cls,
                                                &process_statistics,
                                                NULL);
         }
-        else{
+        else
+        {
           LOG (GNUNET_ERROR_TYPE_DEBUG,
                "Finished\n");
           GNUNET_SCHEDULER_shutdown ();
@@ -759,7 +783,7 @@ static void
 do_shutdown (void *cls)
 {
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "shuting down test.\”");
+       "shuting down test.\n");
 
   if (NULL != box_stats)
   {
@@ -810,8 +834,8 @@ run (void *cls)
       &handle_backchannel_cb,
       cfg_peers_name[i]);   /* cls */
 
-    if ((0 == strcmp ("rekey", test_name))||(0 == strcmp ("backchannel",
-                                                          test_name)) )
+    if ((0 == strcmp ("rekey", test_name)) || (0 == strcmp ("backchannel",
+                                                            test_name)) )
     {
       stats[i] = GNUNET_STATISTICS_create ("C-UDP",
                                            cfg_peers[i]);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]