summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7f30ee2)
raw | patch | inline | side by side (parent: 7f30ee2)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 30 May 2007 12:41:39 +0000 (12:41 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 30 May 2007 12:41:39 +0000 (12:41 +0000) |
src/rrd_fetch.c | patch | blob | history | |
src/rrd_first.c | patch | blob | history | |
src/rrd_graph.c | patch | blob | history | |
src/rrd_graph.h | patch | blob | history | |
src/rrd_info.c | patch | blob | history | |
src/rrd_lastupdate.c | patch | blob | history | |
src/rrd_open.c | patch | blob | history | |
src/rrd_resize.c | patch | blob | history |
diff --git a/src/rrd_fetch.c b/src/rrd_fetch.c
index 618f3d3036a4561eda0c833ac3cbee89c02b5f3e..422f59b0fcf9c1e371c66dc3803ff8a53f210c05 100644 (file)
--- a/src/rrd_fetch.c
+++ b/src/rrd_fetch.c
POSIX_FADV_DONTNEED)) {
rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s",
filename, rrd_strerror(errno));
- goto err_close;/*XXX: should use err_free_all_ds_namv */
+ goto err_close; /*XXX: should use err_free_all_ds_namv */
}
#endif
POSIX_FADV_DONTNEED)) {
rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s", filename,
rrd_strerror(errno));
- goto err_free; /*XXX: should use err_free_all_ds_namv */
+ goto err_free; /*XXX: should use err_free_all_ds_namv */
}
#endif
rrd_close(rrd_file);
return (0);
-err_free_data:
+ err_free_data:
free(*data);
*data = NULL;
-err_free_all_ds_namv:
- for (i = 0; (unsigned long)i < rrd.stat_head->ds_cnt; ++i)
+ err_free_all_ds_namv:
+ for (i = 0; (unsigned long) i < rrd.stat_head->ds_cnt; ++i)
free((*ds_namv)[i]);
-err_free_ds_namv:
+ err_free_ds_namv:
free(*ds_namv);
-err_close:
+ err_close:
rrd_close(rrd_file);
-err_free:
+ err_free:
rrd_free(&rrd);
return (-1);
}
diff --git a/src/rrd_first.c b/src/rrd_first.c
index bb869471574d3f657fbb5c335227885c9ca1e403..abba426f21ecf60ce86c2f27b3cd839605d0986b 100644 (file)
--- a/src/rrd_first.c
+++ b/src/rrd_first.c
rrd.live_head->last_up %
(rrd.rra_def[rraindex].pdp_cnt * rrd.stat_head->pdp_step)) +
(timer * rrd.rra_def[rraindex].pdp_cnt * rrd.stat_head->pdp_step);
-err_close:
+ err_close:
rrd_close(rrd_file);
-err_free:
+ err_free:
rrd_free(&rrd);
return (then);
}
diff --git a/src/rrd_graph.c b/src/rrd_graph.c
index 2aba6f92c5d1f6a9612280eb7b4396ce97c35645..191404e2d0eab670b5f3fc093feb9c3890df38db 100644 (file)
--- a/src/rrd_graph.c
+++ b/src/rrd_graph.c
}
if (im->extra_flags & FULL_SIZE_MODE)
- leg_y = leg_y_prev = leg_y - (int) (im->text_prop[TEXT_PROP_LEGEND].size*1.8);
+ leg_y = leg_y_prev =
+ leg_y - (int) (im->text_prop[TEXT_PROP_LEGEND].size * 1.8);
for (i = 0; i < im->gdes_c; i++) {
fill_last = fill;
if (im->extra_flags & FULL_SIZE_MODE) {
/* only add y space if there was text on the line */
if (leg_x > border || prt_fctn == 's')
- leg_y -= im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
+ leg_y -= im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
if (prt_fctn == 's')
- leg_y += im->text_prop[TEXT_PROP_LEGEND].size;
+ leg_y += im->text_prop[TEXT_PROP_LEGEND].size;
} else {
if (leg_x > border || prt_fctn == 's')
- leg_y += im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
+ leg_y += im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
if (prt_fctn == 's')
- leg_y -= im->text_prop[TEXT_PROP_LEGEND].size;
+ leg_y -= im->text_prop[TEXT_PROP_LEGEND].size;
}
fill = 0;
leg_c = 0;
}
if (im->extra_flags & FULL_SIZE_MODE) {
- if (leg_y != leg_y_prev) {
- *gY = leg_y - im->text_prop[TEXT_PROP_LEGEND].size*1.8;
- im->yorigin = leg_y - im->text_prop[TEXT_PROP_LEGEND].size*1.8;
- }
+ if (leg_y != leg_y_prev) {
+ *gY = leg_y - im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
+ im->yorigin =
+ leg_y - im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
+ }
} else {
- im->yimg = leg_y_prev;
- /* if we did place some legends we have to add vertical space */
- if (leg_y != im->yimg)
- im->yimg += im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
+ im->yimg = leg_y_prev;
+ /* if we did place some legends we have to add vertical space */
+ if (leg_y != im->yimg)
+ im->yimg += im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
}
free(legspace);
}
** | watermark |
** +------------------------------------------------+
*/
-
- if (im->ylegend[0] != '\0' ) {
- Xvertical = im->text_prop[TEXT_PROP_UNIT].size *2;
+
+ if (im->ylegend[0] != '\0') {
+ Xvertical = im->text_prop[TEXT_PROP_UNIT].size * 2;
}
if (im->title[0] != '\0') {
- /* The title is placed "inbetween" two text lines so it
+ /* The title is placed "inbetween" two text lines so it
** automatically has some vertical spacing. The horizontal
** spacing is added here, on each side.
*/
- /* if necessary, reduce the font size of the title until it fits the image width */
- Ytitle = im->text_prop[TEXT_PROP_TITLE].size*2.6+10;
+ /* if necessary, reduce the font size of the title until it fits the image width */
+ Ytitle = im->text_prop[TEXT_PROP_TITLE].size * 2.6 + 10;
}
if (elements) {
- if (im->draw_x_grid) {
- Yxlabel=im->text_prop[TEXT_PROP_AXIS].size *2.5;
- }
- if (im->draw_y_grid || im->forceleftspace ) {
- Xylabel=gfx_get_text_width(im->canvas, 0,
- im->text_prop[TEXT_PROP_AXIS].font,
- im->text_prop[TEXT_PROP_AXIS].size,
- im->tabwidth,
- "0", 0) * im->unitslength;
- }
+ if (im->draw_x_grid) {
+ Yxlabel = im->text_prop[TEXT_PROP_AXIS].size * 2.5;
+ }
+ if (im->draw_y_grid || im->forceleftspace) {
+ Xylabel = gfx_get_text_width(im->canvas, 0,
+ im->text_prop[TEXT_PROP_AXIS].font,
+ im->text_prop[TEXT_PROP_AXIS].size,
+ im->tabwidth,
+ "0", 0) * im->unitslength;
+ }
}
if (im->extra_flags & FULL_SIZE_MODE) {
/* The actual size of the image to draw has been determined by the user.
- ** The graph area is the space remaining after accounting for the legend,
- ** the watermark, the pie chart, the axis labels, and the title.
- */
- im->xorigin =0;
+ ** The graph area is the space remaining after accounting for the legend,
+ ** the watermark, the pie chart, the axis labels, and the title.
+ */
+ im->xorigin = 0;
im->ximg = im->xsize;
im->yimg = im->ysize;
im->yorigin = im->ysize;
- Xmain=im->ximg;
- Ymain=im->yimg;
+ Xmain = im->ximg;
+ Ymain = im->yimg;
im->yorigin += Ytitle;
#ifdef WITH_PIECHART
if (piechart) {
- im->piesize=im->xsize<im->ysize?im->xsize:im->ysize;
- Xpie=im->piesize;
- Ypie=im->piesize;
+ im->piesize = im->xsize < im->ysize ? im->xsize : im->ysize;
+ Xpie = im->piesize;
+ Ypie = im->piesize;
}
#endif
/* Initial size calculation for the main graph area */
Xmain = im->ximg - (Xylabel + 2 * Xspacing);
- if (Xmain) Xmain -= Xspacing; /* put space between main graph area and right edge */
+ if (Xmain)
+ Xmain -= Xspacing; /* put space between main graph area and right edge */
#ifdef WITH_PIECHART
- Xmain -= Xpie; /* remove pie width from main graph area */
- if (Xpie) Xmain -= Xspacing; /* put space between pie and main graph area */
+ Xmain -= Xpie; /* remove pie width from main graph area */
+ if (Xpie)
+ Xmain -= Xspacing; /* put space between pie and main graph area */
#endif
im->xorigin = Xspacing + Xylabel;
/* the length of the title should not influence with width of the graph
if (Xtitle > im->ximg) im->ximg = Xtitle; */
- if (Xvertical) { /* unit description */
+ if (Xvertical) { /* unit description */
Xmain -= Xvertical;
im->xorigin += Xvertical;
}
im->xsize = Xmain;
- xtr(im,0);
+ xtr(im, 0);
/* The vertical size of the image is known in advance. The main graph area
- ** (Ymain) and im->yorigin must be set according to the space requirements
- ** of the legend and the axis labels.
- */
+ ** (Ymain) and im->yorigin must be set according to the space requirements
+ ** of the legend and the axis labels.
+ */
/* Determine where to place the legends onto the image.
- ** Set Ymain and adjust im->yorigin to match the space requirements.
- */
- if (leg_place(im,&Ymain)==-1)
+ ** Set Ymain and adjust im->yorigin to match the space requirements.
+ */
+ if (leg_place(im, &Ymain) == -1)
return -1;
#ifdef WITH_PIECHART
if (Ytitle) {
Ymain -= Ytitle;
} else {
- Ymain -= 1.5*Yspacing;
+ Ymain -= 1.5 * Yspacing;
}
/* watermark doesn't seem to effect the vertical size of the main graph area, oh well! */
im->ysize = Ymain;
- } else /* dimension options -width and -height refer to the dimensions of the main graph area */
- {
+ } else { /* dimension options -width and -height refer to the dimensions of the main graph area */
+
/* The actual size of the image to draw is determined from
- ** several sources. The size given on the command line is
- ** the graph area but we need more as we have to draw labels
- ** and other things outside the graph area.
- */
+ ** several sources. The size given on the command line is
+ ** the graph area but we need more as we have to draw labels
+ ** and other things outside the graph area.
+ */
- if (im->ylegend[0] != '\0' ) {
- Xvertical = im->text_prop[TEXT_PROP_UNIT].size *2;
+ if (im->ylegend[0] != '\0') {
+ Xvertical = im->text_prop[TEXT_PROP_UNIT].size * 2;
}
if (im->title[0] != '\0') {
/* The title is placed "inbetween" two text lines so it
- ** automatically has some vertical spacing. The horizontal
- ** spacing is added here, on each side.
- */
+ ** automatically has some vertical spacing. The horizontal
+ ** spacing is added here, on each side.
+ */
/* don't care for the with of the title
- Xtitle = gfx_get_text_width(im->canvas, 0,
- im->text_prop[TEXT_PROP_TITLE].font,
- im->text_prop[TEXT_PROP_TITLE].size,
- im->tabwidth,
- im->title, 0) + 2*Xspacing; */
- Ytitle = im->text_prop[TEXT_PROP_TITLE].size*2.6+10;
+ Xtitle = gfx_get_text_width(im->canvas, 0,
+ im->text_prop[TEXT_PROP_TITLE].font,
+ im->text_prop[TEXT_PROP_TITLE].size,
+ im->tabwidth,
+ im->title, 0) + 2*Xspacing; */
+ Ytitle = im->text_prop[TEXT_PROP_TITLE].size * 2.6 + 10;
}
if (elements) {
- Xmain=im->xsize;
- Ymain=im->ysize;
+ Xmain = im->xsize;
+ Ymain = im->ysize;
}
-
#ifdef WITH_PIECHART
if (piechart) {
- im->piesize=im->xsize<im->ysize?im->xsize:im->ysize;
- Xpie=im->piesize;
- Ypie=im->piesize;
+ im->piesize = im->xsize < im->ysize ? im->xsize : im->ysize;
+ Xpie = im->piesize;
+ Ypie = im->piesize;
}
#endif
pie chart area. */
/* The legend width cannot yet be determined, as a result we
- ** have problems adjusting the image to it. For now, we just
- ** forget about it at all; the legend will have to fit in the
- ** size already allocated.
- */
+ ** have problems adjusting the image to it. For now, we just
+ ** forget about it at all; the legend will have to fit in the
+ ** size already allocated.
+ */
im->ximg = Xylabel + Xmain + 2 * Xspacing;
#ifdef WITH_PIECHART
- im->ximg += Xpie;
+ im->ximg += Xpie;
#endif
- if (Xmain) im->ximg += Xspacing;
+ if (Xmain)
+ im->ximg += Xspacing;
#ifdef WITH_PIECHART
- if (Xpie) im->ximg += Xspacing;
+ if (Xpie)
+ im->ximg += Xspacing;
#endif
im->xorigin = Xspacing + Xylabel;
/* the length of the title should not influence with width of the graph
if (Xtitle > im->ximg) im->ximg = Xtitle; */
- if (Xvertical) { /* unit description */
+ if (Xvertical) { /* unit description */
im->ximg += Xvertical;
im->xorigin += Xvertical;
}
- xtr(im,0);
+ xtr(im, 0);
/* The vertical size is interesting... we need to compare
- ** the sum of {Ytitle, Ymain, Yxlabel, Ylegend, Ywatermark} with
- ** Yvertical however we need to know {Ytitle+Ymain+Yxlabel}
- ** in order to start even thinking about Ylegend or Ywatermark.
- **
- ** Do it in three portions: First calculate the inner part,
- ** then do the legend, then adjust the total height of the img,
- ** adding space for a watermark if one exists;
- */
+ ** the sum of {Ytitle, Ymain, Yxlabel, Ylegend, Ywatermark} with
+ ** Yvertical however we need to know {Ytitle+Ymain+Yxlabel}
+ ** in order to start even thinking about Ylegend or Ywatermark.
+ **
+ ** Do it in three portions: First calculate the inner part,
+ ** then do the legend, then adjust the total height of the img,
+ ** adding space for a watermark if one exists;
+ */
/* reserve space for main and/or pie */
im->yimg = Ymain + Yxlabel;
-
+
#ifdef WITH_PIECHART
- if (im->yimg < Ypie) im->yimg = Ypie;
+ if (im->yimg < Ypie)
+ im->yimg = Ypie;
#endif
im->yorigin = im->yimg - Yxlabel;
im->yimg += Ytitle;
im->yorigin += Ytitle;
} else {
- im->yimg += 1.5*Yspacing;
- im->yorigin += 1.5*Yspacing;
+ im->yimg += 1.5 * Yspacing;
+ im->yorigin += 1.5 * Yspacing;
}
/* reserve space for padding below the graph */
im->yimg += Yspacing;
-
+
/* Determine where to place the legends onto the image.
- ** Adjust im->yimg to match the space requirements.
- */
- if(leg_place(im,0)==-1)
+ ** Adjust im->yimg to match the space requirements.
+ */
+ if (leg_place(im, 0) == -1)
return -1;
-
+
if (im->watermark[0] != '\0') {
im->yimg += Ywatermark;
}
#ifdef WITH_PIECHART
/* The pie is placed in the upper right hand corner,
- ** just below the title (if any) and with sufficient
- ** padding.
- */
+ ** just below the title (if any) and with sufficient
+ ** padding.
+ */
if (elements) {
- im->pie_x = im->ximg - Xspacing - Xpie/2;
- im->pie_y = im->yorigin-Ymain+Ypie/2;
+ im->pie_x = im->ximg - Xspacing - Xpie / 2;
+ im->pie_y = im->yorigin - Ymain + Ypie / 2;
} else {
- im->pie_x = im->ximg/2;
- im->pie_y = im->yorigin-Ypie/2;
+ im->pie_x = im->ximg / 2;
+ im->pie_y = im->yorigin - Ypie / 2;
}
#endif
- ytr(im,DNAN);
+ ytr(im, DNAN);
return 0;
}
{"vertical-label", required_argument, 0, 'v'},
{"width", required_argument, 0, 'w'},
{"height", required_argument, 0, 'h'},
- {"full-size-mode", no_argument, 0, 'D'},
+ {"full-size-mode", no_argument, 0, 'D'},
{"interlaced", no_argument, 0, 'i'},
{"upper-limit", required_argument, 0, 'u'},
{"lower-limit", required_argument, 0, 'l'},
diff --git a/src/rrd_graph.h b/src/rrd_graph.h
index 8d5dc35cae9421998a60eadef125f2760fb6385f..2c9309beef93057ae9d79f5652ba05a752fe4e19 100644 (file)
--- a/src/rrd_graph.h
+++ b/src/rrd_graph.h
#define FORCE_UNITS 0x100 /* mask for all FORCE_UNITS_* flags */
#define FORCE_UNITS_SI 0x100 /* force use of SI units in Y axis (no effect in linear graph, SI instead of E in log graph) */
-#define FULL_SIZE_MODE 0x200 /* -width and -height indicate the total size of the image */
+#define FULL_SIZE_MODE 0x200 /* -width and -height indicate the total size of the image */
enum tmt_en { TMT_SECOND = 0, TMT_MINUTE, TMT_HOUR, TMT_DAY,
TMT_WEEK, TMT_MONTH, TMT_YEAR
char ***);
int leg_place(
image_desc_t *,
- int*);
+ int *);
int calc_horizontal_grid(
image_desc_t *);
int draw_horizontal_grid(
diff --git a/src/rrd_info.c b/src/rrd_info.c
index e5d195fdbcf3576bfef9ec86ec8485e5772645db..fe65acac9062a0625edf680db6509a2ffe1b042d 100644 (file)
--- a/src/rrd_info.c
+++ b/src/rrd_info.c
}
rrd_close(rrd_file);
-err_free:
+ err_free:
rrd_free(&rrd);
return (data);
}
diff --git a/src/rrd_lastupdate.c b/src/rrd_lastupdate.c
index 046a1733196b3606209b56c17441cc4050ecde2b..76db4ce0753bd0d1c9d272b971a824368873d9bc 100644 (file)
--- a/src/rrd_lastupdate.c
+++ b/src/rrd_lastupdate.c
rrd_close(rrd_file);
return (0);
-err_free_ds_namv:
+ err_free_ds_namv:
free(*ds_namv);
-err_close:
+ err_close:
rrd_close(rrd_file);
-err_free:
+ err_free:
rrd_free(&rrd);
-err_out:
+ err_out:
return (-1);
}
diff --git a/src/rrd_open.c b/src/rrd_open.c
index e18209175e7ea8e5f63d800e3047a269c940a8d1..238c052ae3e168f50d5251c47402dd7cc07fc935 100644 (file)
--- a/src/rrd_open.c
+++ b/src/rrd_open.c
/* Get current position in rrd_file. */
-inline off_t rrd_tell(rrd_file_t *rrd_file)
+inline off_t rrd_tell(
+ rrd_file_t *rrd_file)
{
return rrd_file->pos;
}
#ifdef HAVE_MMAP
inline void rrd_free(
- rrd_t UNUSED(*rrd)) {}
+ rrd_t UNUSED(*rrd))
+{
+}
#else
void rrd_free(
rrd_t *rrd)
diff --git a/src/rrd_resize.c b/src/rrd_resize.c
index 09927df037999531070c68dafdebbf2138e6e3b7..52c208b58f6c98869bafee934ba059b94f1cac12 100644 (file)
--- a/src/rrd_resize.c
+++ b/src/rrd_resize.c
if (rrd_out_file == NULL) {
rrd_set_error("Can't create '%s': %s", outfilename,
rrd_strerror(errno));
- rrd_free(&rrdnew);
+ rrd_free(&rrdnew);
return (-1);
}
if (LockRRD(rrd_out_file->fd) != 0) {