fixed indentation
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Thu, 14 Jun 2007 20:30:13 +0000 (20:30 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Thu, 14 Jun 2007 20:30:13 +0000 (20:30 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1121 a5681a0c-68f1-0310-ab6d-d61299d08faa

bindings/ruby/main.c
src/rrd_graph.c
src/rrd_graph_helper.c
src/rrd_rpncalc.c

index aa082dd..88e9d3a 100644 (file)
@@ -49,7 +49,9 @@ string_arr string_arr_new(
             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;
         }
     }
index 542c3b8..db82882 100644 (file)
@@ -1580,7 +1580,7 @@ int leg_place(
     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)) {
@@ -1598,7 +1598,7 @@ int leg_place(
 
             /* 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;
             }
 
@@ -1644,7 +1644,7 @@ int leg_place(
                 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--;
@@ -1677,19 +1677,19 @@ int leg_place(
             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 ? */
@@ -1701,7 +1701,7 @@ int leg_place(
                         leg_c--;
                     }
                 }
-                if (leg_c == 1 && prt_fctn == 'j'){
+                if (leg_c == 1 && prt_fctn == 'j') {
                     prt_fctn = 'l';
                 }
             }
@@ -2874,13 +2874,13 @@ int graph_size_location(
 
 
 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;
 }
 
 
@@ -3312,20 +3312,23 @@ int graph_paint(
 
     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);
index fb72b16..0a6fabc 100644 (file)
@@ -62,7 +62,7 @@ int       rrd_parse_color(
     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);
@@ -496,17 +496,14 @@ int rrd_parse_textalign(
     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;
index 717ad42..7953320 100644 (file)
@@ -759,7 +759,7 @@ short rpn_calc(
             }
             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");
@@ -769,23 +769,24 @@ short rpn_calc(
                 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;
             }