Code

changelog: Updated to 1.4~rc2+20091004-1.
[pkg-rrdtool.git] / debian / patches / compiler-warning-fixes
index 494854187d6728449fe3a0428a1e909dc4552193..a8f314b830c86d0f634732487cd18f03771f6d2d 100644 (file)
-diff a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
---- a/bindings/ruby/extconf.rb
-+++ b/bindings/ruby/extconf.rb
-@@ -3,6 +3,8 @@
- require 'mkmf'
-+$CFLAGS += ' -Wall '
-+
- if /solaris/ =~ RUBY_PLATFORM
-    $LDFLAGS += '-R$(EPREFIX)/lib'
- elsif /hpux/ =~ RUBY_PLATFORM
-diff a/bindings/ruby/main.c b/bindings/ruby/main.c
---- a/bindings/ruby/main.c
-+++ b/bindings/ruby/main.c
-@@ -4,6 +4,7 @@
- #include <unistd.h>
- #include <ruby.h>
-+#include <math.h>
- #include "../../src/rrd_tool.h"
- typedef struct string_arr_t {
-@@ -19,6 +20,11 @@ typedef int (
-     int argc,
-     char **argv);
-+typedef rrd_info_t *(
-+    *RRDINFOFUNC) (
-+    int argc,
-+    char **argv);
-+
- #define RRD_CHECK_ERROR  \
-     if (rrd_test_error()) \
-       rb_raise(rb_eRRDError, rrd_get_error()); \
-@@ -142,7 +148,7 @@ VALUE rb_rrd_update(
- /* Calls Returning Data via the Info Interface */
- VALUE rb_rrd_infocall(
--    RRDFUNC func,
-+    RRDINFOFUNC func,
-     VALUE args)
- {
-     string_arr a;
-@@ -173,9 +179,12 @@ VALUE rb_rrd_infocall(
-         case RD_I_STR:
-             rb_hash_aset(result, key, rb_str_new2(data->value.u_str));
-             break;
-+        case RD_I_INT:
-+            rb_hash_aset(result, key, INT2FIX(data->value.u_int));
-+            break;
-         case RD_I_BLO:
-             rb_hash_aset(result, key,
--                         rb_str_new(data->value.u_blo.ptr,
-+                         rb_str_new((char *)data->value.u_blo.ptr,
-                                     data->value.u_blo.size));
-             break;
-         }
-diff a/bindings/tcl/tclrrd.c b/bindings/tcl/tclrrd.c
---- a/bindings/tcl/tclrrd.c
-+++ b/bindings/tcl/tclrrd.c
-@@ -97,7 +97,7 @@ static void getopt_squieeze(
- /* Thread-safe version */
- static int Rrd_Create(
--    ClientData clientData,
-+    ClientData __attribute__((unused)) clientData,
-     Tcl_Interp *interp,
-     int argc,
-     CONST84 char *argv[])
-@@ -186,7 +186,8 @@ static int Rrd_Create(
-         return TCL_ERROR;
-     }
--    rrd_create_r(argv2[1], pdp_step, last_up, argc - 2, argv2 + 2);
-+    rrd_create_r(argv2[1], pdp_step, last_up, argc - 2,
-+                 (const char **)argv2 + 2);
-     getopt_cleanup(argc, argv2);
-@@ -204,7 +205,7 @@ static int Rrd_Create(
- /* Thread-safe version */
- static int Rrd_Dump(
--    ClientData clientData,
-+    ClientData __attribute__((unused)) clientData,
-     Tcl_Interp *interp,
-     int argc,
-     CONST84 char *argv[])
-@@ -233,7 +234,7 @@ static int Rrd_Dump(
- /* Thread-safe version */
- static int Rrd_Last(
--    ClientData clientData,
-+    ClientData __attribute__((unused)) clientData,
-     Tcl_Interp *interp,
-     int argc,
-     CONST84 char *argv[])
-@@ -264,7 +265,7 @@ static int Rrd_Last(
- /* Thread-safe version */
- static int Rrd_Update(
--    ClientData clientData,
-+    ClientData __attribute__((unused)) clientData,
-     Tcl_Interp *interp,
-     int argc,
-     CONST84 char *argv[])
-@@ -319,7 +320,7 @@ static int Rrd_Update(
-         return TCL_ERROR;
-     }
--    rrd_update_r(argv2[1], template, argc - 2, argv2 + 2);
-+    rrd_update_r(argv2[1], template, argc - 2, (const char **)argv2 + 2);
-     if (template != NULL) {
-         free(template);
-@@ -337,7 +338,7 @@ static int Rrd_Update(
+diff a/src/rrd_fetch_libdbi.c b/src/rrd_fetch_libdbi.c
+--- a/src/rrd_fetch_libdbi.c
++++ b/src/rrd_fetch_libdbi.c
+@@ -17,20 +17,20 @@ struct sql_table_helper {
+ };
+ /* the prototypes */
+-void _sql_close(struct sql_table_helper* th);
+-int _sql_setparam(struct sql_table_helper* th,char* key, char* value);
+-int _sql_fetchrow(struct sql_table_helper* th,time_t *timestamp, rrd_value_t *value,int ordered);
+-char* _find_next_separator(char* start,char separator);
+-char* _find_next_separator_twice(char*start,char separator);
+-char _hexcharhelper(char c);
+-int _inline_unescape (char* string);
+-double rrd_fetch_dbi_double(dbi_result *result,int idx);
+-long rrd_fetch_dbi_long(dbi_result *result,int idx);
++static void _sql_close(struct sql_table_helper* th);
++static int _sql_setparam(struct sql_table_helper* th,char* key, char* value);
++static int _sql_fetchrow(struct sql_table_helper* th,time_t *timestamp, rrd_value_t *value,int ordered);
++static char* _find_next_separator(char* start,char separator);
++static char* _find_next_separator_twice(char*start,char separator);
++static char _hexcharhelper(char c);
++static int _inline_unescape (char* string);
++static double rrd_fetch_dbi_double(dbi_result *result,int idx);
++static long rrd_fetch_dbi_long(dbi_result *result,int idx);
+ /* the real code */
+ /* helpers to get correctly converted values from DB*/
+-long rrd_fetch_dbi_long(dbi_result *result,int idx) {
++static long rrd_fetch_dbi_long(dbi_result *result,int idx) {
+   char *ptmp="";
+   long value=DNAN;
+   /* get the attributes for this filed */
+@@ -87,7 +87,7 @@ long rrd_fetch_dbi_long(dbi_result *result,int idx) {
+   return value;
  }
  
- static int Rrd_Lastupdate(
--    ClientData clientData,
-+    ClientData __attribute__((unused)) clientData,
-     Tcl_Interp *interp,
-     int argc,
-     CONST84 char *argv[])
-@@ -350,6 +351,12 @@ static int Rrd_Lastupdate(
-     Tcl_Obj  *listPtr;
-     unsigned long ds_cnt, i;
-+    if (argc != 2) {
-+        Tcl_AppendResult(interp, "RRD Error: needs a single rrd filename",
-+                         (char *) NULL);
-+        return TCL_ERROR;
-+    }
-+
-     argv2 = getopt_init(argc, argv);
-     if (rrd_lastupdate(argc - 1, argv2, &last_update,
-                        &ds_cnt, &ds_namv, &last_ds) == 0) {
-@@ -379,7 +386,7 @@ static int Rrd_Lastupdate(
+-double rrd_fetch_dbi_double(dbi_result *result,int idx) {
++static double rrd_fetch_dbi_double(dbi_result *result,int idx) {
+   char *ptmp="";
+   double value=DNAN;
+   /* get the attributes for this filed */
+@@ -144,7 +144,7 @@ double rrd_fetch_dbi_double(dbi_result *result,int idx) {
+   return value;
  }
  
- static int Rrd_Fetch(
--    ClientData clientData,
-+    ClientData __attribute__((unused)) clientData,
-     Tcl_Interp *interp,
-     int argc,
-     CONST84 char *argv[])
-@@ -424,7 +431,7 @@ static int Rrd_Fetch(
- static int Rrd_Graph(
--    ClientData clientData,
-+    ClientData __attribute__((unused)) clientData,
-     Tcl_Interp *interp,
-     int argc,
-     CONST84 char *argv[])
-@@ -534,7 +541,7 @@ static int Rrd_Graph(
- static int Rrd_Tune(
--    ClientData clientData,
-+    ClientData __attribute__((unused)) clientData,
-     Tcl_Interp *interp,
-     int argc,
-     CONST84 char *argv[])
-@@ -558,7 +565,7 @@ static int Rrd_Tune(
- static int Rrd_Resize(
--    ClientData clientData,
-+    ClientData __attribute__((unused)) clientData,
-     Tcl_Interp *interp,
-     int argc,
-     CONST84 char *argv[])
-@@ -582,7 +589,7 @@ static int Rrd_Resize(
+-void _sql_close(struct sql_table_helper* th) {
++static void _sql_close(struct sql_table_helper* th) {
+   /* close only if connected */
+   if (th->conn) {
+     if (getenv("RRDDEBUGSQL")) { fprintf(stderr,"RRDDEBUGSQL: %li: close connection\n",time(NULL) ); }
+@@ -158,7 +158,7 @@ void _sql_close(struct sql_table_helper* th) {
+   }
+ }
  
- static int Rrd_Restore(
--    ClientData clientData,
-+    ClientData __attribute__((unused)) clientData,
-     Tcl_Interp *interp,
-     int argc,
-     CONST84 char *argv[])
-diff a/src/Makefile.am b/src/Makefile.am
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -12,6 +12,8 @@ endif
- INCLUDES = -DLOCALEDIR="\"$(datadir)/locale\""
- RRD_DEFAULT_FONT=@RRD_DEFAULT_FONT@
- AM_CPPFLAGS = -DRRD_DEFAULT_FONT=\"$(RRD_DEFAULT_FONT)\" -DNUMVERS=@NUMVERS@
-+AM_CFLAGS = @CFLAGS@
-+## no including this by default @WERROR@
+-int _sql_setparam(struct sql_table_helper* th,char* key, char* value) {
++static int _sql_setparam(struct sql_table_helper* th,char* key, char* value) {
+   char* dbi_errstr=NULL;
+   dbi_driver driver;
+   /* if not connected */
+@@ -200,7 +200,7 @@ int _sql_setparam(struct sql_table_helper* th,char* key, char* value) {
+   return 0;
+ }
  
- UPD_C_FILES =         \
-       rrd_parsetime.c \
-@@ -77,7 +79,7 @@ librrd_la_LDFLAGS         += -export-symbols librrd.sym
+-int _sql_fetchrow(struct sql_table_helper* th,time_t *timestamp, rrd_value_t *value,int ordered) {
++static int _sql_fetchrow(struct sql_table_helper* th,time_t *timestamp, rrd_value_t *value,int ordered) {
+   char* dbi_errstr=NULL;
+   char sql[10240];
+   time_t startt=0,endt=0;
+@@ -269,7 +269,7 @@ int _sql_fetchrow(struct sql_table_helper* th,time_t *timestamp, rrd_value_t *va
+   return 1;
+ }
  
- librrd_th_la_SOURCES         = $(UPD_C_FILES) $(RRD_C_FILES) rrd_thread_safe.c
- librrd_th_la_DEPENDENCIES    = librrd.sym
--librrd_th_la_CFLAGS          = $(MULTITHREAD_CFLAGS)
-+librrd_th_la_CFLAGS          = $(AM_CFLAGS) $(MULTITHREAD_CFLAGS)
- librrd_th_la_LDFLAGS         = $(MULTITHREAD_LDFLAGS) -version-info @LIBVERS@
- librrd_th_la_LDFLAGS         += -export-symbols librrd.sym
- librrd_th_la_LIBADD          = $(ALL_LIBS)
-diff a/src/rrd_dump.c b/src/rrd_dump.c
---- a/src/rrd_dump.c
-+++ b/src/rrd_dump.c
-@@ -58,8 +58,7 @@
- extern char *tzname[2];
- #endif
+-char* _find_next_separator(char* start,char separator) {
++static char* _find_next_separator(char* start,char separator) {
+   char* found=strchr(start,separator);
+   /* have we found it */
+   if (found) {
+@@ -282,7 +282,7 @@ char* _find_next_separator(char* start,char separator) {
+   return NULL;
+ }
  
--
--int rrd_dump_opt_r(
-+static int rrd_dump_opt_r(
-     const char *filename,
-     char *outname,
-     int opt_noheader)
-diff a/src/rrd_gfx.c b/src/rrd_gfx.c
---- a/src/rrd_gfx.c
-+++ b/src/rrd_gfx.c
-@@ -124,7 +124,7 @@ static PangoLayout *gfx_prep_text(
-     const char *text)
- {
-     PangoLayout  *layout = im->layout;
--    PangoFontDescription *pfd;
-+    const PangoFontDescription *pfd;
-     cairo_t  *cr = im->cr;
+-char* _find_next_separator_twice(char*start,char separator) {
++static char* _find_next_separator_twice(char*start,char separator) {
+   char *found=start;
+   /* find next separator in string*/
+   while (found) {
+@@ -300,7 +300,7 @@ char* _find_next_separator_twice(char*start,char separator) {
+   return NULL;
+ }
  
-     static double last_tabwidth = -1;
-diff a/src/rrd_open.c b/src/rrd_open.c
---- a/src/rrd_open.c
-+++ b/src/rrd_open.c
-@@ -389,9 +389,9 @@ void rrd_dontneed(
-     rrd_t *rrd)
- {
- #if defined USE_MADVISE || defined HAVE_POSIX_FADVISE
--    unsigned long dontneed_start;
--    unsigned long rra_start;
--    unsigned long active_block;
-+    off_t dontneed_start;
-+    off_t rra_start;
-+    off_t active_block;
-     unsigned long i;
-     ssize_t   _page_size = sysconf(_SC_PAGESIZE);
+-char _hexcharhelper(char c) {
++static char _hexcharhelper(char c) {
+   switch (c) {
+   case '0': return 0 ; break;
+   case '1': return 1 ; break;
+@@ -328,7 +328,7 @@ char _hexcharhelper(char c) {
+   return -1;
+ }
  
-diff a/src/rrd_xport.c b/src/rrd_xport.c
---- a/src/rrd_xport.c
-+++ b/src/rrd_xport.c
-@@ -228,7 +228,7 @@ int rrd_xport_fn(
-             ref_list[xport_counter++] = i;
-             *step_list_ptr = im->gdes[im->gdes[i].vidx].step;
-             /* printf("%s:%lu\n",im->gdes[i].legend,*step_list_ptr); */
--            *step_list_ptr++;
-+            step_list_ptr++;
-             /* reserve room for one legend entry */
-             /* is FMT_LEG_LEN + 5 the correct size? */
-             if ((legend_list[j] =
+-int _inline_unescape (char* string) {
++static int _inline_unescape (char* string) {
+   char *src=string;
+   char *dst=string;
+   char c,h1,h2;
+@@ -341,9 +341,15 @@ int _inline_unescape (char* string) {
+       } else {
+       /* try to calculate hex value from the next 2 values*/
+       h1=_hexcharhelper(*src);
+-      if (h1<0) { rrd_set_error( "string escape error at: %s\n",string);return(1); }
++      if (h1 == (char)-1) {
++        rrd_set_error("string escape error at: %s\n",string);
++        return(1);
++      }
+       h2=_hexcharhelper(*(src+1));
+-      if (h2<0) { rrd_set_error( "string escape error at: %s\n",string);return(1); }
++      if (h1 == (char)-1) {
++        rrd_set_error("string escape error at: %s\n",string);
++        return(1);
++      }
+       c=h2+(h1<<4);
+       /* increase src pointer by 2 skiping 2 chars */
+       src+=2;
+@@ -358,8 +364,8 @@ int _inline_unescape (char* string) {
+ int
+ rrd_fetch_fn_libdbi(
+-    char           *filename,  /* name of the rrd */
+-    enum cf_en     cf_idx,     /* which consolidation function ?*/
++    const char     *filename,  /* name of the rrd */
++    enum cf_en     cf_idx __attribute__((unused)), /* consolidation function */
+     time_t         *start,
+     time_t         *end,       /* which time frame do you want ?
+                               * will be changed to represent reality */
+diff a/src/rrd_tool.h b/src/rrd_tool.h
+--- a/src/rrd_tool.h
++++ b/src/rrd_tool.h
+@@ -94,7 +94,7 @@ extern    "C" {
+ #ifdef HAVE_LIBDBI
+-int rrd_fetch_fn_libdbi(char *filename, enum cf_en cf_idx,
++int rrd_fetch_fn_libdbi(const char *filename, enum cf_en cf_idx,
+                       time_t *start,time_t *end,
+                       unsigned long *step,
+                       unsigned long *ds_cnt,