Commit graph

279 commits

Author SHA1 Message Date
Wim Taymans
bd6081018f tests: fix warning 2025-10-09 09:29:32 +02:00
Wim Taymans
b7b9e7dc6e tests: fix compilation 2025-10-09 09:22:07 +02:00
Arun Raghavan
a4ec02f9d7 spa: tests: Add an offline AEC benchmark 2025-10-09 00:16:51 +00:00
Demi Marie Obenour
b04da87e38 pod: check that choices are not empty
Before using the contents of a choice, check that it is not empty to
avoid reading out of bounds.
2025-07-15 10:13:18 +02:00
Samuel Thibault
8b807ded35 Add GNU/Hurd support 2023-09-24 15:11:52 +00:00
Barnabás Pőcze
934ab3036e treewide: use SPDX tags to specify copyright information
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.

See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Niklāvs Koļesņikovs
cba334f028 treewide: fix some strict-prototypes Clang warnings/errors
Clang 15 at least with my build configuration emits warnings about
function prototypes that lack argument types. Most notably this
happens with functions that take no arguments which in compiler view
equates to the void type i.e. void f(void) instead of void f(). As I
understand, this will become an error in some future Clang release,
so might as well fix it now.

Since these were discovered not by a linter but by the actual compiler
for my particular build configuration, some f() may have escaped for
now. But at least it's enough to build PipeWire with most optional
features enabled even when -Werror=strict-prototypes is enabled.

For anyone else wanting to have a go at this, these can be upgraded
from warnings to errors by adding -Werror=strict-prototypes to the
custom CFLAGS which probably works with GCC, too, but has only been
done with Clang 15.0.2.

Finally my editor automatically stripped trailing spaces upon saving
the modified files. I assume it's probably not worth keeping those
invisible bytes around but this may have slightly dubious implications
as it did also turn indented empty lines of JACK license header into
regular empty lines.

Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd@relay.firefox.com>
2022-10-12 07:32:47 +00:00
Lucas Holt
6a15a02ec2 Add support for MidnightBSD
Fix build issue

Fix build issue
2022-06-19 18:22:47 +00:00
Gleb Popov
6c5c3dc090 Fix build on recent FreeBSD 13-STABLE 2022-01-26 14:37:19 +03:00
Barnabás Pőcze
ec465966bc treewide: meson.build: simplify get_variable() calls
Since 01c6fd0a88 the
minimum required meson version is 0.59.0, and since
meson 0.58.0, `get_variable()` on a dependency object
accepts a positional argument. The "type" of variable
(internal, pkgconfig, etc.) in that case does not need
to be specified explicitly.
2022-01-17 08:28:53 +00:00
Barnabás Pőcze
e34cbcb92c spa: tests: meson.build: specify check argument for run_command()
The include tests are not critical, hence there is
no need to halt the build if, for some reason, `find` fails.

See https://github.com/mesonbuild/meson/issues/9300
2022-01-17 08:28:53 +00:00
Barnabás Pőcze
02e76bad8e spa: tests: meson.build: specify configuration inline
Do not construct a `cfg_data` object, instead, simply pass
a dictionary to `configure_file()`.
2022-01-17 08:28:53 +00:00
Barnabás Pőcze
26eb66fb5b treewide: meson.build: get SPA_PLUGIN_DIR from dependency
Instead of hard-coding the path relative to the project root,
retrieve the correct path from `spa_dep`.
2021-12-28 18:39:17 +01:00
Barnabás Pőcze
8ed46a283f treewide: meson.build: use project_{build,source}_root()
Use `meson.project_{build,source}_root()` instead of
`meson.{build,source}_root()` because those functions
do not work as expected when used inside a subproject,
and they have been deprecated in meson 0.56.0.
2021-12-28 18:37:18 +01:00
Barnabás Pőcze
2b110af366 treewide: meson.build: use dependency variable for SPA
Use `spa_dep` everywhere instead of `spa_inc`,
and remove `spa_inc` altogether.
2021-12-28 18:34:06 +01:00
Gleb Popov
f70dd7fa0c Use real sched_getcpu() implementation on FreeBSD 14. 2021-12-26 17:43:23 +03:00
Peter Hutterer
abd5f9fbe8 Remove remaining tabs from meson.build files
No changes, just tab-to-space replacement and a little bit of manual
twiddling.
2021-09-30 00:08:27 +00:00
Nils Tonnätt
dd12910769 Revert "[Meson] Fix all deprecation warnings"
This reverts commit f7e1175ef0.
2021-08-08 19:18:40 +00:00
Nils Tonnätt
f7e1175ef0 [Meson] Fix all deprecation warnings 2021-08-06 07:56:16 +00:00
Niklāvs Koļesņikovs
e062c4d8de meson.build: adds summary() to optional programs 2021-06-29 17:23:37 +00:00
Barnabás Pőcze
7cecb1567d spa: tests: remove double dot from names of test files
Previously, the configured test file would be named like the following:

  spa-include-test-spa_control_control_h..cpp

fix that by removing one of the dots.

Furthermore, use the already existing `find` object instead of
calling `find_program` one more time.
2021-06-16 19:45:27 +02:00
Peter Hutterer
9a65d90e88 test: move the spa tests to pwtest
Move the spa tests to the pwtest framework. The pod tests have only been
wrapped in the function callers, they don't use the variuos pwtest helpers -
too much work for very little gain here. Can be done incrementally if needed.

Note that this removes the spa tests from the installed tests. Arguably,
installing those tests was unnecessary anyway since they are static binaries
and don't load anything. So having them installed runs the same tests as
having them run in the source tree.

