Merge branch 'master' into ff/rrdd
authorFlorian Forster <octo@verplant.org>
Tue, 2 Sep 2008 09:36:35 +0000 (11:36 +0200)
committerFlorian Forster <octo@verplant.org>
Tue, 2 Sep 2008 09:36:35 +0000 (11:36 +0200)
Conflicts:

src/rrd_lastupdate.c
src/rrd_update.c

49 files changed:
bindings/perl-piped/RRDp.pm
bindings/perl-shared/RRDs.pm
bindings/perl-shared/RRDs.xs
bindings/ruby/main.c
configure.ac
doc/rrdbuild.pod
doc/rrdgraph.pod
doc/rrdgraph_data.pod
rrdtool.spec
src/pngsize.c
src/rrd.h
src/rrd_cgi.c
src/rrd_create.c
src/rrd_datalang.c
src/rrd_diff.c
src/rrd_dump.c
src/rrd_error.c
src/rrd_fetch.c
src/rrd_first.c
src/rrd_format.c
src/rrd_format.h
src/rrd_gfx.c
src/rrd_graph.c
src/rrd_graph.h
src/rrd_graph_helper.c
src/rrd_hw.c
src/rrd_hw.h
src/rrd_hw_update.c
src/rrd_i18n.h
src/rrd_info.c
src/rrd_is_thread_safe.h
src/rrd_last.c
src/rrd_lastupdate.c
src/rrd_not_thread_safe.c
src/rrd_open.c
src/rrd_resize.c
src/rrd_restore.c
src/rrd_rpncalc.c
src/rrd_rpncalc.h
src/rrd_thread_safe.c
src/rrd_thread_safe_nt.c
src/rrd_tool.c
src/rrd_tool.h
src/rrd_tune.c
src/rrd_update.c
src/rrd_version.c
src/rrd_xport.c
src/rrd_xport.h
src/rrdupdate.c

index a99e56e..0a28506 100644 (file)
@@ -120,7 +120,7 @@ sub cmd (@);
 sub end ();
 sub read ();
 
