summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 65878d5)
raw | patch | inline | side by side (parent: 65878d5)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 14 Jun 2007 20:30:13 +0000 (20:30 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 14 Jun 2007 20:30:13 +0000 (20:30 +0000) |
bindings/ruby/main.c | patch | blob | history | |
src/rrd_graph.c | patch | blob | history | |
src/rrd_graph_helper.c | patch | blob | history | |
src/rrd_rpncalc.c | patch | blob | history |
diff --git a/bindings/ruby/main.c b/bindings/ruby/main.c
index aa082dda0caf439d9a5a21f4a9f0f4e16e25e9e3..88e9d3a4db230f104bd2b061d8f0c96d1ccf0555 100644 (file)
--- a/bindings/ruby/main.c
+++ b/bindings/ruby/main.c
a.strings[i + 1] = strdup(buf);
break;
default:
- rb_raise(rb_eTypeError, "invalid argument - %s, expected T_STRING or T_FIXNUM on index %d", rb_class2name(CLASS_OF(v)), i);
+ rb_raise(rb_eTypeError,
+ "invalid argument - %s, expected T_STRING or T_FIXNUM on index %d",
+ rb_class2name(CLASS_OF(v)), i);
break;
}
}
diff --git a/src/rrd_graph.c b/src/rrd_graph.c
index 542c3b81847b188c108c761c8e231773362b4237..db828824e1e48a67fbd8be8875ee234d9c3f8044 100644 (file)
--- a/src/rrd_graph.c
+++ b/src/rrd_graph.c
int glue = 0;
int i, ii, mark = 0;
char prt_fctn; /*special printfunctions */
- char default_txtalign = TXA_JUSTIFIED; /*default line orientation*/
+ char default_txtalign = TXA_JUSTIFIED; /*default line orientation */
int *legspace;
if (!(im->extra_flags & NOLEGEND) & !(im->extra_flags & ONLY_GRAPH)) {
/* hide legends for rules which are not displayed */
- if (im->gdes[i].gf == GF_TEXTALIGN){
+ if (im->gdes[i].gf == GF_TEXTALIGN) {
default_txtalign = im->gdes[i].txtalign;
}
prt_fctn = 'l';
}
- /* remove exess space from the end of the legend for \g*/
+ /* remove exess space from the end of the legend for \g */
while (prt_fctn == 'g' &&
leg_cc > 0 && im->gdes[i].legend[leg_cc - 1] == ' ') {
leg_cc--;
if (prt_fctn == '\0') {
if (i == im->gdes_c - 1 || fill > im->ximg - 2 * border) {
/* just one legend item is left right or center */
- switch (default_txtalign){
+ switch (default_txtalign) {
case TXA_RIGHT:
- prt_fctn = 'r';
- break;
+ prt_fctn = 'r';
+ break;
case TXA_CENTER:
- prt_fctn = 'c';
- break;
+ prt_fctn = 'c';
+ break;
case TXA_JUSTIFIED:
- prt_fctn = 'j';
- break;
+ prt_fctn = 'j';
+ break;
default:
- prt_fctn = 'l';
- break;
+ prt_fctn = 'l';
+ break;
}
}
/* is it time to place the legends ? */
leg_c--;
}
}
- if (leg_c == 1 && prt_fctn == 'j'){
+ if (leg_c == 1 && prt_fctn == 'j') {
prt_fctn = 'l';
}
}
static cairo_status_t cairo_write_func_file(
- void *closure,
- const unsigned char *data,
- unsigned int length)
+ void *closure,
+ const unsigned char *data,
+ unsigned int length)
{
- if (fwrite(data, length, 1, closure) != 1)
- return CAIRO_STATUS_WRITE_ERROR;
- return CAIRO_STATUS_SUCCESS;
+ if (fwrite(data, length, 1, closure) != 1)
+ return CAIRO_STATUS_WRITE_ERROR;
+ return CAIRO_STATUS_SUCCESS;
}
switch (im->imgformat) {
case IF_PNG:
- {
- cairo_status_t status;
-
- if (strcmp(im->graphfile, "-") == 0) {
- status = cairo_surface_write_to_png_stream(im->surface, &cairo_write_func_file, (void*)stdout);
- } else {
- status = cairo_surface_write_to_png(im->surface, im->graphfile);
- }
-
- if (status != CAIRO_STATUS_SUCCESS) {
- rrd_set_error("Could not save png to '%s'", im->graphfile);
- return 1;
- }
- }
+ {
+ cairo_status_t status;
+
+ if (strcmp(im->graphfile, "-") == 0) {
+ status =
+ cairo_surface_write_to_png_stream(im->surface,
+ &cairo_write_func_file,
+ (void *) stdout);
+ } else {
+ status = cairo_surface_write_to_png(im->surface, im->graphfile);
+ }
+
+ if (status != CAIRO_STATUS_SUCCESS) {
+ rrd_set_error("Could not save png to '%s'", im->graphfile);
+ return 1;
+ }
+ }
break;
default:
cairo_show_page(im->cr);
diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c
index fb72b16a0613d811cf6877f348556c647d92e4bb..0a6fabcb42121a9df68281dd68e49b4b2e64f438 100644 (file)
--- a/src/rrd_graph_helper.c
+++ b/src/rrd_graph_helper.c
const char *const,
graph_desc_t *const);
-int rrd_parse_textalign(
+int rrd_parse_textalign(
const char *const,
unsigned int *const,
graph_desc_t *const);
unsigned int *const eaten,
graph_desc_t *const gdp)
{
- if (strcmp(&line[*eaten],"left")==0){
- gdp->txtalign=TXA_LEFT;
- }
- else if (strcmp(&line[*eaten],"right")==0){
- gdp->txtalign=TXA_RIGHT;
- }
- else if (strcmp(&line[*eaten],"justified")==0){
- gdp->txtalign=TXA_JUSTIFIED;
- }
- else if (strcmp(&line[*eaten],"center")==0){
- gdp->txtalign=TXA_CENTER;
+ if (strcmp(&line[*eaten], "left") == 0) {
+ gdp->txtalign = TXA_LEFT;
+ } else if (strcmp(&line[*eaten], "right") == 0) {
+ gdp->txtalign = TXA_RIGHT;
+ } else if (strcmp(&line[*eaten], "justified") == 0) {
+ gdp->txtalign = TXA_JUSTIFIED;
+ } else if (strcmp(&line[*eaten], "center") == 0) {
+ gdp->txtalign = TXA_CENTER;
} else {
rrd_set_error("Unknown alignement type '%s'", &line[*eaten]);
return 1;
diff --git a/src/rrd_rpncalc.c b/src/rrd_rpncalc.c
index 717ad42f5fc5ef8b96ff2e9c7c80ddcc9bf8cc9b..7953320f084820349345a38e55b0fba2d8cfdb8d 100644 (file)
--- a/src/rrd_rpncalc.c
+++ b/src/rrd_rpncalc.c
}
break;
case OP_TREND:
- case OP_TRENDNAN:
+ case OP_TRENDNAN:
stackunderflow(1);
if ((rpi < 2) || (rpnp[rpi - 2].op != OP_VARIABLE)) {
rrd_set_error("malformed trend arguments");
time_t step = (time_t) rpnp[rpi - 2].step;
if (output_idx > (int) ceil((float) dur / (float) step)) {
- int ignorenan = (rpnp[rpi].op == OP_TREND);
- double accum = 0.0;
- int i = 0;
- int count = 0;
-
- do {
- double val =
- rpnp[rpi - 2].data[rpnp[rpi - 2].ds_cnt * i--];
- if (ignorenan || !isnan(val)) {
- accum += val;
- ++count;
- }
-
- dur -= step;
- } while (dur > 0);
-
- rpnstack -> s[--stptr] = (count == 0) ? DNAN : (accum / count);
+ int ignorenan = (rpnp[rpi].op == OP_TREND);
+ double accum = 0.0;
+ int i = 0;
+ int count = 0;
+
+ do {
+ double val =
+ rpnp[rpi - 2].data[rpnp[rpi - 2].ds_cnt * i--];
+ if (ignorenan || !isnan(val)) {
+ accum += val;
+ ++count;
+ }
+
+ dur -= step;
+ } while (dur > 0);
+
+ rpnstack->s[--stptr] =
+ (count == 0) ? DNAN : (accum / count);
} else
rpnstack->s[--stptr] = DNAN;
}