summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e14b1c7)
raw | patch | inline | side by side (parent: e14b1c7)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 26 May 2004 22:11:12 +0000 (22:11 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 26 May 2004 22:11:12 +0000 (22:11 +0000) |
20 files changed:
diff --git a/program/src/fnv.h b/program/src/fnv.h
index 205e5a8a9c9fe24c241069a11e3f7d3a220f98f5..22f6ff69fc7aa647bf6d3e025ad5ab605883752c 100644 (file)
--- a/program/src/fnv.h
+++ b/program/src/fnv.h
*/
#define FNV1_32_INIT ((Fnv32_t)0x811c9dc5)
+Fnv32_t fnv_32_buf(void *, size_t, Fnv32_t);
+
+Fnv32_t fnv_32_str(char *, Fnv32_t );
+
+unsigned long FnvHash(char *);
+
#endif /* __FNV_H__ */
index e5a297c979f8f4fa4c1d6bfdb1401f1828180dc8..775a40a2552776ad92c660529612f14944e9f302 100644 (file)
--- a/program/src/parsetime.c
+++ b/program/src/parsetime.c
*/
static struct SpecialToken *Specials;
-static char **scp; /* scanner - pointer at arglist */
+static const char **scp; /* scanner - pointer at arglist */
static char scc; /* scanner - count of remaining arguments */
-static char *sct; /* scanner - next char pointer in current argument */
+static const char *sct; /* scanner - next char pointer in current argument */
static int need; /* scanner - need to advance to next argument */
static char *sc_token=NULL; /* scanner - token buffer */
static size_t sc_len; /* scanner - length of token buffer */
static int sc_tokid; /* scanner - token id */
-static int need_to_free = 0; /* means that we need deallocating memory */
-
/* Local functions */
+static void EnsureMemFree (void);
-void EnsureMemFree ()
+static void EnsureMemFree (void)
{
- if( need_to_free )
+ if( sc_token )
{
free(sc_token);
- need_to_free = 0;
+ sc_token = NULL;
}
}
* init_scanner() sets up the scanner to eat arguments
*/
static char *
-init_scanner(int argc, char **argv)
+init_scanner(int argc, const char **argv)
{
scp = argv;
scc = argc;
sc_token = (char *) malloc(sc_len*sizeof(char));
if( sc_token == NULL )
return "Failed to allocate memory";
- need_to_free = 1;
return TIME_OK;
} /* init_scanner */
int tlen;
/* save token status in case we must abort */
int scc_sv = scc;
- char *sct_sv = sct;
+ const char *sct_sv = sct;
int sc_tokid_sv = sc_tokid;
tlen = strlen(sc_token);
* the pointer to the error message in the case of problems
*/
char *
-parsetime(char *tspec, struct rrd_time_value *ptv)
+parsetime(const char *tspec, struct rrd_time_value *ptv)
{
time_t now = time(NULL);
int hr = 0;
diff --git a/program/src/pngsize.c b/program/src/pngsize.c
index 41ff16ab14f3ea4de9d962b447ee4fea9204339f..e60b6fab0f9f8075b86d02cb2cb04b173e7473c8 100644 (file)
--- a/program/src/pngsize.c
+++ b/program/src/pngsize.c
*****************************************************************************/
#include <png.h>
+#include "rrd_tool.h"
int
PngSize(FILE *fd, long *width, long *height)
diff --git a/program/src/rrd.h b/program/src/rrd.h
index 902f72ad598f993e47e5e773811341aa1635c5ba..7509540b1c230128c3149d0e5913f0b9bb7f09d4 100644 (file)
--- a/program/src/rrd.h
+++ b/program/src/rrd.h
*****************************************************************************
* $Id$
* $Log$
+ * Revision 1.8 2004/05/26 22:11:12 oetiker
+ * reduce compiler warnings. Many small fixes. -- Mike Slifcak <slif@bellsouth.net>
+ *
* Revision 1.7 2003/11/12 22:14:26 oetiker
* allow to pass an open filehandle into rrd_graph as an extra argument
*
int rrd_restore(int, char **);
int rrd_dump(int, char **);
int rrd_tune(int, char **);
-time_t rrd_last(int, char **);
+time_t rrd_last(int, const char **);
int rrd_resize(int, char **);
int rrd_xport(int, char **, int *, time_t *, time_t *,
unsigned long *, unsigned long *,
int rrd_update_r(char *filename, char *_template,
int argc, char **argv);
int rrd_dump_r(char *filename);
-time_t rrd_last_r(char *filename);
+time_t rrd_last_r(const char *filename);
/* Transplanted from parsetime.h */
typedef enum {
/* returns the current per-thread rrd_context */
struct rrd_context *rrd_get_context(void);
-char *parsetime(char *spec, struct rrd_time_value *ptv);
+char *parsetime(const char *spec, struct rrd_time_value *ptv);
/* END parsetime.h */
int proc_start_end (struct rrd_time_value *, struct rrd_time_value *, time_t *, time_t *);
diff --git a/program/src/rrd_afm.c b/program/src/rrd_afm.c
index 61340360ede410ac6acf505695095f8254a25c76..c9996d0b24031dd946a3816647af1820546ee283 100644 (file)
--- a/program/src/rrd_afm.c
+++ b/program/src/rrd_afm.c
* rrd_afm.h Parsing afm tables to find width of strings.
****************************************************************************/
+#include "config.h"
+
#include "rrd_afm.h"
#include "rrd_afm_data.h"
#include <stdlib.h>
#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
#if 0
# define DEBUG 1
# define DLOG(x) fprintf x
#ifdef __APPLE__
const unsigned char afm_mac2iso[128] = {
- '\xC4', '\xC5', '\xC7', '\xC9', '\xD1', '\xD6', '\xDC', '\xE1', // 80
- '\xE0', '\xE2', '\xE4', '\xE3', '\xE5', '\xE7', '\xE9', '\xE8', // 88
- '\xEA', '\xEB', '\xED', '\xEC', '\xEE', '\xEF', '\xF1', '\xF3', // 90
- '\xF2', '\xF4', '\xF6', '\xF5', '\xFA', '\xF9', '\xFB', '\xFC', // 98
- '\xDD', '\xB0', '\xA2', '\xA3', '\xA7', ' ', '\xB6', '\xDF', // A0
- '\xAE', '\xA9', ' ', '\xB4', '\xA8', ' ', '\xC6', '\xD8', // A8
- ' ', '\xB1', '\xBE', ' ', '\xA5', '\xB5', ' ', ' ', // B0
- '\xBD', '\xBC', ' ', '\xAA', '\xBA', ' ', '\xE6', '\xF8', // B8
- '\xBF', '\xA1', '\xAC', ' ', ' ', ' ', ' ', '\xAB', // C0
- '\xBB', ' ', '\xA0', '\xC0', '\xC3', '\xD5', ' ', '\xA6', // C8
- '\xAD', ' ', '"', '"', '\'', '\'', '\xF7', '\xD7', // D0
- '\xFF', ' ', ' ', '\xA4', '\xD0', '\xF0', '\xDE', '\xFE', // D8
- '\xFD', '\xB7', ' ', ' ', ' ', '\xC2', '\xCA', '\xC1', // E0
- '\xCB', '\xC8', '\xCD', '\xCE', '\xCF', '\xCC', '\xD3', '\xD4', // E8
- ' ', '\xD2', '\xDA', '\xDB', '\xD9', ' ', ' ', ' ', // F0
- '\xAF', ' ', ' ', ' ', '\xB8', ' ', ' ', ' ', // F8
+ '\xC4', '\xC5', '\xC7', '\xC9', '\xD1', '\xD6', '\xDC', '\xE1', /* 80 */
+ '\xE0', '\xE2', '\xE4', '\xE3', '\xE5', '\xE7', '\xE9', '\xE8', /* 88 */
+ '\xEA', '\xEB', '\xED', '\xEC', '\xEE', '\xEF', '\xF1', '\xF3', /* 90 */
+ '\xF2', '\xF4', '\xF6', '\xF5', '\xFA', '\xF9', '\xFB', '\xFC', /* 98 */
+ '\xDD', '\xB0', '\xA2', '\xA3', '\xA7', ' ', '\xB6', '\xDF', /* A0 */
+ '\xAE', '\xA9', ' ', '\xB4', '\xA8', ' ', '\xC6', '\xD8', /* A8 */
+ ' ', '\xB1', '\xBE', ' ', '\xA5', '\xB5', ' ', ' ', /* B0 */
+ '\xBD', '\xBC', ' ', '\xAA', '\xBA', ' ', '\xE6', '\xF8', /* B8 */
+ '\xBF', '\xA1', '\xAC', ' ', ' ', ' ', ' ', '\xAB', /* C0 */
+ '\xBB', ' ', '\xA0', '\xC0', '\xC3', '\xD5', ' ', '\xA6', /* C8 */
+ '\xAD', ' ', '"', '"', '\'', '\'', '\xF7', '\xD7', /* D0 */
+ '\xFF', ' ', ' ', '\xA4', '\xD0', '\xF0', '\xDE', '\xFE', /* D8 */
+ '\xFD', '\xB7', ' ', ' ', ' ', '\xC2', '\xCA', '\xC1', /* E0 */
+ '\xCB', '\xC8', '\xCD', '\xCE', '\xCF', '\xCC', '\xD3', '\xD4', /* E8 */
+ ' ', '\xD2', '\xDA', '\xDB', '\xD9', ' ', ' ', ' ', /* F0 */
+ '\xAF', ' ', ' ', ' ', '\xB8', ' ', ' ', ' ', /* F8 */
};
#endif
index 043968de2da6846c4f01bca0cb9f921a61686cad..41ebce0ce3c8379b1d0b5aea32c1098523e91fff 100644 (file)
afm_Times_Roman_kerning_data,
afm_Times_Roman_highchars_index, 220,
afm_Times_Roman_ligatures, 1},
- { 0, 0, 0 }
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
const int afm_fontinfo_count = 14;
index c3446e68d10e903f1cd47e35d8185020f17af87d..f301f21f7a13e1f10f63192a6f7a541eaa7cfb15 100644 (file)
unicode char1, char2, resultingchar;
}
- Font-global info is stored in a
- struct {
- char *fullname; // e.g. "Futura Bold Oblique"
- char *postscript_name; // e.g. "Futura-BoldOblique"
- uint8 *widths;
- sint16 *kerning_index;
- sint8 *kerning_data;
- uint16 *highchars_index;
- uint16 highchars_count;
- unicode *ligatures;
- uint16 ligatures_count;
- }
+ Font-global info is stored in a struct afm_fontinfo (see below).
The highchars_index and ligatures structures are flattened
to a simple array to avoid accidental padding between
typedef const afm_unicode afm_cunicode;
typedef struct afm_fontinfo {
- const char *fullname; // e.g. "Futura Bold Oblique"
- const char *postscript_name; // e.g. "Futura-BoldOblique"
+ const char *fullname; /* e.g. "Futura Bold Oblique" */
+ const char *postscript_name; /* e.g. "Futura-BoldOblique" */
afm_cuint8 *widths;
afm_csint16 *kerning_index;
afm_cuint8 *kerning_data;
diff --git a/program/src/rrd_cgi.c b/program/src/rrd_cgi.c
index 5a47dc2b6384c5e28fd95bdb27e2510e006750b4..d72879f023a2c4a55b03b3a42fc2067a5d50e0e2 100644 (file)
--- a/program/src/rrd_cgi.c
+++ b/program/src/rrd_cgi.c
#define DEBUG_VARS*/
/* global variable for libcgi */
-s_cgi **cgiArg;
+s_cgi *cgiArg;
/* in arg[0] find tags beginning with arg[1] call arg[2] on them
and replace by result of arg[2] call */
-int parse(char **, long, char *, char *(*)(long , char **));
+int parse(char **, long, char *, char *(*)(long , const char **));
/**************************************************/
/* tag replacers ... they are called from parse */
/**************************************************/
/* return cgi var named arg[0] */
-char* cgiget(long , char **);
+char* cgiget(long , const char **);
/* return a quoted cgi var named arg[0] */
-char* cgigetq(long , char **);
+char* cgigetq(long , const char **);
/* return a quoted and sanitized cgi variable */
-char* cgigetqp(long , char **);
+char* cgigetqp(long , const char **);
/* call rrd_graph and insert appropriate image tag */
char* drawgraph(long, char **);
/* return PRINT functions from last rrd_graph call */
-char* drawprint(long, char **);
+char* drawprint(long, const char **);
/* pretty-print the <last></last> value for some.rrd via strftime() */
-char* printtimelast(long, char **);
+char* printtimelast(long, const char **);
/* pretty-print current time */
-char* printtimenow(long,char **);
+char* printtimenow(long, const char **);
/* set an environment variable */
-char* rrdsetenv(long, char **);
+char* rrdsetenv(long, const char **);
/* get an environment variable */
-char* rrdgetenv(long, char **);
+char* rrdgetenv(long, const char **);
/* include the named file at this point */
-char* includefile(long, char **);
+char* includefile(long, const char **);
/* for how long is the output of the cgi valid ? */
-char* rrdgoodfor(long, char **);
+char* rrdgoodfor(long, const char **);
char* rrdstrip(char *buf);
char* scanargs(char *line, int *argc, char ***args);
/* format at-time specified times using strftime */
-char* printstrftime(long, char**);
+char* printstrftime(long, const char**);
/** HTTP protocol needs special format, and GMT time **/
char *http_time(time_t *);
/* rrd interface to the variable functions {put,get}var() */
-char* rrdgetvar(long argc, char **args);
-char* rrdsetvar(long argc, char **args);
-char* rrdsetvarconst(long argc, char **args);
+char* rrdgetvar(long argc, const char **args);
+char* rrdsetvar(long argc, const char **args);
+char* rrdsetvarconst(long argc, const char **args);
/* variable store: put/get key-value pairs */
{
int i;
if (varheap) {
- for (i=0; i<varheap_size; i++) {
+ for (i=0; i<(int)varheap_size; i++) {
if (varheap[i].name) {
free((char*)varheap[i].name);
}
getvar(const char* name)
{
int i;
- for (i=0; i<varheap_size && varheap[i].name; i++) {
+ for (i=0; i<(int)varheap_size && varheap[i].name; i++) {
if (0 == strcmp(name, varheap[i].name)) {
#ifdef DEBUG_VARS
printf("<!-- getvar(%s) -> %s -->\n", name, varheap[i].value);
putvar(const char* name, const char* value, int is_const)
{
int i;
- for (i=0; i < varheap_size && varheap[i].name; i++) {
+ for (i=0; i < (int)varheap_size && varheap[i].name; i++) {
if (0 == strcmp(name, varheap[i].name)) {
/* overwrite existing entry */
if (varheap[i].is_const) {
}
/* no existing variable found by that name, add it */
- if (i == varheap_size) {
+ if (i == (int)varheap_size) {
/* ran out of heap: resize heap to double size */
size_t new_size = varheap_size * 2;
varheap = (vardata*)(realloc(varheap, sizeof(vardata) * new_size));
/* remove occurrences of .. this is a general measure to make
paths which came in via cgi do not go UP ... */
-char* rrdsetenv(long argc, char **args) {
+char* rrdsetenv(long argc, const char **args) {
if (argc >= 2) {
char *xyz = malloc((strlen(args[0]) + strlen(args[1]) + 2));
if (xyz == NULL) {
/* rrd interface to the variable function putvar() */
char*
-rrdsetvar(long argc, char **args)
+rrdsetvar(long argc, const char **args)
{
if (argc >= 2)
{
/* rrd interface to the variable function putvar() */
char*
-rrdsetvarconst(long argc, char **args)
+rrdsetvarconst(long argc, const char **args)
{
if (argc >= 2)
{
"were defined]");
}
-char* rrdgetenv(long argc, char **args) {
+char* rrdgetenv(long argc, const char **args) {
char buf[128];
const char* envvar;
if (argc != 1) {
}
}
-char* rrdgetvar(long argc, char **args) {
+char* rrdgetvar(long argc, const char **args) {
char buf[128];
const char* value;
if (argc != 1) {
}
}
-char* rrdgoodfor(long argc, char **args){
+char* rrdgoodfor(long argc, const char **args){
if (argc == 1) {
goodfor = atol(args[0]);
} else {
* start and end times, because, either might be relative to the other.
* */
#define MAX_STRFTIME_SIZE 256
-char* printstrftime(long argc, char **args){
+char* printstrftime(long argc, const char **args){
struct rrd_time_value start_tv, end_tv;
char *parsetime_error = NULL;
char formatted[MAX_STRFTIME_SIZE];
}
}
-char* includefile(long argc, char **args){
+char* includefile(long argc, const char **args){
char *buffer;
if (argc >= 1) {
- char* filename = args[0];
- readfile(filename, &buffer, 0);
+ readfile(args[0], &buffer, 0);
if (rrd_test_error()) {
char *err = malloc((strlen(rrd_get_error())+DS_NAM_SIZE));
sprintf(err, "[ERROR: %s]",rrd_get_error());
return buf;
}
-char* cgigetq(long argc, char **args){
+char* cgigetq(long argc, const char **args){
if (argc>= 1){
char *buf = rrdstrip(cgiGetValue(cgiArg,args[0]));
char *buf2;
/* remove occurrences of .. this is a general measure to make
paths which came in via cgi do not go UP ... */
-char* cgigetqp(long argc, char **args){
+char* cgigetqp(long argc, const char **args){
if (argc>= 1) {
char *buf = rrdstrip(cgiGetValue(cgiArg,args[0]));
char *buf2;
}
-char* cgiget(long argc, char **args){
+char* cgiget(long argc, const char **args){
if (argc>= 1)
return rrdstrip(cgiGetValue(cgiArg,args[0]));
else
return NULL;
}
-char* drawprint(long argc, char **args){
+char* drawprint(long argc, const char **args){
if (argc==1 && calcpr){
long i=0;
while (calcpr[i] != NULL) i++; /*determine number lines in calcpr*/
return stralloc("[ERROR: RRD::PRINT argument error]");
}
-char* printtimelast(long argc, char **args) {
+char* printtimelast(long argc, const char **args) {
time_t last;
struct tm tm_last;
char *buf;
return stralloc("[ERROR: not enough arguments for RRD::TIME::LAST]");
}
-char* printtimenow(long argc, char **args) {
+char* printtimenow(long argc, const char **args) {
time_t now = time(NULL);
struct tm tm_now;
char *buf;
char **buf, /* buffer */
long i, /* offset in buffer */
char *tag, /* tag to handle */
- char *(*func)(long argc, char **args) /* function to call for 'tag' */
+ char *(*func)(long , const char **) /* function to call for 'tag' */
)
{
/* the name of the vairable ... */
diff --git a/program/src/rrd_gfx.c b/program/src/rrd_gfx.c
index c06e061c8227c120bd2417cb2dc0881bf273f549..12607d408bf68472ca8248e5fa910745655c5d99 100644 (file)
--- a/program/src/rrd_gfx.c
+++ b/program/src/rrd_gfx.c
return text_width/64;
}
-static void gfx_libart_close_path(gfx_canvas_t *canvas,
- gfx_node_t *node, ArtVpath **vec)
+static void gfx_libart_close_path(gfx_node_t *node, ArtVpath **vec)
{
/* libart must have end==start for closed paths,
even if using ART_MOVETO and not ART_MOVETO_OPEN
art_vpath_add_point (vec, &points, &points_max, ART_END, 0, 0);
}
-static void gfx_round_scaled_coordinates(gfx_canvas_t *canvas,
- gfx_node_t *node, ArtVpath *vec)
+static void gfx_round_scaled_coordinates(ArtVpath *vec)
{
while (vec->code != ART_END) {
vec->x = floor(vec->x - LINEOFFSET + 0.5) + LINEOFFSET;
art_affine_scale(dst,canvas->zoom,canvas->zoom);
vec = art_vpath_affine_transform(node->path,dst);
if (node->closed_path)
- gfx_libart_close_path(canvas, node, &vec);
- gfx_round_scaled_coordinates(canvas, node, vec);
+ gfx_libart_close_path(node, &vec);
+ gfx_round_scaled_coordinates(vec);
if(node->type == GFX_LINE){
svp = art_svp_vpath_stroke ( vec, ART_PATH_STROKE_JOIN_ROUND,
ART_PATH_STROKE_CAP_ROUND,
gr = bit->bitmap.num_grays -1;
for (iy=0; iy < bit->bitmap.rows; iy++){
long buf_y = iy+(pen_y+0.5)-bit->top;
- if (buf_y < 0 || buf_y >= pys_height) continue;
+ if (buf_y < 0 || buf_y >= (long)pys_height) continue;
buf_y *= rowstride;
for (ix=0;ix < bit->bitmap.width;ix++){
long buf_x = ix + (pen_x + 0.5) + (double)bit->left ;
art_u8 font_alpha;
- if (buf_x < 0 || buf_x >= pys_width) continue;
+ if (buf_x < 0 || buf_x >= (long)pys_width) continue;
buf_x *= bytes_per_pixel ;
font_alpha = *(bit->bitmap.buffer + iy * bit->bitmap.width + ix);
font_alpha = (art_u8)((double)font_alpha / gr * falpha);
index a7bc3f2c8d16acb4523125b3368e8247f5f30e63..a44cb09b5e599e5c650d2b18f231e9a8178f0d72 100644 (file)
--- a/program/src/rrd_graph.c
+++ b/program/src/rrd_graph.c
** into one interval for the destination.
*/
- for (dst_row=0;row_cnt>=reduce_factor;dst_row++) {
+ for (dst_row=0;(long int)row_cnt>=reduce_factor;dst_row++) {
for (col=0;col<(*ds_cnt);col++) {
rrd_value_t newval=DNAN;
unsigned long validval=0;
int
data_fetch(image_desc_t *im )
{
- unsigned int i,ii;
+ int i,ii;
int skip;
/* pull the data from the log files ... */
- for (i=0;i<im->gdes_c;i++){
+ for (i=0;i< (int)im->gdes_c;i++){
/* only GF_DEF elements fetch data */
if (im->gdes[i].gf != GF_DEF)
continue;
}
/* lets see if the required data source is really there */
- for(ii=0;ii<im->gdes[i].ds_cnt;ii++){
+ for(ii=0;ii<(int)im->gdes[i].ds_cnt;ii++){
if(strcmp(im->gdes[i].ds_namv[ii],im->gdes[i].ds_nam) == 0){
im->gdes[i].ds=ii; }
}
** the time of the graph. Beware.
*/
vidx = im->gdes[ii].vidx;
- if ( (gr_time >= im->gdes[vidx].start) &&
- (gr_time <= im->gdes[vidx].end) ) {
+ if ( ((long int)gr_time >= (long int)im->gdes[vidx].start) &&
+ ((long int)gr_time <= (long int)im->gdes[vidx].end) ) {
value = im->gdes[vidx].data[
(unsigned long) floor(
(double)(gr_time - im->gdes[vidx].start)
/* horrible hack until we can actually print vertically */
{
int n;
- int l=strlen(im->ylegend);
char s[2];
- for (n=0;n<strlen(im->ylegend);n++) {
+ for (n=0;n< (int)strlen(im->ylegend);n++) {
s[0]=im->ylegend[n];
s[1]='\0';
gfx_new_text(im->canvas,7,im->text_prop[TEXT_PROP_AXIS].size*(n+1),
&im->xlab_user.precis,
&stroff) == 7 && stroff != 0){
strncpy(im->xlab_form, optarg+stroff, sizeof(im->xlab_form) - 1);
- if((im->xlab_user.gridtm = tmt_conv(scan_gtm)) == -1){
+ if((int)(im->xlab_user.gridtm = tmt_conv(scan_gtm)) == -1){
rrd_set_error("unknown keyword %s",scan_gtm);
return;
- } else if ((im->xlab_user.mgridtm = tmt_conv(scan_mtm)) == -1){
+ } else if ((int)(im->xlab_user.mgridtm = tmt_conv(scan_mtm)) == -1){
rrd_set_error("unknown keyword %s",scan_mtm);
return;
- } else if ((im->xlab_user.labtm = tmt_conv(scan_ltm)) == -1){
+ } else if ((int)(im->xlab_user.labtm = tmt_conv(scan_ltm)) == -1){
rrd_set_error("unknown keyword %s",scan_ltm);
return;
}
im->imginfo = optarg;
break;
case 'a':
- if((im->canvas->imgformat = if_conv(optarg)) == -1) {
+ if((int)(im->canvas->imgformat = if_conv(optarg)) == -1) {
rrd_set_error("unsupported graphics format '%s'",optarg);
return;
}
n=0;
sscanf(str,"%le,%29[A-Z]%n",¶m,func,&n);
- if (n==strlen(str)) { /* matched */
+ if (n== (int)strlen(str)) { /* matched */
;
} else {
n=0;
sscanf(str,"%29[A-Z]%n",func,&n);
- if (n==strlen(str)) { /* matched */
+ if (n== (int)strlen(str)) { /* matched */
param=DNAN;
} else {
rrd_set_error("Unknown function string '%s' in VDEF '%s'"
index ef1e8e747bb2b6c18ef85dc656fbcdcea98ea388..a15c0ed1dec7d1c6491cfadb534906b1bb44d637 100644 (file)
#define dprintf if (gdp->debug) printf
+/* Define prototypes for the parsing methods.
+ Inputs:
+ char *line - pointer to base of input source
+ unsigned int eaten - index to next input character (INPUT/OUTPUT)
+ graph_desc_t *gdp - pointer to a graph description
+ image_desc_t *im - pointer to an image description
+*/
+
+int rrd_parse_find_gf (char *, unsigned int *, graph_desc_t *);
+int rrd_parse_legend (char *, unsigned int *, graph_desc_t *);
+int rrd_parse_color (char *, graph_desc_t *);
+int rrd_parse_CF (char *, unsigned int *, graph_desc_t *);
+int rrd_parse_print (char *, unsigned int *, graph_desc_t *, image_desc_t *);
+int rrd_parse_PVHLAST (char *, unsigned int *, graph_desc_t *, image_desc_t *);
+int rrd_parse_vname (char *, unsigned int *, graph_desc_t *, image_desc_t *);
+int rrd_parse_def (char *, unsigned int *, graph_desc_t *, image_desc_t *);
+int rrd_parse_vdef (char *, unsigned int *, graph_desc_t *, image_desc_t *);
+int rrd_parse_cdef (char *, unsigned int *, graph_desc_t *, image_desc_t *);
+
+
+
int
rrd_parse_find_gf(char *line, unsigned int *eaten, graph_desc_t *gdp) {
char funcname[11],c1=0,c2=0;
diff --git a/program/src/rrd_last.c b/program/src/rrd_last.c
index 78ba5a360823dfa16d235fe1073cbdc9a0a62969..ad8075e8e90139b80a1cac46e8d5df8c304593bd 100644 (file)
--- a/program/src/rrd_last.c
+++ b/program/src/rrd_last.c
#include "rrd_tool.h"
time_t
-rrd_last(int argc, char **argv)
+rrd_last(int argc, const char **argv)
{
- time_t lastup;
-
if(argc < 2){
rrd_set_error("please specify an rrd");
return(-1);
}
- lastup = rrd_last_r(argv[1]);
-
- return(lastup);
+ return( rrd_last_r(argv[1]) );
}
time_t
-rrd_last_r(char *filename)
+rrd_last_r(const char *filename)
{
FILE *in_file;
time_t lastup;
diff --git a/program/src/rrd_open.c b/program/src/rrd_open.c
index 443a1a5652a50c01a023a47c6fb51773241d364d..66d1865e7d3562e2e62e8479b93c3ad5d69434e9 100644 (file)
--- a/program/src/rrd_open.c
+++ b/program/src/rrd_open.c
*****************************************************************************
* $Id$
* $Log$
+ * Revision 1.10 2004/05/26 22:11:12 oetiker
+ * reduce compiler warnings. Many small fixes. -- Mike Slifcak <slif@bellsouth.net>
+ *
* Revision 1.9 2003/04/29 21:56:49 oetiker
* readline in rrd_open.c reads the file in 8 KB blocks, and calls realloc for
* each block. realloc is very slow in Mac OS X for huge blocks, e.g. when
/* positioned to the first cdp in the first rra */
int
-rrd_open(char *file_name, FILE **in_file, rrd_t *rrd, int rdwr)
+rrd_open(const char *file_name, FILE **in_file, rrd_t *rrd, int rdwr)
{
if (mem) free(mem);
}
-int readfile(char *file_name, char **buffer, int skipfirst){
+int readfile(const char *file_name, char **buffer, int skipfirst){
long writecnt=0,totalcnt = MEMBLK;
long offset = 0;
FILE *input=NULL;
index ddbf9ecce2c87ff2d3bf8f9acee9e96b5a723842..3e67af76f8436de16c977991eab2326d3f47a8a8 100644 (file)
--- a/program/src/rrd_resize.c
+++ b/program/src/rrd_resize.c
}
if (modify < 0)
- if (rrdold.rra_def[target_rra].row_cnt <= -modify) {
+ if ((long)rrdold.rra_def[target_rra].row_cnt <= -modify) {
rrd_set_error("This RRA is not that big");
rrd_free(&rrdold);
fclose(infile);
signed long int remove_end=0;
remove_end=(rrdnew.rra_ptr[target_rra].cur_row-modify)%rrdnew.rra_def[target_rra].row_cnt;
- if (remove_end <= rrdnew.rra_ptr[target_rra].cur_row) {
+ if (remove_end <= (signed long int)rrdnew.rra_ptr[target_rra].cur_row) {
while (remove_end >= 0) {
fseek(infile,sizeof(rrd_value_t)*rrdnew.stat_head->ds_cnt,SEEK_CUR);
rrdnew.rra_ptr[target_rra].cur_row--;
index e759c1c3028a6c895aeef2ab4ddc2f21e4adce1d..3e55490c906d3c550f83bab8a073a6f4c9cce28b 100644 (file)
read_tag(&ptr2,"type",DST_FMT,rrd->ds_def[rrd->stat_head->ds_cnt-1].dst);
/* test for valid type */
- if(dst_conv(rrd->ds_def[rrd->stat_head->ds_cnt-1].dst) == -1) return -1;
+ if( (int)dst_conv(rrd->ds_def[rrd->stat_head->ds_cnt-1].dst) == -1) return -1;
if (dst_conv(rrd->ds_def[rrd->stat_head->ds_cnt-1].dst) != DST_CDEF)
{
read_tag(&ptr2,"cf",CF_NAM_FMT,rrd->rra_def[rrd->stat_head->rra_cnt-1].cf_nam);
/* test for valid type */
- if(cf_conv(rrd->rra_def[rrd->stat_head->rra_cnt-1].cf_nam) == -1) return -1;
+ if( (int)cf_conv(rrd->rra_def[rrd->stat_head->rra_cnt-1].cf_nam) == -1) return -1;
read_tag(&ptr2,"pdp_per_row","%lu",&(rrd->rra_def[rrd->stat_head->rra_cnt-1].pdp_cnt));
/* support to read RRA parameters */
}
eat_tag(&ptr2, "/params");
eat_tag(&ptr2,"cdp_prep");
- for(i=0;i<rrd->stat_head->ds_cnt;i++)
+ for(i=0;i< (int)rrd->stat_head->ds_cnt;i++)
{
eat_tag(&ptr2,"ds");
/* support to read CDP parameters */
rows++;
mempool--;
rrd->rra_def[rrd->stat_head->rra_cnt-1].row_cnt++;
- for(i=0;i<rrd->stat_head->ds_cnt;i++){
+ for(i=0;i< (int)rrd->stat_head->ds_cnt;i++){
rrd_value_t * value = &(rrd->rrd_value[(rows-1)*rrd->stat_head->ds_cnt+i]);
return(-1);
}
- for(i=0; i <rrd->stat_head->rra_cnt; i++) {
+ for(i=0; i < (int)rrd->stat_head->rra_cnt; i++) {
/* last row in the xml file is the most recent; as
* rrd_update increments the current row pointer, set cur_row
* here to the last row. */
diff --git a/program/src/rrd_tool.c b/program/src/rrd_tool.c
index 6892ac57ffb926b12b536bfe0dd7b299bef23c09..6aa53cc5b78dfdbc43266e2ac918c0746401eeac 100644 (file)
--- a/program/src/rrd_tool.c
+++ b/program/src/rrd_tool.c
"\t\t[--resolution|-r resolution]\n"
"\t\t[--start|-s start] [--end|-e end]\n\n";
- char help_graph[] =
+/* break up very large strings (help_graph, help_tune) for ISO C89 compliance*/
+
+ char help_graph1[] =
"* graph - generate a graph from one or several RRD\n\n"
"\trrdtool graph filename [-s|--start seconds] [-e|--end seconds]\n"
"\t\t[-x|--x-grid x-axis grid and label]\n"
"\t\t[-h|--height pixels] [-o|--logarithmic]\n"
"\t\t[-u|--upper-limit value] [-z|--lazy]\n"
"\t\t[-l|--lower-limit value] [-r|--rigid]\n"
- "\t\t[-g|--no-legend]\n"
+ "\t\t[-g|--no-legend]\n";
+ char help_graph2[] =
"\t\t[-j|--only-graph]\n"
"\t\t[--font FONTTAG:size:font]\n"
"\t\t[--zoom factor]\n"
"\t\t[--step seconds]\n"
"\t\t[-f|--imginfo printfstr]\n"
"\t\t[-a|--imgformat PNG]\n"
- "\t\t[-c|--color COLORTAG#rrggbb[aa]] [-t|--title string]\n"
+ "\t\t[-c|--color COLORTAG#rrggbb[aa]] [-t|--title string]\n";
+ char help_graph3[] =
"\t\t[DEF:vname=rrd:ds-name:CF]\n"
"\t\t[CDEF:vname=rpn-expression]\n"
"\t\t[PRINT:vname:CF:format]\n"
"\t\t[AREA:vname[#rrggbb[aa][:legend]]]\n"
"\t\t[STACK:vname[#rrggbb[aa][:legend]]]\n\n";
- char help_tune[] =
+ char help_tune1[] =
" * tune - Modify some basic properties of an RRD\n\n"
"\trrdtool tune filename\n"
"\t\t[--heartbeat|-h ds-name:heartbeat]\n"
"\t\t[--deltapos scale-value] [--deltaneg scale-value]\n"
"\t\t[--failure-threshold integer]\n"
"\t\t[--window-length integer]\n"
- "\t\t[--alpha adaptation-parameter]\n"
+ "\t\t[--alpha adaptation-parameter]\n";
+ char help_tune2[] =
+ " * tune - Modify some basic properties of an RRD\n\n"
"\t\t[--beta adaptation-parameter]\n"
"\t\t[--gamma adaptation-parameter]\n"
"\t\t[--gamma-deviation adaptation-parameter]\n"
fputs(help_fetch, stdout);
break;
case C_GRAPH:
- fputs(help_graph, stdout);
+ fputs(help_graph1, stdout);
+ fputs(help_graph2, stdout);
+ fputs(help_graph3, stdout);
break;
case C_TUNE:
- fputs(help_tune, stdout);
+ fputs(help_tune1, stdout);
+ fputs(help_tune2, stdout);
break;
case C_RESIZE:
fputs(help_resize, stdout);
if (strcmp(firstdir,"")){
chdir(firstdir);
if (errno!=0){
- fprintf(stderr,"ERROR: %s\n",strerror(errno));
+ fprintf(stderr,"ERROR: %s\n",rrd_strerror(errno));
exit(errno);
}
}
#endif
chdir(argv[2]);
if (errno!=0){
- printf("ERROR: %s\n",strerror(errno));
+ printf("ERROR: %s\n",rrd_strerror(errno));
}
return(0);
}
#endif
mkdir(argv[2],0777);
if (errno!=0){
- printf("ERROR: %s\n",strerror(errno));
+ printf("ERROR: %s\n",rrd_strerror(errno));
}
return(0);
}
}
}
else{
- printf("ERROR: %s\n",strerror(errno));
+ printf("ERROR: %s\n",rrd_strerror(errno));
return(errno);
}
return(0);
else if (strcmp("resize", argv[1]) == 0)
rrd_resize(argc-1, &argv[1]);
else if (strcmp("last", argv[1]) == 0)
- printf("%ld\n",rrd_last(argc-1, &argv[1]));
+ printf("%ld\n",rrd_last(argc-1, argv[1]));
else if (strcmp("update", argv[1]) == 0)
rrd_update(argc-1, &argv[1]);
else if (strcmp("fetch", argv[1]) == 0) {
}
else if (strcmp("graph", argv[1]) == 0) {
char **calcpr;
+#ifdef notused /*XXX*/
const char *imgfile = argv[2]; /* rrd_graph changes argv pointer */
+#endif
int xsize, ysize;
int i;
int tostdout = (strcmp(argv[2],"-") == 0);
diff --git a/program/src/rrd_tool.h b/program/src/rrd_tool.h
index 92c99aee53039611dff999f114d38bb4ffbcec36..dbfb26b06add6c1044baaf2df3a610450dc98516 100644 (file)
--- a/program/src/rrd_tool.h
+++ b/program/src/rrd_tool.h
void rrd_freemem(void *mem);
void rrd_init(rrd_t *rrd);
-int rrd_open(char *file_name, FILE **in_file, rrd_t *rrd, int rdwr);
-int rrd_open_r(char *file_name, FILE **in_file, rrd_t *rrd, int rdwr);
-int readfile(char *file, char **buffer, int skipfirst);
-int readfile_r(char *file, char **buffer, int skipfirst);
+int rrd_open(const char *file_name, FILE **in_file, rrd_t *rrd, int rdwr);
+int readfile(const char *file, char **buffer, int skipfirst);
#define RRD_READONLY 0
#define RRD_READWRITE 1
thread overwrite the same buffer */
const char *rrd_strerror(int err);
-/* just a defensive work-around... */
-#define strerror(x) rrd_strerror(x)
-
#endif
#ifdef __cplusplus
diff --git a/program/src/rrd_tune.c b/program/src/rrd_tune.c
index 2996b929f16e87df5eb4d4ddac2019daf059aa82..1b5515d9eb0b03313a753c8e8650f902934d1f50 100644 (file)
--- a/program/src/rrd_tune.c
+++ b/program/src/rrd_tune.c
*****************************************************************************
* $Id$
* $Log$
+ * Revision 1.6 2004/05/26 22:11:12 oetiker
+ * reduce compiler warnings. Many small fixes. -- Mike Slifcak <slif@bellsouth.net>
+ *
* Revision 1.5 2002/02/01 20:34:49 oetiker
* fixed version number and date/time
*
fclose(rrd_file);
return -1;
}
- if (dst_conv(dst) == -1){
+ if ((int)dst_conv(dst) == -1){
rrd_free(&rrd);
fclose(rrd_file);
return -1;
rrd_file);
} else {
int i;
- for(i=0;i< rrd.stat_head->ds_cnt;i++)
+ for(i=0;i< (int)rrd.stat_head->ds_cnt;i++)
if (dst_conv(rrd.ds_def[i].dst) != DST_CDEF) {
printf("DS[%s] typ: %s\thbt: %ld\tmin: %1.4f\tmax: %1.4f\n",
rrd.ds_def[i].ds_nam,
index 117de6a796fa7a6b8b19a04b3a264c26c49c1dba..583d9acf0bcd0540de115bf3093a42fd4b5f1379 100644 (file)
--- a/program/src/rrd_update.c
+++ b/program/src/rrd_update.c
*****************************************************************************
* $Id$
* $Log$
+ * Revision 1.17 2004/05/26 22:11:12 oetiker
+ * reduce compiler warnings. Many small fixes. -- Mike Slifcak <slif@bellsouth.net>
+ *
* Revision 1.16 2004/05/25 20:52:16 oetiker
* fix spelling and syntax, especially in messages that are printed -- Mike Slifcak
*
LockRRD(FILE *rrdfile)
{
int rrd_fd; /* File descriptor for RRD */
- int stat;
+ int rcstat;
rrd_fd = fileno(rrdfile);
{
#ifndef WIN32
- struct flock lock;
+ struct flock lock;
lock.l_type = F_WRLCK; /* exclusive write lock */
lock.l_len = 0; /* whole file */
lock.l_start = 0; /* start of file */
lock.l_whence = SEEK_SET; /* end of file */
- stat = fcntl(rrd_fd, F_SETLK, &lock);
+ rcstat = fcntl(rrd_fd, F_SETLK, &lock);
#else
- struct _stat st;
+ struct _stat st;
- if ( _fstat( rrd_fd, &st ) == 0 ) {
- stat = _locking ( rrd_fd, _LK_NBLCK, st.st_size );
- } else {
- stat = -1;
- }
+ if ( _fstat( rrd_fd, &st ) == 0 ) {
+ rcstat = _locking ( rrd_fd, _LK_NBLCK, st.st_size );
+ } else {
+ rcstat = -1;
+ }
#endif
}
- return(stat);
+ return(rcstat);
}
index c12b783bd07dce361f5b7f9045149a44db8052a0..cceefe26f636d816ad5bc41228d8c621caabb18f 100644 (file)
--- a/program/src/rrd_xport.c
+++ b/program/src/rrd_xport.c
char varname[30],*rpnex;
gdes_alloc(&im);
if(sscanf(argv[i],"%10[A-Z0-9]:%n",symname,&argstart)==1){
- if((im.gdes[im.gdes_c-1].gf=gf_conv(symname))==-1){
+ if((int)(im.gdes[im.gdes_c-1].gf=gf_conv(symname))==-1){
im_free(&im);
rrd_set_error("unknown function '%s'",symname);
return -1;
im.gdes[im.gdes_c-1].vname);
return -1;
}
- if((im.gdes[im.gdes_c-1].cf=cf_conv(symname))==-1){
+ if((int)(im.gdes[im.gdes_c-1].cf=cf_conv(symname))==-1){
im_free(&im);
rrd_set_error("unknown cf '%s'",symname);
return -1;
}
/* fill data structure */
- for(dst_row = 0; dst_row < row_cnt; dst_row++) {
- for(i = 0; i < nof_xports; i++) {
+ for(dst_row = 0; (int)dst_row < (int)row_cnt; dst_row++) {
+ for(i = 0; i < (int)nof_xports; i++) {
j = ref_list[i];
ii = im->gdes[j].vidx;
ds_cnt = &im->gdes[ii].ds_cnt;