aboutsummaryrefslogtreecommitdiff
path: root/src/control
diff options
context:
space:
mode:
authorNicolas Dechesne <nicolas.dechesne@linaro.org>2014-10-03 14:24:17 +0000
committerNicolas Dechesne <nicolas.dechesne@linaro.org>2014-10-03 14:24:17 +0000
commitce044e34dc846856d91f6023e4074dd3f4ab8816 (patch)
treeabacddd1ae38d38f929760f18422251a2a3717e0 /src/control
parent7786e88c56b91bcac3295c58b7a4ad6642990b8c (diff)
Imported Upstream version 1.0.28upstream/1.0.28upstream
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Makefile.am2
-rw-r--r--src/control/Makefile.in4
-rw-r--r--src/control/control_hw.c4
-rw-r--r--src/control/namehint.c22
-rw-r--r--src/control/tlv.c2
5 files changed, 20 insertions, 14 deletions
diff --git a/src/control/Makefile.am b/src/control/Makefile.am
index 8076c732..3d476a21 100644
--- a/src/control/Makefile.am
+++ b/src/control/Makefile.am
@@ -15,4 +15,4 @@ noinst_HEADERS = control_local.h
all: libcontrol.la
-INCLUDES=-I$(top_srcdir)/include
+AM_CPPFLAGS=-I$(top_srcdir)/include
diff --git a/src/control/Makefile.in b/src/control/Makefile.in
index 5c41b3d7..53fd2b46 100644
--- a/src/control/Makefile.in
+++ b/src/control/Makefile.in
@@ -57,7 +57,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -256,7 +256,7 @@ libcontrol_la_SOURCES = cards.c tlv.c namehint.c hcontrol.c control.c \
control_hw.c setup.c ctlparse.c control_symbols.c \
$(am__append_1) $(am__append_2)
noinst_HEADERS = control_local.h
-INCLUDES = -I$(top_srcdir)/include
+AM_CPPFLAGS = -I$(top_srcdir)/include
all: all-am
.SUFFIXES:
diff --git a/src/control/control_hw.c b/src/control/control_hw.c
index 148097fa..dfc9dcd5 100644
--- a/src/control/control_hw.c
+++ b/src/control/control_hw.c
@@ -240,8 +240,10 @@ static int snd_ctl_hw_elem_tlv(snd_ctl_t *handle, int op_flag,
return -errno;
}
if (op_flag == 0) {
- if (xtlv->tlv[1] + 2 * sizeof(unsigned int) > tlv_size)
+ if (xtlv->tlv[1] + 2 * sizeof(unsigned int) > tlv_size) {
+ free(xtlv);
return -EFAULT;
+ }
memcpy(tlv, xtlv->tlv, xtlv->tlv[1] + 2 * sizeof(unsigned int));
}
free(xtlv);
diff --git a/src/control/namehint.c b/src/control/namehint.c
index 8d5e9258..28975a40 100644
--- a/src/control/namehint.c
+++ b/src/control/namehint.c
@@ -406,7 +406,7 @@ static const next_devices_t next_devices[] = {
};
#endif
-static int add_card(snd_config_t *config, struct hint_list *list, int card)
+static int add_card(snd_config_t *config, snd_config_t *rw_config, struct hint_list *list, int card)
{
int err, ok;
snd_config_t *conf, *n;
@@ -449,7 +449,7 @@ static int add_card(snd_config_t *config, struct hint_list *list, int card)
ok = 0;
for (device = 0; err >= 0 && device <= max_device; device++) {
list->device = device;
- err = try_config(config, list, list->siface, str);
+ err = try_config(rw_config, list, list->siface, str);
if (err < 0)
break;
ok++;
@@ -464,7 +464,7 @@ static int add_card(snd_config_t *config, struct hint_list *list, int card)
if (err < 0) {
list->card = card;
list->device = -1;
- err = try_config(config, list, list->siface, str);
+ err = try_config(rw_config, list, list->siface, str);
}
if (err == -ENOMEM)
goto __error;
@@ -493,7 +493,8 @@ static int get_card_name(struct hint_list *list, int card)
return 0;
}
-static int add_software_devices(snd_config_t *config, struct hint_list *list)
+static int add_software_devices(snd_config_t *config, snd_config_t *rw_config,
+ struct hint_list *list)
{
int err;
snd_config_t *conf, *n;
@@ -509,7 +510,7 @@ static int add_software_devices(snd_config_t *config, struct hint_list *list)
continue;
list->card = -1;
list->device = -1;
- err = try_config(config, list, list->siface, str);
+ err = try_config(rw_config, list, list->siface, str);
if (err == -ENOMEM)
return -ENOMEM;
}
@@ -547,7 +548,7 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
struct hint_list list;
char ehints[24];
const char *str;
- snd_config_t *conf, *local_config = NULL;
+ snd_config_t *conf, *local_config = NULL, *local_config_rw = NULL;
snd_config_update_t *local_config_update = NULL;
snd_config_iterator_t i, next;
int err;
@@ -557,6 +558,7 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
err = snd_config_update_r(&local_config, &local_config_update, NULL);
if (err < 0)
return err;
+ err = snd_config_copy(&local_config_rw, local_config);
list.list = NULL;
list.count = list.allocated = 0;
list.siface = iface;
@@ -586,9 +588,9 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
if (card >= 0) {
err = get_card_name(&list, card);
if (err >= 0)
- err = add_card(local_config, &list, card);
+ err = add_card(local_config, local_config_rw, &list, card);
} else {
- add_software_devices(local_config, &list);
+ add_software_devices(local_config, local_config_rw, &list);
err = snd_card_next(&card);
if (err < 0)
goto __error;
@@ -596,7 +598,7 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
err = get_card_name(&list, card);
if (err < 0)
goto __error;
- err = add_card(local_config, &list, card);
+ err = add_card(local_config, local_config_rw, &list, card);
if (err < 0)
goto __error;
err = snd_card_next(&card);
@@ -630,6 +632,8 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
if (list.cardname)
free(list.cardname);
}
+ if (local_config_rw)
+ snd_config_delete(local_config_rw);
if (local_config)
snd_config_delete(local_config);
if (local_config_update)
diff --git a/src/control/tlv.c b/src/control/tlv.c
index 6b0b9f43..b08d8872 100644
--- a/src/control/tlv.c
+++ b/src/control/tlv.c
@@ -312,7 +312,7 @@ int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
submin, submax,
db_gain, value, xdir);
else if (db_gain < dbmin) {
- *value = xdir || pos == 2 ? submin : prev_submax;
+ *value = xdir > 0 || pos == 2 ? submin : prev_submax;
return 0;
}
prev_submax = submax;