-$VERSION=1.3000;
+$VERSION=1.3001;
 
 sub start ($){
   croak "rrdtool is already running"
index d151db4..fbd9c96 100644 (file)
@@ -7,7 +7,7 @@ use vars qw(@ISA $VERSION);
 
 require DynaLoader;
 
-$VERSION=1.3000;
+$VERSION=1.3001;
 
 bootstrap RRDs $VERSION;
 
@@ -82,10 +82,10 @@ B<RRDs::last> returns a single INTEGER representing the last update time.
 
  $lastupdate = RRDs::last ...
 
-B<RRDs::graph> returns an pointer to an ARRAY containing the x-size and y-size of the
-created image and results of the PRINT arguments.
+B<RRDs::graph> returns an ARRAY containing the x-size and y-size of the
+created image and a pointer to an array with the results of the PRINT arguments.
 
- ($averages,$xsize,$ysize) = RRDs::graph ...
+ ($result_arr,$xsize,$ysize) = RRDs::graph ...
  print "Imagesize: ${xsize}x${ysize}\n";
  print "Averages: ", (join ", ", @$averages);
 
@@ -119,10 +119,10 @@ integers, a pointer to an array and a pointer to a array of pointers.
   print "DS names:    ", join (", ", @$names)."\n";
   print "Data points: ", $#$data + 1, "\n";
   print "Data:\n";
-  foreach my $line (@$data) {
+  for my $line (@$data) {
     print "  ", scalar localtime($start), " ($start) ";
     $start += $step;
-    foreach my $val (@$line) {
+    for my $val (@$line) {
       printf "%12.1f ", $val;
     }
     print "\n";
index b2a70d9..25d44a5 100644 (file)
@@ -78,8 +78,8 @@ extern "C" {
                free(argv); \
                 if (rrd_test_error()) XSRETURN_UNDEF; \
                 hash = newHV(); \
+               save=data; \
                 while (data) { \
-                   save=data; \
                /* the newSV will get copied by hv so we create it as a mortal \
            to make sure it does not keep hanging round after the fact */ \
                    switch (data->type) { \
@@ -97,18 +97,14 @@ extern "C" {
                        break; \
                    case RD_I_STR: \
                        hvs(newSVpv(data->value.u_str,0)); \
-                       rrd_freemem(data->value.u_str); \
                        break; \
                    case RD_I_BLO: \
                        hvs(newSVpv(data->value.u_blo.ptr,data->value.u_blo.size)); \
-                       rrd_freemem(data->value.u_blo.ptr); \
                        break; \
                    } \
-                   rrd_freemem(data->key); \
                    data = data->next; \
-                   rrd_freemem(save); \
-                   } \
-            rrd_freemem(data); \
+               } \
+            rrd_info_free(save); \
             RETVAL = newRV_noinc((SV*)hash);
 
 /*
@@ -203,7 +199,7 @@ rrd_tune(...)
                RETVAL
 
 
-void
+SV *
 rrd_graph(...)
        PROTOTYPE: @    
        PREINIT:
@@ -249,7 +245,7 @@ rrd_graph(...)
                PUSHs(sv_2mortal(newSViv(xsize)));
                PUSHs(sv_2mortal(newSViv(ysize)));
 
-void
+SV *
 rrd_fetch(...)
        PROTOTYPE: @    
        PREINIT:
@@ -302,7 +298,7 @@ rrd_fetch(...)
                PUSHs(sv_2mortal(newRV_noinc((SV*)names)));
                PUSHs(sv_2mortal(newRV_noinc((SV*)retar)));
 
-void
+SV *
 rrd_times(start, end)
          char *start
          char *end
index ec74668..d2a7ace 100644 (file)
@@ -155,6 +155,7 @@ VALUE rb_rrd_infocall(
 
     RRD_CHECK_ERROR result = rb_hash_new();
 
+    p = data;
     while (data) {
         VALUE     key = rb_str_new2(data->key);
 
@@ -171,19 +172,16 @@ VALUE rb_rrd_infocall(
             break;
         case RD_I_STR:
             rb_hash_aset(result, key, rb_str_new2(data->value.u_str));
-            rrd_freemem(data->value.u_str);
             break;
         case RD_I_BLO:
             rb_hash_aset(result, key,
                          rb_str_new(data->value.u_blo.ptr,
                                     data->value.u_blo.size));
-            rrd_freemem(data->value.u_blo.ptr);
             break;
         }
-        p = data;
         data = data->next;
-        rrd_freemem(p);
     }
+    rrd_info_free(p);
     return result;
 }
 
@@ -191,21 +189,21 @@ VALUE rb_rrd_info(
     VALUE self,
     VALUE args)
 {
-    return rrd_infocall(rrd_info, args);
+    return rb_rrd_infocall(rrd_info, args);
 }
 
 VALUE rb_rrd_updatev(
     VALUE self,
     VALUE args)
 {
-    return rrd_infocall(rrd_update_v, args);
+    return rb_rrd_infocall(rrd_update_v, args);
 }
 
 VALUE rb_rrd_graphv(
     VALUE self,
     VALUE args)
 {
-    return rrd_infocall(rrd_graph_v, args);
+    return rb_rrd_infocall(rrd_graph_v, args);
 }
 
 
index 822626e..2689075 100644 (file)
@@ -9,14 +9,14 @@ dnl tell automake the this script is for rrdtool
 
 dnl the official version number is
 dnl a.b.c
-AC_INIT([rrdtool],[1.3.0])
+AC_INIT([rrdtool],[1.3.1])
 
 dnl for testing a numberical version number comes handy
 dnl the released version are
 dnl a.bccc
 dnl the devel versions will be something like
 dnl a.b999yymmddhh 
-NUMVERS=1.3000
+NUMVERS=1.3001
 AC_SUBST(NUMVERS)
 
 dnl for the linker to understand which version the library is compatible with
@@ -550,6 +550,7 @@ return 0;
 have_broken_isfinite=no],have_broken_isfinite=yes,[
 case "${target}" in
   hppa*-*-hpux*) have_broken_isfinite=yes ;;
+  sparc-sun-solaris2.8) have_broken_isfinite=yes ;;
   *) have_broken_isfinite=no ;;
 esac])
 ])
index 26e18db..bb9e024 100644 (file)
@@ -41,7 +41,7 @@ Where you want to install the software.
 Once you have decided. Save the two locations into environment variables.
 
  BUILD_DIR=/tmp/rrdbuild
- INSTALL_DIR=/usr/local/rrdtool-1.3.0
+ INSTALL_DIR=/usr/local/rrdtool-1.3.1
 
 
 If your F</tmp> is mounted with the option noexec (RHEL seems todo that) you have to choose
@@ -55,9 +55,9 @@ Now make sure the BUILD_DIR exists and go there:
 Lets first assume you already have all the necessary libraries
 pre-installed. 
 
- wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.3.0.tar.gz
- gunzip -c rrdtool-1.3.0.tar.gz | tar xf -
- cd rrdtool-1.3.0
+ wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.3.1.tar.gz
+ gunzip -c rrdtool-1.3.1.tar.gz | tar xf -
+ cd rrdtool-1.3.1
  ./configure --prefix=$INSTALL_DIR && make && make install
 
 Ok, this was very optimistic. This try will probably have ended with
@@ -334,7 +334,7 @@ because it seems that a fair number of people have ill configured python and
 tcl setups that would prevent rrdtool from building if they are included in
 their current state.
 
- cd $BUILD_DIR/rrdtool-1.3.0
+ cd $BUILD_DIR/rrdtool-1.3.1
  ./configure --prefix=$INSTALL_DIR --disable-tcl --disable-python
  $MAKE clean
  $MAKE
index 99b2e6b..a96ecff 100644 (file)
@@ -264,7 +264,7 @@ Note that for linear graphs, SI notation is used by default.
 
 Only generate the graph if the current graph is out of date or not existent.
 Note, that only the image size will be returned, if you run with lazy even
-when using graphv.
+when using graphv and even when using PRINT.
 
 
 [B<--daemon> I<address>]
index 6c8b28a..c26868f 100644 (file)
@@ -23,7 +23,7 @@ Variable names (I<vname>) must be made up strings of the following characters
 C<A-Z, a-z, 0-9, -,_> and a maximum length of 255 characters.
 
 When picking variable names, make sure you do not choose a name that is
-already taken by an RPN operator. A save bet it to use lowercase or
+already taken by an RPN operator. A safe bet it to use lowercase or
 mixedcase names for variables since operators will always be in uppercase.
 
 =head1 DEF
index db1a055..d71d3e1 100644 (file)
@@ -9,7 +9,7 @@
 
 Summary: Round Robin Database Tool to store and display time-series data
 Name: rrdtool
-Version: 1.3.0
+Version: 1.3.1
 Release: 0.20%{?pre:.%{pre}}%{?dist}
 License: GPLv2+ with exceptions
 Group: Applications/Databases
index 023c829..f74a718 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * pngsize.c  determine the size of a PNG image
  *****************************************************************************/
index e351525..fc01687 100644 (file)
--- a/src/rrd.h
+++ b/src/rrd.h
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrdlib.h   Public header file for librrd
  *****************************************************************************
@@ -321,36 +321,53 @@ extern    "C" {
 #if defined(__GNUC__) && defined (RRD_EXPORT_DEPRECATED)
 # define RRD_DEPRECATED __attribute__((deprecated))
 #else
-# define RRD_DEPRECATED /**/
+# define RRD_DEPRECATED          /**/
 #endif
-
-    void        rrd_free     (rrd_t *rrd)
-      RRD_DEPRECATED;
-    void        rrd_init     (rrd_t *rrd)
-      RRD_DEPRECATED;
-
-    rrd_file_t *rrd_open   (const char *const file_name, rrd_t *rrd,
-        unsigned rdwr)
-      RRD_DEPRECATED;
-
-    void        rrd_dontneed (rrd_file_t *rrd_file, rrd_t *rrd)
-      RRD_DEPRECATED;
-    int         rrd_close    (rrd_file_t *rrd_file)
-      RRD_DEPRECATED;
-    ssize_t     rrd_read     (rrd_file_t *rrd_file, void *buf, size_t count)
-      RRD_DEPRECATED;
-    ssize_t     rrd_write    (rrd_file_t *rrd_file,
-        const void *buf, size_t count)
-      RRD_DEPRECATED;
-    void        rrd_flush    (rrd_file_t *rrd_file)
-      RRD_DEPRECATED;
-    off_t       rrd_seek     (rrd_file_t *rrd_file, off_t off, int whence)
-      RRD_DEPRECATED;
-    off_t       rrd_tell     (rrd_file_t *rrd_file)
-      RRD_DEPRECATED;
-    int         rrd_lock     (rrd_file_t *file)
-      RRD_DEPRECATED;
-#endif /* defined(_RRD_TOOL_H) || defined(RRD_EXPORT_DEPRECATED) */
+     void     rrd_free(
+    rrd_t *rrd)
+              RRD_DEPRECATED;
+    void      rrd_init(
+    rrd_t *rrd)
+              RRD_DEPRECATED;
+
+    rrd_file_t *rrd_open(
+    const char *const file_name,
+    rrd_t *rrd,
+    unsigned rdwr)
+              RRD_DEPRECATED;
+
+    void      rrd_dontneed(
+    rrd_file_t *rrd_file,
+    rrd_t *rrd)
+              RRD_DEPRECATED;
+    int       rrd_close(
+    rrd_file_t *rrd_file)
+              RRD_DEPRECATED;
+    ssize_t   rrd_read(
+    rrd_file_t *rrd_file,
+    void *buf,
+    size_t count)
+              RRD_DEPRECATED;
+    ssize_t   rrd_write(
+    rrd_file_t *rrd_file,
+    const void *buf,
+    size_t count)
+              RRD_DEPRECATED;
+    void      rrd_flush(
+    rrd_file_t *rrd_file)
+              RRD_DEPRECATED;
+    off_t     rrd_seek(
+    rrd_file_t *rrd_file,
+    off_t off,
+    int whence)
+              RRD_DEPRECATED;
+    off_t     rrd_tell(
+    rrd_file_t *rrd_file)
+              RRD_DEPRECATED;
+    int       rrd_lock(
+    rrd_file_t *file)
+              RRD_DEPRECATED;
+#endif                  /* defined(_RRD_TOOL_H) || defined(RRD_EXPORT_DEPRECATED) */
 
 #endif                  /* _RRDLIB_H */
 
index d4e5723..adbd91f 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_cgi.c  RRD Web Page Generator
  *****************************************************************************/
index 2cc8557..b87d2be 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_create.c  creates new rrds
  *****************************************************************************/
@@ -27,6 +27,9 @@ void      parseGENERIC_DS(
 long int  rra_random_row(
     rra_def_t *);
 
+static void rrd_free2(
+    rrd_t *rrd);        /* our onwn copy, immmune to mmap */
+
 int rrd_create(
     int argc,
     char **argv)
@@ -125,15 +128,14 @@ int rrd_create_r(
     /* static header */
     if ((rrd.stat_head = calloc(1, sizeof(stat_head_t))) == NULL) {
         rrd_set_error("allocating rrd.stat_head");
-        free(rrd.stat_head);
+        rrd_free2(&rrd);
         return (-1);
     }
 
     /* live header */
     if ((rrd.live_head = calloc(1, sizeof(live_head_t))) == NULL) {
         rrd_set_error("allocating rrd.live_head");
-        free(rrd.stat_head);
-        free(rrd.live_head);
+        rrd_free2(&rrd);
         return (-1);
     }
 
@@ -166,8 +168,7 @@ int rrd_create_r(
                                           old_size + sizeof(ds_def_t))) ==
                 NULL) {
                 rrd_set_error("allocating rrd.ds_def");
-                free(rrd.stat_head);
-                free(rrd.live_head);
+                rrd_free2(&rrd);
                 return (-1);
             }
             memset(&rrd.ds_def[rrd.stat_head->ds_cnt], 0, sizeof(ds_def_t));
@@ -199,8 +200,7 @@ int rrd_create_r(
                 rrd_set_error("invalid DS format");
             }
             if (rrd_test_error()) {
-                free(rrd.stat_head);
-                free(rrd.live_head);
+                rrd_free2(&rrd);
                 return -1;
             }
 
@@ -223,8 +223,7 @@ int rrd_create_r(
             }
 
             if (rrd_test_error()) {
-                free(rrd.stat_head);
-                free(rrd.live_head);
+                rrd_free2(&rrd);
                 return -1;
             }
             rrd.stat_head->ds_cnt++;
@@ -238,8 +237,7 @@ int rrd_create_r(
                                            old_size + sizeof(rra_def_t))) ==
                 NULL) {
                 rrd_set_error("allocating rrd.rra_def");
-                free(rrd.stat_head);
-                free(rrd.live_head);
+                rrd_free2(&rrd);
                 return (-1);
             }
             memset(&rrd.rra_def[rrd.stat_head->rra_cnt], 0,
@@ -373,6 +371,8 @@ int rrd_create_r(
                     default:
                         rrd.rra_def[rrd.stat_head->rra_cnt].pdp_cnt =
                             atoi(token);
+                        if (atoi(token) < 1)
+                            rrd_set_error("Invalid step: must be >= 1");
                         break;
                     }
                     break;
@@ -494,8 +494,7 @@ int rrd_create_r(
                 if (rrd_test_error()) {
                     /* all errors are unrecoverable */
                     free(argvcopy);
-                    free(rrd.stat_head);
-                    free(rrd.live_head);
+                    rrd_free2(&rrd);
                     return (-1);
                 }
                 token = strtok_r(NULL, ":", &tokptr);
@@ -522,16 +521,14 @@ int rrd_create_r(
                 if (create_hw_contingent_rras(&rrd, period, hashed_name) ==
                     -1) {
                     rrd_set_error("creating contingent RRA");
-                    free(rrd.stat_head);
-                    free(rrd.live_head);
+                    rrd_free2(&rrd);
                     return -1;
                 }
             }
             rrd.stat_head->rra_cnt++;
         } else {
             rrd_set_error("can't parse argument '%s'", argv[i]);
-            free(rrd.stat_head);
-            free(rrd.live_head);
+            rrd_free2(&rrd);
             return -1;
         }
     }
@@ -539,15 +536,13 @@ int rrd_create_r(
 
     if (rrd.stat_head->rra_cnt < 1) {
         rrd_set_error("you must define at least one Round Robin Archive");
-        free(rrd.stat_head);
-        free(rrd.live_head);
+        rrd_free2(&rrd);
         return (-1);
     }
 
     if (rrd.stat_head->ds_cnt < 1) {
         rrd_set_error("you must define at least one Data Source");
-        free(rrd.stat_head);
-        free(rrd.live_head);
+        rrd_free2(&rrd);
         return (-1);
     }
     return rrd_create_fn(filename, &rrd);
@@ -616,6 +611,7 @@ int create_hw_contingent_rras(
     if ((rrd->rra_def = rrd_realloc(rrd->rra_def,
                                     old_size + 4 * sizeof(rra_def_t))) ==
         NULL) {
+        rrd_free2(rrd);
         rrd_set_error("allocating rrd.rra_def");
         return (-1);
     }
@@ -680,15 +676,15 @@ int rrd_create_fn(
     int       unkn_cnt;
     rrd_file_t *rrd_file_dn;
     rrd_t     rrd_dn;
-    unsigned flags = O_WRONLY | O_CREAT | O_TRUNC;
+    unsigned  flags = O_WRONLY | O_CREAT | O_TRUNC;
+
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
     flags |= O_BINARY;
 #endif
 
     if ((rrd_file = open(file_name, flags, 0666)) < 0) {
         rrd_set_error("creating '%s': %s", file_name, rrd_strerror(errno));
-        free(rrd->stat_head);
-        free(rrd->live_head);
+        rrd_free2(rrd);
         return (-1);
     }
 
@@ -703,8 +699,7 @@ int rrd_create_fn(
 
     if ((rrd->pdp_prep = calloc(1, sizeof(pdp_prep_t))) == NULL) {
         rrd_set_error("allocating pdp_prep");
-        free(rrd->stat_head);
-        free(rrd->live_head);
+        rrd_free2(rrd);
         close(rrd_file);
         return (-1);
     }
@@ -720,8 +715,7 @@ int rrd_create_fn(
 
     if ((rrd->cdp_prep = calloc(1, sizeof(cdp_prep_t))) == NULL) {
         rrd_set_error("allocating cdp_prep");
-        free(rrd->stat_head);
-        free(rrd->live_head);
+        rrd_free2(rrd);
         close(rrd_file);
         return (-1);
     }
@@ -768,8 +762,7 @@ int rrd_create_fn(
 
     if ((rrd->rra_ptr = calloc(1, sizeof(rra_ptr_t))) == NULL) {
         rrd_set_error("allocating rra_ptr");
-        free(rrd->stat_head);
-        free(rrd->live_head);
+        rrd_free2(rrd);
         close(rrd_file);
         return (-1);
     }
@@ -786,8 +779,7 @@ int rrd_create_fn(
     /* write the empty data area */
     if ((unknown = (rrd_value_t *) malloc(512 * sizeof(rrd_value_t))) == NULL) {
         rrd_set_error("allocating unknown");
-        free(rrd->stat_head);
-        free(rrd->live_head);
+        rrd_free2(rrd);
         close(rrd_file);
         return (-1);
     }
@@ -805,8 +797,7 @@ int rrd_create_fn(
     }
     free(unknown);
     fdatasync(rrd_file);
-    free(rrd->stat_head);
-    free(rrd->live_head);
+    rrd_free2(rrd);
     if (close(rrd_file) == -1) {
         rrd_set_error("creating rrd: %s", rrd_strerror(errno));
         return -1;
@@ -819,6 +810,20 @@ int rrd_create_fn(
     return (0);
 }
 
+
+static void rrd_free2(
+    rrd_t *rrd)
+{
+    free(rrd->live_head);
+    free(rrd->stat_head);
+    free(rrd->ds_def);
+    free(rrd->rra_def);
+    free(rrd->rra_ptr);
+    free(rrd->pdp_prep);
+    free(rrd->cdp_prep);
+    free(rrd->rrd_value);
+}
+
 static int rand_init = 0;
 
 long int rra_random_row(
index 2022a4a..a7c5e1c 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_datalang  A system for passing named and typed parameters between
  *               the different parts of rrdtool
index 2ff65a3..a00d119 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  * This code is stolen from rateup (mrtg-2.x) by Dave Rand
  *****************************************************************************
  * diff calculate the difference between two very long integers available as
index 12ab204..ea28245 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_dump  Display a RRD
  *****************************************************************************
index 7c75eae..e1fabd5 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_error.c   Common Header File
  *****************************************************************************
index b47a02c..b555bf9 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_fetch.c  read date from an rrd to use for further processing
  *****************************************************************************
index bdba6c0..fe5d174 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_first Return
  *****************************************************************************
index e84461c..3b5baad 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_format.c  RRD Database Format helper functions
  *****************************************************************************
index 75441ac..e457a7a 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_format.h  RRD Database Format header
  *****************************************************************************/
index d61d015..df3ebcb 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  ****************************************************************************
  * rrd_gfx.c  graphics wrapper for rrdtool
   **************************************************************************/
@@ -46,10 +46,13 @@ void gfx_dashed_line(
     double dash_off)
 {
     cairo_t  *cr = im->cr;
-    double    dashes[] = { dash_on, dash_off };
+    double    dashes[2];
     double    x = 0;
     double    y = 0;
 
+    dashes[0] = dash_on;
+    dashes[1] = dash_off;
+
     cairo_save(cr);
     cairo_new_path(cr);
     cairo_set_line_width(cr, width);
@@ -116,15 +119,18 @@ static PangoLayout *gfx_prep_text(
     image_desc_t *im,
     double x,
     gfx_color_t color,
-    char *font,
-    double size,
+    PangoFontDescription *font_desc,
     double tabwidth,
     const char *text)
 {
-    PangoLayout *layout;
-    PangoFontDescription *font_desc;
+    PangoLayout  *layout = im->layout;
+    PangoFontDescription *pfd;
     cairo_t  *cr = im->cr;
 
+    static double last_tabwidth = -1;
+
+
+
     /* for performance reasons we might
        want todo that only once ... tabs will always
        be the same */
@@ -132,34 +138,52 @@ static PangoLayout *gfx_prep_text(
     long      tab_count = strlen(text);
     long      tab_shift = fmod(x, tabwidth);
     int       border = im->text_prop[TEXT_PROP_LEGEND].size * 2.0;
+    
+    gchar    *utf8_text;
 
-    PangoTabArray *tab_array;
-    PangoContext *pango_context;
-
-    tab_array = pango_tab_array_new(tab_count, (gboolean) (1));
-    for (i = 1; i <= tab_count; i++) {
-        pango_tab_array_set_tab(tab_array,
-                                i, PANGO_TAB_LEFT,
-                                tabwidth * i - tab_shift + border);
+    if (last_tabwidth < 0 || last_tabwidth != tabwidth){
+        PangoTabArray *tab_array;
+        // fprintf(stderr,"t");
+        last_tabwidth = tabwidth;
+        tab_array = pango_tab_array_new(tab_count, (gboolean) (1));
+        for (i = 1; i <= tab_count; i++) {
+             pango_tab_array_set_tab(tab_array,
+                                     i, PANGO_TAB_LEFT,
+                                     tabwidth * i - tab_shift + border);
+        }
+        pango_layout_set_tabs(layout, tab_array);
+        pango_tab_array_free(tab_array);
     }
-    cairo_new_path(cr);
-    cairo_set_source_rgba(cr, color.red, color.green, color.blue,
+   pfd = pango_layout_get_font_description(layout);
+
+   if (!pfd || !pango_font_description_equal (pfd,font_desc)){
+        pango_layout_set_font_description(layout, font_desc);
+  }
+//   fprintf(stderr,"%s\n",pango_font_description_to_string(pango_layout_get_font_description(layout))); 
+
+   cairo_new_path(cr);
+   cairo_set_source_rgba(cr, color.red, color.green, color.blue,
                           color.alpha);
-    layout = pango_cairo_create_layout(cr);
-    pango_context = pango_layout_get_context(layout);
-    pango_cairo_context_set_font_options(pango_context, im->font_options);
-    pango_cairo_context_set_resolution(pango_context, 100);
+/*     layout = pango_cairo_create_layout(cr); */
+
+//    pango_cairo_context_set_font_options(pango_context, im->font_options);
+//    pango_cairo_context_set_resolution(pango_context, 100);
 
 /*     pango_cairo_update_context(cr, pango_context); */
 
-    pango_layout_set_tabs(layout, tab_array);
-    font_desc = pango_font_description_from_string(font);
-    pango_font_description_set_size(font_desc, size * PANGO_SCALE);
-    pango_layout_set_font_description(layout, font_desc);
+
+    /* pango expects the string to be utf-8 encoded */
+    utf8_text = g_locale_to_utf8((const gchar *) text, -1, NULL, NULL, NULL);
+
+    /* In case of an error, i.e. utf8_text == NULL (locale settings messed
+     * up?), we fall back to a possible "invalid UTF-8 string" warning instead
+     * of provoking a failed assertion in libpango. */
     if (im->with_markup)
-        pango_layout_set_markup(layout, text, -1);
+        pango_layout_set_markup(layout, utf8_text ? utf8_text : text, -1);
     else
-        pango_layout_set_text(layout, text, -1);
+        pango_layout_set_text(layout, utf8_text ? utf8_text : text, -1);
+
+    g_free(utf8_text);
     return layout;
 }
 
@@ -167,18 +191,16 @@ static PangoLayout *gfx_prep_text(
 double gfx_get_text_width(
     image_desc_t *im,
     double start,
-    char *font,
-    double size,
+    PangoFontDescription *font_desc,
     double tabwidth,
     char *text)
 {
     PangoLayout *layout;
     PangoRectangle log_rect;
     gfx_color_t color = { 0, 0, 0, 0 };
-    layout = gfx_prep_text(im, start, color, font, size, tabwidth, text);
+    layout = gfx_prep_text(im, start, color, font_desc, tabwidth, text);
     pango_layout_get_pixel_extents(layout, NULL, &log_rect);
-    pango_tab_array_free(pango_layout_get_tabs(layout));
-    g_object_unref(layout);
+/*    g_object_unref(layout); */
     return log_rect.width;
 }
 
@@ -187,8 +209,7 @@ void gfx_text(
     double x,
     double y,
     gfx_color_t color,
-    char *font,
-    double size,
+    PangoFontDescription *font_desc,
     double tabwidth,
     double angle,
     enum gfx_h_align_en h_align,
@@ -197,7 +218,6 @@ void gfx_text(
 {
     PangoLayout *layout;
     PangoRectangle log_rect;
-    PangoRectangle ink_rect;
     cairo_t  *cr = im->cr;
     double    sx = 0;
     double    sy = 0;
@@ -206,8 +226,8 @@ void gfx_text(
     cairo_translate(cr, x, y);
 /*    gfx_line(cr,-2,0,2,0,1,color);
     gfx_line(cr,0,-2,0,2,1,color); */
-    layout = gfx_prep_text(im, x, color, font, size, tabwidth, text);
-    pango_layout_get_pixel_extents(layout, &ink_rect, &log_rect);
+    layout = gfx_prep_text(im, x, color, font_desc, tabwidth, text);
+    pango_layout_get_pixel_extents(layout, NULL, &log_rect);
     cairo_rotate(cr, -angle * G_PI / 180.0);
     sx = log_rect.x;
     switch (h_align) {
@@ -238,8 +258,7 @@ void gfx_text(
     pango_cairo_update_layout(cr, layout);
     cairo_move_to(cr, sx, sy);
     pango_cairo_show_layout(cr, layout);
-    pango_tab_array_free(pango_layout_get_tabs(layout));
-    g_object_unref(layout);
+/*    g_object_unref(layout); */
     cairo_restore(cr);
 
 }
index f688d4c..e445cad 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  ****************************************************************************
  * rrd__graph.c  produce graphs from data in rrdfiles
  ****************************************************************************/
 #endif
 
 text_prop_t text_prop[] = {
-    {8.0, RRD_DEFAULT_FONT}
+    {8.0, RRD_DEFAULT_FONT,NULL}
     ,                   /* default */
-    {9.0, RRD_DEFAULT_FONT}
+    {9.0, RRD_DEFAULT_FONT,NULL}
     ,                   /* title */
-    {7.0, RRD_DEFAULT_FONT}
+    {7.0, RRD_DEFAULT_FONT,NULL}
     ,                   /* axis */
-    {8.0, RRD_DEFAULT_FONT}
+    {8.0, RRD_DEFAULT_FONT,NULL}
     ,                   /* unit */
-    {8.0, RRD_DEFAULT_FONT} /* legend */
+    {8.0, RRD_DEFAULT_FONT,NULL} /* legend */
+    ,
+    {5.5, RRD_DEFAULT_FONT,NULL} /* watermark */    
 };
 
 xlab_t    xlab[] = {
@@ -289,6 +291,7 @@ enum text_prop_en text_prop_conv(
     conv_if(AXIS, TEXT_PROP_AXIS);
     conv_if(UNIT, TEXT_PROP_UNIT);
     conv_if(LEGEND, TEXT_PROP_LEGEND);
+    conv_if(WATERMARK, TEXT_PROP_WATERMARK);
     return -1;
 }
 
@@ -338,12 +341,18 @@ int im_free(
     if (im->rendered_image) {
         free(im->rendered_image);
     }
+
+    if (im->layout) {
+        g_object_unref (im->layout);
+    }
+
     if (im->surface)
         cairo_surface_destroy(im->surface);
+
     if (status)
         fprintf(stderr, "OOPS: Cairo has issues it can't even die: %s\n",
                 cairo_status_to_string(status));
-
+        
     return 0;
 }
 
@@ -1739,11 +1748,7 @@ int leg_place(
                                        im->
                                        text_prop
                                        [TEXT_PROP_LEGEND].
-                                       font,
-                                       im->
-                                       text_prop
-                                       [TEXT_PROP_LEGEND].
-                                       size,
+                                       font_desc,
                                        im->tabwidth, im->gdes[i].legend);
                 leg_c++;
             } else {
@@ -1808,11 +1813,7 @@ int leg_place(
                                            im->
                                            text_prop
                                            [TEXT_PROP_LEGEND].
-                                           font,
-                                           im->
-                                           text_prop
-                                           [TEXT_PROP_LEGEND].
-                                           size,
+                                           font_desc,
                                            im->tabwidth, im->gdes[ii].legend)
                         + legspace[ii]
                         + glue;
@@ -2028,10 +2029,8 @@ int draw_horizontal_grid(
                          im->graph_col[GRC_FONT],
                          im->
                          text_prop[TEXT_PROP_AXIS].
-                         font,
-                         im->
-                         text_prop[TEXT_PROP_AXIS].
-                         size, im->tabwidth, 0.0,
+                         font_desc,
+                         im->tabwidth, 0.0,
                          GFX_H_RIGHT, GFX_V_CENTER, graph_label);
                 gfx_line(im, X0 - 2, Y0, X0, Y0,
                          MGRIDWIDTH, im->graph_col[GRC_MGRID]);
@@ -2209,10 +2208,8 @@ int horizontal_log_grid(
                  im->graph_col[GRC_FONT],
                  im->
                  text_prop[TEXT_PROP_AXIS].
-                 font,
-                 im->
-                 text_prop[TEXT_PROP_AXIS].
-                 size, im->tabwidth, 0.0,
+                 font_desc,
+                 im->tabwidth, 0.0,
                  GFX_H_RIGHT, GFX_V_CENTER, graph_label);
         /* minor grid */
         if (mid < 4 && exfrac == 1) {
@@ -2480,10 +2477,8 @@ void vertical_grid(
                  im->graph_col[GRC_FONT],
                  im->
                  text_prop[TEXT_PROP_AXIS].
-                 font,
-                 im->
-                 text_prop[TEXT_PROP_AXIS].
-                 size, im->tabwidth, 0.0,
+                 font_desc,
+                 im->tabwidth, 0.0,
                  GFX_H_CENTER, GFX_V_TOP, graph_label);
     }
 
@@ -2561,10 +2556,8 @@ void grid_paint(
                      im->graph_col[GRC_FONT],
                      im->
                      text_prop[TEXT_PROP_AXIS].
-                     font,
-                     im->
-                     text_prop[TEXT_PROP_AXIS].
-                     size, im->tabwidth, 0.0,
+                     font_desc,
+                     im->tabwidth, 0.0,
                      GFX_H_CENTER, GFX_V_CENTER, nodata);
         }
     }
@@ -2577,10 +2570,8 @@ void grid_paint(
              im->graph_col[GRC_FONT],
              im->
              text_prop[TEXT_PROP_UNIT].
-             font,
-             im->
-             text_prop[TEXT_PROP_UNIT].
-             size, im->tabwidth,
+             font_desc,
+             im->tabwidth,
              RRDGRAPH_YLEGEND_ANGLE, GFX_H_CENTER, GFX_V_CENTER, im->ylegend);
     /* graph title */
     gfx_text(im,
@@ -2588,18 +2579,16 @@ void grid_paint(
              im->graph_col[GRC_FONT],
              im->
              text_prop[TEXT_PROP_TITLE].
-             font,
-             im->
-             text_prop[TEXT_PROP_TITLE].
-             size, im->tabwidth, 0.0, GFX_H_CENTER, GFX_V_TOP, im->title);
+             font_desc,
+             im->tabwidth, 0.0, GFX_H_CENTER, GFX_V_TOP, im->title);
     /* rrdtool 'logo' */
     water_color = im->graph_col[GRC_FONT];
     water_color.alpha = 0.3;
     gfx_text(im, im->ximg - 4, 5,
              water_color,
              im->
-             text_prop[TEXT_PROP_AXIS].
-             font, 5.5, im->tabwidth,
+             text_prop[TEXT_PROP_WATERMARK].
+             font_desc, im->tabwidth,
              -90, GFX_H_LEFT, GFX_V_TOP, "RRDTOOL / TOBI OETIKER");
     /* graph watermark */
     if (im->watermark[0] != '\0') {
@@ -2607,8 +2596,8 @@ void grid_paint(
                  im->ximg / 2, im->yimg - 6,
                  water_color,
                  im->
-                 text_prop[TEXT_PROP_AXIS].
-                 font, 5.5, im->tabwidth, 0,
+                 text_prop[TEXT_PROP_WATERMARK].
+                 font_desc, im->tabwidth, 0,
                  GFX_H_CENTER, GFX_V_BOTTOM, im->watermark);
     }
 
@@ -2624,10 +2613,7 @@ void grid_paint(
                      im->graph_col[GRC_FONT],
                      im->
                      text_prop
-                     [TEXT_PROP_LEGEND].font,
-                     im->
-                     text_prop
-                     [TEXT_PROP_LEGEND].size,
+                     [TEXT_PROP_LEGEND].font_desc,
                      im->tabwidth, 0.0,
                      GFX_H_LEFT, GFX_V_BOTTOM, im->gdes[i].legend);
             /* The legend for GRAPH items starts with "M " to have
@@ -2641,11 +2627,8 @@ void grid_paint(
                                           im->
                                           text_prop
                                           [TEXT_PROP_LEGEND].
-                                          font,
-                                          im->
-                                          text_prop
-                                          [TEXT_PROP_LEGEND].
-                                          size, im->tabwidth, "o") * 1.2;
+                                          font_desc,
+                                          im->tabwidth, "o") * 1.2;
                 boxV = boxH;
                 /* shift the box up a bit */
                 Y0 -= boxV * 0.4;
@@ -2801,11 +2784,8 @@ int graph_size_location(
                                    im->
                                    text_prop
                                    [TEXT_PROP_AXIS].
-                                   font,
-                                   im->
-                                   text_prop
-                                   [TEXT_PROP_AXIS].
-                                   size, im->tabwidth, "0") * im->unitslength;
+                                   font_desc,
+                                   im->tabwidth, "0") * im->unitslength;
         }
     }
 
@@ -2986,10 +2966,11 @@ int graph_paint(
     double    areazero = 0.0;
     graph_desc_t *lastgdes = NULL;
     rrd_infoval_t info;
-    PangoFontMap *font_map = pango_cairo_font_map_get_default();
 
-    /* if we are lazy and there is nothing to PRINT ... quit now */
-    if (lazy && im->prt_c == 0) {
+//    PangoFontMap *font_map = pango_cairo_font_map_get_default();
+
+    /* if we want and can be lazy ... quit now */
+    if (lazy) {
         info.u_cnt = im->ximg;
         grinfo_push(im, sprintf_alloc("image_width"), RD_I_CNT, info);
         info.u_cnt = im->yimg;
@@ -3007,7 +2988,7 @@ int graph_paint(
      * if there are no graph elements (i==0) we stop here ... 
      * if we are lazy, try to quit ... 
      */
-    i = print_calc(im); 
+    i = print_calc(im);
     if (i < 0)
         return -1;
 
@@ -3097,10 +3078,11 @@ int graph_paint(
             (im->surface, CAIRO_SVG_VERSION_1_1);
         break;
     };
+    cairo_destroy(im->cr);
     im->cr = cairo_create(im->surface);
     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);
+//    pango_cairo_font_map_set_resolution(PANGO_CAIRO_FONT_MAP(font_map), 100);
     gfx_new_area(im, 0, 0, 0, im->yimg,
                  im->ximg, im->yimg, im->graph_col[GRC_BACK]);
     gfx_add_point(im, im->ximg, 0);
@@ -3605,7 +3587,7 @@ int rrd_graph(
     *ysize = 0;
     *ymin = 0;
     *ymax = 0;
-    while (walker) {        
+    while (walker) {
         if (strcmp(walker->key, "image_width") == 0) {
             *xsize = walker->value.u_int;
         } else if (strcmp(walker->key, "image_height") == 0) {
@@ -3650,11 +3632,9 @@ rrd_info_t *rrd_graph_v(
 {
     image_desc_t im;
     rrd_info_t *grinfo;
-
     rrd_graph_init(&im);
     /* a dummy surface so that we can measure text sizes for placements */
-    im.surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 10, 10);
-    im.cr = cairo_create(im.surface);
+    
     rrd_graph_options(argc, argv, &im);
     if (rrd_test_error()) {
         rrd_info_free(im.grinfo);
@@ -3705,10 +3685,17 @@ rrd_info_t *rrd_graph_v(
 
     if (im.imginfo) {
         rrd_infoval_t info;
+        char     *filename;
 
+        filename = im.graphfile + strlen(im.graphfile);
+        while (filename > im.graphfile) {
+            if (*(filename - 1) == '/' || *(filename - 1) == '\\')
+                break;
+            filename--;
+        }
         info.u_str =
             sprintf_alloc(im.imginfo,
-                          im.graphfile,
+                          filename,
                           (long) (im.zoom *
                                   im.ximg), (long) (im.zoom * im.yimg));
         grinfo_push(&im, sprintf_alloc("image_info"), RD_I_STR, info);
@@ -3726,11 +3713,52 @@ rrd_info_t *rrd_graph_v(
     return grinfo;
 }
 
+static void 
+rrd_set_font_desc (
+    image_desc_t *im,int prop,char *font, double size ){
+    static text_prop_t tp_cache[] = { {-1,"",NULL}, {-1,"",NULL}, {-1,"",NULL}, {-1,"",NULL}, {-1,"",NULL}, {-1,"",NULL}};
+    
+    if (tp_cache[prop].font_desc == NULL){        
+        if (prop > 0 && tp_cache[0].font_desc != NULL){
+            tp_cache[prop].font_desc = pango_font_description_copy (tp_cache[0].font_desc);
+            strcpy(tp_cache[prop].font,tp_cache[0].font);
+            tp_cache[prop].size = tp_cache[0].size;
+        }
+        else {
+            tp_cache[prop].font_desc = pango_font_description_new();        
+        }
+        im->text_prop[prop].font_desc =  pango_font_description_copy (tp_cache[prop].font_desc);
+    }
+    
+    if (font != NULL && strcmp(tp_cache[prop].font,font) != 0){
+        pango_font_description_free(tp_cache[prop].font_desc);
+        pango_font_description_free(im->text_prop[prop].font_desc);
+        tp_cache[prop].font_desc = pango_font_description_from_string( font );
+        im->text_prop[prop].font_desc = pango_font_description_copy( tp_cache[prop].font_desc );
+        strncpy(tp_cache[prop].font, font, sizeof(text_prop[prop].font) - 1);        
+        tp_cache[prop].font[sizeof(text_prop[prop].font) - 1] = '\0';   
+        strcpy(im->text_prop[prop].font,tp_cache[prop].font);          
+    }
+    if (size != 0 && size != (tp_cache[prop].size)){
+        pango_font_description_set_size(tp_cache[prop].font_desc, size * PANGO_SCALE);
+        pango_font_description_set_size(im->text_prop[prop].font_desc, size * PANGO_SCALE);
+        im->text_prop[prop].size = size;
+        tp_cache[prop].size = size;
+    }
+    if (im->text_prop[prop].size < 0){
+        im->text_prop[prop].size = tp_cache[prop].size;
+        im->text_prop[prop].font_desc = pango_font_description_copy( tp_cache[prop].font_desc );
+        strcpy(im->text_prop[prop].font,tp_cache[prop].font);
+    }
+    // fprintf(stderr,"%d %s\n",prop,pango_font_description_to_string(im->text_prop[prop].font_desc)); 
+}
+
 void rrd_graph_init(
     image_desc_t
     *im)
 {
     unsigned int i;
+    char     *deffont = getenv("RRD_DEFAULT_FONT");
 
 #ifdef HAVE_TZSET
     tzset();
@@ -3742,7 +3770,6 @@ void rrd_graph_init(
 #endif
 #endif
     im->base = 1000;
-    im->cr = NULL;
     im->draw_x_grid = 1;
     im->draw_y_grid = 1;
     im->extra_flags = 0;
@@ -3770,7 +3797,6 @@ void rrd_graph_init(
     im->rendered_image = NULL;
     im->slopemode = 0;
     im->step = 0;
-    im->surface = NULL;
     im->symbol = ' ';
     im->tabwidth = 40.0;
     im->title[0] = '\0';
@@ -3789,31 +3815,33 @@ void rrd_graph_init(
     im->yorigin = 0;
     im->ysize = 100;
     im->zoom = 1;
+
+    im->surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 10, 10);     
+    im->cr = cairo_create(im->surface);
+
+    for (i = 0; i < DIM(text_prop); i++) {
+        im->text_prop[i].size = -1;
+        rrd_set_font_desc(im,i, deffont ? deffont : text_prop[i].font,text_prop[i].size);
+    }
+
+    im->layout = pango_cairo_create_layout(im->cr);    
+    pango_cairo_context_set_resolution(pango_layout_get_context(im->layout), 100);
+
     cairo_font_options_set_hint_style
         (im->font_options, CAIRO_HINT_STYLE_FULL);
     cairo_font_options_set_hint_metrics
         (im->font_options, CAIRO_HINT_METRICS_ON);
     cairo_font_options_set_antialias(im->font_options, CAIRO_ANTIALIAS_GRAY);
+
+
+
     for (i = 0; i < DIM(graph_col); i++)
         im->graph_col[i] = graph_col[i];
-    {
-        char     *deffont;
-
-        deffont = getenv("RRD_DEFAULT_FONT");
-        if (deffont != NULL) {
-            for (i = 0; i < DIM(text_prop); i++) {
-                strncpy(text_prop[i].font, deffont,
-                        sizeof(text_prop[i].font) - 1);
-                text_prop[i].font[sizeof(text_prop[i].font) - 1] = '\0';
-            }
-        }
-    }
-    for (i = 0; i < DIM(text_prop); i++) {
-        im->text_prop[i].size = text_prop[i].size;
-        strcpy(im->text_prop[i].font, text_prop[i].font);
-    }
+
+
 }
 
+
 void rrd_graph_options(
     int argc,
     char *argv[],
@@ -4155,13 +4183,11 @@ void rrd_graph_options(
                     for (propidx = sindex;
                          propidx < TEXT_PROP_LAST; propidx++) {
                         if (size > 0) {
-                            im->text_prop[propidx].size = size;
+                            rrd_set_font_desc(im,propidx,NULL,size);   
                         }
                         if ((int) strlen(optarg) > end) {
                             if (optarg[end] == ':') {
-                                strncpy(im->text_prop[propidx].font,
-                                        optarg + end + 1, 255);
-                                im->text_prop[propidx].font[255] = '\0';
+                                rrd_set_font_desc(im,propidx,optarg + end + 1,0);   
                             } else {
                                 rrd_set_error
                                     ("expected : after font size in '%s'",
@@ -4283,6 +4309,11 @@ void rrd_graph_options(
             im->use_rrdcached = 1;
         }
     }
+    
+    pango_cairo_context_set_font_options(pango_layout_get_context(im->layout), im->font_options);
+    pango_layout_context_changed(im->layout);
+
+
 
     if (im->logarithmic && im->minval <= 0) {
         rrd_set_error
@@ -4527,9 +4558,9 @@ int vdef_calc(
     src = &im->gdes[dst->vidx];
     data = src->data + src->ds;
     end =
-        src->end_orig % (long)src->step ==
-        0 ? src->end_orig : (src->end_orig + (long)src->step -
-                             src->end_orig % (long)src->step);
+        src->end_orig % (long) src->step ==
+        0 ? src->end_orig : (src->end_orig + (long) src->step -
+                             src->end_orig % (long) src->step);
 
     steps = (end - src->start) / src->step;
 #if 0
index c21f356..cffce4b 100644 (file)
@@ -61,11 +61,13 @@ enum vdef_op_en {
         , VDEF_LSLINT   /* least squares line y_intercept */
         , VDEF_LSLCORREL    /* least squares line correlation coefficient */
 };
-enum text_prop_en { TEXT_PROP_DEFAULT = 0,  /* default settings */
+enum text_prop_en { 
+    TEXT_PROP_DEFAULT = 0,  /* default settings */
     TEXT_PROP_TITLE,    /* properties for the title */
     TEXT_PROP_AXIS,     /* for the numbers next to the axis */
     TEXT_PROP_UNIT,     /* for the vertical unit description */
-    TEXT_PROP_LEGEND,   /* fot the legend below the graph */
+    TEXT_PROP_LEGEND,   /* for the legend below the graph */
+    TEXT_PROP_WATERMARK, /* for the little text to the side of the graph */
     TEXT_PROP_LAST
 };
 
@@ -87,6 +89,7 @@ typedef struct gfx_color_t {
 typedef struct text_prop_t {
     double    size;
     char      font[1024];
+    PangoFontDescription *font_desc;
 } text_prop_t;
 
 
@@ -244,7 +247,7 @@ typedef struct image_desc_t {
     cairo_t  *cr;       /* drawin context */
     cairo_font_options_t *font_options; /* cairo font options */
     cairo_antialias_t graph_antialias;  /* antialiasing for the graph */
-
+    PangoLayout *layout; /* the pango layout we use for writing fonts */
     rrd_info_t *grinfo; /* root pointer to extra graph info */
     rrd_info_t *grinfo_current; /* pointing to current entry */
 } image_desc_t;
@@ -339,6 +342,7 @@ int       scan_for_col(
     char *const);
 void      rrd_graph_init(
     image_desc_t *);
+
 void      rrd_graph_options(
     int,
     char **,
@@ -418,8 +422,7 @@ void      gfx_text(
     double x,
     double y,
     gfx_color_t color,
-    char *font,
-    double size,
+    PangoFontDescription *font_desc,
     double tabwidth,
     double angle,
     enum gfx_h_align_en h_align,
@@ -430,8 +433,7 @@ void      gfx_text(
 double    gfx_get_text_width(
     image_desc_t *im,
     double start,
-    char *font,
-    double size,
+    PangoFontDescription *font_desc,
     double tabwidth,
     char *text);
 
@@ -455,5 +457,4 @@ void      gfx_area_fit(
 void      grinfo_push(
     image_desc_t *im,
     char *key,
-    rrd_info_type_t type,
-    rrd_infoval_t value);
+    rrd_info_type_t type,    rrd_infoval_t value);
index 7cefc82..be85b9f 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  ****************************************************************************
  * rrd_graph_helper.c  commandline parser functions 
  *                     this code initially written by Alex van den Bogaerdt
@@ -516,10 +516,10 @@ int rrd_parse_textalign(
 }
 
 
-/* Parsing of PART, VRULE, HRULE, LINE, AREA, STACK and TICK
+/* Parsing of VRULE, HRULE, LINE, AREA, STACK and TICK
 ** is done in one function.
 **
-** Stacking PART, VRULE, HRULE or TICK is not allowed.
+** Stacking VRULE, HRULE or TICK is not allowed.
 **
 ** If a number (which is valid to enter) is more than a
 ** certain amount of characters, it is caught as an error.
@@ -541,18 +541,12 @@ int rrd_parse_PVHLAST(
         float     one_space = gfx_get_text_width(im, 0,
                                                  im->
                                                  text_prop[TEXT_PROP_LEGEND].
-                                                 font,
-                                                 im->
-                                                 text_prop[TEXT_PROP_LEGEND].
-                                                 size,
+                                                 font_desc,
                                                  im->tabwidth, "    ") / 4.0;
         float     target_space = gfx_get_text_width(im, 0,
                                                     im->
                                                     text_prop
-                                                    [TEXT_PROP_LEGEND].font,
-                                                    im->
-                                                    text_prop
-                                                    [TEXT_PROP_LEGEND].size,
+                                                    [TEXT_PROP_LEGEND].font_desc,
                                                     im->tabwidth, "oo");
 
         spacecnt = target_space / one_space;
@@ -739,7 +733,7 @@ int rrd_parse_PVHLAST(
     }
     (*eaten)++;         /* after colon */
 
-    /* PART, HRULE, VRULE and TICK cannot be stacked. */
+    /* HRULE, VRULE and TICK cannot be stacked. */
     if ((gdp->gf != GF_HRULE)
         && (gdp->gf != GF_VRULE)
         && (gdp->gf != GF_TICK)) {
index f04d9f7..263b3f9 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_hw.c : Support for Holt-Winters Smoothing/ Aberrant Behavior Detection
  *****************************************************************************
index eac7616..df1bf07 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_hw.h : Support for Holt-Winters Smoothing/ Aberrant Behavior Detection
  *****************************************************************************/
index 80da40a..9514380 100644 (file)
@@ -48,6 +48,7 @@ int update_hwpredict(
     unsigned long dependent_rra_idx, seasonal_cdp_idx;
     unival   *coefs = rrd->cdp_prep[cdp_idx].scratch;
     rra_def_t *current_rra = &(rrd->rra_def[rra_idx]);
+    rrd_value_t seasonal_coef;
 
     /* save coefficients from current prediction */
     coefs[CDP_hw_last_intercept].u_val = coefs[CDP_hw_intercept].u_val;
@@ -58,7 +59,7 @@ int update_hwpredict(
     dependent_rra_idx = current_rra->par[RRA_dependent_rra_idx].u_cnt;
     seasonal_cdp_idx = dependent_rra_idx * (rrd->stat_head->ds_cnt) + ds_idx;
 
-    rrd_value_t seasonal_coef = (dependent_rra_idx < rra_idx)
+    seasonal_coef = (dependent_rra_idx < rra_idx)
         ? rrd->cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_last_seasonal].u_val
         : rrd->cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_seasonal].u_val;
 
index 83da369..09e455f 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Takao Fujiwara, 2008
+ * RRDtool 1.3.1  Copyright by Takao Fujiwara, 2008
  *****************************************************************************
  * rrd_i18n.h   Common Header File
  *****************************************************************************/
index 385ffad..1ee1442 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_info  Get Information about the configuration of an RRD
  *****************************************************************************/
index 0db2240..85768b8 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  * This file:     Copyright 2003 Peter Stamfest <peter@stamfest.at> 
  *                             & Tobias Oetiker
  * Distributed under the GPL
index f76c82c..d3e4b4c 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_last.c
  *****************************************************************************
index 3ca78e1..37bdf74 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *                Copyright by Florian Forster, 2008
  *****************************************************************************
  * rrd_lastupdate  Get the last datum entered for each DS
index d2809cd..5a100b2 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  * This file:     Copyright 2003 Peter Stamfest <peter@stamfest.at> 
  *                             & Tobias Oetiker
  * Distributed under the GPL
index f5dadbf..aa9350e 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_open.c  Open an RRD File
  *****************************************************************************
@@ -116,7 +116,6 @@ rrd_file_t *rrd_open(
         mm_flags |= MAP_NONBLOCK;   /* just populate ptes */
 #endif
     }
-
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
     flags |= O_BINARY;
 #endif
index 8fc1fc7..e6ccaa4 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_resize.c Alters size of an RRA
  *****************************************************************************
index 2485861..57eb82e 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  * This file:     Copyright 2008 Florian octo Forster
  * Distributed under the GPL
  *****************************************************************************
@@ -318,6 +318,10 @@ static int parse_tag_rra_cdp_prep_ds(
 
     status = 0;
     for (child = node->xmlChildrenNode; child != NULL; child = child->next) {
+        if (atoi(rrd->stat_head->version) == 1) {
+            cdp_prep->scratch[CDP_primary_val].u_val = 0.0;
+            cdp_prep->scratch[CDP_secondary_val].u_val = 0.0;
+        }
         if ((xmlStrcmp(child->name, (const xmlChar *) "comment") == 0)
             || (xmlStrcmp(child->name, (const xmlChar *) "text") == 0))
             /* ignore */ ;
@@ -385,45 +389,6 @@ static int parse_tag_rra_cdp_prep_ds(
             status = get_int_from_node(doc, child,
                                        (int *) &cdp_prep->
                                        scratch[CDP_unkn_pdp_cnt].u_cnt);
-        /*
-         * Compatibility code for 1.0.49
-         */
-        else if (xmlStrcmp(child->name, (const xmlChar *) "value") == 0) {  /* {{{ */
-            unsigned int i = 0;
-            rra_def_t *rra_def = rrd->rra_def + (rrd->stat_head->rra_cnt - 1);
-
-            while (42) {
-                if (i >= ARRAY_LENGTH(cdp_prep->scratch)) {
-                    status = -1;
-                    break;
-                }
-
-                if ((cf_conv(rra_def->cf_nam) == CF_FAILURES)
-                    || (i == CDP_unkn_pdp_cnt)
-                    || (i == CDP_null_count)
-                    || (i == CDP_last_null_count))
-                    status = get_int_from_node(doc, child,
-                                               (int *) &cdp_prep->scratch[i].
-                                               u_cnt);
-                else
-                    status = get_double_from_node(doc, child,
-                                                  &cdp_prep->scratch[i].
-                                                  u_val);
-
-                if (status != 0)
-                    break;
-
-                /* When this loops exits (sucessfully) `child' points to the last
-                 * `value' tag in the list. */
-                if ((child->next == NULL)
-                    || (xmlStrcmp(child->name, (const xmlChar *) "value") !=
-                        0))
-                    break;
-
-                child = child->next;
-                i++;
-            }
-        } /* }}} */
         else {
             rrd_set_error("parse_tag_rra_cdp_prep: Unknown tag: %s",
                           child->name);
@@ -708,7 +673,13 @@ static int parse_tag_rra(
         else if (xmlStrcmp(child->name, (const xmlChar *) "pdp_per_row") == 0)
             status = get_int_from_node(doc, child,
                                        (int *) &cur_rra_def->pdp_cnt);
-        else if (xmlStrcmp(child->name, (const xmlChar *) "params") == 0)
+        else if (atoi(rrd->stat_head->version) == 1
+                 && xmlStrcmp(child->name, (const xmlChar *) "xff") == 0)
+            status = get_double_from_node(doc, child,
+                                          (double *) &cur_rra_def->
+                                          par[RRA_cdp_xff_val].u_val);
+        else if (atoi(rrd->stat_head->version) >= 2
+                 && xmlStrcmp(child->name, (const xmlChar *) "params") == 0)
             status = parse_tag_rra_params(doc, child, cur_rra_def);
         else if (xmlStrcmp(child->name, (const xmlChar *) "cdp_prep") == 0)
             status = parse_tag_rra_cdp_prep(doc, child, rrd, cur_cdp_prep);
@@ -723,8 +694,8 @@ static int parse_tag_rra(
             break;
     }
 
-    /* Set the RRA pointer to the last value in the archive */
-    cur_rra_ptr->cur_row = cur_rra_def->row_cnt - 1;
+    /* Set the RRA pointer to a random location */
+    cur_rra_ptr->cur_row = random() % cur_rra_def->row_cnt;
 
     return (status);
 }                       /* int parse_tag_rra */
@@ -996,7 +967,7 @@ static int write_file(
 {
     FILE     *fh;
     unsigned int i;
-    unsigned int value_count;
+    unsigned int rra_offset;
 
     if (strcmp("-", file_name) == 0)
         fh = stdout;
@@ -1025,7 +996,10 @@ static int write_file(
             return (-1);
         }
     }
-
+    if (atoi(rrd->stat_head->version) < 3) {
+        /* we output 3 or higher */
+        strcpy(rrd->stat_head->version, "0003");
+    }
     fwrite(rrd->stat_head, sizeof(stat_head_t), 1, fh);
     fwrite(rrd->ds_def, sizeof(ds_def_t), rrd->stat_head->ds_cnt, fh);
     fwrite(rrd->rra_def, sizeof(rra_def_t), rrd->stat_head->rra_cnt, fh);
@@ -1036,11 +1010,21 @@ static int write_file(
     fwrite(rrd->rra_ptr, sizeof(rra_ptr_t), rrd->stat_head->rra_cnt, fh);
 
     /* calculate the number of rrd_values to dump */
-    value_count = 0;
-    for (i = 0; i < rrd->stat_head->rra_cnt; i++)
-        value_count += (rrd->rra_def[i].row_cnt * rrd->stat_head->ds_cnt);
+    rra_offset = 0;
+    for (i = 0; i < rrd->stat_head->rra_cnt; i++) {
+        unsigned long num_rows = rrd->rra_def[i].row_cnt;
+        unsigned long cur_row = rrd->rra_ptr[i].cur_row;
+        unsigned long ds_cnt = rrd->stat_head->ds_cnt;
+
+        fwrite(rrd->rrd_value +
+               (rra_offset + num_rows - 1 - cur_row) * ds_cnt,
+               sizeof(rrd_value_t), (cur_row + 1) * ds_cnt, fh);
 
-    fwrite(rrd->rrd_value, sizeof(rrd_value_t), value_count, fh);
+        fwrite(rrd->rrd_value + rra_offset * ds_cnt,
+               sizeof(rrd_value_t), (num_rows - 1 - cur_row) * ds_cnt, fh);
+
+        rra_offset += num_rows;
+    }
 
     /* lets see if we had an error */
     if (ferror(fh)) {
@@ -1059,6 +1043,7 @@ int rrd_restore(
 {
     rrd_t    *rrd;
 
+    srandom((unsigned int) time(NULL) + (unsigned int) getpid());
     /* init rrd clean */
     optind = 0;
     opterr = 0;         /* initialize getopt */
index 1192483..005048f 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  ****************************************************************************
  * rrd_rpncalc.c  RPN calculator functions
  ****************************************************************************/
index 06ef0ff..d23b4dd 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  ****************************************************************************
  * rrd_rpncalc.h  RPN calculator functions
  ****************************************************************************/
index 5143513..ac363f7 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  * This file:     Copyright 2003 Peter Stamfest <peter@stamfest.at> 
  *                             & Tobias Oetiker
  * Distributed under the GPL
index 12fb75a..b427a37 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  * This file:     Copyright 2003 Peter Stamfest <peter@stamfest.at> 
  *                             & Tobias Oetiker
  * Distributed under the GPL
index 2d0e178..5e44b30 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_tool.c  Startup wrapper
  *****************************************************************************/
@@ -376,11 +376,16 @@ static char *fgetslong(
             return *aLinePtr = linebuf;
         bufsize += MAX_LENGTH;
         if (!(linebuf = realloc(linebuf, bufsize))) {
+            free(linebuf);
             perror("fgetslong: realloc");
             exit(1);
         }
     }
-    return *aLinePtr = linebuf[0] ? linebuf : 0;
+    if (linebuf[0]){
+        return  *aLinePtr = linebuf;
+    }
+    free(linebuf);
+    return *aLinePtr = 0;
 }
 
 int main(
@@ -431,11 +436,8 @@ int main(
                    == 0) {
 
 #ifdef HAVE_CHROOT
-                chroot(argv[2]);
-                if (errno != 0) {
-                    fprintf(stderr,
-                            "ERROR: can't change root to '%s' errno=%d\n",
-                            argv[2], errno);
+                if (chroot(argv[2]) != 0){
+                    fprintf(stderr, "ERROR: chroot %s: %s\n", argv[2],rrd_strerror(errno));
                     exit(errno);
                 }
                 ChangeRoot = 1;
@@ -451,15 +453,15 @@ int main(
             }
         }
         if (strcmp(firstdir, "")) {
-            chdir(firstdir);
-            if (errno != 0) {
-                fprintf(stderr, "ERROR: %s\n", rrd_strerror(errno));
+            if (chdir(firstdir) != 0){
+                fprintf(stderr, "ERROR: chdir %s %s\n", firstdir,rrd_strerror(errno));
                 exit(errno);
             }
         }
 
         while (fgetslong(&aLine, stdin)) {
             if ((argc = CountArgs(aLine)) == 0) {
+                free(aLine);
                 printf("ERROR: not enough arguments\n");
             }
             if ((myargv = (char **) malloc((argc + 1) *
@@ -468,6 +470,8 @@ int main(
                 exit(1);
             }
             if ((argc = CreateArgs(argv[0], aLine, argc, myargv)) < 0) {
+                free(aLine);
+                free(myargv);
                 printf("ERROR: creating arguments\n");
             } else {
                 int       ret = HandleInputLine(argc, myargv, stdout);
@@ -524,7 +528,6 @@ int HandleInputLine(
 
     /* Reset errno to 0 before we start.
      */
-    errno = 0;
     if (RemoteMode) {
         if (argc > 1 && strcmp("quit", argv[1]) == 0) {
             if (argc > 2) {
@@ -547,9 +550,8 @@ int HandleInputLine(
                 return (1);
             }
 #endif
-            chdir(argv[2]);
-            if (errno != 0) {
-                printf("ERROR: %s\n", rrd_strerror(errno));
+            if (chdir(argv[2]) != 0){
+                printf("ERROR: chdir %s %s\n", argv[2], rrd_strerror(errno));
                 return (1);
             }
             return (0);
@@ -561,7 +563,7 @@ int HandleInputLine(
             }
             cwd = getcwd(NULL, MAXPATH);
             if (cwd == NULL) {
-                printf("ERROR: %s\n", rrd_strerror(errno));
+                printf("ERROR: getcwd %s\n", rrd_strerror(errno));
                 return (1);
             }
             printf("%s\n", cwd);
@@ -581,9 +583,8 @@ int HandleInputLine(
                 return (1);
             }
 #endif
-            mkdir(argv[2], 0777);
-            if (errno != 0) {
-                printf("ERROR: %s\n", rrd_strerror(errno));
+            if(mkdir(argv[2], 0777)!=0){
+                printf("ERROR: mkdir %s: %s\n", argv[2],rrd_strerror(errno));
                 return (1);
             }
             return (0);
@@ -611,7 +612,7 @@ int HandleInputLine(
                 }
                 closedir(curdir);
             } else {
-                printf("ERROR: %s\n", rrd_strerror(errno));
+                printf("ERROR: opendir .: %s\n", rrd_strerror(errno));
                 return (errno);
             }
             return (0);
index eb8846f..8e0718f 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_tool.h   Common Header File
  *****************************************************************************/
index 3fa33d9..01d9ec5 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * change header parameters of an rrd
  *****************************************************************************
index ed4b48e..b4466e1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *                Copyright by Florian Forster, 2008
  *****************************************************************************
  * rrd_update.c  RRD Update Function
@@ -583,15 +583,15 @@ int _rrd_update(
                         rra_step_cnt, updvals, tmpl_idx, tmpl_cnt,
                         &pcdp_summary, version, skip_update,
                         &schedule_smooth) == -1) {
-           if (rrd_test_error()) { /* Should have error string always here */
-               char *save_error;
-
-               /* Prepend file name to error message */
-               if ((save_error = strdup(rrd_get_error())) != NULL) {
-                   rrd_set_error("%s: %s", filename, save_error);
-                   free(save_error);
-               }
-           }
+            if (rrd_test_error()) { /* Should have error string always here */
+                char     *save_error;
+
+                /* Prepend file name to error message */
+                if ((save_error = strdup(rrd_get_error())) != NULL) {
+                    rrd_set_error("%s: %s", filename, save_error);
+                    free(save_error);
+                }
+            }
             free(arg_copy);
             break;
         }
index 32ccbeb..199929e 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrd_version Return
  *****************************************************************************
index f015a28..c5ff70c 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  ****************************************************************************
  * rrd_xport.c  export RRD data 
  ****************************************************************************/
index 8918d79..759e440 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  ****************************************************************************
  * rrd_xport.h  contains XML related constants
  ****************************************************************************/
index 29b6474..96c98a0 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.3.0  Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.3.1  Copyright by Tobi Oetiker, 1997-2008
  *****************************************************************************
  * rrdupdate.c  Main program for the (standalone) rrdupdate utility
  *****************************************************************************