These headers are designed for including in the project. So the user doesn't
need to install valgrind-devel and we don't have to worry about whether the
headers are available or not.
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>
Set this once during setup so we don't have to remember to call fflush() after
each logging operation.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
In the interested of making the logs narrower, let's drop some digits from the
clock_gettime() seconds value. Clamping to 5 digigts, this gives us just under
28h before we wrap which is likely good enough for debugging.
Write the timestamp and location into a temporary buffer, then include them in
the message print. This makes bugs involving size vs length less likely and
provides a fixed limit for how much space the filename can take in the
message.
Setting a NULL value for the property will remove the property and
will thus not send an update to the server and will thus not stop
freewheeling. Use "" to remove ourselves from the freewheel group
instead of looping forever.
See #1265
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.
The two are functionally equivalent, but spa_snprintf never returns a value
higher than the size, preventing memory corruption where our input string
exceeds the target buffer size (see c851349f1).
Niche case: we can no longer differ between real overflow and fitting an
N-byte string into an N+1 sized buffer, we now get a "...truncated" message
now for log messages of exactly 999 bytes long.
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.
Try to keep the full docs out of the headers and into the .c file.
A small short blurb in the header is enough for quick lookups.
Also try to use a regular comment to not confuse the doc system.
void* cannot be automatically type-casted so let's do this explicitly.
../spa/include/spa/param/latency-utils.h: In function ‘spa_pod* spa_latency_build(spa_pod_builder*, uint32_t, const spa_latency_info*)’:
../spa/include/spa/pod/builder.h:651:1: error: invalid conversion from ‘void*’ to ‘spa_pod*’ [-fpermissive]
First element is a spa_list, so {{0}} it is.
../spa/include/spa/node/utils.h:98:40: warning: missing braces around initializer for ‘spa_list’ [-Wmissing-braces]
98 | struct spa_hook listener = { 0 };
In file included from spa/tests/test-cpp.cpp:49:
../spa/include/spa/param/latency-utils.h: In function ‘int spa_latency_parse(const spa_pod*, spa_latency_info*)’:
../spa/include/spa/param/latency-utils.h:95:25: error: invalid conversion from ‘int’ to ‘spa_direction’ [-fpermissive]
95 | info->direction &= 1;
| ~~~~~~~~~~~~~~~~^~~~
| |
| int
If pw_array_ensure_size() is called on an array that has not been initialized
with an extend, assert. Otherwise we get stuck in an infinite loop since
doubling our zero allocation size will never reach "need".
Previously, if the string started with any of the characters in
delimiter, the first returned string would've been an empty string.
This is in contrast with the fact that otherwise `pw_split_walk()`
skips empty fields.
E.g.
"::field1::field2" with ":" as `delimiter`
would have resulted in
* ""
* "field1"
* "field2".
Adjust the function to skip leading runs of characters in `delimiter`
by calling `strspn()` first.
Since `pw_split_walk()` does not skip leading runs of
delimiters, if `module_dir` is an absolute path, then
l = pw_split_strv(module_dir, "/", 0, &n_paths);
will return an array of one element, which is exactly the same
as `module_dir`, `strcmp(l[0], module_dir) == 0`.
If `module_dir` is a relative path, then the returned array
still contains a single element, which is, again, the same
as `module_dir`.
Therefore, omit the the call to `pw_split_strv()` and simply
use `module_dir` as is.