-fixes
[oweals/gnunet.git] / src / fragmentation / test_fragmentation.c
index 8f0be87a5d955ec5d041b248b5ff5f4880f4eb8f..c409bf3f03deb3f846a76ec9e663932bca005ab9 100644 (file)
@@ -25,7 +25,7 @@
 #include "platform.h"
 #include "gnunet_fragmentation_lib.h"
 
-#define VERBOSE GNUNET_EXTRA_LOGGING
+#define VERBOSE GNUNET_NO
 
 #define DETAILS GNUNET_NO
 
@@ -65,8 +65,7 @@ static struct GNUNET_FRAGMENT_Context *frags[NUM_MSGS];
 static GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
 
 static void
-do_shutdown (void *cls,
-            const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   unsigned int i;
 
@@ -80,7 +79,7 @@ do_shutdown (void *cls,
       continue;
     GNUNET_FRAGMENT_context_destroy (frags[i]);
     frags[i] = NULL;
-  }  
+  }
 }
 
 
@@ -92,7 +91,7 @@ proc_msgs (void *cls, const struct GNUNET_MessageHeader *hdr)
   const char *buf;
 
 #if DETAILS
-  fprintf (stderr, "!");        /* message complete, good! */
+  FPRINTF (stderr, "%s",  "!");        /* message complete, good! */
 #endif
   buf = (const char *) hdr;
   for (i = sizeof (struct GNUNET_MessageHeader); i < ntohs (hdr->size); i++)
@@ -100,11 +99,10 @@ proc_msgs (void *cls, const struct GNUNET_MessageHeader *hdr)
   total++;
 #if ! DETAILS
   if (0 == (total % (NUM_MSGS / 100)))
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
 #endif
   /* tolerate 10% loss, i.e. due to duplicate fragment IDs */
-  if ( (total >= NUM_MSGS - (NUM_MSGS / 10)) &&
-       (ret != 0) )
+  if ((total >= NUM_MSGS - (NUM_MSGS / 10)) && (ret != 0))
   {
     if (GNUNET_SCHEDULER_NO_TASK == shutdown_task)
       shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
@@ -134,7 +132,7 @@ proc_acks (void *cls, uint32_t msg_id, const struct GNUNET_MessageHeader *hdr)
     if (ret == GNUNET_OK)
     {
 #if DETAILS
-      fprintf (stderr, "@");    /* good ACK */
+      FPRINTF (stderr, "%s",  "@");    /* good ACK */
 #endif
       GNUNET_FRAGMENT_context_destroy (frags[i]);
       frags[i] = NULL;
@@ -144,14 +142,14 @@ proc_acks (void *cls, uint32_t msg_id, const struct GNUNET_MessageHeader *hdr)
     if (ret == GNUNET_NO)
     {
 #if DETAILS
-      fprintf (stderr, "@");    /* good ACK */
+      FPRINTF (stderr, "%s",  "@");    /* good ACK */
 #endif
       acks++;
       return;
     }
   }
 #if DETAILS
-  fprintf (stderr, "_");        /* BAD: ack that nobody feels responsible for... */
+  FPRINTF (stderr, "%s",  "_");        /* BAD: ack that nobody feels responsible for... */
 #endif
 }
 
@@ -173,21 +171,21 @@ proc_frac (void *cls, const struct GNUNET_MessageHeader *hdr)
   }
   if (NULL == defrag)
   {
-    fprintf (stderr, "E");      /* Error: frag after shutdown!? */
+    FPRINTF (stderr, "%s",  "E");      /* Error: frag after shutdown!? */
     return;
   }
   ret = GNUNET_DEFRAGMENT_process_fragment (defrag, hdr);
   if (ret == GNUNET_NO)
   {
 #if DETAILS
-    fprintf (stderr, "?");      /* duplicate fragment */
+    FPRINTF (stderr, "%s",  "?");      /* duplicate fragment */
 #endif
     dups++;
   }
   else if (ret == GNUNET_OK)
   {
 #if DETAILS
-    fprintf (stderr, ".");      /* good fragment */
+    FPRINTF (stderr, "%s",  ".");      /* good fragment */
 #endif
     fragc++;
   }
@@ -256,7 +254,7 @@ main (int argc, char *argv[])
                                    100);
   GNUNET_PROGRAM_run (5, argv_prog, "test-fragmentation", "nohelp", options,
                       &run, NULL);
-  fprintf (stderr,
+  FPRINTF (stderr,
            "\nHad %u good fragments, %u duplicate fragments, %u acks and %u simulated drops of acks\n",
            fragc, dups, acks, ack_drops);
   return ret;