From 9e56458803c05e1b98591818412a08ffcf3f0401 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sun, 7 Jun 2009 14:12:28 +0000 Subject: [PATCH] fix some warnings git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1849 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_fetch.c | 4 ++-- src/rrd_flushcached.c | 2 +- src/rrd_info.c | 10 +++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/rrd_fetch.c b/src/rrd_fetch.c index 23be6e0..2c30a98 100644 --- a/src/rrd_fetch.c +++ b/src/rrd_fetch.c @@ -221,7 +221,7 @@ int rrd_fetch_fn( long best_full_step_diff = 0, best_part_step_diff = 0, tmp_step_diff = 0, tmp_match = 0, best_match = 0; long full_match, rra_base; - long start_offset, end_offset; + off_t start_offset, end_offset; int first_full = 1; int first_part = 1; rrd_t rrd; @@ -384,7 +384,7 @@ int rrd_fetch_fn( rra_start_time, rra_end_time, start_offset, end_offset); #endif /* only seek if the start time is before the end time */ - if (*start <= rra_end_time && *end >= rra_start_time - *step ){ + if (*start <= rra_end_time && *end >= rra_start_time - (off_t)*step ){ if (start_offset <= 0) rra_pointer = rrd.rra_ptr[chosen_rra].cur_row + 1; else diff --git a/src/rrd_flushcached.c b/src/rrd_flushcached.c index fb9345b..f7a715e 100644 --- a/src/rrd_flushcached.c +++ b/src/rrd_flushcached.c @@ -87,7 +87,7 @@ int rrd_flushcached (int argc, char **argv) } status = 0; - for (int i = optind; i < argc; i++) + for (i = optind; i < argc; i++) { status = rrdc_flush(argv[i]); if (status) diff --git a/src/rrd_info.c b/src/rrd_info.c index 73407a9..3ab1b59 100644 --- a/src/rrd_info.c +++ b/src/rrd_info.c @@ -24,8 +24,12 @@ char *sprintf_alloc( char *str = NULL; va_list argp; #ifdef HAVE_VASPRINTF - va_start( argp, fmt ); - vasprintf( &str, fmt, argp ); + va_start( argp, fmt ); + if (vasprintf( &str, fmt, argp ) == -1){ + va_end(argp); + rrd_set_error ("vasprintf failed."); + return(NULL); + } #else int maxlen = 1024 + strlen(fmt); str = (char*)malloc(sizeof(char) * (maxlen + 1)); @@ -37,7 +41,7 @@ char *sprintf_alloc( vsprintf(str, fmt, argp); #endif } -#endif // HAVE_VASPRINTF +#endif /* HAVE_VASPRINTF */ va_end(argp); return str; } -- 2.30.2