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);
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;
}
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;
}