Commit Graph

17 Commits

Author SHA1 Message Date
evpobr
4ff3b84eff msvc: Fix annoying conversion warnings #304 2021-03-06 11:41:47 +05:00
bobsayshilol
5ba69401c1
Fix pedantic warnings (#703)
* Fix warnings about incorrect format specifiers.
GCC only wants to see void pointers for %p formatters, so cast as appropriate.

* Fix a warning about an invalid enum value.
The following warning was observed when compiling with -pedantic:

    warning: ISO C restricts enumerator values to range of 'int' (2147483648 is too large)

The values of these enums don't escape wav_read_header() and are only used to set bits in a bitmask, so simply use the next bit rather than jumping to a huge number.

* Give anonymous unions a name.
This fixes the 'anonymous unions are a C11 extension' warning when compiling with -pedantic.

* Use flexible array members rather than zero sized arrays.
This flagged up the following warning when compiling with -pedantic:
    warning: zero size arrays are an extension [-Wzero-length-array]

* Safely return the smallest value of a short.
GCC gives the following warning when compiling with -pedantic:

    warning: overflow in conversion from 'int' to 'short int' changes value from '32768' to '-32768' [-Woverflow]

This looks intentional from the surrounding code, so return -32768 in a legal way rather than depending on undefined behaviour.

* Use the same min/max approach with all compilers.
The GCC specific code gives the following warning from GCC when compiled with -pedantic:

    warning: ISO C forbids braced-groups within expressions [-pedantic]

This code was also a fundamentally different way of calculating min/max since it didn't evaluate the inputs more than once, which meant there was potentially a difference in behaviour when the library was built with different compilers if the evaluation of 'a' or 'b' had side effects.
2021-02-14 10:16:33 +05:00
Gisle Vanem
03bcd1dfff
Fix sndfile-regtest paths handling on Windows platform 2020-09-11 13:50:02 +05:00
evpobr
0cdd232b9f regtest/database.c: Fix compilation with MSVC
getcwd function requires direct.h header.
2017-05-08 21:42:03 +10:00
evpobr
58737ceb48 tests: Fixes for MSVC
* src/test_main.c: Fix undeclared off_t type with MSVC
* tests/misc_test.c: Fix undefined S_ISCHR & S_ISBLK with MSVC
* tests/stdin_test.c: Fix undefined STDIN_FILENO with MSVC
* tests/win32_ordinal_test.c: Fix undeclared getcwd() with MSVC
* Fix missing unistd.h under Win32

Related: https://github.com/erikd/libsndfile/issues/154
2017-04-14 13:03:27 +10:00
Erik de Castro Lopo
e2d1d8e526 regtest/database.c : Fix compiler warning. 2011-07-12 10:37:09 +10:00
Erik de Castro Lopo
f209698448 Update copyright dates. 2011-01-19 21:36:56 +11:00
Erik de Castro Lopo
081903f510 regtest/*.c : Bunch of fixes. 2009-02-22 19:58:45 +11:00
Erik de Castro Lopo
2e97a51cdd Clean out cruft. 2008-04-05 20:13:47 +11:00
Erik de Castro Lopo
28714c9ee0 Fix compile warnings for 64 bit systems. 2007-04-16 23:54:51 +10:00
Erik de Castro Lopo
fe7d03cd59 Remove some of the config related changes in last commit. They broke MinGW builds. 2005-09-03 03:50:47 +00:00
Erik de Castro Lopo
0c7b227de0 Fix a bunch of minor issues found by John Pavel using the Intel compiler. 2005-09-03 02:18:46 +00:00
Erik de Castro Lopo
151b16e5ac Fix compiling when sqlite is missing. 2005-06-20 07:04:21 +00:00
Erik de Castro Lopo
b27ed7ee58 Bunch of win32 fixups. 2005-06-11 04:15:02 +00:00
Erik de Castro Lopo
cdc45c6121 Final integration of regtest code. 2005-05-17 12:47:23 +00:00
Erik de Castro Lopo
b9fdfad449 Add in regtest files. 2005-05-17 11:44:38 +00:00
Erik de Castro Lopo
cb979e10a7 First snapshot of the public project. 2007-05-14 19:55:24 +10:00