alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: John Spencer <maillist-alsa@barfooze.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] pcm: use the same set of uint_XX types	everywhere
Date: Thu, 10 Oct 2013 13:48:32 +0200	[thread overview]
Message-ID: <52569410.3040001@barfooze.de> (raw)
In-Reply-To: <1380728209-24440-1-git-send-email-maillist-alsa@barfooze.de>

Hi Takashi,

do you think this could be merged ?


thanks,
--JS

On 10/02/2013 05:36 PM, John Spencer wrote:
> previously, pcm.h prototyped the functions
> snd_pcm_format_silence* with u_int_XX types
> (legacy BSD types from sys/types.h),
> while the implementation in pcm_misc.c used the C99
> stdint.h types uint_XX.
>
> this caused compilation errors on systems where the
> typedef for u_int_XX and uint_XX is not exactly the same.
>
> we fix it by using the C99 stdint.h types everywhere.
>
> Signed-off-by: John Spencer<maillist-alsa@barfooze.de>
> ---
>   include/pcm.h      |    9 +++++----
>   src/pcm/pcm_misc.c |   42 +++++++++++++++++++++---------------------
>   2 files changed, 26 insertions(+), 25 deletions(-)
>
> diff --git a/include/pcm.h b/include/pcm.h
> index 95b8aed..cd847e4 100644
> --- a/include/pcm.h
> +++ b/include/pcm.h
> @@ -33,6 +33,7 @@
>   extern "C" {
>   #endif
>
> +#include<stdint.h>
>   /**
>    *  \defgroup PCM PCM Interface
>    *  See the \ref pcm page for more details.
> @@ -1048,10 +1049,10 @@ int snd_pcm_format_width(snd_pcm_format_t format);			/* in bits */
>   int snd_pcm_format_physical_width(snd_pcm_format_t format);		/* in bits */
>   snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);
>   ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
> -u_int8_t snd_pcm_format_silence(snd_pcm_format_t format);
> -u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
> -u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
> -u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
> +uint8_t snd_pcm_format_silence(snd_pcm_format_t format);
> +uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
> +uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
> +uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
>   int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples);
>
>   snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);
> diff --git a/src/pcm/pcm_misc.c b/src/pcm/pcm_misc.c
> index d52160c..2a8be21 100644
> --- a/src/pcm/pcm_misc.c
> +++ b/src/pcm/pcm_misc.c
> @@ -363,7 +363,7 @@ ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples)
>    * \param format Sample format
>    * \return silence 64 bit word
>    */
> -u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> +uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
>   {
>   	switch (format) {
>   	case SNDRV_PCM_FORMAT_S8:
> @@ -437,7 +437,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
>   	{
>   		union {
>   			float f[2];
> -			u_int64_t i;
> +			uint64_t i;
>   		} u;
>   		u.f[0] = u.f[1] = 0.0;
>   #ifdef SNDRV_LITTLE_ENDIAN
> @@ -450,7 +450,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
>   	{
>   		union {
>   			double f;
> -			u_int64_t i;
> +			uint64_t i;
>   		} u;
>   		u.f = 0.0;
>   #ifdef SNDRV_LITTLE_ENDIAN
> @@ -463,7 +463,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
>   	{
>   		union {
>   			float f[2];
> -			u_int64_t i;
> +			uint64_t i;
>   		} u;
>   		u.f[0] = u.f[1] = 0.0;
>   #ifdef SNDRV_LITTLE_ENDIAN
> @@ -476,7 +476,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
>   	{
>   		union {
>   			double f;
> -			u_int64_t i;
> +			uint64_t i;
>   		} u;
>   		u.f = 0.0;
>   #ifdef SNDRV_LITTLE_ENDIAN
> @@ -509,10 +509,10 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
>    * \param format Sample format
>    * \return silence 32 bit word
>    */
> -u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
> +uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
>   {
>   	assert(snd_pcm_format_physical_width(format)<= 32);
> -	return (u_int32_t)snd_pcm_format_silence_64(format);
> +	return (uint32_t)snd_pcm_format_silence_64(format);
>   }
>
>   /**
> @@ -520,10 +520,10 @@ u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
>    * \param format Sample format
>    * \return silence 16 bit word
>    */
> -u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
> +uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
>   {
>   	assert(snd_pcm_format_physical_width(format)<= 16);
> -	return (u_int16_t)snd_pcm_format_silence_64(format);
> +	return (uint16_t)snd_pcm_format_silence_64(format);
>   }
>
>   /**
> @@ -531,10 +531,10 @@ u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
>    * \param format Sample format
>    * \return silence 8 bit word
>    */
> -u_int8_t snd_pcm_format_silence(snd_pcm_format_t format)
> +uint8_t snd_pcm_format_silence(snd_pcm_format_t format)
>   {
>   	assert(snd_pcm_format_physical_width(format)<= 8);
> -	return (u_int8_t)snd_pcm_format_silence_64(format);
> +	return (uint8_t)snd_pcm_format_silence_64(format);
>   }
>
>   /**
> @@ -550,7 +550,7 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
>   		return 0;
>   	switch (snd_pcm_format_physical_width(format)) {
>   	case 4: {
> -		u_int8_t silence = snd_pcm_format_silence_64(format);
> +		uint8_t silence = snd_pcm_format_silence_64(format);
>   		unsigned int samples1;
>   		if (samples % 2 != 0)
>   			return -EINVAL;
> @@ -559,13 +559,13 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
>   		break;
>   	}
>   	case 8: {
> -		u_int8_t silence = snd_pcm_format_silence_64(format);
> +		uint8_t silence = snd_pcm_format_silence_64(format);
>   		memset(data, silence, samples);
>   		break;
>   	}
>   	case 16: {
> -		u_int16_t silence = snd_pcm_format_silence_64(format);
> -		u_int16_t *pdata = (u_int16_t *)data;
> +		uint16_t silence = snd_pcm_format_silence_64(format);
> +		uint16_t *pdata = (uint16_t *)data;
>   		if (! silence)
>   			memset(data, 0, samples * 2);
>   		else {
> @@ -575,8 +575,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
>   		break;
>   	}
>   	case 24: {
> -		u_int32_t silence = snd_pcm_format_silence_64(format);
> -		u_int8_t *pdata = (u_int8_t *)data;
> +		uint32_t silence = snd_pcm_format_silence_64(format);
> +		uint8_t *pdata = (uint8_t *)data;
>   		if (! silence)
>   			memset(data, 0, samples * 3);
>   		else {
> @@ -595,8 +595,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
>   		break;
>   	}
>   	case 32: {
> -		u_int32_t silence = snd_pcm_format_silence_64(format);
> -		u_int32_t *pdata = (u_int32_t *)data;
> +		uint32_t silence = snd_pcm_format_silence_64(format);
> +		uint32_t *pdata = (uint32_t *)data;
>   		if (! silence)
>   			memset(data, 0, samples * 4);
>   		else {
> @@ -606,8 +606,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
>   		break;
>   	}
>   	case 64: {
> -		u_int64_t silence = snd_pcm_format_silence_64(format);
> -		u_int64_t *pdata = (u_int64_t *)data;
> +		uint64_t silence = snd_pcm_format_silence_64(format);
> +		uint64_t *pdata = (uint64_t *)data;
>   		if (! silence)
>   			memset(data, 0, samples * 8);
>   		else {

  reply	other threads:[~2013-10-10 11:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-02 15:36 [PATCH] pcm: use the same set of uint_XX types everywhere John Spencer
2013-10-10 11:48 ` John Spencer [this message]
2013-10-10 12:49   ` Takashi Iwai
2013-10-10 13:13     ` Default volume set to maximum stéphane cerveau
2013-10-10 14:11       ` Clemens Ladisch
2013-10-10 14:48         ` stéphane cerveau
2013-10-11 11:52           ` Clemens Ladisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52569410.3040001@barfooze.de \
    --to=maillist-alsa@barfooze.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).