fix
[oweals/gnunet.git] / src / datacache / plugin_datacache_mysql.c
index 267ea9d3d55bea7f904264f3c50c849583d43bac..8e477409e1ea36d8c90fe231b4c776d2dd991386 100644 (file)
@@ -79,7 +79,7 @@
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
-#include "plugin_datacache.h"
+#include "gnunet_datacache_plugin.h"
 #include <mysql/mysql.h>
 
 #define DEBUG_DATACACHE_MYSQL GNUNET_NO
@@ -261,9 +261,6 @@ prepared_statement_destroy (struct Plugin *plugin,
 static int
 iclose (struct Plugin *plugin)
 {
-  struct GNUNET_MysqlStatementHandle *spos;
-
-  spos = plugin->shead;
   while (NULL != plugin->shead)
     prepared_statement_destroy (plugin,
                                plugin->shead);
@@ -479,7 +476,7 @@ init_params (struct Plugin *plugin,
   memset (qbind, 0, sizeof (qbind));
   off = 0;
   ft = 0;
-  while ((pc > 0) && (-1 != (ft = va_arg (ap, enum enum_field_types))))
+  while ( (pc > 0) && (-1 != (int) (ft = va_arg (ap, enum enum_field_types))) )
     {
       qbind[off].buffer_type = ft;
       switch (ft)
@@ -510,7 +507,7 @@ init_params (struct Plugin *plugin,
       pc--;
       off++;
     }
-  if (!((pc == 0) && (ft != -1) && (va_arg (ap, int) == -1)))
+  if (! ( (pc == 0) && (-1 != (int) ft) && (va_arg (ap, int) == -1)) )
     {
       GNUNET_break (0);
       return GNUNET_SYSERR;
@@ -721,10 +718,10 @@ itable (struct Plugin *plugin)
  * @param discard_time when to discard the value in any case
  * @return 0 on error, number of bytes used otherwise
  */
-static uint32_t 
+static size_t 
 mysql_plugin_put (void *cls,
                  const GNUNET_HashCode * key,
-                 uint32_t size,
+                 size_t size,
                  const char *data,
                  enum GNUNET_BLOCK_Type type,
                  struct GNUNET_TIME_Absolute discard_time)
@@ -750,8 +747,8 @@ mysql_plugin_put (void *cls,
   k_length = sizeof (GNUNET_HashCode);
   v_length = size;
   v_type = type;
-  v_now = (unsigned long long) now.value;
-  v_discard_time = (unsigned long long) discard_time.value;
+  v_now = (unsigned long long) now.abs_value;
+  v_discard_time = (unsigned long long) discard_time.abs_value;
   if (GNUNET_OK ==
       prepared_statement_run (plugin,
                              plugin->update_value,
@@ -862,7 +859,7 @@ mysql_plugin_get (void *cls,
   rbind[0].buffer = &total;
   rbind[0].is_unsigned = GNUNET_YES;
   v_type = type;
-  v_now = (unsigned long long) now.value;
+  v_now = (unsigned long long) now.abs_value;
   if ((GNUNET_OK !=
        (ret = prepared_statement_run_select (plugin,
                                             plugin->count_value,
@@ -930,7 +927,7 @@ mysql_plugin_get (void *cls,
           return GNUNET_SYSERR;
         }
       cnt++;
-      expire.value = v_expire;
+      expire.abs_value = v_expire;
       if (GNUNET_OK != iter (iter_cls, 
                             expire,
                             key,