Merge pull request #142 from Tilka/clang-modernize

Run clang-modernize and manually fix the result
This commit is contained in:
Matthew Parlane
2014-03-10 09:24:09 +13:00
355 changed files with 2257 additions and 2211 deletions
+2 -2
View File
@@ -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");
@@ -73,7 +73,7 @@ void AOSound::Stop()
ao_shutdown();
device = NULL;
device = nullptr;
}
}
+4 -4
View File
@@ -31,11 +31,11 @@ public:
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;
@@ -45,7 +45,7 @@ public:
return true;
}
virtual void Update();
virtual void Update() override;
#else
public:
+3 -3
View File
@@ -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];
}
@@ -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;
}
}
+4 -4
View File
@@ -19,9 +19,9 @@ public:
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;
@@ -30,7 +30,7 @@ public:
return true;
}
virtual void Update();
virtual void Update() override;
private:
bool AlsaInit();
@@ -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;
}
+3 -3
View File
@@ -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);
@@ -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)
@@ -378,5 +378,5 @@ void dpl2reset()
{
olddelay = -1;
oldfreq = 0;
filter_coefs_lfe = NULL;
filter_coefs_lfe = nullptr;
}
+4 -4
View File
@@ -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);
@@ -43,7 +43,7 @@ bool DSound::CreateBuffer()
{
// Failed.
PanicAlertT("Sound buffer creation failed: %08x", res);
dsBuffer = NULL;
dsBuffer = nullptr;
return false;
}
}
@@ -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);
}
@@ -143,7 +143,7 @@ void DSound::Clear(bool mute)
{
m_muted = mute;
if (dsBuffer != NULL)
if (dsBuffer != nullptr)
{
if (m_muted)
{
+6 -6
View File
@@ -21,12 +21,12 @@ public:
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;
};
+5 -6
View File
@@ -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)
@@ -49,7 +49,6 @@ bool OpenALStream::Start()
{
PanicAlertT("OpenAL: can't open device %s", defDevName);
}
delete pDeviceList;
}
else
{
@@ -84,7 +83,7 @@ void OpenALStream::Stop()
ALCcontext *pContext = alcGetCurrentContext();
ALCdevice *pDevice = alcGetContextsDevice(pContext);
alcMakeContextCurrent(NULL);
alcMakeContextCurrent(nullptr);
alcDestroyContext(pContext);
alcCloseDevice(pDevice);
}
+7 -7
View File
@@ -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;
+16 -16
View File
@@ -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;
@@ -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]);
@@ -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);
@@ -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};
@@ -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);
@@ -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
+2 -2
View File
@@ -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)
{};
@@ -27,6 +27,6 @@ private:
Common::Event soundSyncEvent;
#else
public:
OpenSLESStream(CMixer *mixer, void *hWnd = NULL): SoundStream(mixer) {}
OpenSLESStream(CMixer *mixer, void *hWnd = nullptr): SoundStream(mixer) {}
#endif // HAVE_OPENSL
};
+7 -7
View File
@@ -47,7 +47,7 @@ void PulseAudio::SoundLoop()
if (PulseInit())
{
while (m_run_thread.load() && m_pa_connected == 1 && m_pa_error >= 0)
m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, NULL);
m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, nullptr);
if(m_pa_error < 0)
ERROR_LOG(AUDIO, "PulseAudio error: %s", pa_strerror(m_pa_error));
@@ -66,12 +66,12 @@ bool PulseAudio::PulseInit()
m_pa_ml = pa_mainloop_new();
m_pa_mlapi = pa_mainloop_get_api(m_pa_ml);
m_pa_ctx = pa_context_new(m_pa_mlapi, "dolphin-emu");
m_pa_error = pa_context_connect(m_pa_ctx, NULL, PA_CONTEXT_NOFLAGS, NULL);
m_pa_error = pa_context_connect(m_pa_ctx, nullptr, PA_CONTEXT_NOFLAGS, nullptr);
pa_context_set_state_callback(m_pa_ctx, StateCallback, this);
// wait until we're connected to the pulseaudio server
while (m_pa_connected == 0 && m_pa_error >= 0)
m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, NULL);
m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, nullptr);
if (m_pa_connected == 2 || m_pa_error < 0)
{
@@ -85,7 +85,7 @@ bool PulseAudio::PulseInit()
ss.format = PA_SAMPLE_S16LE;
ss.channels = 2;
ss.rate = m_mixer->GetSampleRate();
m_pa_s = pa_stream_new(m_pa_ctx, "Playback", &ss, NULL);
m_pa_s = pa_stream_new(m_pa_ctx, "Playback", &ss, nullptr);
pa_stream_set_write_callback(m_pa_s, WriteCallback, this);
pa_stream_set_underflow_callback(m_pa_s, UnderflowCallback, this);
@@ -97,7 +97,7 @@ bool PulseAudio::PulseInit()
m_pa_ba.prebuf = -1; // start as early as possible
m_pa_ba.tlength = BUFFER_SIZE; // designed latency, only change this flag for low latency output
pa_stream_flags flags = pa_stream_flags(PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_ADJUST_LATENCY | PA_STREAM_AUTO_TIMING_UPDATE);
m_pa_error = pa_stream_connect_playback(m_pa_s, NULL, &m_pa_ba, flags, NULL, NULL);
m_pa_error = pa_stream_connect_playback(m_pa_s, nullptr, &m_pa_ba, flags, nullptr, nullptr);
if (m_pa_error < 0)
{
ERROR_LOG(AUDIO, "PulseAudio failed to initialize: %s", pa_strerror(m_pa_error));
@@ -135,7 +135,7 @@ void PulseAudio::StateCallback(pa_context* c)
void PulseAudio::UnderflowCallback(pa_stream* s)
{
m_pa_ba.tlength += BUFFER_SIZE;
pa_stream_set_buffer_attr(s, &m_pa_ba, NULL, NULL);
pa_stream_set_buffer_attr(s, &m_pa_ba, nullptr, nullptr);
WARN_LOG(AUDIO, "pulseaudio underflow, new latency: %d bytes", m_pa_ba.tlength);
}
@@ -150,7 +150,7 @@ void PulseAudio::WriteCallback(pa_stream* s, size_t length)
return; // error will be printed from main loop
m_mixer->Mix((s16*) buffer, length / sizeof(s16) / CHANNEL_COUNT);
m_pa_error = pa_stream_write(s, buffer, length, NULL, 0, PA_SEEK_RELATIVE);
m_pa_error = pa_stream_write(s, buffer, length, nullptr, 0, PA_SEEK_RELATIVE);
}
// Callbacks that forward to internal methods (required because PulseAudio is a C API).
+4 -4
View File
@@ -20,21 +20,21 @@ class PulseAudio : public SoundStream
public:
PulseAudio(CMixer *mixer);
virtual bool Start();
virtual void Stop();
virtual bool Start() override;
virtual void Stop() override;
static bool isValid() {return true;}
virtual bool usesMixer() const {return true;}
virtual void Update();
virtual void Update() override;
void StateCallback(pa_context *c);
void WriteCallback(pa_stream *s, size_t length);
void UnderflowCallback(pa_stream *s);
private:
virtual void SoundLoop();
virtual void SoundLoop() override;
bool PulseInit();
void PulseShutdown();
+1 -1
View File
@@ -11,7 +11,7 @@ enum {BUF_SIZE = 32*1024};
WaveFileWriter::WaveFileWriter():
skip_silence(false),
audio_size(0),
conv_buffer(NULL)
conv_buffer(nullptr)
{
}
+1 -1
View File
@@ -158,7 +158,7 @@ XAudio2::XAudio2(CMixer *mixer)
: SoundStream(mixer)
, m_mastering_voice(nullptr)
, m_volume(1.0f)
, m_cleanup_com(SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED)))
, m_cleanup_com(SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)))
{
}
+1 -1
View File
@@ -159,7 +159,7 @@ XAudio2_7::XAudio2_7(CMixer *mixer)
: SoundStream(mixer)
, m_mastering_voice(nullptr)
, m_volume(1.0f)
, m_cleanup_com(SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED)))
, m_cleanup_com(SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)))
{
}
+10 -10
View File
@@ -50,13 +50,13 @@ ALDeviceList::ALDeviceList()
defaultDeviceIndex = 0;
// grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices
//if (LoadOAL10Library(NULL, &ALFunction) == TRUE) {
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"))
//if (LoadOAL10Library(nullptr, &ALFunction) == TRUE) {
if (alcIsExtensionPresent(nullptr, "ALC_ENUMERATION_EXT"))
{
const char *devices = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
const char *defaultDeviceName = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
// go through device list (each device terminated with a single NULL, list terminated with double NULL)
for (s32 index = 0; devices != NULL && strlen(devices) > 0; index++, devices += strlen(devices) + 1)
const char *devices = alcGetString(nullptr, ALC_DEVICE_SPECIFIER);
const char *defaultDeviceName = alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER);
// go through device list (each device terminated with a single nullptr, list terminated with double nullptr)
for (s32 index = 0; devices != nullptr && strlen(devices) > 0; index++, devices += strlen(devices) + 1)
{
if (strcmp(defaultDeviceName, devices) == 0)
{
@@ -65,7 +65,7 @@ ALDeviceList::ALDeviceList()
ALCdevice *device = alcOpenDevice(devices);
if (device)
{
ALCcontext *context = alcCreateContext(device, NULL);
ALCcontext *context = alcCreateContext(device, nullptr);
if (context)
{
alcMakeContextCurrent(context);
@@ -79,7 +79,7 @@ ALDeviceList::ALDeviceList()
bNewName = false;
}
}
if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0))
if ((bNewName) && (actualDeviceName != nullptr) && (strlen(actualDeviceName) > 0))
{
ALDeviceInfo.bSelected = true;
ALDeviceInfo.strDeviceName = actualDeviceName;
@@ -120,7 +120,7 @@ ALDeviceList::ALDeviceList()
vDeviceInfo.push_back(ALDeviceInfo);
}
alcMakeContextCurrent(NULL);
alcMakeContextCurrent(nullptr);
alcDestroyContext(context);
}
alcCloseDevice(device);
@@ -163,7 +163,7 @@ char * ALDeviceList::GetDeviceName(s32 index)
if (index < GetNumDevices())
return (char *)vDeviceInfo[index].strDeviceName.c_str();
else
return NULL;
return nullptr;
}
/*
+5 -5
View File
@@ -14,7 +14,7 @@ const char procfile[] = "/proc/cpuinfo";
char *GetCPUString()
{
const char marker[] = "Hardware\t: ";
char *cpu_string = 0;
char *cpu_string = nullptr;
// Count the number of processor lines in /proc/cpuinfo
char buf[1024];
@@ -38,7 +38,7 @@ char *GetCPUString()
unsigned char GetCPUImplementer()
{
const char marker[] = "CPU implementer\t: ";
char *implementer_string = 0;
char *implementer_string = nullptr;
unsigned char implementer = 0;
char buf[1024];
@@ -65,7 +65,7 @@ unsigned char GetCPUImplementer()
unsigned short GetCPUPart()
{
const char marker[] = "CPU part\t: ";
char *part_string = 0;
char *part_string = nullptr;
unsigned short part = 0;
char buf[1024];
@@ -105,11 +105,11 @@ bool CheckCPUFeature(const char *feature)
continue;
char *featurestring = buf + sizeof(marker) - 1;
char *token = strtok(featurestring, " ");
while (token != NULL)
while (token != nullptr)
{
if (strstr(token, feature))
return true;
token = strtok(NULL, " ");
token = strtok(nullptr, " ");
}
}
+2 -2
View File
@@ -710,7 +710,7 @@ protected:
size_t region_size;
public:
ARMXCodeBlock() : region(NULL), region_size(0) {}
ARMXCodeBlock() : region(nullptr), region_size(0) {}
virtual ~ARMXCodeBlock() { if (region) FreeCodeSpace(); }
// Call this before you generate any code.
@@ -735,7 +735,7 @@ public:
{
#ifndef __SYMBIAN32__
FreeMemoryPages(region, region_size);
region = NULL;
region = nullptr;
#endif
region_size = 0;
}

Some files were not shown because too many files have changed in this diff Show More