mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-08 13:30:03 -05:00
hcontrol: fix compare_default function to handle also id.device and id.subdevice
In case when kcontrol differs only by device or subdevice numbers, the find function can give wrong results. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
0d81de0bca
commit
0110d62043
1 changed files with 10 additions and 4 deletions
|
|
@ -471,8 +471,9 @@ int snd_hctl_compare_fast(const snd_hctl_elem_t *c1,
|
|||
static int snd_hctl_compare_default(const snd_hctl_elem_t *c1,
|
||||
const snd_hctl_elem_t *c2)
|
||||
{
|
||||
int res;
|
||||
int d = c1->id.iface - c2->id.iface;
|
||||
int res, d;
|
||||
|
||||
d = c1->id.iface - c2->id.iface;
|
||||
if (d != 0)
|
||||
return d;
|
||||
if (c1->id.iface == SNDRV_CTL_ELEM_IFACE_MIXER) {
|
||||
|
|
@ -480,11 +481,16 @@ static int snd_hctl_compare_default(const snd_hctl_elem_t *c1,
|
|||
if (d != 0)
|
||||
return d;
|
||||
}
|
||||
d = c1->id.device - c2->id.device;
|
||||
if (d != 0)
|
||||
return d;
|
||||
d = c1->id.subdevice - c2->id.subdevice;
|
||||
if (d != 0)
|
||||
return d;
|
||||
res = strcmp((const char *)c1->id.name, (const char *)c2->id.name);
|
||||
if (res != 0)
|
||||
return res;
|
||||
d = c1->id.index - c2->id.index;
|
||||
return d;
|
||||
return c1->id.index - c2->id.index;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue