From fc447ec426cec7c419a44f3d533df9e3235f55ed Mon Sep 17 00:00:00 2001 From: dhewg Date: Thu, 1 Dec 2011 00:36:29 +0100 Subject: [PATCH] Fix -Waddress warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- neo/sys/linux/sound.h | 2 -- neo/sys/linux/sound_alsa.cpp | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/neo/sys/linux/sound.h b/neo/sys/linux/sound.h index f57dedd0..68804eae 100644 --- a/neo/sys/linux/sound.h +++ b/neo/sys/linux/sound.h @@ -89,8 +89,6 @@ private: #define ALSA_PCM_NEW_SW_PARAMS_API #include -#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 snd_pcm_sframes_t ( *pfn_snd_pcm_avail_update )( snd_pcm_t *pcm ); typedef int ( *pfn_snd_pcm_close )( snd_pcm_t *pcm ); diff --git a/neo/sys/linux/sound_alsa.cpp b/neo/sys/linux/sound_alsa.cpp index 1d7c4110..b9410512 100644 --- a/neo/sys/linux/sound_alsa.cpp +++ b/neo/sys/linux/sound_alsa.cpp @@ -137,9 +137,9 @@ bool idAudioHardwareALSA::Initialize( void ) { // set hardware parameters ---------------------------------------------------------------------- // init hwparams with the full configuration space - snd_pcm_hw_params_t *hwparams; - // this one is a define - id_snd_pcm_hw_params_alloca( &hwparams ); + snd_pcm_hw_params_t *hwparams = (snd_pcm_hw_params_t *) alloca(id_snd_pcm_hw_params_sizeof()); + memset(hwparams, 0, id_snd_pcm_hw_params_sizeof()); + 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 ) ); InitFailed(); @@ -282,6 +282,7 @@ bool idAudioHardwareALSA::Flush( void ) { Sys_Printf( "preparing audio device for output\n" ); } Write( true ); + return true; } /*