Goal for the pwtest framework is to allow for installed tests, just not there
yet.
2021-06-09 18:00:59 +10:00
Peter Hutterer
7909c99ead test: convert two spa tests to pwtest 2021-06-09 18:00:39 +10:00
Peter Hutterer
0054319d88 meson.build: add -D_GNU_SOURCE to the project arguments
This appends it to every compilation command so we can get rid of the c_args
for (almost all) executables.
2021-06-09 07:47:51 +00:00
Peter Hutterer
fee4d0eae1 spa: switch the include header test to C++ by default
If we have a C++ compiler, compile all the #include tests with that - it'll
pick up any issues that a C compiler will pick up anyway. This saves us from
having a separate C++ compiler test and it'll test each header separately for
C++ compatibility..
2021-06-09 07:43:46 +00:00
Peter Hutterer
f3a98debec spa: don't run the spa_scnprintf abort test under valgrind
valgrind doesn't know we expect this to fail, so let's not confuse it
2021-06-08 20:21:50 +10:00
Peter Hutterer
d08d989412 spa: add a test for missing includes
For each header in the spa directory, generate a compilation test that
includes just that header. This way we can pick up missing #includes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-06-07 10:31:17 +00:00
Peter Hutterer
db989d851d spa: auto-generate the cpp compilation test
Replace the manually maintained header list with a Python script that finds
all header files and includes them in order. This adds another 25 or so
previously headers to the C++ compilation tests.
2021-06-07 07:20:21 +00:00
Peter Hutterer
47c173c83f spa/util: add spa_scnprintf to use over snprintf
Wraps the glibc snprintf/vsnprintf calls, but aborts if given a negative size
and zero-terminates the buffer on error.

The returned value is clipped to size - 1 which avoids issues like the one
fixed in c851349f17.
2021-06-07 15:16:35 +10:00
Peter Hutterer
81cc466752 spa: the cpp test is a compilation test only
No point installing or even running it, we don't do anything here.
2021-06-04 18:46:29 +10:00
Peter Hutterer
4d45182801 spa: add SPA_FOR_EACH_ELEMENT for array traversal 2021-06-03 07:25:32 +00:00
Peter Hutterer
6826df07da spa/utils: add spa_atou32, spa_atoi64,spa_atou64, spa_atod, spa_atof
Same as the existing spa_atoi32 but for uint32_t, {u}int64_t, float and
double.
2021-06-02 07:39:41 +00:00
Peter Hutterer
1a5faa7b52 spa: add a header for ANSI color sequences
Makes the code more readable and guarantees we use the same sequences for the
same colors everywhere.
2021-06-02 14:17:29 +10:00
Wim Taymans
9262f576d5 spa: fix unit test, add new object type 2021-05-27 15:26:09 +02:00
Peter Hutterer
cdfd50e166 spa: add spa_atob() to convert a string to a boolean
This replaces the manual check for "true" and some (inconsistent) return value
of atoi. All those instances now require either "true" or "1" to parse as
true, any other value (including NULL) is boolean false.
2021-05-18 22:18:56 +10:00
Peter Hutterer
95a84e797a treewide: replace !strcmp() with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
7697ed0757 treewide: replace strcmp() == 0 with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
d8a9534a9a spa/string: add spa_streq() and spa_strneq() for string equality
Easier to use than strcmp() since their return value matches expectations. And
they do what is expected with NULL strings, two NULL pointers are equal, one
NULL pointer is not equal.
2021-05-18 22:10:27 +10:00
Peter Hutterer
5aa15d10e9 spa: add a new string helper with spa_strtol()
Most of the time when we convert a string to an integer we only care about
success. Let's wrap this with a helper function that sets the value to the
result and returns true on success.
2021-05-18 07:35:00 +00:00
Peter Hutterer
0504ebffeb spa: prefix SPA_*_LAST enum values with an underscore
These are not part of the ABI, prefixing them makes this a bit more obvious
that they shouldn't be used.
2021-05-18 10:41:26 +10:00
Peter Hutterer
2405f0942b spa/buffer: rename SPA_MEMBER to SPA_PTROFF
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a
type-casting the result. Rename to SPA_PTROFF which is more expressive (and
has the same number of characters so we don't need to re-indent).
2021-05-06 09:39:39 +00:00
Peter Hutterer
223f20709d meson: replace join_paths(a, b) with a / b
More readable and from the meson reference manual:
(since 0.49.0) Using the/ operator on strings is equivalent to calling join_paths.
2021-04-15 06:57:00 +00:00
Wim Taymans
7c819320c7 tests: fix test of array values
Don't assign but test. Also test the right array index..
2021-03-27 20:10:01 +01:00
Wim Taymans
db85339f50 json: handle overflow better
We need at least the length of the string+1 as the length of the
target in spa_json_get_string(). Add a unit test for this.
2021-03-18 19:44:25 +01:00
Wim Taymans
fc9a6d6b1e spa: spa_json_get_string does not return the length
The returned string is null terminated.
2021-03-18 18:57:26 +01:00
Wim Taymans
8e590df92f spa: improve info parsing
Make info parsing a bit easier to read by assigning the key and
value to temporary variables.
Improve the parsing of channelmap using json parser to make it
support more cases.
Add a unit test for channelmap parsing options.
2021-03-18 18:40:56 +01:00
Wim Taymans
f41de50b28 json: escape and unescape invalid unicode chars 2021-03-12 09:23:33 +01:00
eater
6a21909281
spa: escape double quotes 2021-02-18 14:01:28 +01:00
Wim Taymans
ebf324590b pod: handle various ways of making empty array/choice
Make it possible to make empty array/choice
Handle empty array/choice
Add some tests to make empty arrays/choice objects
2021-01-25 10:55:30 +01:00
Oschowa
f767521baf spa: fix test-buffer
there is a new meta type since b39a2258
2021-01-22 13:51:08 +01:00