From 773e54162688367f54f890ca34f938226854e20f Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Wed, 8 Feb 2017 12:13:26 +0000 Subject: [PATCH] portaudio: minimal const-correctness --- .../portaudio/src/hostapi/alsa/pa_linux_alsa.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/3rdparty/portaudio/src/hostapi/alsa/pa_linux_alsa.c b/3rdparty/portaudio/src/hostapi/alsa/pa_linux_alsa.c index 584cde8901d..73fceb3be6c 100644 --- a/3rdparty/portaudio/src/hostapi/alsa/pa_linux_alsa.c +++ b/3rdparty/portaudio/src/hostapi/alsa/pa_linux_alsa.c @@ -676,7 +676,7 @@ PaAlsaHostApiRepresentation; typedef struct PaAlsaDeviceInfo { PaDeviceInfo baseDeviceInfo; - char *alsaName; + const char *alsaName; int isPlug; int minInputChannels; int minOutputChannels; @@ -982,7 +982,7 @@ static PaUint32 PaAlsaVersionNum(void) /* Helper struct */ typedef struct { - char *alsaName; + const char *alsaName; char *name; int isPlug; int hasPlayback; @@ -1079,9 +1079,9 @@ static int IgnorePlugin( const char *pluginId ) } /* Skip past parts at the beginning of a (pcm) info name that are already in the card name, to avoid duplication */ -static char *SkipCardDetailsInName( char *infoSkipName, char *cardRefName ) +static const char *SkipCardDetailsInName( const char *infoSkipName, const char *cardRefName ) { - char *lastSpacePosn = infoSkipName; + const char *lastSpacePosn = infoSkipName; /* Skip matching chars; but only in chunks separated by ' ' (not part words etc), so track lastSpacePosn */ while( *cardRefName ) @@ -1238,7 +1238,7 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi ) int res; int blocking = SND_PCM_NONBLOCK; int usePlughw = 0; - char *hwPrefix = ""; + const char *hwPrefix = ""; char alsaCardName[50]; #ifdef PA_ENABLE_DEBUG_OUTPUT PaTime startTime = PaUtil_GetTime(); @@ -1292,7 +1292,8 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi ) while( alsa_snd_ctl_pcm_next_device( ctl, &devIdx ) == 0 && devIdx >= 0 ) { - char *alsaDeviceName, *deviceName, *infoName; + char *alsaDeviceName, *deviceName; + const char *infoName; size_t len; int hasPlayback = 0, hasCapture = 0; @@ -1319,7 +1320,7 @@ static PaError BuildDeviceList( PaAlsaHostApiRepresentation *alsaApi ) continue; } - infoName = SkipCardDetailsInName( (char *)alsa_snd_pcm_info_get_name( pcmInfo ), cardName ); + infoName = SkipCardDetailsInName( alsa_snd_pcm_info_get_name( pcmInfo ), cardName ); /* The length of the string written by snprintf plus terminating 0 */ len = snprintf( NULL, 0, "%s: %s (%s)", cardName, infoName, buf ) + 1;