1 diff a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
2 --- a/bindings/ruby/extconf.rb
3 +++ b/bindings/ruby/extconf.rb
4 @@ -3,6 +3,8 @@
6 require 'mkmf'
8 +$CFLAGS += ' -Wall '
9 +
10 if /solaris/ =~ RUBY_PLATFORM
11 $LDFLAGS += '-R$(EPREFIX)/lib'
12 elsif /hpux/ =~ RUBY_PLATFORM
13 diff a/bindings/ruby/main.c b/bindings/ruby/main.c
14 --- a/bindings/ruby/main.c
15 +++ b/bindings/ruby/main.c
16 @@ -4,6 +4,7 @@
18 #include <unistd.h>
19 #include <ruby.h>
20 +#include <math.h>
21 #include "../../src/rrd_tool.h"
23 typedef struct string_arr_t {
24 @@ -19,6 +20,11 @@ typedef int (
25 int argc,
26 char **argv);
28 +typedef rrd_info_t *(
29 + *RRDINFOFUNC) (
30 + int argc,
31 + char **argv);
32 +
33 #define RRD_CHECK_ERROR \
34 if (rrd_test_error()) \
35 rb_raise(rb_eRRDError, rrd_get_error()); \
36 @@ -142,7 +148,7 @@ VALUE rb_rrd_update(
37 /* Calls Returning Data via the Info Interface */
39 VALUE rb_rrd_infocall(
40 - RRDFUNC func,
41 + RRDINFOFUNC func,
42 VALUE args)
43 {
44 string_arr a;
45 @@ -173,9 +179,12 @@ VALUE rb_rrd_infocall(
46 case RD_I_STR:
47 rb_hash_aset(result, key, rb_str_new2(data->value.u_str));
48 break;
49 + case RD_I_INT:
50 + rb_hash_aset(result, key, INT2FIX(data->value.u_int));
51 + break;
52 case RD_I_BLO:
53 rb_hash_aset(result, key,
54 - rb_str_new(data->value.u_blo.ptr,
55 + rb_str_new((char *)data->value.u_blo.ptr,
56 data->value.u_blo.size));
57 break;
58 }
59 diff a/bindings/tcl/tclrrd.c b/bindings/tcl/tclrrd.c
60 --- a/bindings/tcl/tclrrd.c
61 +++ b/bindings/tcl/tclrrd.c
62 @@ -97,7 +97,7 @@ static void getopt_squieeze(
64 /* Thread-safe version */
65 static int Rrd_Create(
66 - ClientData clientData,
67 + ClientData __attribute__((unused)) clientData,
68 Tcl_Interp *interp,
69 int argc,
70 CONST84 char *argv[])
71 @@ -186,7 +186,8 @@ static int Rrd_Create(
72 return TCL_ERROR;
73 }
75 - rrd_create_r(argv2[1], pdp_step, last_up, argc - 2, argv2 + 2);
76 + rrd_create_r(argv2[1], pdp_step, last_up, argc - 2,
77 + (const char **)argv2 + 2);
79 getopt_cleanup(argc, argv2);
81 @@ -204,7 +205,7 @@ static int Rrd_Create(
83 /* Thread-safe version */
84 static int Rrd_Dump(
85 - ClientData clientData,
86 + ClientData __attribute__((unused)) clientData,
87 Tcl_Interp *interp,
88 int argc,
89 CONST84 char *argv[])
90 @@ -233,7 +234,7 @@ static int Rrd_Dump(
92 /* Thread-safe version */
93 static int Rrd_Last(
94 - ClientData clientData,
95 + ClientData __attribute__((unused)) clientData,
96 Tcl_Interp *interp,
97 int argc,
98 CONST84 char *argv[])
99 @@ -264,7 +265,7 @@ static int Rrd_Last(
101 /* Thread-safe version */
102 static int Rrd_Update(
103 - ClientData clientData,
104 + ClientData __attribute__((unused)) clientData,
105 Tcl_Interp *interp,
106 int argc,
107 CONST84 char *argv[])
108 @@ -319,7 +320,7 @@ static int Rrd_Update(
109 return TCL_ERROR;
110 }
112 - rrd_update_r(argv2[1], template, argc - 2, argv2 + 2);
113 + rrd_update_r(argv2[1], template, argc - 2, (const char **)argv2 + 2);
115 if (template != NULL) {
116 free(template);
117 @@ -337,7 +338,7 @@ static int Rrd_Update(
118 }
120 static int Rrd_Lastupdate(
121 - ClientData clientData,
122 + ClientData __attribute__((unused)) clientData,
123 Tcl_Interp *interp,
124 int argc,
125 CONST84 char *argv[])
126 @@ -350,6 +351,12 @@ static int Rrd_Lastupdate(
127 Tcl_Obj *listPtr;
128 unsigned long ds_cnt, i;
130 + if (argc != 2) {
131 + Tcl_AppendResult(interp, "RRD Error: needs a single rrd filename",
132 + (char *) NULL);
133 + return TCL_ERROR;
134 + }
135 +
136 argv2 = getopt_init(argc, argv);
137 if (rrd_lastupdate(argc - 1, argv2, &last_update,
138 &ds_cnt, &ds_namv, &last_ds) == 0) {
139 @@ -379,7 +386,7 @@ static int Rrd_Lastupdate(
140 }
142 static int Rrd_Fetch(
143 - ClientData clientData,
144 + ClientData __attribute__((unused)) clientData,
145 Tcl_Interp *interp,
146 int argc,
147 CONST84 char *argv[])
148 @@ -424,7 +431,7 @@ static int Rrd_Fetch(
151 static int Rrd_Graph(
152 - ClientData clientData,
153 + ClientData __attribute__((unused)) clientData,
154 Tcl_Interp *interp,
155 int argc,
156 CONST84 char *argv[])
157 @@ -534,7 +541,7 @@ static int Rrd_Graph(
160 static int Rrd_Tune(
161 - ClientData clientData,
162 + ClientData __attribute__((unused)) clientData,
163 Tcl_Interp *interp,
164 int argc,
165 CONST84 char *argv[])
166 @@ -558,7 +565,7 @@ static int Rrd_Tune(
169 static int Rrd_Resize(
170 - ClientData clientData,
171 + ClientData __attribute__((unused)) clientData,
172 Tcl_Interp *interp,
173 int argc,
174 CONST84 char *argv[])
175 @@ -582,7 +589,7 @@ static int Rrd_Resize(
178 static int Rrd_Restore(
179 - ClientData clientData,
180 + ClientData __attribute__((unused)) clientData,
181 Tcl_Interp *interp,
182 int argc,
183 CONST84 char *argv[])
184 diff a/src/Makefile.am b/src/Makefile.am
185 --- a/src/Makefile.am
186 +++ b/src/Makefile.am
187 @@ -12,6 +12,8 @@ endif
188 INCLUDES = -DLOCALEDIR="\"$(datadir)/locale\""
189 RRD_DEFAULT_FONT=@RRD_DEFAULT_FONT@
190 AM_CPPFLAGS = -DRRD_DEFAULT_FONT=\"$(RRD_DEFAULT_FONT)\" -DNUMVERS=@NUMVERS@
191 +AM_CFLAGS = @CFLAGS@
192 +## no including this by default @WERROR@
194 UPD_C_FILES = \
195 rrd_parsetime.c \
196 @@ -77,7 +79,7 @@ librrd_la_LDFLAGS += -export-symbols librrd.sym
198 librrd_th_la_SOURCES = $(UPD_C_FILES) $(RRD_C_FILES) rrd_thread_safe.c
199 librrd_th_la_DEPENDENCIES = librrd.sym
200 -librrd_th_la_CFLAGS = $(MULTITHREAD_CFLAGS)
201 +librrd_th_la_CFLAGS = $(AM_CFLAGS) $(MULTITHREAD_CFLAGS)
202 librrd_th_la_LDFLAGS = $(MULTITHREAD_LDFLAGS) -version-info @LIBVERS@
203 librrd_th_la_LDFLAGS += -export-symbols librrd.sym
204 librrd_th_la_LIBADD = $(ALL_LIBS)
205 diff a/src/rrd_dump.c b/src/rrd_dump.c
206 --- a/src/rrd_dump.c
207 +++ b/src/rrd_dump.c
208 @@ -58,8 +58,7 @@
209 extern char *tzname[2];
210 #endif
212 -
213 -int rrd_dump_opt_r(
214 +static int rrd_dump_opt_r(
215 const char *filename,
216 char *outname,
217 int opt_noheader)
218 diff a/src/rrd_gfx.c b/src/rrd_gfx.c
219 --- a/src/rrd_gfx.c
220 +++ b/src/rrd_gfx.c
221 @@ -124,7 +124,7 @@ static PangoLayout *gfx_prep_text(
222 const char *text)
223 {
224 PangoLayout *layout = im->layout;
225 - PangoFontDescription *pfd;
226 + const PangoFontDescription *pfd;
227 cairo_t *cr = im->cr;
229 static double last_tabwidth = -1;
230 diff a/src/rrd_open.c b/src/rrd_open.c
231 --- a/src/rrd_open.c
232 +++ b/src/rrd_open.c
233 @@ -389,9 +389,9 @@ void rrd_dontneed(
234 rrd_t *rrd)
235 {
236 #if defined USE_MADVISE || defined HAVE_POSIX_FADVISE
237 - unsigned long dontneed_start;
238 - unsigned long rra_start;
239 - unsigned long active_block;
240 + off_t dontneed_start;
241 + off_t rra_start;
242 + off_t active_block;
243 unsigned long i;
244 ssize_t _page_size = sysconf(_SC_PAGESIZE);
246 diff a/src/rrd_xport.c b/src/rrd_xport.c
247 --- a/src/rrd_xport.c
248 +++ b/src/rrd_xport.c
249 @@ -228,7 +228,7 @@ int rrd_xport_fn(
250 ref_list[xport_counter++] = i;
251 *step_list_ptr = im->gdes[im->gdes[i].vidx].step;
252 /* printf("%s:%lu\n",im->gdes[i].legend,*step_list_ptr); */
253 - *step_list_ptr++;
254 + step_list_ptr++;
255 /* reserve room for one legend entry */
256 /* is FMT_LEG_LEN + 5 the correct size? */
257 if ((legend_list[j] =