The type of expression '1<<31' is signed int and this causes cppcheck to
issue the following warning.
src/gf_w32.c:681]: (error) Signed integer overflow for expression
'1<<31'.
Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
Add a test to run with make check to run encoder and decoder to make
sure they work at least in one simple case. It is also useful as a
documentation about how to use them.
Signed-off-by: Loic Dachary <loic@dachary.org>
If the gf_methods was not found, the test would silently succeed doing
nothing. Check for existence and fail if it is not in the path.
Signed-off-by: Loic Dachary <loic@dachary.org>
When a fatal error (unaligned memory etc.) is detected, jerasure
should assert(3) instead of exit(3) to give a chance to the calling
program to catch the exception and display a stack trace. Although it is
possible for gdb to display the stack trace and break on exit, libraries
are not usually expected to terminate the calling program in this way.
Signed-off-by: Loic Dachary <loic@dachary.org>
galois_init_default_field returns an errno(3) code in case of error
instead of exiting. This is handy when the caller needs to perform
cleanup or error reporting when an error occurs instead of exit(2).
The exit(2) based error handling is preserved in the static
galois_init() function which is used in galois.c instead and is based on
galois_init_default_field to avoid code duplication.
Signed-off-by: Loic Dachary <loic@dachary.org>
Fix for Coverity issue from Ceph project:
CID 1093211 (#1 of 1): Resource leak (RESOURCE_LEAK)
20. leaked_storage: Variable "ind_to_row" going out of scope leaks
the storage it points to.
CID 1093212 (#1 of 1): Resource leak (RESOURCE_LEAK)
20. leaked_storage: Variable "row_ids" going out of scope leaks the
storage it points to.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix warning: implicit declaration of function 'getcwd' is invalid in
C99 [-Wimplicit-function-declaration]
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix warning: implicit declaration of function 'gettimeofday' is
invalid in C99 [-Wimplicit-function-declaration]
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Check matrix for NULL before call talloc().
CID 1093213 (#1 of 1): Resource leak (RESOURCE_LEAK)
4. leaked_storage: Variable "bitmatrix" going out of scope
leaks the storage it points to.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>