- fix
[oweals/gnunet.git] / src / datacache / test_datacache_quota.c
index f943844a4b7228f7351a2ef468b313d8af6a5e0d..cc47bdb8fb512f13e5db59f2a3f16d140479273b 100644 (file)
@@ -44,9 +44,8 @@ static const char *plugin_name;
  * some of the data from the last iteration is still there.
  */
 static void
-run (void *cls,
-     char *const *args,
-     const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
+run (void *cls, char *const *args, const char *cfgfile,
+     const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   struct GNUNET_DATACACHE_Handle *h;
   GNUNET_HashCode k;
@@ -61,17 +60,15 @@ run (void *cls,
 
   if (h == NULL)
   {
-    fprintf (stderr,
-             "Failed to initialize datacache.  Database likely not setup, skipping test.\n");
+    FPRINTF (stderr, "%s", "Failed to initialize datacache.  Database likely not setup, skipping test.\n");
     return;
   }
-  exp = GNUNET_TIME_absolute_get ();
-  exp.abs_value += 20 * 60 * 1000;
+  exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS);
   memset (buf, 1, sizeof (buf));
   memset (&k, 0, sizeof (GNUNET_HashCode));
   for (i = 0; i < 10; i++)
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
     for (j = i; j < sizeof (buf); j += 10)
     {
@@ -82,11 +79,11 @@ run (void *cls,
     }
     k = n;
   }
-  fprintf (stderr, "\n");
+  FPRINTF (stderr, "%s",  "\n");
   memset (&k, 0, sizeof (GNUNET_HashCode));
   for (i = 0; i < 10; i++)
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
     if (i < 2)
       ASSERT (0 == GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL));
@@ -94,7 +91,7 @@ run (void *cls,
       ASSERT (0 < GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL));
     k = n;
   }
-  fprintf (stderr, "\n");
+  FPRINTF (stderr, "%s",  "\n");
   GNUNET_DATACACHE_destroy (h);
   return;
 FAILURE:
@@ -140,16 +137,14 @@ main (int argc, char *argv[])
   else
     pos = (char *) plugin_name;
 
-  GNUNET_snprintf (cfg_name,
-                   sizeof (cfg_name),
-                   "test_datacache_data_%s.conf", plugin_name);
+  GNUNET_snprintf (cfg_name, sizeof (cfg_name), "test_datacache_data_%s.conf",
+                   plugin_name);
   if (pos != plugin_name)
     pos[0] = '.';
-  GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1,
-                      xargv, "test-datacache-quota", "nohelp",
-                      options, &run, NULL);
+  GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
+                      "test-datacache-quota", "nohelp", options, &run, NULL);
   if (ok != 0)
-    fprintf (stderr, "Missed some testcases: %d\n", ok);
+    FPRINTF (stderr, "Missed some testcases: %d\n", ok);
   return ok;
 }