* replaced strtok with strtok_r for thread safety
[rrdtool.git] / src / rrd_graph.c
index ac0f3ea..501db48 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"}
     ,
@@ -340,7 +340,7 @@ int im_free(
     if (im->surface)
         cairo_surface_destroy(im->surface);
     if (status)
-        fprintf(stderr, "OOPS: Cairo has issuesm it can't even die: %s\n",
+        fprintf(stderr, "OOPS: Cairo has issues it can't even die: %s\n",
                 cairo_status_to_string(status));
 
     return 0;
@@ -3031,9 +3031,9 @@ int graph_paint(
         break;
     };
     im->cr = cairo_create(im->surface);
-    pango_cairo_font_map_set_resolution(PANGO_CAIRO_FONT_MAP(font_map), 100);
     cairo_set_antialias(im->cr, im->graph_antialias);
     cairo_scale(im->cr, im->zoom, im->zoom);
+    pango_cairo_font_map_set_resolution(PANGO_CAIRO_FONT_MAP(font_map), 100);
 
     gfx_new_area(im,
                  0, 0,
@@ -3450,6 +3450,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 +4069,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 +4082,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;