Skip to content

Commit

Permalink
Merge pull request #142 from Tilka/clang-modernize
Browse files Browse the repository at this point in the history
Run clang-modernize and manually fix the result
  • Loading branch information
Parlane committed Mar 9, 2014
2 parents f401263 + d802d39 commit 633dc75
Show file tree
Hide file tree
Showing 355 changed files with 2,264 additions and 2,218 deletions.
4 changes: 2 additions & 2 deletions Source/Core/AudioCommon/AOSoundStream.cpp
Expand Up @@ -22,7 +22,7 @@ void AOSound::SoundLoop()
format.rate = m_mixer->GetSampleRate();
format.byte_format = AO_FMT_LITTLE;

device = ao_open_live(default_driver, &format, NULL /* no options */);
device = ao_open_live(default_driver, &format, nullptr /* no options */);
if (!device)
{
PanicAlertT("AudioCommon: Error opening AO device.\n");
Expand Down Expand Up @@ -73,7 +73,7 @@ void AOSound::Stop()

ao_shutdown();

device = NULL;
device = nullptr;
}
}

Expand Down
8 changes: 4 additions & 4 deletions Source/Core/AudioCommon/AOSoundStream.h
Expand Up @@ -31,11 +31,11 @@ class AOSound : public SoundStream

virtual ~AOSound();

virtual bool Start();
virtual bool Start() override;

virtual void SoundLoop();
virtual void SoundLoop() override;

virtual void Stop();
virtual void Stop() override;

static bool isValid() {
return true;
Expand All @@ -45,7 +45,7 @@ class AOSound : public SoundStream
return true;
}

virtual void Update();
virtual void Update() override;

#else
public:
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/AudioCommon/AlsaSoundStream.cpp
Expand Up @@ -12,7 +12,7 @@
#define BUFFER_SIZE_MAX 8192
#define BUFFER_SIZE_BYTES (BUFFER_SIZE_MAX*2*2)

AlsaSound::AlsaSound(CMixer *mixer) : SoundStream(mixer), thread_data(0), handle(NULL), frames_to_deliver(FRAME_COUNT_MIN)
AlsaSound::AlsaSound(CMixer *mixer) : SoundStream(mixer), thread_data(0), handle(nullptr), frames_to_deliver(FRAME_COUNT_MIN)
{
mix_buffer = new u8[BUFFER_SIZE_BYTES];
}
Expand Down Expand Up @@ -204,11 +204,11 @@ bool AlsaSound::AlsaInit()

void AlsaSound::AlsaShutdown()
{
if (handle != NULL)
if (handle != nullptr)
{
snd_pcm_drop(handle);
snd_pcm_close(handle);
handle = NULL;
handle = nullptr;
}
}

8 changes: 4 additions & 4 deletions Source/Core/AudioCommon/AlsaSoundStream.h
Expand Up @@ -19,9 +19,9 @@ class AlsaSound : public SoundStream
AlsaSound(CMixer *mixer);
virtual ~AlsaSound();

virtual bool Start();
virtual void SoundLoop();
virtual void Stop();
virtual bool Start() override;
virtual void SoundLoop() override;
virtual void Stop() override;

static bool isValid() {
return true;
Expand All @@ -30,7 +30,7 @@ class AlsaSound : public SoundStream
return true;
}

virtual void Update();
virtual void Update() override;

