]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/log
thirdparty/rrdtool-1.x.git
4 years agoFix AM_CHECK_PYTHON_HEADERS macro for Python3 1072/head
Pierre Lejeune [Mon, 30 Dec 2019 00:30:58 +0000 (01:30 +0100)] 
Fix AM_CHECK_PYTHON_HEADERS macro for Python3

This detects Python3 include paths like /usr/include/python3.7m.
Taken from pygobject.

4 years agoMerge pull request #1069 from Thomas-Gelf/patch-2
Tobias Oetiker [Tue, 10 Dec 2019 15:14:25 +0000 (16:14 +0100)] 
Merge pull request #1069 from Thomas-Gelf/patch-2

rrdgraph_rpn.pod: fix typo

4 years agorrdgraph_rpn.pod: fix typo 1069/head
Thomas Gelf [Fri, 29 Nov 2019 17:52:41 +0000 (18:52 +0100)] 
rrdgraph_rpn.pod: fix typo

This should probably have read `Now` (instead of `No`). I dropped the whole word as the former sentence also starts with `Now`.

4 years agorrdgraph_rpn.pod: fix SMIN example
Thomas Gelf [Fri, 29 Nov 2019 15:44:57 +0000 (16:44 +0100)] 
rrdgraph_rpn.pod: fix SMIN example

4 years agoUse LC_NUMERIC=C for tests
Wolfgang Stöggl [Mon, 18 Nov 2019 19:11:47 +0000 (20:11 +0100)] 
Use LC_NUMERIC=C for tests

The following tests require dot as decimal separator:
graph1, rpn1, create-with-source-4, dcounter1, vformatter1, pdp-calc1

Set LC_NUMERIC=C, which allows these tests to pass also under locales,
where the decimal separator is not a dot by default:
de_DE, es_ES, fr_FR, nl_NL etc.

4 years agoAdd podchecker to .travis.yml
Wolfgang Stöggl [Tue, 12 Nov 2019 11:58:28 +0000 (12:58 +0100)] 
Add podchecker to .travis.yml

