a637c29f31976bf1e796946d5e042e6e2532951d
[scm/bb/meta-tizen.git] / recipes-multimedia / pulseaudio / pulseaudio_5.0 / 0088-device-creator-stream-creator-Add-a-couple-of-assert.patch
1 From: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
2 Date: Tue, 27 May 2014 10:45:04 +0300
3 Subject: device-creator, stream-creator: Add a couple of assertions
4
5 Klocwork complained that source (in device-creator) and output (in
6 stream-creator) may be dereferenced if they're NULL. Let's make
7 Klocwork happy, and the code a bit more obvious to human readers as
8 well.
9
10 Change-Id: I835dd7d9da44e2866a97bc0424001a42c29602a8
11 ---
12  src/modules/volume-api/device-creator.c | 4 +++-
13  src/modules/volume-api/stream-creator.c | 4 +++-
14  2 files changed, 6 insertions(+), 2 deletions(-)
15
16 diff --git a/src/modules/volume-api/device-creator.c b/src/modules/volume-api/device-creator.c
17 index 1d912ba..f35fab0 100644
18 --- a/src/modules/volume-api/device-creator.c
19 +++ b/src/modules/volume-api/device-creator.c
20 @@ -513,8 +513,10 @@ static pa_hook_result_t sink_or_source_mute_changed_cb(void *hook_data, void *ca
21  
22      if (sink)
23          mute = sink->muted;
24 -    else
25 +    else if (source)
26          mute = source->muted;
27 +    else
28 +        pa_assert_not_reached();
29  
30      pa_mute_control_mute_changed(control->mute_control, mute);
31  
32 diff --git a/src/modules/volume-api/stream-creator.c b/src/modules/volume-api/stream-creator.c
33 index 2bd0053..f6ca7b3 100644
34 --- a/src/modules/volume-api/stream-creator.c
35 +++ b/src/modules/volume-api/stream-creator.c
36 @@ -216,8 +216,10 @@ static pa_hook_result_t sink_input_or_source_output_mute_changed_cb(void *hook_d
37  
38      if (input)
39          mute = input->muted;
40 -    else
41 +    else if (output)
42          mute = output->muted;
43 +    else
44 +        pa_assert_not_reached();
45  
46      pa_mute_control_mute_changed(stream->stream->own_mute_control, mute);
47