pod: be more careful with bool

This commit is contained in:
Wim Taymans 2020-01-15 18:10:54 +01:00
parent 4169d9196d
commit 919656aba3
3 changed files with 3 additions and 3 deletions

View file

@ -459,7 +459,7 @@ static inline uint32_t spa_choice_from_id(char id)
do { \
switch (type) { \
case 'b': \
spa_pod_builder_bool(builder, va_arg(args, int)); \
spa_pod_builder_bool(builder, !!va_arg(args, int)); \
break; \
case 'I': \
spa_pod_builder_id(builder, va_arg(args, uint32_t)); \

View file

@ -151,7 +151,7 @@ static inline int spa_pod_get_bool(const struct spa_pod *pod, bool *value)
{
if (!spa_pod_is_bool(pod))
return -EINVAL;
*value = SPA_POD_VALUE(struct spa_pod_bool, pod);
*value = !!SPA_POD_VALUE(struct spa_pod_bool, pod);
return 0;
}

View file

@ -333,7 +333,7 @@ static inline bool spa_pod_parser_can_collect(const struct spa_pod *pod, char ty
do { \
switch (_type) { \
case 'b': \
*va_arg(args, int*) = SPA_POD_VALUE(struct spa_pod_bool, pod); \
*va_arg(args, bool*) = SPA_POD_VALUE(struct spa_pod_bool, pod); \
break; \
case 'I': \
case 'i': \