- Check the syntax of doc/*.pod files

4 years agoUpdate rrdlist manual
Jean-Michel Vourgère [Tue, 12 Nov 2019 10:29:48 +0000 (11:29 +0100)] 
Update rrdlist manual

Add documentation for --noflush and --recursive options.

4 years agoFix rrd_pdpcalc whatis entry in manual
Jean-Michel Vourgère [Tue, 12 Nov 2019 10:49:39 +0000 (11:49 +0100)] 
Fix rrd_pdpcalc whatis entry in manual

From Debian lintian checker:
 Each manual page should start with a "NAME" section, which lists the
 name and a brief description of the page separated by "\-". The "NAME"
 section is parsed by lexgrog and used to generate a database that's
 queried by commands like apropos and whatis. This tag indicates that
 lexgrog was unable to parse the NAME section of this manual page.

 For manual pages that document multiple programs, functions, files, or
 other things, the part before "\-" should list each separated by a comma
 and a space. Each thing listed must not contain spaces; a man page for a
 two-part command like "fs listacl" must use something like "fs_listacl"
 in the "NAME" section so that it can be parsed by lexgrog.

 Refer to the lexgrog(1) manual page, the groff_man(7) manual page, and
 the groff_mdoc(7) manual page for details.

4 years agoUpdate .travis.yml according to yamllint
Wolfgang Stöggl [Wed, 9 Oct 2019 10:56:48 +0000 (12:56 +0200)] 
Update .travis.yml according to yamllint

- Fix the following warnings and errors reported by yamllint 1.17.0:

24:1  warning  comment not indented like content (comments-indentation)
28:1  warning  comment not indented like content (comments-indentation)
44:18 error    trailing spaces (trailing-spaces)
49:1  error    too many blank lines (1 > 0) (empty-lines)

- Used the following yamllint command:
  yamllint -d "{extends: default, rules: {document-start: disable, \
  line-length: {max: 512}}}" .travis.yml

4 years agoFix potential duplicate write_changes_to_disk() calls 2019-10
Yong Li [Mon, 30 Sep 2019 12:16:43 +0000 (08:16 -0400)] 
Fix potential duplicate write_changes_to_disk() calls

Fix duplicate write_changes_to_disk() calls when HAVE_LIBRADOS is true and HAVE_MMAP is false

4 years agoSort and remove duplicate entries in ALL_LIBS
Wolfgang Stöggl [Thu, 26 Sep 2019 07:27:47 +0000 (09:27 +0200)] 
Sort and remove duplicate entries in ALL_LIBS

- So far, configure showed e.g. the following at the end:
Libraries: -lgobject-2.0 -lpng -lm  -ldbi -lglib-2.0  -lpangocairo-1.0
 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lcairo  -lxml2

The variable ALL_LIBS included duplicates resulting from the configure
process and some double spaces.

- Now, ALL_LIBS is sorted and duplicate entries are removed, e.g.:
Libraries: -lcairo -ldbi -lglib-2.0 -lgobject-2.0 -lharfbuzz -lm
 -lpango-1.0 -lpangocairo-1.0 -lpng -lxml2

4 years agoSync librrd-8.def with librrd.sym
Wolfgang Stöggl [Tue, 10 Sep 2019 14:32:58 +0000 (16:32 +0200)] 
Sync librrd-8.def with librrd.sym

- Export the same functions in the dll from MSVC builds under Windows
  as defined in librrd.sym

4 years agolibrrd.sym: add missing rrdc symbols
Derrick Lyndon Pallas [Thu, 29 Aug 2019 20:44:12 +0000 (20:44 +0000)] 
librrd.sym: add missing rrdc symbols

4 years agoRemove duplicate code of find_first_weekday()
Wolfgang Stöggl [Sun, 8 Sep 2019 13:19:09 +0000 (15:19 +0200)] 
Remove duplicate code of find_first_weekday()

So far, the same code of find_first_weekday() was used in rrd_graph.c
and rrd_rpncalc.c
Remove duplicate code from rrd_graph.c and add find_first_weekday()
to rrd_rpncalc.h, which is included from rrd_graph.h

4 years agoIndent rrd_rpncalc.h
Wolfgang Stöggl [Sun, 8 Sep 2019 13:12:54 +0000 (15:12 +0200)] 
Indent rrd_rpncalc.h

- indent src/rrd_rpncalc.h using GNU indent 2.2.12
  before further changes to the code

4 years agoUse DefaultPlatformToolset for .vcxproj files
Wolfgang Stöggl [Tue, 10 Sep 2019 10:07:14 +0000 (12:07 +0200)] 
Use DefaultPlatformToolset for .vcxproj files

- Use $(DefaultPlatformToolset) for the PlatformToolset
  instead of v140. This allows to use the associated PlatformToolset
  automatically for each version of Visual Studio:
  v140 for VS2015, v141 for VS2017, v142 for VS2019.
  However, a developer can easily target projects to a desired,
  different PlatformToolset.
- Set ToolsVersion="Current" instead of ToolsVersion="14.0"
- Strings were replaced in .vcxproj files the following way:
  git grep -l 'v140' -- '*.vcxproj' | \
    xargs sed -i 's/v140/$(DefaultPlatformToolset)/g'
  git grep -l '14.0' -- '*.vcxproj' | xargs sed -i 's/14.0/Current/g'

4 years agoUse temp pointer for realloc()
Wolfgang Stöggl [Sat, 7 Sep 2019 20:27:22 +0000 (22:27 +0200)] 
Use temp pointer for realloc()

- Fixes the following Cppcheck 1.89 errors:
  [src/rrd_cgi.c:295] (error) Common realloc mistake:'varheap'
    nulled but not freed upon failure [memleakOnRealloc]
  [src/rrd_cgi.c:1138] (error) Common realloc mistake: 'argv'
    nulled but not freed upon failure [memleakOnRealloc]
  [src/rrd_graph.c:1211] (error) Common realloc mistake: 'steparray'
    nulled but not freed upon failure [memleakOnRealloc]

4 years agorrd_client: avoid invalid read
Derrick Lyndon Pallas [Tue, 3 Sep 2019 20:39:33 +0000 (20:39 +0000)] 
rrd_client: avoid invalid read

In rrd_client_last and rrd_client_first, the response value is in the
message prior to any additional lines.  Unfortunately, the buffer that
contains this data is on the stack for response_read and is no longer valid
by the time the caller sees it.

This change strdups the message line in response_read and subsequently frees
it in response_free.

Resolves issue #1047.

4 years agoClean tests/rpn1.out
Wolfgang Stöggl [Mon, 2 Sep 2019 10:20:54 +0000 (12:20 +0200)] 
Clean tests/rpn1.out

- There was another leftover in the tests folder after
  make clean: rpn1.out
  It is a png file created during the test rpn1
- This is a followup commit to PR #1049

4 years agoClean up tests leftover files
nirgal [Sun, 1 Sep 2019 15:26:51 +0000 (15:26 +0000)] 
Clean up tests leftover files

4 years agoZero wbuf on start.
Clar Fon [Sun, 25 Aug 2019 23:18:47 +0000 (19:18 -0400)] 
Zero wbuf on start.

It turns out that calloc isn't enough, because listen_fds is copied to the socket array on start. This zeroes these fields out when the socket is opened.

4 years agoAllocate client_sock using calloc instead of malloc
Clar Fon [Thu, 22 Aug 2019 21:48:42 +0000 (17:48 -0400)] 
Allocate client_sock using calloc instead of malloc

This ensures that wbuf_data, wbuf_size, and wbuf_capacity are all initialised to zero

4 years agoFix compiler warning (-Wstringop-truncation)
Wolfgang Stöggl [Thu, 22 Aug 2019 12:18:35 +0000 (14:18 +0200)] 
Fix compiler warning (-Wstringop-truncation)

- Use strncat() the following way in rrd_cgi.c:
  strncat(dest, src, dest_size - strlen(dest) - 1);

- Fixes the following gcc compiler warning:
  rrd_cgi.c:1407:21: warning: ‘strncat’ output truncated before
  terminating nul copying as many bytes from a string as its length
  [-Wstringop-truncation]
  strncat(line, tmp, tmplen);

4 years agoFix compiler warnings (-Wcast-function-type)
Wolfgang Stöggl [Wed, 21 Aug 2019 15:50:09 +0000 (17:50 +0200)] 
Fix compiler warnings (-Wcast-function-type)

- Add tree_compare_func() and use this function instead of
  `(GCompareDataFunc) strcmp`
  Fixes the following gcc compiler warning:
  rrd_daemon.c:4245:34: warning: cast between incompatible function
  types from ‘int (*)(const char *, const char *)’
  to ‘gint (*)(const void *, const void *, void *)’
  {aka ‘int (*)(const void *, const void *, void *)’}
  [-Wcast-function-type]
  cache_tree = g_tree_new_full((GCompareDataFunc) strcmp, NULL, NULL,

- Use g_strcmp0() instead of strcmp() in tree_compare_func().
  g_strcmp0() compares str1 and str2 like strcmp(). Handles NULL
  gracefully by sorting it before non-NULL strings.
  Comparing two NULL pointers returns 0.

- Cast free_cache_item using (void (*)(void)
  Fixes the following gcc compiler warning:
  rrd_daemon.c:4246:34: warning: cast between incompatible function
  types from ‘void * (*)(cache_item_t *)’
  {aka ‘void * (*)(struct cache_item_s *)’}
  to ‘void (*)(void *)’ [-Wcast-function-type]
  (GDestroyNotify) free_cache_item);

4 years agoFix typos found by codespell
Wolfgang Stöggl [Wed, 14 Aug 2019 09:44:25 +0000 (11:44 +0200)] 
Fix typos found by codespell

- Typos were found by codespell v1.15.0

4 years agoUpdate .travis.yml for Ubuntu xenial (16.04LTS)
Wolfgang Stöggl [Fri, 2 Aug 2019 17:00:10 +0000 (19:00 +0200)] 
Update .travis.yml for Ubuntu xenial (16.04LTS)

- Install libtool-bin to fix failing "valgrind-logfile" tests
- Enable the following "valgrind-logfile" tests, which are passing now
  under xenial: create-with-source-4, vformatter1
  Add also graph1 and pdp-calc1, which have been added in the meantime.
  There are only three failing tests left: rpn1, rpn2, xport1
- Add Perl 5.22, which is the version in xenial

4 years agoUpdate win32-glob.c to current upstream version
Wolfgang Stöggl [Tue, 30 Jul 2019 09:31:33 +0000 (11:31 +0200)] 
Update win32-glob.c to current upstream version

See commit https://sourceforge.net/p/sox/code/ci/5761ed/
for upstream fix.

4 years agoCleanup ssize_t, off_t and strtoll() for MSVC
Wolfgang Stöggl [Sat, 20 Jul 2019 11:20:12 +0000 (13:20 +0200)] 
Cleanup ssize_t, off_t and strtoll() for MSVC

MSVC defines the standard type off_t. Remove unneeded off_t typedef.

So far there has been a "typedef size_t ssize_t" in case of _MSC_VER,
which is incorrect because size_t is unsigned and ssize_t signed.
MSVC supports SSIZE_T (in capital letters). It is sufficient to have
the typedef SSIZE_T ssize_t in rrd.h - remove redundant, obsolete code
from rrd_restore.c

The function strtoll() is supported since Visual Studio 2013.

In rrd_resize.c, b_read is ssize_t. Use %zd in fprintf() as format
specifier, because ssize_t is signed.

4 years agoIndent rrd.h
Wolfgang Stöggl [Sat, 20 Jul 2019 10:58:28 +0000 (12:58 +0200)] 
Indent rrd.h

- indent src/rrd.h using GNU indent 2.2.12
  before further changes to the code

4 years agoFix rrd_cgi.c Cppcheck_warnings
Wolfgang Stöggl [Wed, 17 Jul 2019 10:36:30 +0000 (12:36 +0200)] 
Fix rrd_cgi.c Cppcheck_warnings

Remove the identical inner 'if' condition.
Use the %zu format specifier for size_t returned from strlen(),
according to: https://en.cppreference.com/w/c/string/byte/strlen

- Fixes the following Cppcheck warnings:
  [src/rrd_cgi.c:349] (warning) Identical inner 'if' condition is
    always true (outer condition is 'calcpr[i]' and inner condition is
    'calcpr[i]'). [identicalInnerCondition]

  [src/rrd_cgi.c:527] (portability) %zd in format string (no. 1)
    requires 'ssize_t' but the argument type is 'size_t
    {aka unsigned long}'. [invalidPrintfArgType_sint]
  or
  [src/rrd_cgi.c:527] (portability) %zd in format string (no. 1)
    requires 'ssize_t' but the argument type is 'size_t
    {aka unsigned long long}'. [invalidPrintfArgType_sint]

4 years agoIndent rrd_cgi.c
Wolfgang Stöggl [Wed, 17 Jul 2019 10:30:15 +0000 (12:30 +0200)] 
Indent rrd_cgi.c

- indent src/rrd_cgi.c using GNU indent 2.2.12
  before further changes to the code

4 years agoFix format specifiers
Wolfgang Stöggl [Mon, 15 Jul 2019 13:09:06 +0000 (15:09 +0200)] 
Fix format specifiers

- Fixes the following Cppcheck warnings:

  [bindings/tcl/tclrrd.c:513] (warning) %lu in format string (no. 1)
    requires 'unsigned long' but the argument type is 'signed long'.
    [invalidPrintfArgType_uint]

  [src/rrd_fetch_libdbi.c:56] (warning) %i in format string (no. 3)
    requires 'int' but the argument type is 'unsigned int'.
    [invalidPrintfArgType_sint]
  [src/rrd_fetch_libdbi.c:63] (warning) %i in format string (no. 3)
    requires 'int' but the argument type is 'unsigned int'.
    [invalidPrintfArgType_sint]
  [src/rrd_fetch_libdbi.c:85] (warning) %i in format string (no. 3)
    requires 'int' but the argument type is 'unsigned int'.
    [invalidPrintfArgType_sint]
  [src/rrd_fetch_libdbi.c:85] (warning) %i in format string (no. 4)
    requires 'int' but the argument type is 'unsigned int'.
    [invalidPrintfArgType_sint]
  [src/rrd_fetch_libdbi.c:119] (warning) %i in format string (no. 3)
    requires 'int' but the argument type is 'unsigned int'.
    [invalidPrintfArgType_sint]
  [src/rrd_fetch_libdbi.c:126] (warning) %i in format string (no. 3)
    requires 'int' but the argument type is 'unsigned int'.
    [invalidPrintfArgType_sint]
  [src/rrd_fetch_libdbi.c:148] (warning) %i in format string (no. 3)
    requires 'int' but the argument type is 'unsigned int'.
    [invalidPrintfArgType_sint]
  [src/rrd_fetch_libdbi.c:148] (warning) %i in format string (no. 4)
    requires 'int' but the argument type is 'unsigned int'.
    [invalidPrintfArgType_sint]

  [src/rrd_graph_helper.c:1504] (warning) %u in format string (no. 2)
    requires 'unsigned int' but the argument type is 'signed int'.
    [invalidPrintfArgType_uint]
  [src/rrd_graph_helper.c:1511] (warning) %u in format string (no. 2)
    requires 'unsigned int' but the argument type is 'signed int'.
    [invalidPrintfArgType_uint]
  [src/rrd_graph_helper.c:1695] (warning) %u in format string (no. 1)
    requires 'unsigned int' but the argument type is 'signed int'.
    [invalidPrintfArgType_uint]
  [src/rrd_graph_helper.c:1812] (warning) %u in format string (no. 2)
    requires 'unsigned int' but the argument type is 'signed int'.
    [invalidPrintfArgType_uint]

  [src/rrd_tune.c:392] (warning) %ld in format string (no. 3)
    requires 'long' but the argument type is 'unsigned long'.
    [invalidPrintfArgType_sint]

4 years agoAdd check for va_copy to configure
Wolfgang Stöggl [Fri, 12 Jul 2019 13:56:37 +0000 (15:56 +0200)] 
Add check for va_copy to configure

So far, configure did not check for va_copy and HAVE_VA_COPY was
undefined. A check for HAVE_VA_COPY is part of rrd_snprintf.c

- Add HW_FUNC_VA_COPY to configure.ac
- MSVC has got va_copy(), so define it in win32/rrd_config.h:
  #define HAVE_VA_COPY 1

4 years agoUse temp pointer for realloc()
Wolfgang Stöggl [Thu, 11 Jul 2019 13:00:09 +0000 (15:00 +0200)] 
Use temp pointer for realloc()

If realloc() fails, it returns NULL and the original block is
left untouched; it is not freed. Use a temporary pointer first to
check, if realloc() has failed.

- Fixes the following Cppcheck errors:
  [src/rrd_create.c:958] (error) Common realloc mistake: 'mappings'
    nulled but not freed upon failure [memleakOnRealloc]
  [src/rrd_create.c:2451] (error) Common realloc mistake: 'candidates'
    nulled but not freed upon failure [memleakOnRealloc]
  [src/rrd_daemon.c:2402] (error) Common realloc mistake: 'sources'
    nulled but not freed upon failure [memleakOnRealloc]

4 years agoAdd Bear compilation database file to .gitignore
Wolfgang Stöggl [Thu, 11 Jul 2019 09:46:15 +0000 (11:46 +0200)] 
Add Bear compilation database file to .gitignore

- Add compile_commands.json to .gitignore. This compilation database
  file can be created by Build EAR
  (BEAR, https://github.com/rizsotto/Bear) and used by Cppcheck

4 years agoIndent rrd_daemon.c
Wolfgang Stöggl [Thu, 11 Jul 2019 09:32:10 +0000 (11:32 +0200)] 
Indent rrd_daemon.c

- indent src/rrd_daemon.c using GNU indent 2.2.12
  before further changes to the code

4 years agoUpdate MSVC .vcxproj files (SAFESH, IntDir)
Wolfgang Stöggl [Tue, 9 Jul 2019 09:24:42 +0000 (11:24 +0200)] 
Update MSVC .vcxproj files (SAFESH, IntDir)

Win32 Debug configurations have EditAndContinue set, whereas /SAFESEH
is incompatible with EditAndContinue. Add
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
to these configurations.

- Fixes the following warning in Visual Studio build log files, e.g.:
  warning LNK4075: ignoring '/EDITANDCONTINUE' due to
  '/SAFESEH' specification

The projects librrd-8, rrdcgi, rrdtool and rrdupdate are built in
the same directory, which is OK, as there is no overlap. No need for a
separate IntDir for each project. To silence the warning, add:
<IntDirSharingDetected>None</IntDirSharingDetected>

- Fixes the following warning in Visual Studio build log files, e.g.:
  warning MSB8028: The intermediate directory (Debug\) contains files
  shared from another project (librrd-8.vcxproj).
  This can lead to incorrect clean and rebuild behavior.

4 years agoFix identical inner if condition rrd_graph_helper
Wolfgang Stöggl [Mon, 8 Jul 2019 12:06:28 +0000 (14:06 +0200)] 
Fix identical inner if condition rrd_graph_helper

- Fixes the following Cppcheck warning:
  [src/rrd_graph_helper.c:972] (warning) Identical inner 'if' condition
  is always true
  (outer condition is '!vname' and inner condition is '!vname').
  [identicalInnerCondition]

4 years agoIndent rrd_graph_helper.c
Wolfgang Stöggl [Mon, 8 Jul 2019 10:50:49 +0000 (12:50 +0200)] 
Indent rrd_graph_helper.c

- indent src/rrd_graph_helper.c using GNU indent 2.2.12

4 years agoFix possible memory leak by buffer.file
Wolfgang Stöggl [Sat, 6 Jul 2019 12:14:28 +0000 (14:14 +0200)] 
Fix possible memory leak by buffer.file

Close the opened buffer.file in rrd_xport.c before return -1,
if the data processing has failed

- Fixes the following Cppcheck error:
  [rrdtool-1.x/src/rrd_xport.c:435] (error) Memory leak:
  buffer.file [memleak]

4 years agoInclude asprintf.h in rrd_info.c for MSVC builds
Wolfgang Stöggl [Sat, 6 Jul 2019 03:45:20 +0000 (05:45 +0200)] 
Include asprintf.h in rrd_info.c for MSVC builds

- Fixes the following MSVC level 3 compiler warning:
  rrd_info.c(21): warning C4013: 'vasprintf' undefined;
  assuming extern returning int
- This is a follow-up to PR #828 and commit b1bcbca

4 years agoAdd rrdcgi.vcxproj and update Makefile.am (MSVC)
Wolfgang Stöggl [Thu, 27 Jun 2019 19:35:40 +0000 (21:35 +0200)] 
Add rrdcgi.vcxproj and update Makefile.am (MSVC)

So far, rrdcgi.exe has been built using nmake. Add rrdcgi.vcxproj
as an additional Visual Studio project and add it to rrd.sln

- Update Makefile.am:
  Add win32/rrdcgi.vcxproj and win32/Makefile_vcpkg.msc to EXTRA_DIST
  Remove win32/rrdtool.sln and win32/rrdupdate.sln, because all
  projects are part of rrd.sln
- git rm win32/rrdtool.sln win32/rrdupdate.sln

4 years agoUpdate MSVC rrd.sln and .vcxproj files
Wolfgang Stöggl [Thu, 27 Jun 2019 14:06:52 +0000 (16:06 +0200)] 
Update MSVC rrd.sln and .vcxproj files

- rrd.sln:
  Do not build rrdtool and rrdupdate in case of configurations
  DebugDLL|x64 and ReleaseDLL|x64
- rrdtool.vcxproj:
  Move <AdditionalIncludeDirectories> before <PreprocessorDefinitions>
  like in librrd-8.vcxproj, rrdupdate.vcxproj and the other occurrences
  in rrdtool.vcxproj
- rrdupdate.vcxproj:
  Change GenerateDebugInformation for Release configurations from
  true to false

4 years agoFix UB when calculating median of all-NaN values
Dmitry Marakasov [Wed, 26 Jun 2019 18:14:32 +0000 (21:14 +0300)] 
Fix UB when calculating median of all-NaN values

The current code contains undefined behavior where all-NaN values
are passed to median. In that case we end up with final_elements==0
in the following branch:

    else {
        rpnstack->s[++stptr] =
            0.5 * (element_ptr[final_elements / 2] +
                   element_ptr[final_elements / 2 - 1]);
    }

and so we use 0 and -1 as element_ptr array indexes. The
latter is ill-formed and leads to a crash in my case. Move the
check which accounts for the last NaN earlier, so we could
push NaN and finish right away.

4 years agoAdd platform x64 to MSVC .sln and .vcxproj files
Wolfgang Stöggl [Tue, 25 Jun 2019 09:03:26 +0000 (11:03 +0200)] 
Add platform x64 to MSVC .sln and .vcxproj files

So far, MSVC x64 builds have been created using nmake. This adds x64 to
the .sln and .vcxproj files and x64 can be chosen within Visual Studio.

- Update the created x64 platform configurations with the matching
  include and lib directories
- Remove unnecessary and incorrect <AdditionalIncludeDirectories>
  from rrdtool.vcxproj and rrdupdate.vcxproj (one ../ was too much)

4 years agoBump version to librrd-8.dll for MSVC builds
Wolfgang Stöggl [Sat, 22 Jun 2019 20:58:50 +0000 (22:58 +0200)] 
Bump version to librrd-8.dll for MSVC builds

The current version in the filename of the library is 8, e.g.
librrd.so.8 or librrd-8.dll (MinGW-w64 builds), which is based on
LIBVERS from configure.ac. The version of the dll for MSVC builds is
not derived from LIBVERS and has not been updated yet.

- Substitute occurrences of librrd-4 with librrd-8 using:
  git grep -l 'librrd-4' | xargs sed -b -i 's/librrd-4/librrd-8/g'
- rename librrd-4* files to librrd-8* using:
  find . -name 'librrd-4*' \
  -exec bash -c 'file={}; git mv $file ${file/librrd-4/librrd-8}' \;

4 years agoSimplify first_weekday under Windows
Wolfgang Stöggl [Tue, 18 Jun 2019 08:20:55 +0000 (10:20 +0200)] 
Simplify first_weekday under Windows

Use LOCALE_IFIRSTDAYOFWEEK | LOCALE_RETURN_NUMBER. In this case,
the function GetLocaleInfoEx() retrieves the value as a number instead
of a string.
According to: GetLocaleInfoEx function (winnls.h) | Microsoft Docs

sscanf() is not required any more to convert a char array to an int

4 years agoImplement first_weekday under Windows
Wolfgang Stöggl [Mon, 17 Jun 2019 19:47:29 +0000 (21:47 +0200)] 
Implement first_weekday under Windows

- Use GetLocaleInfoEx() to obtain the first weekday

4 years agoIndent src/rrd_rpncalc.c
Wolfgang Stöggl [Mon, 17 Jun 2019 14:58:16 +0000 (16:58 +0200)] 
Indent src/rrd_rpncalc.c

- indent src/rrd_rpncalc.c using GNU indent 2.2.12
  before further changes to the file
- Fixes: indent: src/rrd_rpncalc.c:1007:
  Warning:old style assignment ambiguity in "=-". Assuming "= -"

4 years agoAdd vcpkg support for MSVC builds
Wolfgang Stöggl [Mon, 17 Jun 2019 10:07:19 +0000 (12:07 +0200)] 
Add vcpkg support for MSVC builds

- This allows building against newer and up-to-date versions of
  required libraries. Vcpkg is a library manager and can be found here:
  https://github.com/microsoft/vcpkg
- Libraries are provided for 32-bit and 64-bit.
  Current versions of libraries are e.g.:
  cairo 1.16.0, expat 2.2.6, fontconfig 2.12.4, freetype 2.9.1,
  gettext 0.19, glib 2.52.3, libpng 1.6.37, pango 1.40.11, pcre 8.41,
  libxml2 2.9.9 and zlib 1.2.11
  Furthermore these libraries from vcpkg are regularly updated.
- Added information to WIN32-BUILD-TIPS.txt and win32/README concerning
  vcpkg
- Added win32/Makefile_vcpkg.msc for building using nmake

4 years agoSet fallback first_weekday to 0 (fix #1012)
Jean-Michel Vourgère [Sun, 16 Jun 2019 06:07:32 +0000 (08:07 +0200)] 
Set fallback first_weekday to 0 (fix #1012)

- Set first_weekday to 0 (Sunday), when HAVE__NL_TIME_WEEK_1STDAY
  is not defined
- Fixes: https://github.com/oetiker/rrdtool-1.x/issues/1012

4 years agoLink to section "HOW TO MEASURE"
Tobyee [Tue, 11 Jun 2019 05:47:04 +0000 (13:47 +0800)] 
Link to section "HOW TO MEASURE"

4 years agoAdd rrdpython.pod and rrdruby.pod to dist
Wolfgang Stöggl [Wed, 5 Jun 2019 19:55:28 +0000 (21:55 +0200)] 
Add rrdpython.pod and rrdruby.pod to dist

4 years agoAdding Rounding Function
TheWitness [Sun, 3 Mar 2019 13:10:07 +0000 (08:10 -0500)] 
Adding Rounding Function

4 years agoUpdate doc/rrdruby.pod
Wolfgang Stöggl [Tue, 4 Jun 2019 12:08:57 +0000 (14:08 +0200)] 
Update doc/rrdruby.pod

- Fixes: https://github.com/oetiker/rrdtool-1.x/issues/885
  Typo: --interlace -> --interlaced
- Change encoding of file from ANSI to UTF-8
  add to pod file: =encoding utf8
  Fixes podchecker error:
  *** ERROR: Non-ASCII character seen before =encoding in 'Loïs'.
  Assuming CP1252 at line 84 in file doc/rrdruby.pod
  doc/rrdruby.pod has 1 pod syntax error.

4 years agoFix --use-nan-for-all-missing-data
Wolfgang Stöggl [Tue, 4 Jun 2019 08:14:11 +0000 (10:14 +0200)] 
Fix --use-nan-for-all-missing-data

- Fixes: https://github.com/oetiker/rrdtool-1.x/issues/918

4 years agoIndent rrd_graph.c
Wolfgang Stöggl [Tue, 4 Jun 2019 08:04:11 +0000 (10:04 +0200)] 
Indent rrd_graph.c

- indent src/rrd_graph.c using GNU indent 2.2.12

4 years agoAdd --showtime to xport help output
Wolfgang Stöggl [Mon, 3 Jun 2019 12:53:44 +0000 (14:53 +0200)] 
Add --showtime to xport help output

- Fixes: https://github.com/oetiker/rrdtool-1.x/issues/911

4 years agoIndent rrd_tool.c
Wolfgang Stöggl [Mon, 3 Jun 2019 12:48:11 +0000 (14:48 +0200)] 
Indent rrd_tool.c

- indent src/rrd_tool.c using GNU indent 2.2.12

4 years agoFix failed to expand Py_UNUSED (rrdtoolmodule.c)
Wolfgang Stöggl [Mon, 3 Jun 2019 09:04:41 +0000 (11:04 +0200)] 
Fix failed to expand Py_UNUSED (rrdtoolmodule.c)

- Fix: failed to expand 'Py_UNUSED', Invalid ## usage when expanding
  'Py_UNUSED'.
- Fixes: https://github.com/oetiker/rrdtool-1.x/issues/903

4 years agoUpdate rrdtool-release script
Wolfgang Stöggl [Fri, 31 May 2019 09:38:12 +0000 (11:38 +0200)] 
Update rrdtool-release script

- Update version numbers for MSVC builds too. These are defined in
  win32/rrd_config.h
- Update Copyright info and years in win32/*.rc files
- Use a variable for the current year
- Make script compatible with rrdtool major versions > 1
  (use \d instead of 1)
- Minor updates to the script considering recommendations from
  ShellCheck, e.g.:
  Use $(...) notation instead of legacy backticked `...`.

4 years agoRestore Copyright Years in src/*.c src/*.h
Wolfgang Stöggl [Wed, 29 May 2019 15:29:19 +0000 (17:29 +0200)] 
Restore Copyright Years in src/*.c src/*.h

- Restore the Copyright Years, so that rrdtool-release will update the
  years in the future again as intended.
  The years are not present any more since the following commit:
  https://github.com/oetiker/rrdtool-1.x/commit/1964f6f
- rrdtool-release expects a 4 digit year for the substitution:
  s/Copyright.+?Oetiker.+\d{4}

4 years agoFix missing double values in rrdinfo.
Stefan Gluszek [Tue, 28 May 2019 12:01:46 +0000 (14:01 +0200)] 
Fix missing double values in rrdinfo.

The double values of rrd info were never properly converted to the
python dictionary causing some keys (e.g. xff) to be missing.

4 years agonumeric version for perl v1.7.2
Tobias Oetiker [Mon, 27 May 2019 19:12:03 +0000 (21:12 +0200)] 
numeric version for perl

4 years agoreleased 1.7.2
Tobias Oetiker [Mon, 27 May 2019 18:07:42 +0000 (20:07 +0200)] 
released 1.7.2

5 years agoDefine _POSIX_THREAD_SAFE_FUNCTIONS (MinGW-w64)
Wolfgang Stöggl [Sun, 19 May 2019 18:28:59 +0000 (20:28 +0200)] 
Define _POSIX_THREAD_SAFE_FUNCTIONS (MinGW-w64)

- time.h of MinGW-w64 requires _POSIX_THREAD_SAFE_FUNCTIONS to be
  defined in order to provide ctime_r, gmtime_r or localtime_r.
- In newer versions of winpthreads (e.g. git-7.0.0.5447.a2d94c81),
  _POSIX_THREAD_SAFE_FUNCTIONS is not defined any more in
  pthread_unistd.h. Hence define it here directly.
- This is a follow-up to commit:
  https://github.com/oetiker/rrdtool-1.x/commit/603de9a

5 years agoSilence unused variable and parameter warnings
Wolfgang Stöggl [Tue, 7 May 2019 14:41:17 +0000 (16:41 +0200)] 
Silence unused variable and parameter warnings

- Cast unused variables and parameters to void, do nothing
- Fixes the following compiler warnings on Windows:
rrd_open.c:
  757:9: warning: unused parameter 'writelock' [-Wunused-parameter]
    int writelock)
  810:24: warning: unused variable 'rrd_simple_file'
    [-Wunused-variable] rrd_simple_file_t *rrd_simple_file;
  807:17: warning: unused parameter 'rrd_file' [-Wunused-parameter]
    rrd_file_t *rrd_file,
  808:12: warning: unused parameter 'rrd' [-Wunused-parameter]
    rrd_t *rrd)
rrd_client.c:
  746:39: warning: unused parameter 'client' [-Wunused-parameter]
    static int connect_unix(rrd_client_t *client, const char *path)
    /* {{{ */
  746:59: warning: unused parameter 'path' [-Wunused-parameter]
    static int connect_unix(rrd_client_t *client, const char *path)
    /* {{{ */

