[alsa-devel] [PATCH 1/2] BAT: eliminate compiler warnings due to printf type mismatch

Takashi Iwai tiwai at suse.de
Sat Oct 24 09:40:44 CEST 2015


On Sat, 24 Oct 2015 00:29:15 +0200,
Caleb Crome wrote:
> 
> Explict type cast to (size_t) to eliminate compiler warnings.

Actually better to use %lu for snd_pcm_uframes_t.
size_t isn't equivalent.


Takashi

> 
> Signed-off-by: Caleb Crome <caleb at crome.org>
> ---
>  bat/alsa.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/bat/alsa.c b/bat/alsa.c
> index 582c604..b2aa34b 100644
> --- a/bat/alsa.c
> +++ b/bat/alsa.c
> @@ -161,7 +161,7 @@ static int set_snd_pcm_params(struct bat *bat, struct pcm_container *sndpcm)
>  	if (err < 0) {
>  		fprintf(bat->err, _("Get parameter from device error: "));
>  		fprintf(bat->err, _("period size: %zd %s: %s(%d)\n"),
> -				sndpcm->period_size,
> +				(size_t) sndpcm->period_size,
>  				device_name, snd_strerror(err), err);
>  		return err;
>  	}
> @@ -170,7 +170,7 @@ static int set_snd_pcm_params(struct bat *bat, struct pcm_container *sndpcm)
>  	if (err < 0) {
>  		fprintf(bat->err, _("Get parameter from device error: "));
>  		fprintf(bat->err, _("buffer size: %zd %s: %s(%d)\n"),
> -				sndpcm->buffer_size,
> +				(size_t) sndpcm->buffer_size,
>  				device_name, snd_strerror(err), err);
>  		return err;
>  	}
> @@ -178,7 +178,7 @@ static int set_snd_pcm_params(struct bat *bat, struct pcm_container *sndpcm)
>  	if (sndpcm->period_size == sndpcm->buffer_size) {
>  		fprintf(bat->err, _("Invalid parameters: can't use period "));
>  		fprintf(bat->err, _("equal to buffer size (%zd)\n"),
> -				sndpcm->period_size);
> +				(size_t) sndpcm->period_size);
>  		return -EINVAL;
>  	}
>  
> -- 
> 2.6.1
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 


More information about the Alsa-devel mailing list