private:
bool AlsaInit();
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/AudioCommon/CoreAudioSoundStream.cpp
Expand Up @@ -40,8 +40,8 @@ bool CoreAudioSound::Start()
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
component = FindNextComponent(NULL, &desc);
if (component == NULL) {
component = FindNextComponent(nullptr, &desc);
if (component == nullptr) {
ERROR_LOG(AUDIO, "error finding audio component");
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/AudioCommon/DPL2Decoder.cpp
Expand Up @@ -123,7 +123,7 @@ float* design_fir(unsigned int *n, float* fc, float opt)
float fc1; // Cutoff frequencies

// Sanity check
if(*n==0) return NULL;
if(*n==0) return nullptr;
MathUtil::Clamp(&fc[0],float(0.001),float(1));

float *w=(float*)calloc(sizeof(float),*n);
Expand Down Expand Up @@ -188,7 +188,7 @@ void done(void)
{
free(filter_coefs_lfe);
}
filter_coefs_lfe = NULL;
filter_coefs_lfe = nullptr;
}

float* calc_coefficients_125Hz_lowpass(int rate)
Expand Down Expand Up @@ -378,5 +378,5 @@ void dpl2reset()
{
olddelay = -1;
oldfreq = 0;
filter_coefs_lfe = NULL;
filter_coefs_lfe = nullptr;
}
8 changes: 4 additions & 4 deletions Source/Core/AudioCommon/DSoundStream.cpp
Expand Up @@ -32,7 +32,7 @@ bool DSound::CreateBuffer()
dsbdesc.lpwfxFormat = (WAVEFORMATEX *)&pcmwf;
dsbdesc.guid3DAlgorithm = DS3DALG_DEFAULT;

HRESULT res = ds->CreateSoundBuffer(&dsbdesc, &dsBuffer, NULL);
HRESULT res = ds->CreateSoundBuffer(&dsbdesc, &dsBuffer, nullptr);
if (SUCCEEDED(res))
{
dsBuffer->SetCurrentPosition(0);
Expand All @@ -43,7 +43,7 @@ bool DSound::CreateBuffer()
{
// Failed.
PanicAlertT("Sound buffer creation failed: %08x", res);
dsBuffer = NULL;
dsBuffer = nullptr;
return false;
}
}
Expand Down Expand Up @@ -130,7 +130,7 @@ void DSound::SetVolume(int volume)
// This is in "dBA attenuation" from 0 to -10000, logarithmic
m_volume = (int)floor(log10((float)volume) * 5000.0f) - 10000;

if (dsBuffer != NULL)
if (dsBuffer != nullptr)
dsBuffer->SetVolume(m_volume);
}

Expand All @@ -143,7 +143,7 @@ void DSound::Clear(bool mute)
{
m_muted = mute;

if (dsBuffer != NULL)
if (dsBuffer != nullptr)
{
if (m_muted)
{
Expand Down
12 changes: 6 additions & 6 deletions Source/Core/AudioCommon/NullSoundStream.h
Expand Up @@ -21,12 +21,12 @@ class NullSound : public SoundStream

virtual ~NullSound() {}

virtual bool Start();
virtual void SoundLoop();
virtual void SetVolume(int volume);
virtual void Stop();
virtual void Clear(bool mute);
virtual bool Start() override;
virtual void SoundLoop() override;
virtual void SetVolume(int volume) override;
virtual void Stop() override;
virtual void Clear(bool mute) override;
static bool isValid() { return true; }
virtual bool usesMixer() const { return true; }
virtual void Update();
virtual void Update() override;
};
11 changes: 5 additions & 6 deletions Source/Core/AudioCommon/OpenALStream.cpp
Expand Up @@ -17,17 +17,17 @@ bool OpenALStream::Start()
{
bool bReturn = false;

ALDeviceList *pDeviceList = new ALDeviceList();
if ((pDeviceList) && (pDeviceList->GetNumDevices()))
ALDeviceList pDeviceList;
if (pDeviceList.GetNumDevices())
{
char *defDevName = pDeviceList->GetDeviceName(pDeviceList->GetDefaultDevice());
char *defDevName = pDeviceList.GetDeviceName(pDeviceList.GetDefaultDevice());

WARN_LOG(AUDIO, "Found OpenAL device %s", defDevName);

ALCdevice *pDevice = alcOpenDevice(defDevName);
if (pDevice)
{
ALCcontext *pContext = alcCreateContext(pDevice, NULL);
ALCcontext *pContext = alcCreateContext(pDevice, nullptr);
if (pContext)
{
// Used to determine an appropriate period size (2x period = total buffer size)
Expand All @@ -49,7 +49,6 @@ bool OpenALStream::Start()
{
PanicAlertT("OpenAL: can't open device %s", defDevName);
}
delete pDeviceList;
}
else
{
Expand Down Expand Up @@ -84,7 +83,7 @@ void OpenALStream::Stop()
ALCcontext *pContext = alcGetCurrentContext();
ALCdevice *pDevice = alcGetContextsDevice(pContext);

alcMakeContextCurrent(NULL);
alcMakeContextCurrent(nullptr);
alcDestroyContext(pContext);
alcCloseDevice(pDevice);
}
Expand Down
14 changes: 7 additions & 7 deletions Source/Core/AudioCommon/OpenALStream.h
Expand Up @@ -44,21 +44,21 @@ class OpenALStream: public SoundStream
{
#if defined HAVE_OPENAL && HAVE_OPENAL
public:
OpenALStream(CMixer *mixer, void *hWnd = NULL)
OpenALStream(CMixer *mixer, void *hWnd = nullptr)
: SoundStream(mixer)
, uiSource(0)
{}

virtual ~OpenALStream() {}

virtual bool Start();
virtual void SoundLoop();
virtual void SetVolume(int volume);
virtual void Stop();
virtual void Clear(bool mute);
virtual bool Start() override;
virtual void SoundLoop() override;
virtual void SetVolume(int volume) override;
virtual void Stop() override;
virtual void Clear(bool mute) override;
static bool isValid() { return true; }
virtual bool usesMixer() const { return true; }
virtual void Update();
virtual void Update() override;

private:
std::thread thread;
Expand Down
32 changes: 16 additions & 16 deletions Source/Core/AudioCommon/OpenSLESStream.cpp
Expand Up @@ -17,7 +17,7 @@ static SLEngineItf engineEngine;
static SLObjectItf outputMixObject;

// buffer queue player interfaces
static SLObjectItf bqPlayerObject = NULL;
static SLObjectItf bqPlayerObject = nullptr;
static SLPlayItf bqPlayerPlay;
static SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue;
static SLMuteSoloItf bqPlayerMuteSolo;
Expand All @@ -32,7 +32,7 @@ static int curBuffer = 0;

static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context) {
assert(bq == bqPlayerBufferQueue);
assert(NULL == context);
assert(nullptr == context);

short *nextBuffer = buffer[curBuffer];
int nextSize = sizeof(buffer[0]);
Expand All @@ -53,7 +53,7 @@ bool OpenSLESStream::Start()
{
SLresult result;
// create engine
result = slCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL);
result = slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr);
assert(SL_RESULT_SUCCESS == result);
result = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result);
Expand All @@ -79,7 +79,7 @@ bool OpenSLESStream::Start()

// configure audio sink
SLDataLocator_OutputMix loc_outmix = {SL_DATALOCATOR_OUTPUTMIX, outputMixObject};
SLDataSink audioSnk = {&loc_outmix, NULL};
SLDataSink audioSnk = {&loc_outmix, nullptr};

// create audio player
const SLInterfaceID ids[2] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME};
Expand All @@ -94,7 +94,7 @@ bool OpenSLESStream::Start()
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE,
&bqPlayerBufferQueue);
assert(SL_RESULT_SUCCESS == result);
result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, NULL);
result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, nullptr);
assert(SL_RESULT_SUCCESS == result);
result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING);
assert(SL_RESULT_SUCCESS == result);
Expand All @@ -113,22 +113,22 @@ bool OpenSLESStream::Start()

