X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_graph.c;h=7b9f64844408de5104ec9c7183073f703fdef34e;hp=643abe4236a827eae37488263ac8d51e9a72c43e;hb=ce30e9e1379022835687aa08b7712e27372e05ec;hpb=e93e7c0658f76edf7cf83dca3cd076df97f5d655 diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 643abe4..7b9f648 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -1,5 +1,5 @@ /**************************************************************************** - * RRDtool 1.3.2 Copyright by Tobi Oetiker, 1997-2008 + * RRDtool 1.4.1 Copyright by Tobi Oetiker, 1997-2009 **************************************************************************** * rrd__graph.c produce graphs from data in rrdfiles ****************************************************************************/ @@ -25,13 +25,9 @@ #include #endif -#ifdef HAVE_TIME_H #include -#endif -#ifdef HAVE_LOCALE_H #include -#endif #include "rrd_graph.h" #include "rrd_client.h" @@ -3897,9 +3893,10 @@ rrd_info_t *rrd_graph_v( { image_desc_t im; rrd_info_t *grinfo; + char *old_locale; rrd_graph_init(&im); /* a dummy surface so that we can measure text sizes for placements */ - + old_locale = setlocale(LC_NUMERIC, "C"); rrd_graph_options(argc, argv, &im); if (rrd_test_error()) { rrd_info_free(im.grinfo); @@ -3929,6 +3926,8 @@ rrd_info_t *rrd_graph_v( } rrd_graph_script(argc, argv, &im, 1); + setlocale(LC_NUMERIC, old_locale); /* reenable locale for rendering the graph */ + if (rrd_test_error()) { rrd_info_free(im.grinfo); im_free(&im); @@ -4120,7 +4119,6 @@ void rrd_graph_options( long long_tmp; rrd_time_value_t start_tv, end_tv; long unsigned int color; - char *old_locale = ""; /* defines for long options without a short equivalent. should be bytes, and may not collide with (the ASCII value of) short options */ @@ -4252,7 +4250,6 @@ void rrd_graph_options( case LONGOPT_UNITS_SI: if (im->extra_flags & FORCE_UNITS) { rrd_set_error("--units can only be used once!"); - setlocale(LC_NUMERIC, old_locale); return; } if (strcmp(optarg, "si") == 0) @@ -4270,14 +4267,10 @@ void rrd_graph_options( im->forceleftspace = 1; break; case 'T': - old_locale = setlocale(LC_NUMERIC, "C"); im->tabwidth = atof(optarg); - setlocale(LC_NUMERIC, old_locale); break; case 'S': - old_locale = setlocale(LC_NUMERIC, "C"); im->step = atoi(optarg); - setlocale(LC_NUMERIC, old_locale); break; case 'N': im->gridfit = 0; @@ -4341,9 +4334,7 @@ void rrd_graph_options( im->draw_y_grid = 0; break; }; - old_locale = setlocale(LC_NUMERIC, "C"); if (sscanf(optarg, "%lf:%d", &im->ygridstep, &im->ylabfact) == 2) { - setlocale(LC_NUMERIC, old_locale); if (im->ygridstep <= 0) { rrd_set_error("grid step must be > 0"); return; @@ -4352,7 +4343,6 @@ void rrd_graph_options( return; } } else { - setlocale(LC_NUMERIC, old_locale); rrd_set_error("invalid y-grid format"); return; } @@ -4401,14 +4391,10 @@ void rrd_graph_options( im->ylegend[150] = '\0'; break; case 'u': - old_locale = setlocale(LC_NUMERIC, "C"); im->maxval = atof(optarg); - setlocale(LC_NUMERIC, old_locale); break; case 'l': - old_locale = setlocale(LC_NUMERIC, "C"); im->minval = atof(optarg); - setlocale(LC_NUMERIC, old_locale); break; case 'b': im->base = atol(optarg); @@ -4513,11 +4499,9 @@ void rrd_graph_options( double size = 1; int end; - old_locale = setlocale(LC_NUMERIC, "C"); if (sscanf(optarg, "%10[A-Z]:%lf%n", prop, &size, &end) >= 2) { int sindex, propidx; - setlocale(LC_NUMERIC, old_locale); if ((sindex = text_prop_conv(prop)) != -1) { for (propidx = sindex; propidx < TEXT_PROP_LAST; propidx++) { @@ -4544,16 +4528,13 @@ void rrd_graph_options( return; } } else { - setlocale(LC_NUMERIC, old_locale); rrd_set_error("invalid text property format"); return; } break; } case 'm': - old_locale = setlocale(LC_NUMERIC, "C"); im->zoom = atof(optarg); - setlocale(LC_NUMERIC, old_locale); if (im->zoom <= 0.0) { rrd_set_error("zoom factor must be > 0"); return; @@ -4776,12 +4757,9 @@ int vdef_parse( double param; char func[30]; int n; - char *old_locale; n = 0; - old_locale = setlocale(LC_NUMERIC, "C"); sscanf(str, "%le,%29[A-Z]%n", ¶m, func, &n); - setlocale(LC_NUMERIC, old_locale); if (n == (int) strlen(str)) { /* matched */ ; } else {