Skip to content

Commit

Permalink
Merge pull request #2393 from ace20022/ae_check
Browse files Browse the repository at this point in the history
[AE] Cleanup things found by Cppcheck
  • Loading branch information
Arne Morten Kvarving committed Mar 17, 2013
2 parents 59437d0 + add8fab commit 8f3fecd
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 19 deletions.
6 changes: 2 additions & 4 deletions xbmc/cores/AudioEngine/AEFactory.cpp
Expand Up @@ -48,9 +48,8 @@ bool CAEFactory::LoadEngine()

bool loaded = false;

std::string engine;

#if defined(TARGET_LINUX)
std::string engine;
if (getenv("AE_ENGINE"))
{
engine = (std::string)getenv("AE_ENGINE");
Expand Down Expand Up @@ -203,9 +202,8 @@ void CAEFactory::VerifyOutputDevice(std::string &device, bool passthrough)
EnumerateOutputDevices(devices, passthrough);
std::string firstDevice;

for (AEDeviceList::const_iterator deviceIt = devices.begin(); deviceIt != devices.end(); deviceIt++)
for (AEDeviceList::const_iterator deviceIt = devices.begin(); deviceIt != devices.end(); ++deviceIt)
{
std::string currentDevice = deviceIt->second;
/* remember the first device so we can default to it if required */
if (firstDevice.empty())
firstDevice = deviceIt->second;
Expand Down
8 changes: 7 additions & 1 deletion xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp
Expand Up @@ -29,7 +29,13 @@
#include <string.h>

CAEEncoderFFmpeg::CAEEncoderFFmpeg():
m_CodecCtx(NULL)
m_CodecCtx (NULL ),
m_BitRate (0 ),
m_BufferSize (0 ),
m_OutputSize (0 ),
m_OutputRatio (0.0 ),
m_SampleRateMul (0.0 ),
m_NeededFrames (0 )
{
}

Expand Down
Expand Up @@ -1103,7 +1103,8 @@ m_allowMixing (false ),
m_encoded (false ),
m_initVolume (1.0f ),
m_NumLatencyFrames (0 ),
m_OutputBufferIndex (0 )
m_OutputBufferIndex (0 ),
m_ae (NULL )
{
}

Expand Down
Expand Up @@ -45,7 +45,8 @@ CCoreAudioAEHALOSX::CCoreAudioAEHALOSX() :
m_encoded (false ),
m_initVolume (1.0f ),
m_NumLatencyFrames (0 ),
m_OutputBufferIndex (0 )
m_OutputBufferIndex (0 ),
m_ae (NULL )
{
m_AudioDevice = new CCoreAudioDevice();
m_OutputStream = new CCoreAudioStream();
Expand Down
4 changes: 2 additions & 2 deletions xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioMixMap.cpp
Expand Up @@ -58,12 +58,12 @@ void CCoreAudioMixMap::Rebuild(AudioChannelLayout& inLayout, AudioChannelLayout&
// Try to find a 'well-known' matrix
const AudioChannelLayout* layouts[] = {&inLayout, &outLayout};
UInt32 propSize = 0;
OSStatus ret = AudioFormatGetPropertyInfo(kAudioFormatProperty_MatrixMixMap,
AudioFormatGetPropertyInfo(kAudioFormatProperty_MatrixMixMap,
sizeof(layouts), layouts, &propSize);
m_pMap = (Float32*)calloc(1,propSize);

// Try and get a predefined mixmap
ret = AudioFormatGetProperty(kAudioFormatProperty_MatrixMixMap,
OSStatus ret = AudioFormatGetProperty(kAudioFormatProperty_MatrixMixMap,
sizeof(layouts), layouts, &propSize, m_pMap);
if (!ret)
{
Expand Down
Expand Up @@ -156,7 +156,7 @@ class CoreAudioRingBuffer {
unsigned int space = GetReadSize();

//want to read more than we have written?
if( space <= 0 )
if( space == 0 )
{
#ifdef RING_BUFFER_DEBUG
CLog::Log(LOGDEBUG, "CoereAudioRingBuffer: Can't read from empty buffer.");
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/AudioEngine/Engines/PulseAE/PulseAE.cpp
Expand Up @@ -81,6 +81,7 @@ CPulseAE::CPulseAE()
m_Context = NULL;
m_MainLoop = NULL;
m_muted = false;
m_Volume = 0.0f;
}

CPulseAE::~CPulseAE()
Expand Down
6 changes: 4 additions & 2 deletions xbmc/cores/AudioEngine/Engines/PulseAE/PulseAESound.cpp
Expand Up @@ -34,9 +34,11 @@ CPulseAESound::CPulseAESound(const std::string &filename, pa_context *context, p
m_context (context ),
m_mainLoop (mainLoop),
m_stream (NULL ),
m_op (NULL )
m_op (NULL ),
m_maxVolume (0.0f ),
m_volume (0.0f ),
m_pulseName (StringUtils::CreateUUID())
{
m_pulseName = StringUtils::CreateUUID();
m_wavLoader.Load(filename);
}

Expand Down
6 changes: 0 additions & 6 deletions xbmc/cores/AudioEngine/Engines/SoftAE/SoftAESound.cpp
Expand Up @@ -34,12 +34,6 @@
/* typecast AE to CSoftAE */
#define AE (*((CSoftAE*)CAEFactory::GetEngine()))

typedef struct
{
char chunk_id[4];
uint32_t chunksize;
} WAVE_CHUNK;

CSoftAESound::CSoftAESound(const std::string &filename) :
IAESound (filename),
m_filename (filename),
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/AudioEngine/Utils/AEChannelInfo.cpp
Expand Up @@ -239,6 +239,7 @@ CAEChannelInfo::operator std::string()

const char* CAEChannelInfo::GetChName(const enum AEChannel ch)
{
// Logical disjunction always evaluates to true: ch >= 0 || ch < 29.
ASSERT(ch >= 0 || ch < AE_CH_MAX);

static const char* channels[AE_CH_MAX] =
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/AudioEngine/Utils/AEStreamInfo.cpp
Expand Up @@ -102,7 +102,6 @@ int CAEStreamInfo::AddData(uint8_t *data, unsigned int size, uint8_t **buffer/*
return 0;
}

unsigned int consumed = 0;
if (m_skipBytes)
{
unsigned int canSkip = std::min(size, m_skipBytes);
Expand All @@ -125,6 +124,7 @@ int CAEStreamInfo::AddData(uint8_t *data, unsigned int size, uint8_t **buffer/*
}
else
{
unsigned int consumed = 0;
unsigned int offset = 0;
unsigned int room = sizeof(m_buffer) - m_bufferSize;
while(1)
Expand Down

0 comments on commit 8f3fecd

Please sign in to comment.