X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Frrd_restore.c;h=d3a2c8a91c3066d45c046c1b845e1d608a848b2c;hb=3a9760d1aea27a60cf558cf8998042acc455fd61;hp=65bbb10438b0d9a7e0e72d0fbcaaa438e20fb46d;hpb=7d0d6b07c9f5bd5dfd99aa7fe9826eebf2181f1f;p=rrdtool.git diff --git a/src/rrd_restore.c b/src/rrd_restore.c index 65bbb10..d3a2c8a 100644 --- a/src/rrd_restore.c +++ b/src/rrd_restore.c @@ -1,5 +1,5 @@ /***************************************************************************** - * RRDtool 1.2.23 Copyright by Tobi Oetiker, 1997-2007 + * RRDtool 1.2.99907080300 Copyright by Tobi Oetiker, 1997-2007 ***************************************************************************** * rrd_restore.c creates new rrd from data dumped by rrd_dump.c *****************************************************************************/ @@ -223,14 +223,12 @@ int xml2rrd( rrd->stat_head = NULL; return -1; } - /* make sure we output the right version */ - strcpy(rrd->stat_head->version, RRD_VERSION); - - /* if (atoi(rrd -> stat_head -> version) < 2) - { - rrd_set_error("Can only restore version >= 2 (Not %s). Dump your old rrd using a current rrdtool dump.", rrd -> stat_head -> version ); - return -1; - } */ + /* make sure we output the right version only go over 3 if input is over 3 too */ + if (input_version > 3) { + strcpy(rrd->stat_head->version, RRD_VERSION); + } else { + strcpy(rrd->stat_head->version, RRD_VERSION3); + } rrd->stat_head->float_cookie = FLOAT_COOKIE; rrd->stat_head->ds_cnt = 0; @@ -385,6 +383,11 @@ int xml2rrd( read_tag(&ptr2, "seasonal_smooth_idx", "%lu", &(rrd->rra_def[rra_index]. par[RRA_seasonal_smooth_idx].u_cnt)); + if (atoi(rrd->stat_head->version) >= 4) { + read_tag(&ptr2, "smoothing_window", "%lf", + &(rrd->rra_def[rra_index]. + par[RRA_seasonal_smoothing_window].u_val)); + } read_tag(&ptr2, "dependent_rra_idx", "%lu", &(rrd->rra_def[rra_index]. par[RRA_dependent_rra_idx].u_cnt));