[1/2] BAT: eliminate compiler warnings due to printf type mismatch
diff mbox

Message ID 1445639356-20343-1-git-send-email-caleb@crome.org
State New
Headers show

Commit Message

Caleb Crome Oct. 23, 2015, 10:29 p.m. UTC
Explict type cast to (size_t) to eliminate compiler warnings.

Signed-off-by: Caleb Crome <caleb@crome.org>
---
 bat/alsa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Takashi Iwai Oct. 24, 2015, 7:40 a.m. UTC | #1
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@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@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>

Patch
diff mbox

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;
 	}