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]
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
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
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
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:
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.
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)
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}' \;
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
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 "= -"
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
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.
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 `...`.
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}
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
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]
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.
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
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
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);
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
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))) {
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
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;
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)
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..."
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
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.
Ó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
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
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
Wolfgang Stöggl [Mon, 18 Feb 2019 10:28:09 +0000 (11:28 +0100)]
Update snprintf.m4, add _HW_FUNC_XPRINTF_REPLACE
- Add _HW_FUNC_XPRINTF_REPLACE again to snprintf.m4, in a modified way.
Use AC_LIBOBJ([rrd_snprintf]) instead of original AC_LIBOBJ([snprintf])
- Fixes the following configure messages under MinGW-w64:
./configure: line 14694: _HW_FUNC_XPRINTF_REPLACE: command not found
./configure: line 14752: _HW_FUNC_XPRINTF_REPLACE: command not found
Wolfgang Stöggl [Sun, 10 Feb 2019 01:46:21 +0000 (02:46 +0100)]
Update FSF address and fix UTF8
- Update FSF address in COPYRIGHT
old: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
new: 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Update LICENSE file according to the current version from:
https://www.gnu.org/licenses/gpl-2.0.txt
- Update bindings/python/COPYING according to the current version from:
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
- Change encoding of CONTRIBUTORS from ISO 8859-1 to UTF-8
- Fixes rpmlint warnings and errors:
W: file-not-utf8 CONTRIBUTORS
E: incorrect-fsf-address COPYRIGHT
E: incorrect-fsf-address LICENSE
E: incorrect-fsf-address bindings/python/COPYING
Wolfgang Stöggl [Fri, 25 Jan 2019 10:08:18 +0000 (11:08 +0100)]
Fix rc compiler redefinition warnings (nmake)
- Surround code in win32/rrd_config.h that causes warnings by rc with
#ifndef RC_INVOKED and #endif. Remark: _MSC_VER is unknown to rc
- Fixes the following warnings for .rc files, e.g.:
rc /nologo /I./src /fo./win32/rrdtool.res ./win32\rrdtool.rc
./win32\rrd_config.h(130) : warning RC4005: 'isinf' : redefinition
./win32\rrd_config.h(131) : warning RC4005: 'isnan' : redefinition
- This concerns: librrd-4.rc, rrdtool.rc, rrdupdate.rc, rrdcgi.rc,
when using the resource compiler (rc) via nmake under Windows
Wolfgang Stöggl [Thu, 24 Jan 2019 16:44:01 +0000 (17:44 +0100)]
Initialize local variable junk
- Fixes the following compiler warnings (MSVC):
rrd_modify.c(439) : warning C4700: uninitialized local variable
'junk' used
rrd_modify.c(1027) : warning C4700: uninitialized local variable
'junk' used
Wolfgang Stöggl [Sun, 20 Jan 2019 21:11:34 +0000 (22:11 +0100)]
Include winsdkver.h for _WIN32_MAXVER
- _WIN32_MAXVER is defined in winsdkver.h
The include is required in case of MinGW-w64 builds
- Fixes rrd_open.c:11:5: warning:
"_WIN32_MAXVER" is not defined, evaluates to 0 [-Wundef]
#if _WIN32_MAXVER >= 0x0602 /* _WIN32_WINNT_WIN8 */
Wolfgang Stöggl [Fri, 18 Jan 2019 17:05:47 +0000 (18:05 +0100)]
Fix: Cannot rename temporary file to final file
- Fixes the following failing tests under Windows:
modify1, modify2, modify3, modify4, modify5
- Use CreateFileA() with FILE_SHARE_DELETE in rrd_open.c,
so that the outfilename can later be replaced by tmpfilename using
write_rrd() in rrd_create.c