Fix -Waddress warning

the address of ‘hwparams’ will always evaluate as ‘true’

This was only in idAudioHardwareALSA::Initialize(), add the
missing return statement too while I'm at it.
This commit is contained in:
dhewg 2011-12-01 00:36:29 +01:00
parent 9d0e0d6fbc
commit fc447ec426
2 changed files with 4 additions and 5 deletions

View file

@ -89,8 +89,6 @@ private:
#define ALSA_PCM_NEW_SW_PARAMS_API #define ALSA_PCM_NEW_SW_PARAMS_API
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
#define id_snd_pcm_hw_params_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_hw_params_t *) alloca(id_snd_pcm_hw_params_sizeof()); memset(*ptr, 0, id_snd_pcm_hw_params_sizeof()); } while (0)
typedef const char * ( *pfn_snd_asoundlib_version )( void ); typedef const char * ( *pfn_snd_asoundlib_version )( void );
typedef snd_pcm_sframes_t ( *pfn_snd_pcm_avail_update )( snd_pcm_t *pcm ); typedef snd_pcm_sframes_t ( *pfn_snd_pcm_avail_update )( snd_pcm_t *pcm );
typedef int ( *pfn_snd_pcm_close )( snd_pcm_t *pcm ); typedef int ( *pfn_snd_pcm_close )( snd_pcm_t *pcm );

View file

@ -137,9 +137,9 @@ bool idAudioHardwareALSA::Initialize( void ) {
// set hardware parameters ---------------------------------------------------------------------- // set hardware parameters ----------------------------------------------------------------------
// init hwparams with the full configuration space // init hwparams with the full configuration space
snd_pcm_hw_params_t *hwparams; snd_pcm_hw_params_t *hwparams = (snd_pcm_hw_params_t *) alloca(id_snd_pcm_hw_params_sizeof());
// this one is a define memset(hwparams, 0, id_snd_pcm_hw_params_sizeof());
id_snd_pcm_hw_params_alloca( &hwparams );
if ( ( err = id_snd_pcm_hw_params_any( m_pcm_handle, hwparams ) ) < 0 ) { if ( ( err = id_snd_pcm_hw_params_any( m_pcm_handle, hwparams ) ) < 0 ) {
common->Printf( "cannot configure the PCM device: %s\n", id_snd_strerror( err ) ); common->Printf( "cannot configure the PCM device: %s\n", id_snd_strerror( err ) );
InitFailed(); InitFailed();
@ -282,6 +282,7 @@ bool idAudioHardwareALSA::Flush( void ) {
Sys_Printf( "preparing audio device for output\n" ); Sys_Printf( "preparing audio device for output\n" );
} }
Write( true ); Write( true );
return true;
} }
/* /*