From 919656aba367afe01958380d13ec07b8e56944a3 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 15 Jan 2020 18:10:54 +0100 Subject: [PATCH] pod: be more careful with bool --- spa/include/spa/pod/builder.h | 2 +- spa/include/spa/pod/iter.h | 2 +- spa/include/spa/pod/parser.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spa/include/spa/pod/builder.h b/spa/include/spa/pod/builder.h index cc34ade05..5f2c794f3 100644 --- a/spa/include/spa/pod/builder.h +++ b/spa/include/spa/pod/builder.h @@ -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)); \ diff --git a/spa/include/spa/pod/iter.h b/spa/include/spa/pod/iter.h index 1f7f97a2b..3299484c1 100644 --- a/spa/include/spa/pod/iter.h +++ b/spa/include/spa/pod/iter.h @@ -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; } diff --git a/spa/include/spa/pod/parser.h b/spa/include/spa/pod/parser.h index 59dcf1440..ddf13d67b 100644 --- a/spa/include/spa/pod/parser.h +++ b/spa/include/spa/pod/parser.h @@ -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': \