[pulseaudio-commits] src/pulse

Tanu Kaskinen tanuk at kemper.freedesktop.org
Fri Jun 29 02:52:22 PDT 2012


 src/pulse/introspect.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 9b3d5acbbc005b96925aa0e5b35156e5c856240b
Author: Tanu Kaskinen <tanu.kaskinen at digia.com>
Date:   Fri Apr 13 14:32:12 2012 +0300

    pulse: Use more intuitive indexing with port infos in introspect.c.

diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index 38a9d1c..6e07494 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -204,22 +204,22 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
                     i.ports[0] = pa_xnew(pa_sink_port_info, i.n_ports);
 
                     for (j = 0; j < i.n_ports; j++) {
-                        if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
-                            pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
-                            pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
+                        i.ports[j] = &i.ports[0][j];
+
+                        if (pa_tagstruct_gets(t, &i.ports[j]->name) < 0 ||
+                            pa_tagstruct_gets(t, &i.ports[j]->description) < 0 ||
+                            pa_tagstruct_getu32(t, &i.ports[j]->priority) < 0) {
 
                             goto fail;
                         }
 
-                        i.ports[0][j].available = PA_PORT_AVAILABLE_UNKNOWN;
+                        i.ports[j]->available = PA_PORT_AVAILABLE_UNKNOWN;
                         if (o->context->version >= 24) {
                             uint32_t av;
                             if (pa_tagstruct_getu32(t, &av) < 0 || av > PA_PORT_AVAILABLE_YES)
                                 goto fail;
-                            i.ports[0][j].available = av;
+                            i.ports[j]->available = av;
                         }
-
-                        i.ports[j] = &i.ports[0][j];
                     }
 
                     i.ports[j] = NULL;
@@ -477,22 +477,22 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
                     i.ports[0] = pa_xnew(pa_source_port_info, i.n_ports);
 
                     for (j = 0; j < i.n_ports; j++) {
-                        if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
-                            pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
-                            pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
+                        i.ports[j] = &i.ports[0][j];
+
+                        if (pa_tagstruct_gets(t, &i.ports[j]->name) < 0 ||
+                            pa_tagstruct_gets(t, &i.ports[j]->description) < 0 ||
+                            pa_tagstruct_getu32(t, &i.ports[j]->priority) < 0) {
 
                             goto fail;
                         }
 
-                        i.ports[0][j].available = PA_PORT_AVAILABLE_UNKNOWN;
+                        i.ports[j]->available = PA_PORT_AVAILABLE_UNKNOWN;
                         if (o->context->version >= 24) {
                             uint32_t av;
                             if (pa_tagstruct_getu32(t, &av) < 0 || av > PA_PORT_AVAILABLE_YES)
                                 goto fail;
-                            i.ports[0][j].available = av;
+                            i.ports[j]->available = av;
                         }
-
-                        i.ports[j] = &i.ports[0][j];
                     }
 
                     i.ports[j] = NULL;



More information about the pulseaudio-commits mailing list