void OpenSLESStream::Stop()
{
if (bqPlayerObject != NULL) {
if (bqPlayerObject != nullptr) {
(*bqPlayerObject)->Destroy(bqPlayerObject);
bqPlayerObject = NULL;
bqPlayerPlay = NULL;
bqPlayerBufferQueue = NULL;
bqPlayerMuteSolo = NULL;
bqPlayerVolume = NULL;
bqPlayerObject = nullptr;
bqPlayerPlay = nullptr;
bqPlayerBufferQueue = nullptr;
bqPlayerMuteSolo = nullptr;
bqPlayerVolume = nullptr;
}
if (outputMixObject != NULL) {
if (outputMixObject != nullptr) {
(*outputMixObject)->Destroy(outputMixObject);
outputMixObject = NULL;
outputMixObject = nullptr;
}
if (engineObject != NULL) {
if (engineObject != nullptr) {
(*engineObject)->Destroy(engineObject);
engineObject = NULL;
engineEngine = NULL;
engineObject = nullptr;
engineEngine = nullptr;
}
}
#endif
4 changes: 2 additions & 2 deletions Source/Core/AudioCommon/OpenSLESStream.h
Expand Up @@ -11,7 +11,7 @@ class OpenSLESStream : public SoundStream
{
#ifdef ANDROID
public:
OpenSLESStream(CMixer *mixer, void *hWnd = NULL)
OpenSLESStream(CMixer *mixer, void *hWnd = nullptr)
: SoundStream(mixer)
{};

Expand All @@ -27,6 +27,6 @@ class OpenSLESStream : public SoundStream
Common::Event soundSyncEvent;
#else
public:
OpenSLESStream(CMixer *mixer, void *hWnd = NULL): SoundStream(mixer) {}
OpenSLESStream(CMixer *mixer, void *hWnd = nullptr): SoundStream(mixer) {}
#endif // HAVE_OPENSL
};

0 comments on commit 633dc75

Please sign in to comment.