* [PATCH] [alsa-lib] Removed compilation warning from test/namehint.c
@ 2017-04-09 17:45 soodvarun78
2017-04-10 7:31 ` Takashi Sakamoto
0 siblings, 1 reply; 2+ messages in thread
From: soodvarun78 @ 2017-04-09 17:45 UTC (permalink / raw)
To: o-takashi; +Cc: alsa-devel, varun
From: varun <soodvarun78@gmail.com>
Changed hint variable from char ** to void ** to match function snd_device_name_hint
Signed-off-by: varun <soodvarun78@gmail.com>
---
test/namehint.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/namehint.c b/test/namehint.c
index e978d5c..18bad1d 100644
--- a/test/namehint.c
+++ b/test/namehint.c
@@ -4,7 +4,8 @@
int main(int argc, char *argv[])
{
const char *iface = "pcm";
- char **hints, **n;
+ void **hints;
+ char **n;
int err;
if (argc > 1)
@@ -12,7 +13,7 @@ int main(int argc, char *argv[])
err = snd_device_name_hint(-1, iface, &hints);
if (err < 0)
errx(1, "snd_device_name_hint error: %s", snd_strerror(err));
- n = hints;
+ n = (char **)hints;
while (*n != NULL) {
printf("%s\n", *n);
n++;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] [alsa-lib] Removed compilation warning from test/namehint.c
2017-04-09 17:45 [PATCH] [alsa-lib] Removed compilation warning from test/namehint.c soodvarun78
@ 2017-04-10 7:31 ` Takashi Sakamoto
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Sakamoto @ 2017-04-10 7:31 UTC (permalink / raw)
To: soodvarun78; +Cc: alsa-devel
On Apr 10 2017 02:45, soodvarun78@gmail.com wrote:
> From: varun <soodvarun78@gmail.com>
>
> Changed hint variable from char ** to void ** to match function snd_device_name_hint
>
> Signed-off-by: varun <soodvarun78@gmail.com>
> ---
> test/namehint.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
This patch can suppress below compiler warnings:
```
alsa-lib/test$ make namehint
CC namehint.o
namehint.c: In function ‘main’:
namehint.c:12:40: warning: passing argument 3 of ‘snd_device_name_hint’
from incompatible pointer type [-Wincompatible-pointer-types]
err = snd_device_name_hint(-1, iface, &hints);
^
In file included from ../include/asoundlib.h:58:0,
from namehint.c:1:
../include/alsa/control.h:228:5: note: expected ‘void ***’ but argument
is of type ‘char ***’
int snd_device_name_hint(int card, const char *iface, void ***hints);
^~~~~~~~~~~~~~~~~~~~
namehint.c:20:28: warning: passing argument 1 of
‘snd_device_name_free_hint’ from incompatible pointer type
[-Wincompatible-pointer-types]
snd_device_name_free_hint(hints);
^~~~~
In file included from ../include/asoundlib.h:58:0,
from namehint.c:1:
../include/alsa/control.h:229:5: note: expected ‘void **’ but argument
is of type ‘char **’
int snd_device_name_free_hint(void **hints);
^~~~~~~~~~~~~~~~~~~~~~~~~
CCLD namehint
```
The combination of 'void ***' and 'char **' variables are also used by
'aplay' in alsa-utils.git, therefore it's not so odd.
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> diff --git a/test/namehint.c b/test/namehint.c
> index e978d5c..18bad1d 100644
> --- a/test/namehint.c
> +++ b/test/namehint.c
> @@ -4,7 +4,8 @@
> int main(int argc, char *argv[])
> {
> const char *iface = "pcm";
> - char **hints, **n;
> + void **hints;
> + char **n;
> int err;
>
> if (argc > 1)
> @@ -12,7 +13,7 @@ int main(int argc, char *argv[])
> err = snd_device_name_hint(-1, iface, &hints);
> if (err < 0)
> errx(1, "snd_device_name_hint error: %s", snd_strerror(err));
> - n = hints;
> + n = (char **)hints;
> while (*n != NULL) {
> printf("%s\n", *n);
> n++;
Thanks
Takashi Sakamoto
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-10 7:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-09 17:45 [PATCH] [alsa-lib] Removed compilation warning from test/namehint.c soodvarun78
2017-04-10 7:31 ` Takashi Sakamoto
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.