Fix compile time issues
[collectd.git] / src / csv.c
index 59d1d2f..953473f 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
@@ -23,8 +23,8 @@
 
 #include "collectd.h"
 
-#include "common.h"
 #include "plugin.h"
+#include "utils/common/common.h"
 #include "utils_cache.h"
 
 /*
@@ -33,9 +33,9 @@
 static const char *config_keys[] = {"DataDir", "StoreRates"};
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 
-static char *datadir = NULL;
-static int store_rates = 0;
-static int use_stdio = 0;
+static char *datadir;
+static int store_rates;
+static int use_stdio;
 
 static int value_list_to_string(char *buffer, int buffer_len,
                                 const data_set_t *ds, const value_list_t *vl) {
@@ -74,8 +74,8 @@ static int value_list_to_string(char *buffer, int buffer_len,
       }
       status = snprintf(buffer + offset, buffer_len - offset, ",%lf", rates[i]);
     } else if (ds->ds[i].type == DS_TYPE_COUNTER) {
-      status = snprintf(buffer + offset, buffer_len - offset, ",%llu",
-                        vl->values[i].counter);
+      status = snprintf(buffer + offset, buffer_len - offset, ",%" PRIu64,
+                        (uint64_t)vl->values[i].counter);
     } else if (ds->ds[i].type == DS_TYPE_DERIVE) {
       status = snprintf(buffer + offset, buffer_len - offset, ",%" PRIi64,
                         vl->values[i].derive);
@@ -190,12 +190,12 @@ static int csv_config(const char *key, const char *value) {
     }
     datadir = strdup(value);
     if (datadir != NULL) {
-      int len = strlen(datadir);
+      size_t len = strlen(datadir);
       while ((len > 0) && (datadir[len - 1] == '/')) {
         len--;
         datadir[len] = '\0';
       }
-      if (len <= 0) {
+      if (len == 0) {
         free(datadir);
         datadir = NULL;
       }