reat nan as FALSE in an IF CDEF
[rrdtool.git] / src / rrd_graph.c
index 795a6ac..56f509a 100644 (file)
@@ -61,7 +61,7 @@ xlab_t    xlab[] = {
     ,
     {60, 0, TMT_MINUTE, 30, TMT_HOUR, 2, TMT_HOUR, 2, 0, "%H:%M"}
     ,
-    {60, 24 * 3600, TMT_MINUTE, 30, TMT_HOUR, 2, TMT_HOUR, 4, 0, "%a %H:%M"}
+    {60, 24 * 3600, TMT_MINUTE, 30, TMT_HOUR, 2, TMT_HOUR, 6, 0, "%a %H:%M"}
     ,
     {180, 0, TMT_HOUR, 1, TMT_HOUR, 6, TMT_HOUR, 6, 0, "%H:%M"}
     ,
@@ -3346,6 +3346,7 @@ int graph_paint(
         case GF_HRULE:
             if (im->gdes[i].yrule >= im->minval
                 && im->gdes[i].yrule <= im->maxval)
+           {   
                 cairo_save(im->cr);
             if (im->gdes[i].dash) {
                 cairo_set_dash(im->cr, im->gdes[i].p_dashes,
@@ -3358,10 +3359,12 @@ int graph_paint(
                      1.0, im->gdes[i].col);
             cairo_stroke(im->cr);
             cairo_restore(im->cr);
+           }
             break;
         case GF_VRULE:
             if (im->gdes[i].xrule >= im->start
                 && im->gdes[i].xrule <= im->end)
+           {   
                 cairo_save(im->cr);
             if (im->gdes[i].dash) {
                 cairo_set_dash(im->cr, im->gdes[i].p_dashes,
@@ -3373,6 +3376,7 @@ int graph_paint(
                      im->yorigin - im->ysize, 1.0, im->gdes[i].col);
             cairo_stroke(im->cr);
             cairo_restore(im->cr);
+           }
             break;
         default:
             break;
@@ -3450,6 +3454,9 @@ int gdes_alloc(
     im->gdes[im->gdes_c - 1].rpnp = NULL;
     im->gdes[im->gdes_c - 1].p_dashes = NULL;
     im->gdes[im->gdes_c - 1].shift = 0.0;
+    im->gdes[im->gdes_c - 1].dash = 0;
+    im->gdes[im->gdes_c - 1].ndash = 0;
+    im->gdes[im->gdes_c - 1].offset = 0;
     im->gdes[im->gdes_c - 1].col.red = 0.0;
     im->gdes[im->gdes_c - 1].col.green = 0.0;
     im->gdes[im->gdes_c - 1].col.blue = 0.0;
@@ -4066,10 +4073,10 @@ void rrd_graph_options(
         case 'n':{
             char      prop[15];
             double    size = 1;
-            char      font[1024] = "";
+            int       end;
 
             old_locale = setlocale(LC_NUMERIC, "C");
-            if (sscanf(optarg, "%10[A-Z]:%lf:%1000s", prop, &size, font) >= 2) {
+            if (sscanf(optarg, "%10[A-Z]:%lf%n", prop, &size, &end) >= 2) {
                 int       sindex, propidx;
 
                 setlocale(LC_NUMERIC, old_locale);
@@ -4079,8 +4086,17 @@ void rrd_graph_options(
                         if (size > 0) {
                             im->text_prop[propidx].size = size;
                         }
-                        if (strlen(font) > 0) {
-                            strcpy(im->text_prop[propidx].font, font);
+                        if (strlen(prop) > end) {
+                            if (prop[end] == ':') {
+                                strncpy(im->text_prop[propidx].font,
+                                        prop + end + 1, 255);
+                                im->text_prop[propidx].font[255] = '\0';
+                            } else {
+                                rrd_set_error
+                                    ("expected after font size in '%s'",
+                                     prop);
+                                return;
+                            }
                         }
                         if (propidx == sindex && sindex != 0)
                             break;