[pulseaudio-discuss] [PATCH 2/2] core: Work around -Wlogical-not-parentheses warnings

Peter Meerwald pmeerw at pmeerw.net
Tue May 26 14:40:41 PDT 2015


pulsecore/sink.c: In function 'pa_sink_put':
pulsecore/sink.c:648:53: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
     pa_assert(!(s->flags & PA_SINK_DYNAMIC_LATENCY) == (s->thread_info.fixed_latency != 0));
                                                     ^

pulsecore/source.c: In function 'pa_source_put':
pulsecore/source.c:599:55: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
     pa_assert(!(s->flags & PA_SOURCE_DYNAMIC_LATENCY) == (s->thread_info.fixed_latency != 0));
                                                       ^
rewrite expression to suppress warning:
!(x & MASK) == (y != 0)
<->
!(x & MASK) == !(y == 0)

Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/pulsecore/sink.c   | 2 +-
 src/pulsecore/source.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index f29a9b7..a22c199 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -645,7 +645,7 @@ void pa_sink_put(pa_sink* s) {
               || (s->base_volume == PA_VOLUME_NORM
                   && ((s->flags & PA_SINK_DECIBEL_VOLUME || (s->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)))));
     pa_assert(!(s->flags & PA_SINK_DECIBEL_VOLUME) || s->n_volume_steps == PA_VOLUME_NORM+1);
-    pa_assert(!(s->flags & PA_SINK_DYNAMIC_LATENCY) == (s->thread_info.fixed_latency != 0));
+    pa_assert(!(s->flags & PA_SINK_DYNAMIC_LATENCY) == !(s->thread_info.fixed_latency == 0));
     pa_assert(!(s->flags & PA_SINK_LATENCY) == !(s->monitor_source->flags & PA_SOURCE_LATENCY));
     pa_assert(!(s->flags & PA_SINK_DYNAMIC_LATENCY) == !(s->monitor_source->flags & PA_SOURCE_DYNAMIC_LATENCY));
 
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 97f6cd9..4be7306 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -596,7 +596,7 @@ void pa_source_put(pa_source *s) {
               || (s->base_volume == PA_VOLUME_NORM
                   && ((s->flags & PA_SOURCE_DECIBEL_VOLUME || (s->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)))));
     pa_assert(!(s->flags & PA_SOURCE_DECIBEL_VOLUME) || s->n_volume_steps == PA_VOLUME_NORM+1);
-    pa_assert(!(s->flags & PA_SOURCE_DYNAMIC_LATENCY) == (s->thread_info.fixed_latency != 0));
+    pa_assert(!(s->flags & PA_SOURCE_DYNAMIC_LATENCY) == !(s->thread_info.fixed_latency == 0));
 
     if (s->suspend_cause)
         pa_assert_se(source_set_state(s, PA_SOURCE_SUSPENDED) == 0);
-- 
1.9.1



More information about the pulseaudio-discuss mailing list