Message ID | 1491759907-10912-1-git-send-email-soodvarun78@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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
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++;