From ec07b3ad201df42d6b5bd8f326fec0f7b88f0b5c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 17 Aug 2000 21:50:34 +0000 Subject: [PATCH] Warning removal. --- src/control/controls.c | 3 +-- src/mixer/mixer.c | 17 ++++++++++------- src/mixer/simple.c | 18 +++++++++--------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/control/controls.c b/src/control/controls.c index 4ab9837e..cd44911e 100644 --- a/src/control/controls.c +++ b/src/control/controls.c @@ -134,7 +134,7 @@ static int snd_ctl_hsort_mixer_priority_lookup(char **name, char * const *names, if (!strncmp(*name, *names, strlen(*names))) { *name += strlen(*names); if (**name == ' ') - *name++; + (*name)++; return res; } } @@ -189,7 +189,6 @@ static int snd_ctl_hsort_mixer_priority(const char *name) "Bypass", NULL }; - char **ptr, *s; int res, res1; if ((res = snd_ctl_hsort_mixer_priority_lookup((char **)&name, names, 1000000)) == NOT_FOUND) diff --git a/src/mixer/mixer.c b/src/mixer/mixer.c index d66671cc..1bea0d5a 100644 --- a/src/mixer/mixer.c +++ b/src/mixer/mixer.c @@ -43,19 +43,21 @@ int snd_mixer_open(snd_mixer_t **r_handle, int card) *r_handle = NULL; if ((err = snd_ctl_open(&ctl_handle, card)) < 0) return err; + handle = (snd_mixer_t *) calloc(1, sizeof(snd_mixer_t)); + if (handle == NULL) { + snd_ctl_close(ctl_handle); + return -ENOMEM; + } if ((err = snd_ctl_hcallback_rebuild(ctl_handle, snd_mixer_simple_read_rebuild, handle)) < 0) { snd_ctl_close(ctl_handle); + free(handle); return err; } if ((err = snd_ctl_hcallback_add(ctl_handle, snd_mixer_simple_read_add, handle)) < 0) { snd_ctl_close(ctl_handle); + free(handle); return err; } - handle = (snd_mixer_t *) calloc(1, sizeof(snd_mixer_t)); - if (handle == NULL) { - snd_ctl_close(ctl_handle); - return -ENOMEM; - } handle->ctl_handle = ctl_handle; INIT_LIST_HEAD(&handle->simples); *r_handle = handle; @@ -103,7 +105,8 @@ int snd_mixer_simple_control_list(snd_mixer_t *handle, snd_mixer_simple_control_ struct list_head *lh; mixer_simple_t *s; snd_mixer_sid_t *p; - int err, idx; + int err; + unsigned int idx; if (handle == NULL || list == NULL) return -EINVAL; @@ -183,7 +186,7 @@ static void snd_mixer_simple_read_rebuild(snd_ctl_t *ctl_handle, void *private_d handle->simple_changes++; } -static void snd_mixer_simple_read_add(snd_ctl_t *ctl_handle, void *private_data, snd_hcontrol_t *hcontrol) +static void snd_mixer_simple_read_add(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, void *private_data, snd_hcontrol_t *hcontrol) { snd_mixer_t *handle = (snd_mixer_t *)private_data; mixer_simple_t *s; diff --git a/src/mixer/simple.c b/src/mixer/simple.c index 69d8c21b..17b48bd6 100644 --- a/src/mixer/simple.c +++ b/src/mixer/simple.c @@ -86,12 +86,12 @@ static mixer_simple_t *simple_new(mixer_simple_t *scontrol) return s; } -static void hcontrol_event_change(snd_ctl_t *ctl_handle, snd_hcontrol_t *hcontrol) +static void hcontrol_event_change(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hcontrol_t *hcontrol ATTRIBUTE_UNUSED) { /* ignore at this moment */ } -static void hcontrol_event_value(snd_ctl_t *ctl_handle, snd_hcontrol_t *hcontrol) +static void hcontrol_event_value(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hcontrol_t *hcontrol) { snd_mixer_t *handle = (snd_mixer_t *)hcontrol->private_data; mixer_simple_t *s; @@ -103,7 +103,7 @@ static void hcontrol_event_value(snd_ctl_t *ctl_handle, snd_hcontrol_t *hcontrol } } -static void hcontrol_event_remove(snd_ctl_t *ctl_handle, snd_hcontrol_t *hcontrol) +static void hcontrol_event_remove(snd_ctl_t *ctl_handle ATTRIBUTE_UNUSED, snd_hcontrol_t *hcontrol ATTRIBUTE_UNUSED) { /* ignore at this moment */ } @@ -365,7 +365,7 @@ static int build_input(snd_mixer_t *handle, const char *sname) min = max = 0; bag = NULL; sprintf(str, "%s Switch", sname); - if (hcontrol = test_mixer_id(handle, str, index)) { + if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) { if ((err = get_mixer_info(handle, str, index, &gswitch_info)) < 0) return err; if (gswitch_info.type == SND_CONTROL_TYPE_BOOLEAN) { @@ -377,7 +377,7 @@ static int build_input(snd_mixer_t *handle, const char *sname) } } sprintf(str, "%s Volume", sname); - if (hcontrol = test_mixer_id(handle, str, index)) { + if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) { if ((err = get_mixer_info(handle, str, index, &gvolume_info)) < 0) return err; if (gvolume_info.type == SND_CONTROL_TYPE_INTEGER) { @@ -393,7 +393,7 @@ static int build_input(snd_mixer_t *handle, const char *sname) } } sprintf(str, "%s Playback Switch", sname); - if (hcontrol = test_mixer_id(handle, str, index)) { + if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) { if ((err = get_mixer_info(handle, str, index, &pswitch_info)) < 0) return err; if (pswitch_info.type == SND_CONTROL_TYPE_BOOLEAN) { @@ -405,7 +405,7 @@ static int build_input(snd_mixer_t *handle, const char *sname) } } sprintf(str, "%s Capture Switch", sname); - if (hcontrol = test_mixer_id(handle, str, index)) { + if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) { if ((err = get_mixer_info(handle, str, index, &cswitch_info)) < 0) return err; if (cswitch_info.type == SND_CONTROL_TYPE_BOOLEAN) { @@ -417,7 +417,7 @@ static int build_input(snd_mixer_t *handle, const char *sname) } } sprintf(str, "%s Playback Volume", sname); - if (hcontrol = test_mixer_id(handle, str, index)) { + if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) { if ((err = get_mixer_info(handle, str, index, &pvolume_info)) < 0) return err; if (pvolume_info.type == SND_CONTROL_TYPE_INTEGER) { @@ -433,7 +433,7 @@ static int build_input(snd_mixer_t *handle, const char *sname) } } sprintf(str, "%s Capture Volume", sname); - if (hcontrol = test_mixer_id(handle, str, index)) { + if ((hcontrol = test_mixer_id(handle, str, index)) != NULL) { if ((err = get_mixer_info(handle, str, index, &cvolume_info)) < 0) return err; if (cvolume_info.type == SND_CONTROL_TYPE_INTEGER) { -- 2.47.1