Re: [PATCH alsa-utils 3/4] Use %lli for long long in printf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 05, 2020 at 12:12:20AM -0800, Michael Forney wrote:
> The `L` length modifier only applies to floating-point conversion
> specifiers, and `ll` is used for `long long` integers.
> 
> Although glibc accepts %Li, musl does not and returns EINVAL.
> 
> Signed-off-by: Michael Forney <mforney@xxxxxxxxxxx>
> ---
>  alsactl/state.c | 4 ++--
>  amixer/amixer.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
 
Looks good to me.

Reviewed-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>

> diff --git a/alsactl/state.c b/alsactl/state.c
> index 38e85c0..22e0269 100644
> --- a/alsactl/state.c
> +++ b/alsactl/state.c
> @@ -336,9 +336,9 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
>  		long long max = snd_ctl_elem_info_get_max64(info);
>  		long long step = snd_ctl_elem_info_get_step64(info);
>  		if (step)
> -			sprintf(buf, "%Li - %Li (step %Li)", min, max, step);
> +			sprintf(buf, "%lli - %lli (step %lli)", min, max, step);
>  		else
> -			sprintf(buf, "%Li - %Li", min, max);
> +			sprintf(buf, "%lli - %lli", min, max);
>  		err = snd_config_string_add(comment, "range", buf);
>  		if (err < 0) {
>  			error("snd_config_string_add: %s", snd_strerror(err));
> diff --git a/amixer/amixer.c b/amixer/amixer.c
> index 928f7c5..4c19a58 100644
> --- a/amixer/amixer.c
> +++ b/amixer/amixer.c
> @@ -620,7 +620,7 @@ static int show_control(const char *space, snd_hctl_elem_t *elem,
>  		       snd_ctl_elem_info_get_step(info));
>  		break;
>  	case SND_CTL_ELEM_TYPE_INTEGER64:
> -		printf(",min=%Li,max=%Li,step=%Li\n", 
> +		printf(",min=%lli,max=%lli,step=%lli\n",
>  		       snd_ctl_elem_info_get_min64(info),
>  		       snd_ctl_elem_info_get_max64(info),
>  		       snd_ctl_elem_info_get_step64(info));
> @@ -662,7 +662,7 @@ static int show_control(const char *space, snd_hctl_elem_t *elem,
>  				printf("%li", snd_ctl_elem_value_get_integer(control, idx));
>  				break;
>  			case SND_CTL_ELEM_TYPE_INTEGER64:
> -				printf("%Li", snd_ctl_elem_value_get_integer64(control, idx));
> +				printf("%lli", snd_ctl_elem_value_get_integer64(control, idx));
>  				break;
>  			case SND_CTL_ELEM_TYPE_ENUMERATED:
>  				printf("%u", snd_ctl_elem_value_get_enumerated(control, idx));
> -- 
> 2.25.0
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@xxxxxxxxxxxxxxxx
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux