first step to remove plibc
[oweals/gnunet.git] / src / datastore / test_datastore_api.c
index 0da68b26643ff6a74df6ba3785bb01dca5377cce..ee78a8cfce75e4b9f10c9ec66fe42069779a64a5 100644 (file)
@@ -2,20 +2,20 @@
      This file is part of GNUnet.
      Copyright (C) 2004, 2005, 2006, 2007, 2009, 2015 GNUnet e.V.
 
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
+     Affero General Public License for more details.
 
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-     Boston, MA 02110-1301, USA.
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
 */
 /*
  * @file datastore/test_datastore_api.c
@@ -231,6 +231,7 @@ check_value (void *cls,
              enum GNUNET_BLOCK_Type type,
              uint32_t priority,
              uint32_t anonymity,
+             uint32_t replication,
              struct GNUNET_TIME_Absolute expiration,
              uint64_t uid)
 {
@@ -250,11 +251,11 @@ check_value (void *cls,
     return;
   }
 #if 0
-  FPRINTF (stderr,
+  fprintf (stderr,
           "Check value got `%s' of size %u, type %d, expire %s\n",
            GNUNET_h2s (key), (unsigned int) size, type,
            GNUNET_STRINGS_absolute_time_to_string (expiration));
-  FPRINTF (stderr,
+  fprintf (stderr,
            "Check value iteration %d wants size %u, type %d, expire %s\n", i,
            (unsigned int) get_size (i), get_type (i),
            GNUNET_STRINGS_absolute_time_to_string (get_expiration(i)));
@@ -283,6 +284,7 @@ delete_value (void *cls,
               enum GNUNET_BLOCK_Type type,
               uint32_t priority,
               uint32_t anonymity,
+              uint32_t replication,
               struct GNUNET_TIME_Absolute expiration,
               uint64_t uid)
 {
@@ -308,6 +310,7 @@ check_nothing (void *cls,
                enum GNUNET_BLOCK_Type type,
                uint32_t priority,
                uint32_t anonymity,
+               uint32_t replication,
                struct GNUNET_TIME_Absolute expiration,
                uint64_t uid)
 {
@@ -329,6 +332,7 @@ check_multiple (void *cls,
                 enum GNUNET_BLOCK_Type type,
                 uint32_t priority,
                 uint32_t anonymity,
+                uint32_t replication,
                 struct GNUNET_TIME_Absolute expiration,
                 uint64_t uid)
 {
@@ -551,14 +555,14 @@ run_tests (void *cls,
                               crc);
     return;
   case GNUNET_NO:
-    FPRINTF (stderr,
+    fprintf (stderr,
              "%s", "Test 'put' operation failed, key already exists (!?)\n");
     GNUNET_DATASTORE_disconnect (datastore,
                                  GNUNET_YES);
     GNUNET_free (crc);
     return;
   case GNUNET_SYSERR:
-    FPRINTF (stderr,
+    fprintf (stderr,
              "Test 'put' operation failed with error `%s' database likely not setup, skipping test.\n",
              msg);
     GNUNET_DATASTORE_disconnect (datastore,
@@ -605,7 +609,7 @@ run (void *cls,
                             0, 1,
                             &run_tests, crc))
   {
-    FPRINTF (stderr,
+    fprintf (stderr,
              "%s",
              "Test 'put' operation failed.\n");
     ok = 1;
@@ -631,7 +635,7 @@ duc_dummy (void *cls,
 
 
 /**
- * check if plugin is actually working 
+ * check if plugin is actually working
  */
 static int
 test_plugin (const char *cfg_name)
@@ -640,7 +644,7 @@ test_plugin (const char *cfg_name)
   struct GNUNET_CONFIGURATION_Handle *cfg;
   struct GNUNET_DATASTORE_PluginFunctions *api;
   struct GNUNET_DATASTORE_PluginEnvironment env;
-  
+
   cfg = GNUNET_CONFIGURATION_create ();
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_load (cfg,
@@ -687,9 +691,9 @@ int
 main (int argc,
       char *argv[])
 {
-  char cfg_name[128];
+  char cfg_name[PATH_MAX];
   int ret;
-    
+
   plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
   GNUNET_snprintf (cfg_name,
                    sizeof (cfg_name),