mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
introspect: Use pa_direction_valid() to validate port direction
There's no behavioral change, just nicer code.
This commit is contained in:
parent
b9147fad0f
commit
633bc529e2
1 changed files with 3 additions and 3 deletions
|
|
@ -25,6 +25,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <pulse/context.h>
|
#include <pulse/context.h>
|
||||||
|
#include <pulse/direction.h>
|
||||||
#include <pulse/xmalloc.h>
|
#include <pulse/xmalloc.h>
|
||||||
#include <pulse/fork-detect.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, &port->priority) < 0 ||
|
||||||
pa_tagstruct_getu32(t, &available) < 0 ||
|
pa_tagstruct_getu32(t, &available) < 0 ||
|
||||||
pa_tagstruct_getu8(t, &direction) < 0 ||
|
pa_tagstruct_getu8(t, &direction) < 0 ||
|
||||||
|
!pa_direction_valid(direction) ||
|
||||||
pa_tagstruct_get_proplist(t, port->proplist) < 0 ||
|
pa_tagstruct_get_proplist(t, port->proplist) < 0 ||
|
||||||
pa_tagstruct_getu32(t, &port->n_profiles) < 0) {
|
pa_tagstruct_getu32(t, &port->n_profiles) < 0) {
|
||||||
|
|
||||||
return -PA_ERR_PROTOCOL;
|
return -PA_ERR_PROTOCOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (available > PA_PORT_AVAILABLE_YES ||
|
if (available > PA_PORT_AVAILABLE_YES ) {
|
||||||
direction > PA_DIRECTION_OUTPUT + PA_DIRECTION_INPUT) {
|
|
||||||
|
|
||||||
return -PA_ERR_PROTOCOL;
|
return -PA_ERR_PROTOCOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue