[pulseaudio-commits] src/modules

Tanu Kaskinen tanuk at kemper.freedesktop.org
Wed Mar 27 02:38:58 PDT 2013


 src/modules/alsa/alsa-mixer.c |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

New commits:
commit 6be21425cd8490411eb0b15cb4d3fd9185195c84
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Mon Mar 25 13:47:08 2013 +0100

    alsa-mixer: It's valid to have zero elements in a path
    
    It's valid for a path to have zero elements, e g if it contains
    a single jack only. Earlier, this would cause an assertion failure
    in pa_path_condense.
    
    Also convert pa_bool_t to bool.
    
    Signed-off-by: David Henningsson <david.henningsson at canonical.com>

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 2814add..b65baeb 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -3152,14 +3152,14 @@ static void path_set_condense(pa_alsa_path_set *ps, snd_mixer_t *m) {
         PA_HASHMAP_FOREACH(p2, ps->paths, state2) {
             pa_alsa_element *ea, *eb;
             pa_alsa_jack *ja, *jb;
-            pa_bool_t is_subset = TRUE;
+            bool is_subset = true;
 
             if (p == p2)
                 continue;
 
             /* If a has a jack that b does not have, a is not a subset */
             PA_LLIST_FOREACH(ja, p->jacks) {
-                pa_bool_t exists = FALSE;
+                bool exists = false;
 
                 if (!ja->has_control)
                     continue;
@@ -3168,35 +3168,34 @@ static void path_set_condense(pa_alsa_path_set *ps, snd_mixer_t *m) {
                     if (jb->has_control && pa_streq(jb->alsa_name, ja->alsa_name) &&
                        (ja->state_plugged == jb->state_plugged) &&
                        (ja->state_unplugged == jb->state_unplugged)) {
-                        exists = TRUE;
+                        exists = true;
                         break;
                     }
                 }
 
                 if (!exists) {
-                    is_subset = FALSE;
+                    is_subset = false;
                     break;
                 }
             }
 
             /* Compare the elements of each set... */
-            pa_assert_se(ea = p->elements);
-            pa_assert_se(eb = p2->elements);
+            ea = p->elements;
+            eb = p2->elements;
 
             while (is_subset) {
-                if (pa_streq(ea->alsa_name, eb->alsa_name)) {
+                if (!ea && !eb)
+                    break;
+                else if ((ea && !eb) || (!ea && eb))
+                    is_subset = false;
+                else if (pa_streq(ea->alsa_name, eb->alsa_name)) {
                     if (element_is_subset(ea, eb, m)) {
                         ea = ea->next;
                         eb = eb->next;
-                        if ((ea && !eb) || (!ea && eb))
-                            is_subset = FALSE;
-                        else if (!ea && !eb)
-                            break;
                     } else
-                        is_subset = FALSE;
-
+                        is_subset = false;
                 } else
-                    is_subset = FALSE;
+                    is_subset = false;
             }
 
             if (is_subset) {



More information about the pulseaudio-commits mailing list