5 years agoIndent src/rrd_client.c
Wolfgang Stöggl [Tue, 7 May 2019 14:17:19 +0000 (16:17 +0200)] 
Indent src/rrd_client.c

- indent src/rrd_client.c before any further changes using
  GNU indent 2.2.12

5 years agoFix compiler warning: label defined but not used
Wolfgang Stöggl [Tue, 30 Apr 2019 14:23:32 +0000 (16:23 +0200)] 
Fix compiler warning: label defined but not used

- The label 'no_lseek_necessary' is only relevant,
  if HAVE_POSIX_FALLOCATE is defined.
- Fixes the following compiler warning on systems, where
  HAVE_POSIX_FALLOCATE is not defined:
  rrd_open.c:387:3: warning: label 'no_lseek_necessary' defined but not
  used [-Wunused-label]

5 years agoIndent rrd_create.c
Wolfgang Stöggl [Sat, 13 Apr 2019 20:51:36 +0000 (22:51 +0200)] 
Indent rrd_create.c

- Add typename GList to .indent.pro
- indent rrd_create.c using GNU indent 2.2.12

5 years agoAvoid MinGW-w64 strndup compiler warning
Wolfgang Stöggl [Sat, 13 Apr 2019 20:34:48 +0000 (22:34 +0200)] 
Avoid MinGW-w64 strndup compiler warning

