mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-10 13:30:05 -05:00
Use errno for result errors
Make new enumeration for data transport status and use errno style error numbers for errors.
This commit is contained in:
parent
dda28b1589
commit
6fb0f580ea
86 changed files with 2019 additions and 1988 deletions
|
|
@ -484,7 +484,7 @@ do { \
|
|||
|
||||
static inline void *
|
||||
spa_pod_builder_addv(struct spa_pod_builder *builder,
|
||||
const char *format, va_list args)
|
||||
const char *format, va_list args)
|
||||
{
|
||||
while (format) {
|
||||
switch (*format) {
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ static inline int spa_pod_object_fixate(struct spa_pod_object *obj)
|
|||
if (res->type == SPA_POD_TYPE_PROP)
|
||||
((struct spa_pod_prop *) res)->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <spa/pod/iter.h>
|
||||
|
|
@ -206,27 +207,27 @@ static inline int spa_pod_parser_getv(struct spa_pod_parser *parser,
|
|||
switch (*format) {
|
||||
case '<':
|
||||
if (pod == NULL || SPA_POD_TYPE(pod) != SPA_POD_TYPE_OBJECT)
|
||||
return SPA_RESULT_INCOMPATIBLE;
|
||||
return -EINVAL;
|
||||
if (++parser->depth >= SPA_POD_MAX_DEPTH)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
it = &parser->iter[parser->depth];
|
||||
spa_pod_iter_init(it, pod, SPA_POD_SIZE(pod), sizeof(struct spa_pod_object));
|
||||
goto read_pod;
|
||||
case '[':
|
||||
if (pod == NULL || SPA_POD_TYPE(pod) != SPA_POD_TYPE_STRUCT)
|
||||
return SPA_RESULT_INCOMPATIBLE;
|
||||
return -EINVAL;
|
||||
if (++parser->depth >= SPA_POD_MAX_DEPTH)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
it = &parser->iter[parser->depth];
|
||||
spa_pod_iter_init(it, pod, SPA_POD_SIZE(pod), sizeof(struct spa_pod_struct));
|
||||
goto read_pod;
|
||||
case ']': case '>':
|
||||
if (current != NULL)
|
||||
return SPA_RESULT_INCOMPATIBLE;
|
||||
return -EINVAL;
|
||||
if (--parser->depth < 0)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
it = &parser->iter[parser->depth];
|
||||
current = spa_pod_iter_current(it);
|
||||
|
|
@ -268,12 +269,12 @@ static inline int spa_pod_parser_getv(struct spa_pod_parser *parser,
|
|||
case 'V':
|
||||
pod = (struct spa_pod *) prop;
|
||||
if (pod == NULL && required)
|
||||
return SPA_RESULT_NOT_FOUND;
|
||||
return -ENOENT;
|
||||
goto collect;
|
||||
default:
|
||||
if (pod == NULL || !spa_pod_parser_can_collect(pod, *format)) {
|
||||
if (required)
|
||||
return SPA_RESULT_NOT_FOUND;
|
||||
return -ENOENT;
|
||||
skip = true;
|
||||
}
|
||||
collect:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue