Removed compilation warning from test/namehint.c
PATCH 1/1 Removed compilation warning from test/namehint.c
From: varun <[email protected]>
Changed hint variable from char ** to void ** to match function snd_device_name_hint
Signed-off-by varun <[email protected]>
--- test/namehint.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
test/namehint.c +3 -2
@@ -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++;
Signature · 1 line
1.9.1
Quoted 8 lines · On Apr 10 2017 02:45, [email protected] wrote:
From: varun <[email protected]>
Changed hint variable from char ** to void ** to match function
snd_device_name_hintSigned-off-by varun <[email protected]>--- 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 <[email protected]>
Quoted 15 lines
test/namehint.c +2
-1@@ -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 )
test/namehint.c int main(int argc, char *argv[]) · line 19
Quoted 8 lines
test/namehint.c +1
-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