]> code.delx.au - pulseaudio/commitdiff
introspect: Use pa_direction_valid() to validate port direction
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Wed, 26 Mar 2014 09:52:34 +0000 (11:52 +0200)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Thu, 27 Mar 2014 08:02:57 +0000 (10:02 +0200)
There's no behavioral change, just nicer code.

src/pulse/introspect.c

index 2d54fdb9ba92877aacc7929585e3582e76cd4cbe..d7696df40d6cfb89f11c1bce9623bd23f00d8fa0 100644 (file)
@@ -25,6 +25,7 @@
 #endif
 
 #include <pulse/context.h>
+#include <pulse/direction.h>
 #include <pulse/xmalloc.h>
 #include <pulse/fork-detect.h>
 
@@ -823,15 +824,14 @@ static int fill_card_port_info(pa_context *context, pa_tagstruct* t, pa_card_inf
             pa_tagstruct_getu32(t, &port->priority) < 0 ||
             pa_tagstruct_getu32(t, &available) < 0 ||
             pa_tagstruct_getu8(t, &direction) < 0 ||
+            !pa_direction_valid(direction) ||
             pa_tagstruct_get_proplist(t, port->proplist) < 0 ||
             pa_tagstruct_getu32(t, &port->n_profiles) < 0) {
 
             return -PA_ERR_PROTOCOL;
         }
 
-        if (available > PA_PORT_AVAILABLE_YES ||
-            direction > PA_DIRECTION_OUTPUT + PA_DIRECTION_INPUT) {
-
+        if (available > PA_PORT_AVAILABLE_YES ) {
             return -PA_ERR_PROTOCOL;
         }