cleanup: Use uint*_t instead of u_int*_t everythwere

Use the standard uint{8,16,32,64}_t everywhere instead of the
non-standard u_int{8,16,32,64}_t.

This changes the types in the public headers and removes the u_int*_t
defines. This may break things. However, indentifiers ending with _t are
reserved by POSIX[1]; defining those can lead to undefined behavior.

So if you rely on alsa-lib defining those for you, then you want the
compiler to error so things can be fixed properly.

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02_02

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Natanael Copa 2017-07-14 16:18:11 +02:00 committed by Takashi Iwai
parent 885c64bcc4
commit adab355f35
11 changed files with 146 additions and 156 deletions

View file

@ -387,7 +387,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:
@ -467,7 +467,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
@ -480,7 +480,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
@ -493,7 +493,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
@ -506,7 +506,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
@ -539,10 +539,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);
}
/**
@ -550,10 +550,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);
}
/**
@ -561,10 +561,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);
}
/**
@ -580,7 +580,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;
@ -589,13 +589,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 {
@ -605,8 +605,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 {
@ -625,8 +625,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 {
@ -636,8 +636,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 {