- Fixes the following MinGW-w64 GCC compiler warning:
  rrd_create.c:287:14: warning: declaration of 'strndup' shadows a
  built-in function [-Wshadow] static char *strndup(
- MinGW-w64: strndup is not detected by configure, therefore
  HAVE_STRNDUP is not defined.
  Use strndup_() here instead of strndup() to avoid any collisions.

5 years agoConsider flags for CreateFileA(), Windows
Wolfgang Stöggl [Wed, 24 Apr 2019 13:29:54 +0000 (15:29 +0200)] 
Consider flags for CreateFileA(), Windows

- Implement dwDesiredAccess and dwCreationDisposition based on
  the flags O_RDONLY, O_RDWR, O_CREAT | O_TRUNC and O_EXCL
- This updates how a file handle is created using CreateFileA()
  under Windows, considering the flags. Use e.g.
  DesiredAccess = GENERIC_READ | GENERIC_WRITE
  dwCreationDisposition = OPEN_EXISTING
- CreateFileA(): Check for INVALID_HANDLE_VALUE and add output of error
  messages using GetLastError() and FormatMessage()
- The error message provides correct output now, which error occurs.
  e.g.: rrdtool.exe info not_existing_file.rrd
    ERROR: opening 'not_existing_file.rrd':
    The system cannot find the file specified.
  Previously, the following error occurred later in the code:
    ERROR: short read while reading header rrd->stat_head
  And also empty files were left behind:
  e.g. rrdtool.exe resize not_existing_file.rrd 0 GROW 5200
- Use <CharacterSet>MultiByte</CharacterSet> consistently
  in .vcxproj files. There were 4 inadvertent occurrences of
  <CharacterSet>Unicode</CharacterSet> in librrd-4.vcxproj.
  Using MultiByte or NotSet instead of Unicode is required for
  printing "(LPTSTR) lpMsgBuf" from FormatMessage() using %s, to avoid
  unnecessary wide characters.
- This commit is an update to a9671a7

5 years agoAdd missing #define and indent rrd_open.c
Wolfgang Stöggl [Wed, 24 Apr 2019 12:42:01 +0000 (14:42 +0200)] 
Add missing #define and indent rrd_open.c

- Add missing "#define __rrd_read(dst, dst_t, cnt) { \" after
  #elif defined(HAVE_LIBRADOS) && !defined(HAVE_MMAP)
- This fixes:
    indent: src/rrd_open.c:77: Error:Unmatched 'else'
    indent: src/rrd_open.c:79: Error:Stmt nesting error.
    and errors in case of defined(HAVE_LIBRADOS) && !defined(HAVE_MMAP)
- indent src/rrd_open.c using GNU indent 2.2.12
- Replace all remaining tabs by four spaces

5 years agoFix GCC string truncation warnings
Wolfgang Stöggl [Fri, 12 Apr 2019 14:59:36 +0000 (16:59 +0200)] 
Fix GCC string truncation warnings

- Fixes the following GCC compiler warnings:
  rrd_fetch.c:338:9: warning: 'strncpy' output may be truncated copying
  19 bytes from a string of length 19 [-Wstringop-truncation]
    strncpy((*ds_namv)[i], rrd.ds_def[i].ds_nam, DS_NAM_SIZE - 1);
  rrd_tune.c:284:13: warning: 'strncpy' output may be truncated copying
  19 bytes from a string of length 19 [-Wstringop-truncation]
    strncpy(rrd.ds_def[ds].ds_nam, ds_new, DS_NAM_SIZE - 1);
  rrd_graph.c:2282:17: warning: 'strncpy' output may be truncated
    copying 204 bytes from a string of length 204
    [-Wstringop-truncation] strncpy(im->gdes[i].legend, saved_legend,
    sizeof im->gdes[0].legend - 1);

5 years agoAvoid pragma comment warning under MinGW
Wolfgang Stöggl [Wed, 10 Apr 2019 11:20:59 +0000 (13:20 +0200)] 
Avoid pragma comment warning under MinGW

- Removes the following MinGW compiler warning:
  rrd_client.c:32: warning: ignoring #pragma comment
  [-Wunknown-pragmas] #pragma comment(lib, "ws2_32.lib")
- This #pragma comment is only relevant for MSVC

5 years agoUpdate .gitignore files
Wolfgang Stöggl [Tue, 9 Apr 2019 15:17:39 +0000 (17:17 +0200)] 
Update .gitignore files

5 years agoCast lua_tostring return value to char *
Wolfgang Stöggl [Tue, 9 Apr 2019 11:35:53 +0000 (13:35 +0200)] 
Cast lua_tostring return value to char *

- Fixes the following gcc compiler warning:
  rrdlua.c:69:21: warning: assignment discards ‘const’ qualifier from
  pointer target type [-Wdiscarded-qualifiers]
  if (!(argv[i] = lua_tostring (L, i))) {

5 years agoUpdate test tune1
Wolfgang Stöggl [Tue, 9 Apr 2019 09:30:00 +0000 (11:30 +0200)] 
Update test tune1

- Compare dump of the updated rrd file with tune1-testorg.dump,
  which is available in tests

5 years agoCast unsigned long values to long for labs()
Wolfgang Stöggl [Thu, 4 Apr 2019 13:35:18 +0000 (15:35 +0200)] 
Cast unsigned long values to long for labs()

- Fixes the following clang compiler warning:
  rrd_fetch.c:391:29: warning: taking the absolute value of unsigned
  type 'unsigned long' has no effect [-Wabsolute-value]
    tmp_step_diff = labs(*step - (rrd.stat_head->pdp_step

5 years agoUse fabs() for floating point, labs() for long
Wolfgang Stöggl [Wed, 3 Apr 2019 16:13:33 +0000 (18:13 +0200)] 
Use fabs() for floating point, labs() for long

- Fixes the following clang compiler warnings:
  rrd_rpncalc.c:999:11: warning: using integer absolute value function
  'abs' when argument is of floating point type [-Wabsolute-value]
    if (abs(percentile) > 100) {
  rrd_rpncalc.c:1103:24: warning: using integer absolute value function
  'abs' when argument is of floating point type [-Wabsolute-value]
    int idx = round(abs(idxf));
  rrd_hw.c:519:36: warning: absolute value function 'abs' given an
  argument of type 'long' but has parameter of type 'int' which may
  cause truncation of value [-Wabsolute-value]
    new_val = ((unsigned long) abs(val)) % mod;

5 years agoUpdate strftime.c and use it under MinGW
Wolfgang Stöggl [Thu, 28 Mar 2019 14:10:05 +0000 (15:10 +0100)] 
Update strftime.c and use it under MinGW

- Add %F and %T to strftime.c
  These format codes are commonly used, part of C99 and used in the
  test vformatter1
- rrd_graph.c: Include local strftime.h and use strftime_ from
  strftime.c in case of MinGW or MinGW-w64 builds.
- This allows test vformatter1 to pass under MSYS2 (MinGW-w64)

5 years agoRemove strftime.c and strftime.h from MSVC builds
Wolfgang Stöggl [Wed, 27 Mar 2019 15:59:24 +0000 (16:59 +0100)] 
Remove strftime.c and strftime.h from MSVC builds

- Recent versions of MSVC (VS2015 and newer) properly support strftime
  including formatting codes like %F, %T or %V (ISO 8601)

5 years agofix segfault on non-existent RRD file when using rrdcached
themylogin [Wed, 27 Mar 2019 17:09:55 +0000 (18:09 +0100)] 
fix segfault on non-existent RRD file when using rrdcached

fix segfault on non-existent RRD file when using rrdcached + rrdtool xport
(like 814ca69a3329ccc88040ed184a413e4e5adf604c does for rrdtool graph)

5 years agoUpdate test list1
Wolfgang Stöggl [Tue, 26 Mar 2019 16:04:53 +0000 (17:04 +0100)] 
Update test list1

- Avoid double slashes at beginning of filename paths.
  Leave "/" in CACHED_DIR (only sed ^$BASEDIR), then it is not
  necessary to add "/" in function do_list_tests() several times
  again and "$1" can be used instead of "/$1" there.
- This allows passing of test list1 under MSYS2 (Windows), where paths
  starting (unnecessarily) with // are not working. Exit test list1
  under Windows (MSYS2) before "Starting rrdcached..."

5 years agoUpdate functions
Tobias Oetiker [Mon, 25 Mar 2019 12:14:39 +0000 (13:14 +0100)] 
Update functions

5 years agoUpdate further URLs from http to https
Wolfgang Stöggl [Mon, 25 Mar 2019 08:58:31 +0000 (09:58 +0100)] 
Update further URLs from http to https

- Command used to replace http with https:
  git grep -l 'http://tobi.oetiker.ch' -- './*' ':(exclude)CHANGES' | \
  xargs sed -i 's|http://tobi.oetiker.ch|https://tobi.oetiker.ch|g'
- This is an addition to commit: 267369f

5 years agoLet two more tests pass under MSYS2 (Windows)
Wolfgang Stöggl [Sat, 23 Mar 2019 14:12:16 +0000 (15:12 +0100)] 
Let two more tests pass under MSYS2 (Windows)

- Updates the following tests:
  create-with-source-4, xport1
- Avoid Windows drive letter in the path of DEF:vname=rrdfile
  under MSYS or MSYS2. Use only the filename of the rrd and not
  the full path if environmental variable MSYSTEM is set.

5 years agoUpdate URL from http to https
Wolfgang Stöggl [Thu, 21 Mar 2019 10:25:39 +0000 (11:25 +0100)] 
Update URL from http to https

- Command used to replace http with https:
  git grep -l 'http://oss.oetiker.ch' -- './*' ':(exclude)CHANGES' | \
  xargs sed -b -i 's|http://oss.oetiker.ch|https://oss.oetiker.ch|g'
- Fixes:
  https://github.com/oetiker/rrdtool-1.x/issues/934

5 years agoUpdate bugs address
Wolfgang Stöggl [Thu, 21 Mar 2019 09:34:07 +0000 (10:34 +0100)] 
Update bugs address

- Replace:
  http://oss.oetiker.ch/rrdtool-trac/newticket
  with
  https://github.com/oetiker/rrdtool-1.x/issues

5 years agoFix docs on rrdxport
Óscar Nájera [Mon, 18 Mar 2019 17:23:05 +0000 (18:23 +0100)] 
Fix docs on rrdxport

5 years agoUpdate xport tests
Óscar Nájera [Mon, 18 Mar 2019 17:12:24 +0000 (18:12 +0100)] 
Update xport tests

5 years agoFix bounds in rrd_xport
Óscar Nájera [Mon, 18 Mar 2019 15:22:31 +0000 (16:22 +0100)] 
Fix bounds in rrd_xport

rrdxport needs to provide enough data points in its output for the
receiving client to be able to reproduce the graphs generated by rrdgraph.

- The start time pointer needs to be at the start of the interval that
  contain the query start time. For the function that retrieves the data.
  On output the returned start timestamp is > than query timestamp.
- SV export was missing the end boundary

5 years agoFix %s/%S unit autoscaling in gprint for json/xml
Alexander Zangerl [Sat, 6 Oct 2018 02:31:08 +0000 (12:31 +1000)] 
Fix %s/%S unit autoscaling in gprint for json/xml

5 years agoAdd typenames to .indent.pro, add to EXTRA_DIST
Wolfgang Stöggl [Mon, 11 Mar 2019 00:03:34 +0000 (01:03 +0100)] 
Add typenames to .indent.pro, add to EXTRA_DIST

- Several typenames have been added in the meantime using typedef.
  Add them to .indent.pro
- Add .indent.pro file to EXTRA_DIST, so that it is available in the
  tarball
- re-indent src/rrd_xport.c with updated .indent.pro

5 years agoIndent src/rrd_xport.c, tests/Makefile.am
Wolfgang Stöggl [Sun, 10 Mar 2019 01:20:48 +0000 (02:20 +0100)] 
Indent src/rrd_xport.c, tests/Makefile.am

- Indent src/rrd_xport.c using GNU indent 2.2.12
- tests/Makefile.am:
  Use tab in lines 8 and 22, like in the other lines of Makefile.am

5 years agoAllow nan and -nan in test pdp-calc1
Wolfgang Stöggl [Wed, 6 Mar 2019 17:29:36 +0000 (18:29 +0100)] 
Allow nan and -nan in test pdp-calc1

5 years agoAdded PDP calculation tests
Jens Kammler [Tue, 5 Mar 2019 17:04:43 +0000 (18:04 +0100)] 
Added PDP calculation tests

5 years agoFixed bug in bug fix. Has to be tested now.
Jens Kammler [Sat, 16 Feb 2019 14:35:23 +0000 (15:35 +0100)] 
Fixed bug in bug fix. Has to be tested now.

Forgot to increase proc_pdp_cnt after finishing most left open PDP.
Added check for invalid values before calculation, just to be sure.

5 years agoOptimized PDP calculation when multiple PDPs are closed by an update and the previous...
Jens Kammler [Tue, 12 Feb 2019 16:14:11 +0000 (17:14 +0100)] 
Optimized PDP calculation when multiple PDPs are closed by an update and the previous one was open

5 years agoUpdate etc/Makefile.am
Wolfgang Stöggl [Mon, 18 Feb 2019 15:35:52 +0000 (16:35 +0100)] 
Update etc/Makefile.am

- Add rrdcached-init-lsb to EXTRA_DIST
- Trim trailing space after backslash. Fixes:
  etc/Makefile.am:1: warning: whitespace following trailing backslash