clang-modernize -use-nullptr

and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine
This commit is contained in:
Tillmann Karras 2014-03-09 21:14:26 +01:00
parent f28116b7da
commit d802d39281
292 changed files with 1526 additions and 1526 deletions

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;
}
}

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;
}
}

View File

@ -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;
}

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;
}

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)
{

View File

@ -27,7 +27,7 @@ bool OpenALStream::Start()
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)
@ -83,7 +83,7 @@ void OpenALStream::Stop()
ALCcontext *pContext = alcGetCurrentContext();
ALCdevice *pDevice = alcGetContextsDevice(pContext);
alcMakeContextCurrent(NULL);
alcMakeContextCurrent(nullptr);
alcDestroyContext(pContext);
alcCloseDevice(pDevice);
}

View File

@ -44,7 +44,7 @@ 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)
{}

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

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
};

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).

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)
{
}

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)))
{
}

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)))
{
}

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;
}
/*

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, " ");
}
}

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;
}

View File

@ -152,7 +152,7 @@ void MemChecks::AddFromStrings(const TMemChecksStr& mcstrs)
void MemChecks::Add(const TMemCheck& _rMemoryCheck)
{
if (GetMemCheck(_rMemoryCheck.StartAddress) == 0)
if (GetMemCheck(_rMemoryCheck.StartAddress) == nullptr)
m_MemChecks.push_back(_rMemoryCheck);
}
@ -184,7 +184,7 @@ TMemCheck *MemChecks::GetMemCheck(u32 address)
}
// none found
return 0;
return nullptr;
}
void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr, bool write, int size, u32 pc)

View File

@ -41,7 +41,7 @@ std::vector<std::string> cdio_get_devices()
{
std::vector<std::string> drives;
const DWORD buffsize = GetLogicalDriveStrings(0, NULL);
const DWORD buffsize = GetLogicalDriveStrings(0, nullptr);
std::vector<TCHAR> buff(buffsize);
if (GetLogicalDriveStrings(buffsize, buff.data()) == buffsize - 1)
{
@ -77,7 +77,7 @@ std::vector<std::string> cdio_get_devices()
return( drives );
classes_to_match = IOServiceMatching( kIOCDMediaClass );
if( classes_to_match == NULL )
if( classes_to_match == nullptr )
return( drives );
CFDictionarySetValue( classes_to_match,
@ -101,7 +101,7 @@ std::vector<std::string> cdio_get_devices()
IORegistryEntryCreateCFProperty( next_media,
CFSTR( kIOBSDNameKey ), kCFAllocatorDefault,
0 );
if( str_bsd_path == NULL )
if( str_bsd_path == nullptr )
{
IOObjectRelease( next_media );
continue;
@ -118,7 +118,7 @@ std::vector<std::string> cdio_get_devices()
sizeof(psz_buf) - dev_path_length,
kCFStringEncodingASCII))
{
if(psz_buf != NULL)
if(psz_buf != nullptr)
{
std::string str = psz_buf;
drives.push_back(str);
@ -151,7 +151,7 @@ static struct
{ "/dev/acd%d", 0, 27 },
{ "/dev/cd%d", 0, 27 },
#endif
{ NULL, 0, 0 }
{ nullptr, 0, 0 }
};
// Returns true if a device is a block or char device and not a symbolic link
@ -196,7 +196,7 @@ std::vector<std::string> cdio_get_devices ()
for (unsigned int j = checklist[i].num_min; j <= checklist[i].num_max; ++j)
{
std::string drive = StringFromFormat(checklist[i].format, j);
if (is_cdrom(drive, NULL))
if (is_cdrom(drive, nullptr))
{
drives.push_back(std::move(drive));
}

View File

@ -206,7 +206,7 @@ public:
void DoLinkedList(LinkedListItem<T>*& list_start, LinkedListItem<T>** list_end=0)
{
LinkedListItem<T>* list_cur = list_start;
LinkedListItem<T>* prev = 0;
LinkedListItem<T>* prev = nullptr;
while (true)
{
@ -220,7 +220,7 @@ public:
{
if (mode == MODE_READ)
{
cur->next = 0;
cur->next = nullptr;
list_cur = cur;
if (prev)
prev->next = cur;
@ -239,13 +239,13 @@ public:
if (mode == MODE_READ)
{
if (prev)
prev->next = 0;
prev->next = nullptr;
if (list_end)
*list_end = prev;
if (list_cur)
{
if (list_start == list_cur)
list_start = 0;
list_start = nullptr;
do
{
LinkedListItem<T>* next = list_cur->next;
@ -393,7 +393,7 @@ public:
}
// Get data
u8 *ptr = 0;
u8 *ptr = nullptr;
PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
_class.DoState(p);
size_t const sz = (size_t)ptr;

View File

@ -127,7 +127,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){
// Restore the global locale
_configthreadlocale(_DISABLE_PER_THREAD_LOCALE);
}
else if(new_locale != NULL)
else if(new_locale != nullptr)
{
// Configure the thread to set the locale only for this thread
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);

View File

@ -18,7 +18,7 @@
ConsoleListener::ConsoleListener()
{
#ifdef _WIN32
hConsole = NULL;
hConsole = nullptr;
bUseColor = true;
#else
bUseColor = isatty(fileno(stdout));
@ -68,19 +68,19 @@ void ConsoleListener::UpdateHandle()
void ConsoleListener::Close()
{
#ifdef _WIN32
if (hConsole == NULL)
if (hConsole == nullptr)
return;
FreeConsole();
hConsole = NULL;
hConsole = nullptr;
#else
fflush(NULL);
fflush(nullptr);
#endif
}
bool ConsoleListener::IsOpen()
{
#ifdef _WIN32
return (hConsole != NULL);
return (hConsole != nullptr);
#else
return true;
#endif
@ -280,11 +280,11 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
{
// First 10 chars white
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
WriteConsole(hConsole, Text, 10, &cCharsWritten, NULL);
WriteConsole(hConsole, Text, 10, &cCharsWritten, nullptr);
Text += 10;
}
SetConsoleTextAttribute(hConsole, Color);
WriteConsole(hConsole, Text, (DWORD)strlen(Text), &cCharsWritten, NULL);
WriteConsole(hConsole, Text, (DWORD)strlen(Text), &cCharsWritten, nullptr);
#else
char ColorAttr[16] = "";
char ResetAttr[16] = "";

View File

@ -316,7 +316,7 @@ void point_mul(u8 *d, const u8 *a, const u8 *b) // a is bignum
static void silly_random(u8 * rndArea, u8 count)
{
u16 i;
srand((unsigned) (time(NULL)));
srand((unsigned) (time(nullptr)));
for(i=0;i<count;i++)
{

View File

@ -84,7 +84,7 @@ static void InitSymbolPath( PSTR lpszSymbolPath, PCSTR lpszIniPath )
}
// Add user defined path
if ( lpszIniPath != NULL )
if ( lpszIniPath != nullptr )
if ( lpszIniPath[0] != '\0' )
{
strcat( lpszSymbolPath, ";" );
@ -140,7 +140,7 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L
DWORD dwSymSize = 10000;
TCHAR lpszUnDSymbol[BUFFERSIZE]=_T("?");
CHAR lpszNonUnicodeUnDSymbol[BUFFERSIZE]="?";
LPTSTR lpszParamSep = NULL;
LPTSTR lpszParamSep = nullptr;
LPTSTR lpszParsed = lpszUnDSymbol;
PIMAGEHLP_SYMBOL pSym = (PIMAGEHLP_SYMBOL)GlobalAlloc( GMEM_FIXED, dwSymSize );
@ -193,13 +193,13 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L
// Let's go through the stack, and modify the function prototype, and insert the actual
// parameter values from the stack
if ( _tcsstr( lpszUnDSymbol, _T("(void)") ) == NULL && _tcsstr( lpszUnDSymbol, _T("()") ) == NULL)
if ( _tcsstr( lpszUnDSymbol, _T("(void)") ) == nullptr && _tcsstr( lpszUnDSymbol, _T("()") ) == nullptr)
{
ULONG index = 0;
for( ; ; index++ )
{
lpszParamSep = _tcschr( lpszParsed, _T(',') );
if ( lpszParamSep == NULL )
if ( lpszParamSep == nullptr )
break;
*lpszParamSep = _T('\0');
@ -211,7 +211,7 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L
}
lpszParamSep = _tcschr( lpszParsed, _T(')') );
if ( lpszParamSep != NULL )
if ( lpszParamSep != nullptr )
{
*lpszParamSep = _T('\0');
@ -254,7 +254,7 @@ static BOOL GetSourceInfoFromAddress( UINT address, LPTSTR lpszSourceInfo )
PCSTR2LPTSTR( lineInfo.FileName, lpszFileName );
TCHAR fname[_MAX_FNAME];
TCHAR ext[_MAX_EXT];
_tsplitpath(lpszFileName, NULL, NULL, fname, ext);
_tsplitpath(lpszFileName, nullptr, nullptr, fname, ext);
_stprintf( lpszSourceInfo, _T("%s%s(%d)"), fname, ext, lineInfo.LineNumber );
ret = TRUE;
}
@ -338,11 +338,11 @@ void StackTrace( HANDLE hThread, const char* lpszMessage, FILE *file )
hProcess,
hThread,
&callStack,
NULL,
NULL,
nullptr,
nullptr,
SymFunctionTableAccess,
SymGetModuleBase,
NULL);
nullptr);
if ( index == 0 )
continue;
@ -393,11 +393,11 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
hProcess,
hThread,
&callStack,
NULL,
NULL,
nullptr,
nullptr,
SymFunctionTableAccess,
SymGetModuleBase,
NULL);
nullptr);
if ( index == 0 )
continue;

View File

@ -65,8 +65,8 @@ public:
ElementPtr *tmpptr = m_read_ptr;
// advance the read pointer
m_read_ptr = AtomicLoad(tmpptr->next);
// set the next element to NULL to stop the recursive deletion
tmpptr->next = NULL;
// set the next element to nullptr to stop the recursive deletion
tmpptr->next = nullptr;
delete tmpptr; // this also deletes the element
}
@ -81,7 +81,7 @@ public:
ElementPtr *tmpptr = m_read_ptr;
m_read_ptr = AtomicLoadAcquire(tmpptr->next);
t = std::move(tmpptr->current);
tmpptr->next = NULL;
tmpptr->next = nullptr;
delete tmpptr;
return true;
}
@ -100,7 +100,7 @@ private:
class ElementPtr
{
public:
ElementPtr() : next(NULL) {}
ElementPtr() : next(nullptr) {}
~ElementPtr()
{

View File

@ -150,7 +150,7 @@ bool CreateDir(const std::string &path)
{
INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str());
#ifdef _WIN32
if (::CreateDirectory(UTF8ToTStr(path).c_str(), NULL))
if (::CreateDirectory(UTF8ToTStr(path).c_str(), nullptr))
return true;
DWORD error = GetLastError();
if (error == ERROR_ALREADY_EXISTS)
@ -250,7 +250,7 @@ bool Rename(const std::string &srcFilename, const std::string &destFilename)
auto df = UTF8ToTStr(destFilename);
// The Internet seems torn about whether ReplaceFile is atomic or not.
// Hopefully it's atomic enough...
if (ReplaceFile(df.c_str(), sf.c_str(), NULL, REPLACEFILE_IGNORE_MERGE_ERRORS, NULL, NULL))
if (ReplaceFile(df.c_str(), sf.c_str(), nullptr, REPLACEFILE_IGNORE_MERGE_ERRORS, nullptr, nullptr))
return true;
// Might have failed because the destination doesn't exist.
if (GetLastError() == ERROR_FILE_NOT_FOUND)
@ -481,7 +481,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
FSTEntry entry;
const std::string virtualName(TStrToUTF8(ffd.cFileName));
#else
struct dirent dirent, *result = NULL;
struct dirent dirent, *result = nullptr;
DIR *dirp = opendir(directory.c_str());
if (!dirp)
@ -549,7 +549,7 @@ bool DeleteDirRecursively(const std::string &directory)
{
const std::string virtualName(TStrToUTF8(ffd.cFileName));
#else
struct dirent dirent, *result = NULL;
struct dirent dirent, *result = nullptr;
DIR *dirp = opendir(directory.c_str());
if (!dirp)
return false;
@ -623,7 +623,7 @@ void CopyDir(const std::string &source_path, const std::string &dest_path)
{
const std::string virtualName(TStrToUTF8(ffd.cFileName));
#else
struct dirent dirent, *result = NULL;
struct dirent dirent, *result = nullptr;
DIR *dirp = opendir(source_path.c_str());
if (!dirp) return;
@ -660,11 +660,11 @@ std::string GetCurrentDir()
{
char *dir;
// Get the current working directory (getcwd uses malloc)
if (!(dir = __getcwd(NULL, 0))) {
if (!(dir = __getcwd(nullptr, 0))) {
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s",
GetLastErrorMsg());
return NULL;
return nullptr;
}
std::string strDir = dir;
free(dir);
@ -682,11 +682,11 @@ std::string GetTempFilenameForAtomicWrite(const std::string &path)
std::string abs = path;
#ifdef _WIN32
TCHAR absbuf[MAX_PATH];
if (_tfullpath(absbuf, UTF8ToTStr(path).c_str(), MAX_PATH) != NULL)
if (_tfullpath(absbuf, UTF8ToTStr(path).c_str(), MAX_PATH) != nullptr)
abs = TStrToUTF8(absbuf);
#else
char absbuf[PATH_MAX];
if (realpath(path.c_str(), absbuf) != NULL)
if (realpath(path.c_str(), absbuf) != nullptr)
abs = absbuf;
#endif
return abs + ".xxx";
@ -715,7 +715,7 @@ std::string& GetExeDirectory()
if (DolphinPath.empty())
{
TCHAR Dolphin_exe_Path[2048];
GetModuleFileName(NULL, Dolphin_exe_Path, 2048);
GetModuleFileName(nullptr, Dolphin_exe_Path, 2048);
DolphinPath = TStrToUTF8(Dolphin_exe_Path);
DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\'));
}
@ -767,14 +767,14 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
HKEY hkey;
DWORD local = 0;
TCHAR configPath[MAX_PATH] = {0};
if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Dolphin Emulator"), NULL, KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS)
if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS)
{
DWORD size = 4;
if (RegQueryValueEx(hkey, TEXT("LocalUserConfig"), NULL, NULL, reinterpret_cast<LPBYTE>(&local), &size) != ERROR_SUCCESS)
if (RegQueryValueEx(hkey, TEXT("LocalUserConfig"), nullptr, nullptr, reinterpret_cast<LPBYTE>(&local), &size) != ERROR_SUCCESS)
local = 0;
size = MAX_PATH;
if (RegQueryValueEx(hkey, TEXT("UserConfigPath"), NULL, NULL, (LPBYTE)configPath, &size) != ERROR_SUCCESS)
if (RegQueryValueEx(hkey, TEXT("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath, &size) != ERROR_SUCCESS)
configPath[0] = 0;
RegCloseKey(hkey);
}
@ -783,7 +783,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
// Get Program Files path in case we need it.
TCHAR my_documents[MAX_PATH];
bool my_documents_found = SUCCEEDED(SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, my_documents));
bool my_documents_found = SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, my_documents));
if (local) // Case 1-2
paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
@ -960,7 +960,7 @@ bool ReadFileToString(const char *filename, std::string &str)
}
IOFile::IOFile()
: m_file(NULL), m_good(true)
: m_file(nullptr), m_good(true)
{}
IOFile::IOFile(std::FILE* file)
@ -968,7 +968,7 @@ IOFile::IOFile(std::FILE* file)
{}
IOFile::IOFile(const std::string& filename, const char openmode[])
: m_file(NULL), m_good(true)
: m_file(nullptr), m_good(true)
{
Open(filename, openmode);
}
@ -979,7 +979,7 @@ IOFile::~IOFile()
}
IOFile::IOFile(IOFile&& other)
: m_file(NULL), m_good(true)
: m_file(nullptr), m_good(true)
{
Swap(other);
}
@ -1014,14 +1014,14 @@ bool IOFile::Close()
if (!IsOpen() || 0 != std::fclose(m_file))
m_good = false;
m_file = NULL;
m_file = nullptr;
return m_good;
}
std::FILE* IOFile::ReleaseHandle()
{
std::FILE* const ret = m_file;
m_file = NULL;
m_file = nullptr;
return ret;
}

View File

@ -167,7 +167,7 @@ public:
bool Close();
template <typename T>
bool ReadArray(T* data, size_t length, size_t* pReadBytes = NULL)
bool ReadArray(T* data, size_t length, size_t* pReadBytes = nullptr)
{
size_t read_bytes = 0;
if (!IsOpen() || length != (read_bytes = std::fread(data, sizeof(T), length, m_file)))
@ -198,11 +198,11 @@ public:
return WriteArray(reinterpret_cast<const char*>(data), length);
}
bool IsOpen() { return NULL != m_file; }
bool IsOpen() { return nullptr != m_file; }
// m_good is set to false when a read, write or other function fails
bool IsGood() { return m_good; }
operator void*() { return m_good ? m_file : NULL; }
operator void*() { return m_good ? m_file : nullptr; }
std::FILE* ReleaseHandle();

View File

@ -212,7 +212,7 @@ const IniFile::Section* IniFile::GetSection(const std::string& sectionName) cons
for (const Section& sect : sections)
if (!strcasecmp(sect.name.c_str(), sectionName.c_str()))
return (&(sect));
return 0;
return nullptr;
}
IniFile::Section* IniFile::GetSection(const std::string& sectionName)
@ -220,7 +220,7 @@ IniFile::Section* IniFile::GetSection(const std::string& sectionName)
for (Section& sect : sections)
if (!strcasecmp(sect.name.c_str(), sectionName.c_str()))
return (&(sect));
return 0;
return nullptr;
}
IniFile::Section* IniFile::GetOrCreateSection(const std::string& sectionName)
@ -335,7 +335,7 @@ bool IniFile::Load(const std::string& filename, bool keep_current_data)
if (in.fail()) return false;
Section* current_section = NULL;
Section* current_section = nullptr;
while (!in.eof())
{
char templine[MAX_BYTES];

View File

@ -70,7 +70,7 @@ public:
// good header, read some key/value pairs
K key;
V *value = NULL;
V *value = nullptr;
u32 value_size;
u32 entry_number;

View File

@ -30,7 +30,7 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
va_end(args);
}
LogManager *LogManager::m_logManager = NULL;
LogManager *LogManager::m_logManager = nullptr;
LogManager::LogManager()
{
@ -145,7 +145,7 @@ void LogManager::Init()
void LogManager::Shutdown()
{
delete m_logManager;
m_logManager = NULL;
m_logManager = nullptr;
}
LogContainer::LogContainer(const char* shortName, const char* fullName, bool enable)

View File

@ -52,7 +52,7 @@ int AshmemCreateFileMapping(const char *name, size_t size)
void MemArena::GrabLowMemSpace(size_t size)
{
#ifdef _WIN32
hMemoryMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, (DWORD)(size), NULL);
hMemoryMapping = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, (DWORD)(size), nullptr);
#elif defined(ANDROID)
fd = AshmemCreateFileMapping("Dolphin-emu", size);
if (fd < 0)
@ -190,9 +190,9 @@ static bool Memory_TryBase(u8 *base, const MemoryView *views, int num_views, u32
for (int i = 0; i < num_views; i++)
{
if (views[i].out_ptr_low)
*views[i].out_ptr_low = 0;
*views[i].out_ptr_low = nullptr;
if (views[i].out_ptr)
*views[i].out_ptr = 0;
*views[i].out_ptr = nullptr;
}
int i;
@ -255,13 +255,13 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
{
PanicAlert("MemoryMap_Setup: Failed finding a memory base.");
exit(0);
return 0;
return nullptr;
}
#else
#ifdef _WIN32
// Try a whole range of possible bases. Return once we got a valid one.
u32 max_base_addr = 0x7FFF0000 - 0x31000000;
u8 *base = NULL;
u8 *base = nullptr;
for (u32 base_addr = 0x40000; base_addr < max_base_addr; base_addr += 0x40000)
{
@ -304,7 +304,7 @@ void MemoryMap_Shutdown(const MemoryView *views, int num_views, u32 flags, MemAr
{
arena->ReleaseView(*outptr, view->size);
freeset.insert(*outptr);
*outptr = NULL;
*outptr = nullptr;
}
}
}

View File

@ -31,7 +31,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
#if defined(_WIN32)
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#else
static char *map_hint = 0;
static char *map_hint = nullptr;
#if defined(__x86_64__) && !defined(MAP_32BIT)
// This OS has no flag to enforce allocation below the 4 GB boundary,
// but if we hint that we want a low address it is very likely we will
@ -56,9 +56,9 @@ void* AllocateExecutableMemory(size_t size, bool low)
#if defined(__FreeBSD__)
if (ptr == MAP_FAILED)
{
ptr = NULL;
ptr = nullptr;
#else
if (ptr == NULL)
if (ptr == nullptr)
{
#endif
PanicAlert("Failed to allocate executable memory");
@ -88,14 +88,14 @@ void* AllocateMemoryPages(size_t size)
#ifdef _WIN32
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
#else
void* ptr = mmap(0, size, PROT_READ | PROT_WRITE,
void* ptr = mmap(nullptr, size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);
#endif
// printf("Mapped memory at %p (size %ld)\n", ptr,
// (unsigned long)size);
if (ptr == NULL)
if (ptr == nullptr)
PanicAlert("Failed to allocate raw memory");
return ptr;
@ -106,7 +106,7 @@ void* AllocateAlignedMemory(size_t size,size_t alignment)
#ifdef _WIN32
void* ptr = _aligned_malloc(size,alignment);
#else
void* ptr = NULL;
void* ptr = nullptr;
#ifdef ANDROID
ptr = memalign(alignment, size);
#else
@ -118,7 +118,7 @@ void* AllocateAlignedMemory(size_t size,size_t alignment)
// printf("Mapped memory at %p (size %ld)\n", ptr,
// (unsigned long)size);
if (ptr == NULL)
if (ptr == nullptr)
PanicAlert("Failed to allocate aligned memory");
return ptr;
@ -185,7 +185,7 @@ std::string MemUsage()
// Print information about the memory usage of the process.
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID);
if (NULL == hProcess) return "MemUsage Error";
if (nullptr == hProcess) return "MemUsage Error";
if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc)))
Ret = StringFromFormat("%s K", ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str());

View File

@ -21,9 +21,9 @@ const char* GetLastErrorMsg()
#ifdef _WIN32
static __declspec(thread) char err_str[buff_size] = {};
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
err_str, buff_size, NULL);
err_str, buff_size, nullptr);
#else
static __thread char err_str[buff_size] = {};

View File

@ -72,9 +72,9 @@ public:
#if defined(_WIN32) && defined(USE_CONDITION_VARIABLES)
InitializeConditionVariable(&m_handle);
#elif defined(_WIN32)
m_handle = CreateEvent(NULL, false, false, NULL);
m_handle = CreateEvent(nullptr, false, false, nullptr);
#else
pthread_cond_init(&m_handle, NULL);
pthread_cond_init(&m_handle, nullptr);
#endif
}

View File

@ -143,7 +143,7 @@ public:
#ifdef _WIN32
InitializeSRWLock(&m_handle);
#else
pthread_mutex_init(&m_handle, NULL);
pthread_mutex_init(&m_handle, nullptr);
#endif
}
@ -238,7 +238,7 @@ public:
typedef Mutex mutex_type;
unique_lock()
: pm(NULL), owns(false)
: pm(nullptr), owns(false)
{}
/*explicit*/ unique_lock(mutex_type& m)
@ -290,11 +290,11 @@ public:
unique_lock(const unique_lock&) /*= delete*/;
unique_lock(unique_lock&& other)
: pm(NULL), owns(false)
: pm(nullptr), owns(false)
{
#else
unique_lock(const unique_lock& u)
: pm(NULL), owns(false)
: pm(nullptr), owns(false)
{
// ugly const_cast to get around lack of rvalue references
unique_lock& other = const_cast<unique_lock&>(u);
@ -335,7 +335,7 @@ public:
{
auto const ret = mutex();
pm = NULL;
pm = nullptr;
owns = false;
return ret;

View File

@ -193,7 +193,7 @@ public:
WaitForSingleObject(m_handle, INFINITE);
detach();
#else
pthread_join(m_id.m_thread, NULL);
pthread_join(m_id.m_thread, nullptr);
m_id = id();
#endif
}
@ -238,9 +238,9 @@ private:
void StartThread(F* param)
{
#ifdef USE_BEGINTHREADEX
m_handle = (HANDLE)_beginthreadex(NULL, 0, &RunAndDelete<F>, param, 0, &m_id.m_thread);
m_handle = (HANDLE)_beginthreadex(nullptr, 0, &RunAndDelete<F>, param, 0, &m_id.m_thread);
#elif defined(_WIN32)
m_handle = CreateThread(NULL, 0, &RunAndDelete<F>, param, 0, &m_id.m_thread);
m_handle = CreateThread(nullptr, 0, &RunAndDelete<F>, param, 0, &m_id.m_thread);
#else
pthread_attr_t attr;
pthread_attr_init(&attr);

View File

@ -28,7 +28,7 @@
// faster than sscanf
bool AsciiToHex(const char* _szValue, u32& result)
{
char *endptr = NULL;
char *endptr = nullptr;
const u32 value = strtoul(_szValue, &endptr, 16);
if (!endptr || *endptr)
@ -66,7 +66,7 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar
// will be present in the middle of a multibyte sequence.
//
// This is why we lookup an ANSI (cp1252) locale here and use _vsnprintf_l.
static locale_t c_locale = NULL;
static locale_t c_locale = nullptr;
if (!c_locale)
c_locale = _create_locale(LC_ALL, ".1252");
writtenCount = _vsnprintf_l(out, outsize, format, c_locale, args);
@ -89,7 +89,7 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar
std::string StringFromFormat(const char* format, ...)
{
va_list args;
char *buf = NULL;
char *buf = nullptr;
#ifdef _WIN32
int required = 0;
@ -159,7 +159,7 @@ std::string StripQuotes(const std::string& s)
bool TryParse(const std::string &str, u32 *const output)
{
char *endptr = NULL;
char *endptr = nullptr;
// Reset errno to a value other than ERANGE
errno = 0;

View File

@ -46,7 +46,7 @@ Symbol *SymbolDB::GetSymbolFromName(const char *name)
if (!strcmp(func.second.name.c_str(), name))
return &func.second;
}
return 0;
return nullptr;
}
void SymbolDB::AddCompleteSymbol(const Symbol &symbol)

View File

@ -79,8 +79,8 @@ protected:
public:
SymbolDB() {}
virtual ~SymbolDB() {}
virtual Symbol *GetSymbolFromAddr(u32 addr) { return 0; }
virtual Symbol *AddFunction(u32 startAddr) { return 0;}
virtual Symbol *GetSymbolFromAddr(u32 addr) { return nullptr; }
virtual Symbol *AddFunction(u32 startAddr) { return nullptr;}
void AddCompleteSymbol(const Symbol &symbol);
@ -90,7 +90,7 @@ public:
if (iter != checksumToFunction.end())
return iter->second;
else
return 0;
return nullptr;
}
const XFuncMap &Symbols() const {return functions;}

View File

@ -27,7 +27,7 @@ u32 Timer::GetTimeMs()
return timeGetTime();
#else
struct timeval t;
(void)gettimeofday(&t, NULL);
(void)gettimeofday(&t, nullptr);
return ((u32)(t.tv_sec * 1000 + t.tv_usec / 1000));
#endif
}
@ -184,7 +184,7 @@ std::string Timer::GetTimeFormatted()
return StringFromFormat("%s:%03i", tmp, tp.millitm);
#else
struct timeval t;
(void)gettimeofday(&t, NULL);
(void)gettimeofday(&t, nullptr);
return StringFromFormat("%s:%03d", tmp, (int)(t.tv_usec / 1000));
#endif
}
@ -198,7 +198,7 @@ double Timer::GetDoubleTime()
(void)::ftime(&tp);
#else
struct timeval t;
(void)gettimeofday(&t, NULL);
(void)gettimeofday(&t, nullptr);
#endif
// Get continuous timestamp
u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970();

View File

@ -265,7 +265,7 @@ protected:
inline void Write64(u64 value) {*(u64*)code = (value); code += 8;}
public:
XEmitter() { code = NULL; }
XEmitter() { code = nullptr; }
XEmitter(u8 *code_ptr) { code = code_ptr; }
virtual ~XEmitter() {}
@ -773,7 +773,7 @@ protected:
size_t region_size;
public:
XCodeBlock() : region(NULL), region_size(0) {}
XCodeBlock() : region(nullptr), region_size(0) {}
virtual ~XCodeBlock() { if (region) FreeCodeSpace(); }
// Call this before you generate any code.
@ -797,7 +797,7 @@ public:
void FreeCodeSpace()
{
FreeMemoryPages(region, region_size);
region = NULL;
region = nullptr;
region_size = 0;
}

View File

@ -72,7 +72,7 @@ enum
};
// pointer to the code currently being run, (used by log messages that include the code name)
static ARCode const* current_code = NULL;
static ARCode const* current_code = nullptr;
static bool b_RanOnce = false;
static std::vector<ARCode> arCodes;

View File

@ -81,6 +81,6 @@ void InstallExceptionHandler()
sa.sa_sigaction = &sigsegv_handler;
sa.sa_flags = SA_SIGINFO;
sigemptyset(&sa.sa_mask);
sigaction(SIGSEGV, &sa, NULL);
sigaction(SIGSEGV, &sa, nullptr);
}
} // namespace

View File

@ -125,7 +125,7 @@ bool CBoot::FindMapFile(std::string* existing_map_file,
bool CBoot::LoadMapFromFilename()
{
std::string strMapFilename;
bool found = FindMapFile(&strMapFilename, NULL);
bool found = FindMapFile(&strMapFilename, nullptr);
if (found && g_symbolDB.LoadMap(strMapFilename.c_str()))
{
UpdateDebugger_MapLoaded();
@ -201,7 +201,7 @@ bool CBoot::BootUp()
case SCoreStartupParameter::BOOT_ISO:
{
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_StartupPara.m_strFilename);
if (pVolume == NULL)
if (pVolume == nullptr)
break;
bool isoWii = DiscIO::IsVolumeWiiDisc(pVolume);

View File

@ -30,10 +30,10 @@ public:
// Tries to find a map file for the current game by looking first in the
// local user directory, then in the shared user directory.
//
// If existing_map_file is not NULL and a map file exists, it is set to the
// If existing_map_file is not nullptr and a map file exists, it is set to the
// path to the existing map file.
//
// If writable_map_file is not NULL, it is set to the path to where a map
// If writable_map_file is not nullptr, it is set to the path to where a map
// file should be saved.
//
// Returns true if a map file exists, false if none could be found.
@ -43,7 +43,7 @@ public:
private:
static void RunFunction(u32 _iAddr);
static void UpdateDebugger_MapLoaded(const char* _gameID = NULL);
static void UpdateDebugger_MapLoaded(const char* _gameID = nullptr);
static bool LoadMapFromFilename();
static bool Boot_ELF(const char *filename);

View File

@ -34,13 +34,13 @@ CDolLoader::~CDolLoader()
for (auto& sect : text_section)
{
delete [] sect;
sect = NULL;
sect = nullptr;
}
for (auto& sect : data_section)
{
delete [] sect;
sect = NULL;
sect = nullptr;
}
}
@ -54,9 +54,9 @@ void CDolLoader::Initialize(u8* _pBuffer, u32 _Size)
p[i] = Common::swap32(p[i]);
for (auto& sect : text_section)
sect = NULL;
sect = nullptr;
for (auto& sect : data_section)
sect = NULL;
sect = nullptr;
u32 HID4_pattern = 0x7c13fba6;
u32 HID4_mask = 0xfc1fffff;

View File

@ -90,7 +90,7 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename)
// DOL
const DiscIO::SNANDContent* pContent = ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex());
if (pContent == NULL)
if (pContent == nullptr)
return false;
WII_IPC_HLE_Interface::SetDefaultContentFile(_pFilename);
@ -119,7 +119,7 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename)
// Load patches and run startup patches
const DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_pFilename);
if (pVolume != NULL)
if (pVolume != nullptr)
PatchEngine::LoadPatches();
return true;

View File

@ -82,7 +82,7 @@ ElfReader::ElfReader(void *ptr)
const char *ElfReader::GetSectionName(int section) const
{
if (sections[section].sh_type == SHT_NULL)
return NULL;
return nullptr;
int nameOffset = sections[section].sh_name;
char *ptr = (char*)GetSectionDataPtr(header->e_shstrndx);
@ -90,7 +90,7 @@ const char *ElfReader::GetSectionName(int section) const
if (ptr)
return ptr + nameOffset;
else
return NULL;
return nullptr;
}
bool ElfReader::LoadInto(u32 vaddr)
@ -181,7 +181,7 @@ SectionID ElfReader::GetSectionByName(const char *name, int firstSection) const
{
const char *secname = GetSectionName(i);
if (secname != NULL && strcmp(name, secname) == 0)
if (secname != nullptr && strcmp(name, secname) == 0)
return i;
}
return -1;

View File

@ -51,11 +51,11 @@ public:
const u8 *GetSectionDataPtr(int section) const
{
if (section < 0 || section >= header->e_shnum)
return 0;
return nullptr;
if (sections[section].sh_type != SHT_NOBITS)
return GetPtr(sections[section].sh_offset);
else
return 0;
return nullptr;
}
bool IsCodeSection(int section) const
{

View File

@ -125,7 +125,7 @@ void SConfig::Init()
void SConfig::Shutdown()
{
delete m_Instance;
m_Instance = NULL;
m_Instance = nullptr;
}
SConfig::~SConfig()

View File

@ -79,7 +79,7 @@ void EmuThread();
bool g_bStopping = false;
bool g_bHwInit = false;
bool g_bStarted = false;
void *g_pWindowHandle = NULL;
void *g_pWindowHandle = nullptr;
std::string g_stateFileName;
std::thread g_EmuThread;

View File

@ -21,7 +21,7 @@
#include "DiscIO/VolumeCreator.h"
SCoreStartupParameter::SCoreStartupParameter()
: hInstance(0),
: hInstance(nullptr),
bEnableDebugging(false), bAutomaticStart(false), bBootToPause(false),
bJITNoBlockCache(false), bJITBlockLinking(true),
bJITOff(false),
@ -125,7 +125,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
}
std::string Extension;
SplitPath(m_strFilename, NULL, NULL, &Extension);
SplitPath(m_strFilename, nullptr, nullptr, &Extension);
if (!strcasecmp(Extension.c_str(), ".gcm") ||
!strcasecmp(Extension.c_str(), ".iso") ||
!strcasecmp(Extension.c_str(), ".wbfs") ||
@ -135,7 +135,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
{
m_BootType = BOOT_ISO;
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(m_strFilename);
if (pVolume == NULL)
if (pVolume == nullptr)
{
if (bootDrive)
PanicAlertT("Could not read \"%s\". "
@ -223,7 +223,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
const DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(m_strFilename);
const DiscIO::INANDContentLoader& ContentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename);
if (ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex()) == NULL)
if (ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex()) == nullptr)
{
//WAD is valid yet cannot be booted. Install instead.
u64 installed = DiscIO::CNANDContentManager::Access().Install_WiiWAD(m_strFilename);

View File

@ -43,7 +43,7 @@ static std::mutex tsWriteLock;
Common::FifoQueue<BaseEvent, false> tsQueue;
// event pools
Event *eventPool = 0;
Event *eventPool = nullptr;
int downcount, slicelength;
int maxSliceLength = MAX_SLICE_LENGTH;
@ -59,7 +59,7 @@ u64 fakeTBStartTicks;
int ev_lost;
void (*advanceCallback)(int cyclesExecuted) = NULL;
void (*advanceCallback)(int cyclesExecuted) = nullptr;
Event* GetNewEvent()
{
@ -236,7 +236,7 @@ void ClearPendingEvents()
void AddEventToQueue(Event* ne)
{
Event* prev = NULL;
Event* prev = nullptr;
Event** pNext = &first;
for(;;)
{

View File

@ -79,7 +79,7 @@ static const char *err_string[] =
};
DSPAssembler::DSPAssembler(const AssemblerSettings &settings) :
gdg_buffer(NULL),
gdg_buffer(nullptr),
m_cur_addr(0),
m_cur_pass(0),
m_current_param(0),
@ -127,7 +127,7 @@ bool DSPAssembler::Assemble(const char *text, std::vector<u16> &code, std::vecto
if(gdg_buffer) {
free(gdg_buffer);
gdg_buffer = NULL;
gdg_buffer = nullptr;
}
last_error_str = "(no errors)";
@ -310,7 +310,7 @@ char *DSPAssembler::FindBrackets(char *src, char *dst)
}
if (count)
ShowError(ERR_NO_MATCHING_BRACKETS);
return NULL;
return nullptr;
}
// Bizarre in-place expression evaluator.
@ -323,7 +323,7 @@ u32 DSPAssembler::ParseExpression(const char *ptr)
char *s_buffer = (char *)malloc(1024);
strcpy(s_buffer, ptr);
while ((pbuf = FindBrackets(s_buffer, d_buffer)) != NULL)
while ((pbuf = FindBrackets(s_buffer, d_buffer)) != nullptr)
{
val = ParseExpression(d_buffer);
sprintf(d_buffer, "%s%d%s", s_buffer, val, pbuf);
@ -359,14 +359,14 @@ u32 DSPAssembler::ParseExpression(const char *ptr)
d_buffer[i] = c;
}
while ((pbuf = strstr(d_buffer, "+")) != NULL)
while ((pbuf = strstr(d_buffer, "+")) != nullptr)
{
*pbuf = 0x0;
val = ParseExpression(d_buffer) + ParseExpression(pbuf+1);
sprintf(d_buffer, "%d", val);
}
while ((pbuf = strstr(d_buffer, "-")) != NULL)
while ((pbuf = strstr(d_buffer, "-")) != nullptr)
{
*pbuf = 0x0;
val = ParseExpression(d_buffer) - ParseExpression(pbuf+1);
@ -378,28 +378,28 @@ u32 DSPAssembler::ParseExpression(const char *ptr)
sprintf(d_buffer, "%d", val);
}
while ((pbuf = strstr(d_buffer, "*")) != NULL)
while ((pbuf = strstr(d_buffer, "*")) != nullptr)
{
*pbuf = 0x0;
val = ParseExpression(d_buffer) * ParseExpression(pbuf+1);
sprintf(d_buffer, "%d", val);
}
while ((pbuf = strstr(d_buffer, "/")) != NULL)
while ((pbuf = strstr(d_buffer, "/")) != nullptr)
{
*pbuf = 0x0;
val = ParseExpression(d_buffer) / ParseExpression(pbuf+1);
sprintf(d_buffer, "%d", val);
}
while ((pbuf = strstr(d_buffer, "|")) != NULL)
while ((pbuf = strstr(d_buffer, "|")) != nullptr)
{
*pbuf = 0x0;
val = ParseExpression(d_buffer) | ParseExpression(pbuf+1);
sprintf(d_buffer, "%d", val);
}
while ((pbuf = strstr(d_buffer, "&")) != NULL)
while ((pbuf = strstr(d_buffer, "&")) != nullptr)
{
*pbuf = 0x0;
val = ParseExpression(d_buffer) & ParseExpression(pbuf+1);
@ -420,7 +420,7 @@ u32 DSPAssembler::GetParams(char *parstr, param_t *par)
tmpstr = strtok(tmpstr, ",\x00");
for (int i = 0; i < 10; i++)
{
if (tmpstr == NULL)
if (tmpstr == nullptr)
break;
tmpstr = skip_spaces(tmpstr);
if (strlen(tmpstr) == 0)
@ -463,7 +463,7 @@ u32 DSPAssembler::GetParams(char *parstr, param_t *par)
par[i].type = P_VAL;
break;
}
tmpstr = strtok(NULL, ",\x00");
tmpstr = strtok(nullptr, ",\x00");
}
return count;
}
@ -493,7 +493,7 @@ const opc_t *DSPAssembler::FindOpcode(const char *opcode, u32 par_count, const o
}
}
ShowError(ERR_UNKNOWN_OPCODE);
return NULL;
return nullptr;
}
// weird...
@ -780,8 +780,8 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
//printf("A: %s\n", line);
code_line++;
param_t params[10] = {{0, P_NONE, NULL}};
param_t params_ext[10] = {{0, P_NONE, NULL}};
param_t params[10] = {{0, P_NONE, nullptr}};
param_t params_ext[10] = {{0, P_NONE, nullptr}};
bool upper = true;
for (int i = 0; i < LINEBUF_SIZE; i++)
@ -851,33 +851,33 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
}
}
char *opcode = NULL;
char *opcode = nullptr;
opcode = strtok(ptr, " ");
char *opcode_ext = NULL;
char *opcode_ext = nullptr;
u32 params_count = 0;
u32 params_count_ext = 0;
if (opcode)
{
if ((opcode_ext = strstr(opcode, "'")) != NULL)
if ((opcode_ext = strstr(opcode, "'")) != nullptr)
{
opcode_ext[0] = '\0';
opcode_ext++;
if (strlen(opcode_ext) == 0)
opcode_ext = NULL;
opcode_ext = nullptr;
}
// now we have opcode and label
params_count = 0;
params_count_ext = 0;
char *paramstr = strtok(NULL, "\0");
char *paramstr_ext = 0;
char *paramstr = strtok(nullptr, "\0");
char *paramstr_ext = nullptr;
// there is valid opcode so probably we have parameters
if (paramstr)
{
if ((paramstr_ext = strstr(paramstr, ":")) != NULL)
if ((paramstr_ext = strstr(paramstr, ":")) != nullptr)
{
paramstr_ext[0] = '\0';
paramstr_ext++;
@ -899,14 +899,14 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
if (strcmp(opcode, "EQU") == 0)
{
lval = params[0].val;
opcode = NULL;
opcode = nullptr;
}
}
if (pass == 1)
labels.RegisterLabel(label, lval);
}
if (opcode == NULL)
if (opcode == nullptr)
continue;
// check if opcode is reserved compiler word
@ -981,7 +981,7 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
VerifyParams(opc, params, params_count);
const opc_t *opc_ext = NULL;
const opc_t *opc_ext = nullptr;
// Check for opcode extensions.
if (opc->extended)
{

View File

@ -73,7 +73,7 @@ public:
// one for each word of code, indicating the source assembler code line number it came from.
// If returns false, call GetErrorString to get some text to present to the user.
bool Assemble(const char *text, std::vector<u16> &code, std::vector<int> *line_numbers = NULL);
bool Assemble(const char *text, std::vector<u16> &code, std::vector<int> *line_numbers = nullptr);
std::string GetErrorString() const { return last_error_str; }
err_t GetError() const { return last_error; }
@ -103,8 +103,8 @@ private:
void InitPass(int pass);
bool AssembleFile(const char *fname, int pass);
void ShowError(err_t err_code, const char *extra_info = NULL);
// void ShowWarning(err_t err_code, const char *extra_info = NULL);
void ShowError(err_t err_code, const char *extra_info = nullptr);
// void ShowWarning(err_t err_code, const char *extra_info = nullptr);
char *FindBrackets(char *src, char *dst);
const opc_t *FindOpcode(const char *opcode, u32 par_count, const opc_t * const opcod, int opcod_size);

View File

@ -114,7 +114,7 @@ void CodeToHeader(const std::vector<u16> &code, std::string _filename,
header.reserve(code_padded.size() * 4);
header.append("#define NUM_UCODES 1\n\n");
std::string filename;
SplitPath(_filename, NULL, &filename, NULL);
SplitPath(_filename, nullptr, &filename, nullptr);
header.append(StringFromFormat("const char* UCODE_NAMES[NUM_UCODES] = {\"%s\"};\n\n", filename.c_str()));
header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n");
@ -151,7 +151,7 @@ void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>
for (u32 i = 0; i < numCodes; i++)
{
std::string filename;
if (! SplitPath(filenames->at(i), NULL, &filename, NULL))
if (! SplitPath(filenames->at(i), nullptr, &filename, nullptr))
filename = filenames->at(i);
header.append(StringFromFormat("\t\"%s\",\n", filename.c_str()));
}

View File

@ -41,7 +41,7 @@ DSPBreakpoints dsp_breakpoints;
DSPCoreState core_state = DSPCORE_STOP;
u16 cyclesLeft = 0;
bool init_hax = false;
DSPEmitter *dspjit = NULL;
DSPEmitter *dspjit = nullptr;
Common::Event step_event;
static bool LoadRom(const char *fname, int size_in_words, u16 *rom)
@ -133,7 +133,7 @@ static void DSPCore_FreeMemoryPages()
FreeMemoryPages(g_dsp.iram, DSP_IRAM_BYTE_SIZE);
FreeMemoryPages(g_dsp.dram, DSP_DRAM_BYTE_SIZE);
FreeMemoryPages(g_dsp.coef, DSP_COEF_BYTE_SIZE);
g_dsp.irom = g_dsp.iram = g_dsp.dram = g_dsp.coef = NULL;
g_dsp.irom = g_dsp.iram = g_dsp.dram = g_dsp.coef = nullptr;
}
bool DSPCore_Init(const char *irom_filename, const char *coef_filename,
@ -142,7 +142,7 @@ bool DSPCore_Init(const char *irom_filename, const char *coef_filename,
g_dsp.step_counter = 0;
cyclesLeft = 0;
init_hax = false;
dspjit = NULL;
dspjit = nullptr;
g_dsp.irom = (u16*)AllocateMemoryPages(DSP_IROM_BYTE_SIZE);
g_dsp.iram = (u16*)AllocateMemoryPages(DSP_IRAM_BYTE_SIZE);
@ -218,7 +218,7 @@ void DSPCore_Shutdown()
if(dspjit) {
delete dspjit;
dspjit = NULL;
dspjit = nullptr;
}
DSPCore_FreeMemoryPages();
}

View File

@ -208,8 +208,8 @@ bool DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16
const u32 op1 = binbuf[*pc & 0x0fff];
const DSPOPCTemplate *opc = NULL;
const DSPOPCTemplate *opc_ext = NULL;
const DSPOPCTemplate *opc = nullptr;
const DSPOPCTemplate *opc_ext = nullptr;
// find opcode
for (int j = 0; j < opcodes_size; j++)
@ -222,7 +222,7 @@ bool DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16
break;
}
}
const DSPOPCTemplate fake_op = {"CW", 0x0000, 0x0000, nop, NULL, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}}, false, false, false, false, false};
const DSPOPCTemplate fake_op = {"CW", 0x0000, 0x0000, nop, nullptr, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}}, false, false, false, false, false};
if (!opc)
opc = &fake_op;

View File

@ -18,7 +18,7 @@ using namespace Gen;
DSPEmitter::DSPEmitter() : gpr(*this), storeIndex(-1), storeIndex2(-1)
{
m_compiledCode = NULL;
m_compiledCode = nullptr;
AllocCodeSpace(COMPILED_CODE_SIZE);
@ -37,7 +37,7 @@ DSPEmitter::DSPEmitter() : gpr(*this), storeIndex(-1), storeIndex2(-1)
for(int i = 0x0000; i < MAX_BLOCKS; i++)
{
blocks[i] = (DSPCompiledCode)stubEntryPoint;
blockLinks[i] = 0;
blockLinks[i] = nullptr;
blockSize[i] = 0;
}
}
@ -55,7 +55,7 @@ void DSPEmitter::ClearIRAM()
for(int i = 0x0000; i < 0x1000; i++)
{
blocks[i] = (DSPCompiledCode)stubEntryPoint;
blockLinks[i] = 0;
blockLinks[i] = nullptr;
blockSize[i] = 0;
unresolvedJumps[i].clear();
}
@ -71,7 +71,7 @@ void DSPEmitter::ClearIRAMandDSPJITCodespaceReset()
for(int i = 0x0000; i < 0x10000; i++)
{
blocks[i] = (DSPCompiledCode)stubEntryPoint;
blockLinks[i] = 0;
blockLinks[i] = nullptr;
blockSize[i] = 0;
unresolvedJumps[i].clear();
}
@ -345,7 +345,7 @@ void DSPEmitter::Compile(u16 start_addr)
{
// Mark the block to be recompiled again
blocks[i] = (DSPCompiledCode)stubEntryPoint;
blockLinks[i] = 0;
blockLinks[i] = nullptr;
blockSize[i] = 0;
}
}

View File

@ -292,7 +292,7 @@ const DSPOPCTemplate opcodes[] =
};
const DSPOPCTemplate cw =
{"CW", 0x0000, 0x0000, nop, NULL, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}}, false, false, false, false, false};
{"CW", 0x0000, 0x0000, nop, nullptr, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}}, false, false, false, false, false};
// extended opcodes
@ -353,43 +353,43 @@ const pdlabel_t pdlabels[] =
{0xffae, "COEF_A1_7", "COEF_A1_7",},
{0xffaf, "COEF_A2_7", "COEF_A2_7",},
{0xffb0, "0xffb0", 0,},
{0xffb1, "0xffb1", 0,},
{0xffb2, "0xffb2", 0,},
{0xffb3, "0xffb3", 0,},
{0xffb4, "0xffb4", 0,},
{0xffb5, "0xffb5", 0,},
{0xffb6, "0xffb6", 0,},
{0xffb7, "0xffb7", 0,},
{0xffb8, "0xffb8", 0,},
{0xffb9, "0xffb9", 0,},
{0xffba, "0xffba", 0,},
{0xffbb, "0xffbb", 0,},
{0xffbc, "0xffbc", 0,},
{0xffbd, "0xffbd", 0,},
{0xffbe, "0xffbe", 0,},
{0xffbf, "0xffbf", 0,},
{0xffb0, "0xffb0", nullptr,},
{0xffb1, "0xffb1", nullptr,},
{0xffb2, "0xffb2", nullptr,},
{0xffb3, "0xffb3", nullptr,},
{0xffb4, "0xffb4", nullptr,},
{0xffb5, "0xffb5", nullptr,},
{0xffb6, "0xffb6", nullptr,},
{0xffb7, "0xffb7", nullptr,},
{0xffb8, "0xffb8", nullptr,},
{0xffb9, "0xffb9", nullptr,},
{0xffba, "0xffba", nullptr,},
{0xffbb, "0xffbb", nullptr,},
{0xffbc, "0xffbc", nullptr,},
{0xffbd, "0xffbd", nullptr,},
{0xffbe, "0xffbe", nullptr,},
{0xffbf, "0xffbf", nullptr,},
{0xffc0, "0xffc0", 0,},
{0xffc1, "0xffc1", 0,},
{0xffc2, "0xffc2", 0,},
{0xffc3, "0xffc3", 0,},
{0xffc4, "0xffc4", 0,},
{0xffc5, "0xffc5", 0,},
{0xffc6, "0xffc6", 0,},
{0xffc7, "0xffc7", 0,},
{0xffc8, "0xffc8", 0,},
{0xffc0, "0xffc0", nullptr,},
{0xffc1, "0xffc1", nullptr,},
{0xffc2, "0xffc2", nullptr,},
{0xffc3, "0xffc3", nullptr,},
{0xffc4, "0xffc4", nullptr,},
{0xffc5, "0xffc5", nullptr,},
{0xffc6, "0xffc6", nullptr,},
{0xffc7, "0xffc7", nullptr,},
{0xffc8, "0xffc8", nullptr,},
{0xffc9, "DSCR", "DSP DMA Control Reg",},
{0xffca, "0xffca", 0,},
{0xffca, "0xffca", nullptr,},
{0xffcb, "DSBL", "DSP DMA Block Length",},
{0xffcc, "0xffcc", 0,},
{0xffcc, "0xffcc", nullptr,},
{0xffcd, "DSPA", "DSP DMA DMEM Address",},
{0xffce, "DSMAH", "DSP DMA Mem Address H",},
{0xffcf, "DSMAL", "DSP DMA Mem Address L",},
{0xffd0, "0xffd0",0,},
{0xffd0, "0xffd0",nullptr,},
{0xffd1, "SampleFormat", "SampleFormat",},
{0xffd2, "0xffd2",0,},
{0xffd2, "0xffd2",nullptr,},
{0xffd3, "UnkZelda", "Unk Zelda reads/writes from/to it",},
{0xffd4, "ACSAH", "Accelerator start address H",},
{0xffd5, "ACSAL", "Accelerator start address L",},
@ -402,36 +402,36 @@ const pdlabel_t pdlabels[] =
{0xffdc, "yn2", "yn2",},
{0xffdd, "ARAM", "Direct Read from ARAM (uses ADPCM)",},
{0xffde, "GAIN", "Gain",},
{0xffdf, "0xffdf", 0,},
{0xffdf, "0xffdf", nullptr,},
{0xffe0, "0xffe0",0,},
{0xffe1, "0xffe1",0,},
{0xffe2, "0xffe2",0,},
{0xffe3, "0xffe3",0,},
{0xffe4, "0xffe4",0,},
{0xffe5, "0xffe5",0,},
{0xffe6, "0xffe6",0,},
{0xffe7, "0xffe7",0,},
{0xffe8, "0xffe8",0,},
{0xffe9, "0xffe9",0,},
{0xffea, "0xffea",0,},
{0xffeb, "0xffeb",0,},
{0xffec, "0xffec",0,},
{0xffed, "0xffed",0,},
{0xffee, "0xffee",0,},
{0xffe0, "0xffe0",nullptr,},
{0xffe1, "0xffe1",nullptr,},
{0xffe2, "0xffe2",nullptr,},
{0xffe3, "0xffe3",nullptr,},
{0xffe4, "0xffe4",nullptr,},
{0xffe5, "0xffe5",nullptr,},
{0xffe6, "0xffe6",nullptr,},
{0xffe7, "0xffe7",nullptr,},
{0xffe8, "0xffe8",nullptr,},
{0xffe9, "0xffe9",nullptr,},
{0xffea, "0xffea",nullptr,},
{0xffeb, "0xffeb",nullptr,},
{0xffec, "0xffec",nullptr,},
{0xffed, "0xffed",nullptr,},
{0xffee, "0xffee",nullptr,},
{0xffef, "AMDM", "ARAM DMA Request Mask",},
{0xfff0, "0xfff0",0,},
{0xfff1, "0xfff1",0,},
{0xfff2, "0xfff2",0,},
{0xfff3, "0xfff3",0,},
{0xfff4, "0xfff4",0,},
{0xfff5, "0xfff5",0,},
{0xfff6, "0xfff6",0,},
{0xfff7, "0xfff7",0,},
{0xfff8, "0xfff8",0,},
{0xfff9, "0xfff9",0,},
{0xfffa, "0xfffa",0,},
{0xfff0, "0xfff0",nullptr,},
{0xfff1, "0xfff1",nullptr,},
{0xfff2, "0xfff2",nullptr,},
{0xfff3, "0xfff3",nullptr,},
{0xfff4, "0xfff4",nullptr,},
{0xfff5, "0xfff5",nullptr,},
{0xfff6, "0xfff6",nullptr,},
{0xfff7, "0xfff7",nullptr,},
{0xfff8, "0xfff8",nullptr,},
{0xfff9, "0xfff9",nullptr,},
{0xfffa, "0xfffa",nullptr,},
{0xfffb, "DIRQ", "DSP IRQ Request",},
{0xfffc, "DMBH", "DSP Mailbox H",},
{0xfffd, "DMBL", "DSP Mailbox L",},

View File

@ -95,7 +95,7 @@ static void WriteBlockLink(DSPEmitter& emitter, u16 dest)
// Jump directly to the called block if it has already been compiled.
if (!(dest >= emitter.startAddr && dest <= emitter.compilePC))
{
if (emitter.blockLinks[dest] != 0 )
if (emitter.blockLinks[dest] != nullptr )
{
emitter.gpr.flushRegs();
// Check if we have enough cycles to execute the next block

View File

@ -71,7 +71,7 @@ static void *reg_ptr(int reg)
#endif
default:
_assert_msg_(DSPLLE, 0, "cannot happen");
return NULL;
return nullptr;
}
}

View File

@ -31,7 +31,7 @@ void DSPEmitter::dsp_reg_stack_push(int stack_reg)
MOVZX(32, 8, EAX, R(AL));
#endif
MOV(16, MComplex(EAX, EAX, 1,
PtrOffset(&g_dsp.reg_stack[stack_reg][0],0)), R(tmp1));
PtrOffset(&g_dsp.reg_stack[stack_reg][0],nullptr)), R(tmp1));
gpr.putXReg(tmp1);
}
@ -50,7 +50,7 @@ void DSPEmitter::dsp_reg_stack_pop(int stack_reg)
MOVZX(32, 8, EAX, R(AL));
#endif
MOV(16, R(tmp1), MComplex(EAX, EAX, 1,
PtrOffset(&g_dsp.reg_stack[stack_reg][0],0)));
PtrOffset(&g_dsp.reg_stack[stack_reg][0],nullptr)));
MOV(16, M(&g_dsp.r.st[stack_reg]), R(tmp1));
gpr.putXReg(tmp1);

View File

@ -10,7 +10,7 @@
#include "Core/Debugger/Dump.h"
CDump::CDump(const char* _szFilename) :
m_pData(NULL)
m_pData(nullptr)
{
File::IOFile pStream(_szFilename, "rb");
if (pStream)
@ -25,10 +25,10 @@ CDump::CDump(const char* _szFilename) :
CDump::~CDump(void)
{
if (m_pData != NULL)
if (m_pData != nullptr)
{
delete[] m_pData;
m_pData = NULL;
m_pData = nullptr;
}
}

View File

@ -129,7 +129,7 @@ FifoDataFile *FifoDataFile::Load(const std::string &filename, bool flagsOnly)
File::IOFile file;
file.Open(filename, "rb");
if (!file)
return NULL;
return nullptr;
FileHeader header;
file.ReadBytes(&header, sizeof(header));
@ -137,7 +137,7 @@ FifoDataFile *FifoDataFile::Load(const std::string &filename, bool flagsOnly)
if (header.fileId != FILE_ID || header.min_loader_version > VERSION_NUMBER)
{
file.Close();
return NULL;
return nullptr;
}
FifoDataFile* dataFile = new FifoDataFile;

View File

@ -39,13 +39,13 @@ bool FifoPlayer::Open(const std::string& filename)
if (m_FileLoadedCb)
m_FileLoadedCb();
return (m_File != NULL);
return (m_File != nullptr);
}
void FifoPlayer::Close()
{
delete m_File;
m_File = NULL;
m_File = nullptr;
m_FrameRangeStart = 0;
m_FrameRangeEnd = 0;
@ -158,9 +158,9 @@ FifoPlayer::FifoPlayer() :
m_ObjectRangeStart(0),
m_ObjectRangeEnd(10000),
m_EarlyMemoryUpdates(false),
m_FileLoadedCb(NULL),
m_FrameWrittenCb(NULL),
m_File(NULL)
m_FileLoadedCb(nullptr),
m_FrameWrittenCb(nullptr),
m_File(nullptr)
{
m_Loop = SConfig::GetInstance().m_LocalCoreStartupParameter.bLoopFifoReplay;
}
@ -271,7 +271,7 @@ void FifoPlayer::WriteAllMemoryUpdates()
void FifoPlayer::WriteMemory(const MemoryUpdate& memUpdate)
{
u8 *mem = NULL;
u8 *mem = nullptr;
if (memUpdate.address & 0x10000000)
mem = &Memory::m_pEXRAM[memUpdate.address & Memory::EXRAM_MASK];

View File

@ -16,7 +16,7 @@ using namespace FifoAnalyzer;
FifoRecordAnalyzer::FifoRecordAnalyzer() :
m_DrawingObject(false),
m_BpMem(NULL)
m_BpMem(nullptr)
{
}

View File

@ -19,13 +19,13 @@ FifoRecorder::FifoRecorder() :
m_WasRecording(false),
m_RequestedRecordingEnd(false),
m_RecordFramesRemaining(0),
m_FinishedCb(NULL),
m_File(NULL),
m_FinishedCb(nullptr),
m_File(nullptr),
m_SkipNextData(true),
m_SkipFutureData(true),
m_FrameEnded(false),
m_Ram(NULL),
m_ExRam(NULL)
m_Ram(nullptr),
m_ExRam(nullptr)
{
}

View File

@ -88,7 +88,7 @@ void PatchFunctions()
for (u32 i = 0; i < sizeof(OSPatches) / sizeof(SPatch); i++)
{
Symbol *symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName);
if (symbol > 0)
if (symbol)
{
for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
{
@ -103,7 +103,7 @@ void PatchFunctions()
for (size_t i = 1; i < sizeof(OSBreakPoints) / sizeof(SPatch); i++)
{
Symbol *symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName);
if (symbol > 0)
if (symbol)
{
PowerPC::breakpoints.Add(symbol->address, false);
INFO_LOG(OSHLE, "Adding BP to %s %08x", OSBreakPoints[i].m_szPatchName, symbol->address);
@ -159,7 +159,7 @@ bool IsEnabled(int flags)
u32 UnPatch(std::string patchName)
{
Symbol *symbol = g_symbolDB.GetSymbolFromName(patchName.c_str());
if (symbol > 0)
if (symbol)
{
for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
{

View File

@ -120,7 +120,7 @@ void ReadThreadHandler(CEXIETHERNET* self)
struct timeval timeout;
timeout.tv_sec = 0;
timeout.tv_usec = 50000;
if (select(self->fd + 1, &rfds, NULL, NULL, &timeout) <= 0)
if (select(self->fd + 1, &rfds, nullptr, nullptr, &timeout) <= 0)
continue;
int readBytes = read(self->fd, self->mRecvBuffer, BBA_RECV_SIZE);

View File

@ -35,7 +35,7 @@ bool IsTAPDevice(const TCHAR *guid)
DWORD data_type;
len = sizeof(enum_name);
status = RegEnumKeyEx(netcard_key, i, enum_name, &len, NULL, NULL, NULL, NULL);
status = RegEnumKeyEx(netcard_key, i, enum_name, &len, nullptr, nullptr, nullptr, nullptr);
if (status == ERROR_NO_MORE_ITEMS)
break;
@ -53,13 +53,13 @@ bool IsTAPDevice(const TCHAR *guid)
else
{
len = sizeof(component_id);
status = RegQueryValueEx(unit_key, component_id_string, NULL,
status = RegQueryValueEx(unit_key, component_id_string, nullptr,
&data_type, (LPBYTE)component_id, &len);
if (!(status != ERROR_SUCCESS || data_type != REG_SZ))
{
len = sizeof(net_cfg_instance_id);
status = RegQueryValueEx(unit_key, net_cfg_instance_id_string, NULL,
status = RegQueryValueEx(unit_key, net_cfg_instance_id_string, nullptr,
&data_type, (LPBYTE)net_cfg_instance_id, &len);
if (status == ERROR_SUCCESS && data_type == REG_SZ)
@ -106,7 +106,7 @@ bool GetGUIDs(std::vector<std::basic_string<TCHAR>>& guids)
len = sizeof(enum_name);
status = RegEnumKeyEx(control_net_key, i, enum_name,
&len, NULL, NULL, NULL, NULL);
&len, nullptr, nullptr, nullptr, nullptr);
if (status == ERROR_NO_MORE_ITEMS)
break;
@ -122,7 +122,7 @@ bool GetGUIDs(std::vector<std::basic_string<TCHAR>>& guids)
if (status == ERROR_SUCCESS)
{
len = sizeof(name_data);
status = RegQueryValueEx(connection_key, name_string, NULL,
status = RegQueryValueEx(connection_key, name_string, nullptr,
&name_type, (LPBYTE)name_data, &len);
if (status != ERROR_SUCCESS || name_type != REG_SZ)
@ -199,7 +199,7 @@ bool CEXIETHERNET::Activate()
/* get driver version info */
ULONG info[3];
if (DeviceIoControl(mHAdapter, TAP_IOCTL_GET_VERSION,
&info, sizeof(info), &info, sizeof(info), &len, NULL))
&info, sizeof(info), &info, sizeof(info), &len, nullptr))
{
INFO_LOG(SP1, "TAP-Win32 Driver Version %d.%d %s",
info[0], info[1], info[2] ? "(DEBUG)" : "");
@ -217,7 +217,7 @@ bool CEXIETHERNET::Activate()
/* set driver media status to 'connected' */
ULONG status = TRUE;
if (!DeviceIoControl(mHAdapter, TAP_IOCTL_SET_MEDIA_STATUS,
&status, sizeof(status), &status, sizeof(status), &len, NULL))
&status, sizeof(status), &status, sizeof(status), &len, nullptr))
{
ERROR_LOG(SP1, "WARNING: The TAP-Win32 driver rejected a"
"TAP_IOCTL_SET_MEDIA_STATUS DeviceIoControl call.");
@ -283,7 +283,7 @@ bool CEXIETHERNET::RecvInit()
{
// Set up recv event
if ((mHRecvEvent = CreateEvent(NULL, false, false, NULL)) == NULL)
if ((mHRecvEvent = CreateEvent(nullptr, false, false, nullptr)) == nullptr)
{
ERROR_LOG(SP1, "Failed to create recv event:%x", GetLastError());
return false;

View File

@ -18,20 +18,20 @@
namespace
{
static Common::Event m_StepEvent;
static Common::Event *m_SyncEvent = NULL;
static Common::Event *m_SyncEvent = nullptr;
static std::mutex m_csCpuOccupied;
}
void CCPU::Init(int cpu_core)
{
PowerPC::Init(cpu_core);
m_SyncEvent = NULL;
m_SyncEvent = nullptr;
}
void CCPU::Shutdown()
{
PowerPC::Shutdown();
m_SyncEvent = NULL;
m_SyncEvent = nullptr;
}
void CCPU::Run()
@ -68,7 +68,7 @@ reswitch:
if (m_SyncEvent)
{
m_SyncEvent->Set();
m_SyncEvent = NULL;
m_SyncEvent = nullptr;
}
Host_UpdateDisasmDialog();
break;

View File

@ -28,7 +28,7 @@ public:
static void Reset();
// StepOpcode (Steps one Opcode)
static void StepOpcode(Common::Event *event = 0);
static void StepOpcode(Common::Event *event = nullptr);
// one step only
static void SingleStep();

View File

@ -174,7 +174,7 @@ struct ARAMInfo
wii_mode = false;
size = ARAM_SIZE;
mask = ARAM_MASK;
ptr = NULL;
ptr = nullptr;
}
};
@ -282,12 +282,12 @@ void Shutdown()
if (!g_ARAM.wii_mode)
{
FreeMemoryPages(g_ARAM.ptr, g_ARAM.size);
g_ARAM.ptr = NULL;
g_ARAM.ptr = nullptr;
}
dsp_emulator->Shutdown();
delete dsp_emulator;
dsp_emulator = NULL;
dsp_emulator = nullptr;
}
void RegisterMMIO(MMIO::Mapping* mmio, u32 base)

View File

@ -21,7 +21,7 @@
DSPHLE::DSPHLE()
{
m_InitMixer = false;
soundStream = NULL;
soundStream = nullptr;
}
// Mailbox utility
@ -46,8 +46,8 @@ bool DSPHLE::Initialize(void *hWnd, bool bWii, bool bDSPThread)
{
m_hWnd = hWnd;
m_bWii = bWii;
m_pUCode = NULL;
m_lastUCode = NULL;
m_pUCode = nullptr;
m_lastUCode = nullptr;
m_bHalt = false;
m_bAssertInt = false;
@ -74,7 +74,7 @@ void DSPHLE::DSP_Update(int cycles)
{
// This is called OFTEN - better not do anything expensive!
// ~1/6th as many cycles as the period PPC-side.
if (m_pUCode != NULL)
if (m_pUCode != nullptr)
m_pUCode->Update(cycles / 6);
}
@ -82,7 +82,7 @@ u32 DSPHLE::DSP_UpdateRate()
{
// AX HLE uses 3ms (Wii) or 5ms (GC) timing period
int fields = VideoInterface::GetNumFields();
if (m_pUCode != NULL)
if (m_pUCode != nullptr)
return (SystemTimers::GetTicksPerSecond() / 1000) * m_pUCode->GetUpdateMs() / fields;
else
return SystemTimers::GetTicksPerSecond() / 1000;
@ -90,7 +90,7 @@ u32 DSPHLE::DSP_UpdateRate()
void DSPHLE::SendMailToDSP(u32 _uMail)
{
if (m_pUCode != NULL) {
if (m_pUCode != nullptr) {
DEBUG_LOG(DSP_MAIL, "CPU writes 0x%08x", _uMail);
m_pUCode->HandleMail(_uMail);
}
@ -105,7 +105,7 @@ void DSPHLE::SetUCode(u32 _crc)
{
delete m_pUCode;
m_pUCode = NULL;
m_pUCode = nullptr;
m_MailHandler.Clear();
m_pUCode = UCodeFactory(_crc, this, m_bWii);
}
@ -117,7 +117,7 @@ void DSPHLE::SwapUCode(u32 _crc)
{
m_MailHandler.Clear();
if (m_lastUCode == NULL)
if (m_lastUCode == nullptr)
{
m_lastUCode = m_pUCode;
m_pUCode = UCodeFactory(_crc, this, m_bWii);
@ -126,7 +126,7 @@ void DSPHLE::SwapUCode(u32 _crc)
{
delete m_pUCode;
m_pUCode = m_lastUCode;
m_lastUCode = NULL;
m_lastUCode = nullptr;
}
}
@ -154,7 +154,7 @@ void DSPHLE::DoState(PointerWrap &p)
AudioCommon::PauseAndLock(false);
soundStream->Stop();
delete soundStream;
soundStream = NULL;
soundStream = nullptr;
}
}

View File

@ -468,7 +468,7 @@ void CUCode_AX::ProcessPBList(u32 pb_addr)
ApplyUpdatesForMs(curr_ms, (u16*)&pb, pb.updates.num_updates, updates);
ProcessVoice(pb, buffers, spms, ConvertMixerControl(pb.mixer_control),
m_coeffs_available ? m_coeffs : NULL);
m_coeffs_available ? m_coeffs : nullptr);
// Forward the buffers
for (u32 i = 0; i < sizeof (buffers.ptrs) / sizeof (buffers.ptrs[0]); ++i)
@ -482,7 +482,7 @@ void CUCode_AX::ProcessPBList(u32 pb_addr)
void CUCode_AX::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr)
{
int* buffers[3] = { 0 };
int* buffers[3] = { nullptr };
switch (aux_id)
{

View File

@ -467,7 +467,7 @@ void CUCode_AXWii::ProcessPBList(u32 pb_addr)
ApplyUpdatesForMs(curr_ms, (u16*)&pb, num_updates, updates);
ProcessVoice(pb, buffers, 32,
ConvertMixerControl(HILO_TO_32(pb.mixer_control)),
m_coeffs_available ? m_coeffs : NULL);
m_coeffs_available ? m_coeffs : nullptr);
// Forward the buffers
for (u32 i = 0; i < sizeof (buffers.ptrs) / sizeof (buffers.ptrs[0]); ++i)
@ -479,7 +479,7 @@ void CUCode_AXWii::ProcessPBList(u32 pb_addr)
{
ProcessVoice(pb, buffers, 96,
ConvertMixerControl(HILO_TO_32(pb.mixer_control)),
m_coeffs_available ? m_coeffs : NULL);
m_coeffs_available ? m_coeffs : nullptr);
}
WritePB(pb_addr, pb);
@ -493,7 +493,7 @@ void CUCode_AXWii::MixAUXSamples(int aux_id, u32 write_addr, u32 read_addr, u16
GenerateVolumeRamp(volume_ramp, m_last_aux_volumes[aux_id], volume, 96);
m_last_aux_volumes[aux_id] = volume;
int* buffers[3] = { 0 };
int* buffers[3] = { nullptr };
int* main_buffers[3] = {
m_samples_left,
m_samples_right,

View File

@ -99,7 +99,7 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
break;
}
return NULL;
return nullptr;
}
bool IUCode::NeedsResumeMail()

View File

@ -33,7 +33,7 @@
DSPLLE::DSPLLE()
{
soundStream = NULL;
soundStream = nullptr;
m_InitMixer = false;
m_bIsRunning = false;
m_cycle_count = 0;
@ -95,7 +95,7 @@ void DSPLLE::DoState(PointerWrap &p)
AudioCommon::PauseAndLock(false);
soundStream->Stop();
delete soundStream;
soundStream = NULL;
soundStream = nullptr;
}
}
}

View File

@ -70,7 +70,7 @@ Symbol *DSPSymbolDB::GetSymbolFromAddr(u32 addr)
return &func.second;
}
}
return 0;
return nullptr;
}
// lower case only

View File

@ -47,7 +47,7 @@ void Shutdown()
for (auto& channel : g_Channels)
{
delete channel;
channel = NULL;
channel = nullptr;
}
}
@ -102,7 +102,7 @@ IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex)
if (device)
return device;
}
return NULL;
return nullptr;
}
// Unused (?!)

View File

@ -87,7 +87,7 @@ void CEXIChannel::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
IEXIDevice* pDevice = GetDevice(m_Status.CHIP_SELECT ^ newStatus.CHIP_SELECT);
m_Status.CHIP_SELECT = newStatus.CHIP_SELECT;
if (pDevice != NULL)
if (pDevice != nullptr)
pDevice->SetCS(m_Status.CHIP_SELECT);
CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0);
@ -110,7 +110,7 @@ void CEXIChannel::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
if (m_Control.TSTART)
{
IEXIDevice* pDevice = GetDevice(m_Status.CHIP_SELECT);
if (pDevice == NULL)
if (pDevice == nullptr)
return;
if (m_Control.DMA == 0)
@ -216,7 +216,7 @@ IEXIDevice* CEXIChannel::GetDevice(const u8 chip_select)
case 2: return m_pDevices[1].get();
case 4: return m_pDevices[2].get();
}
return NULL;
return nullptr;
}
void CEXIChannel::Update()
@ -273,5 +273,5 @@ IEXIDevice* CEXIChannel::FindDevice(TEXIDevices device_type, int customIndex)
if (device)
return device;
}
return NULL;
return nullptr;
}

View File

@ -90,7 +90,7 @@ public:
// F A C T O R Y
IEXIDevice* EXIDevice_Create(TEXIDevices device_type, const int channel_num)
{
IEXIDevice* result = NULL;
IEXIDevice* result = nullptr;
switch (device_type)
{
@ -132,7 +132,7 @@ IEXIDevice* EXIDevice_Create(TEXIDevices device_type, const int channel_num)
break;
}
if (result != NULL)
if (result != nullptr)
result->m_deviceType = device_type;
return result;

View File

@ -40,7 +40,7 @@ public:
virtual void SetCS(int) {}
virtual void DoState(PointerWrap&) {}
virtual void PauseAndLock(bool doLock, bool unpauseOnUnlock=true) {}
virtual IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex=-1) { return (device_type == m_deviceType) ? this : NULL; }
virtual IEXIDevice* FindDevice(TEXIDevices device_type, int customIndex=-1) { return (device_type == m_deviceType) ? this : nullptr; }
// Update
virtual void Update() {}

View File

@ -130,7 +130,7 @@ CEXIIPL::~CEXIIPL()
}
FreeMemoryPages(m_pIPL, ROM_SIZE);
m_pIPL = NULL;
m_pIPL = nullptr;
// SRAM
File::IOFile file(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strSRAM, "wb");

View File

@ -108,7 +108,7 @@ void innerFlush(FlushData* data)
if (!pFile)
{
std::string dir;
SplitPath(data->filename, &dir, 0, 0);
SplitPath(data->filename, &dir, nullptr, nullptr);
if (!File::IsDirectory(dir))
File::CreateFullPath(dir);
pFile.Open(data->filename, "wb");
@ -166,7 +166,7 @@ CEXIMemoryCard::~CEXIMemoryCard()
CoreTiming::RemoveEvent(et_this_card);
Flush(true);
delete[] memory_card_content;
memory_card_content = NULL;
memory_card_content = nullptr;
if (flushThread.joinable())
{
@ -482,8 +482,8 @@ void CEXIMemoryCard::DoState(PointerWrap &p)
IEXIDevice* CEXIMemoryCard::FindDevice(TEXIDevices device_type, int customIndex)
{
if (device_type != m_deviceType)
return NULL;
return nullptr;
if (customIndex != card_index)
return NULL;
return nullptr;
return this;
}

View File

@ -34,7 +34,7 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
{
//This function can be removed once more about hdr is known and we can check for a valid header
std::string fileType;
SplitPath(filename, NULL, NULL, &fileType);
SplitPath(filename, nullptr, nullptr, &fileType);
if (strcasecmp(fileType.c_str(), ".raw") && strcasecmp(fileType.c_str(), ".gcp"))
{
PanicAlertT("File has the extension \"%s\"\nvalid extensions are (.raw/.gcp)", fileType.c_str());
@ -814,7 +814,7 @@ u32 GCMemcard::ImportGciInternal(FILE* gcih, const char *inputFile, const std::s
File::IOFile gci(gcih);
unsigned int offset;
std::string fileType;
SplitPath(inputFile, NULL, NULL, &fileType);
SplitPath(inputFile, nullptr, nullptr, &fileType);
if (!strcasecmp(fileType.c_str(), ".gci"))
offset = GCI;
@ -913,7 +913,7 @@ u32 GCMemcard::ExportGci(u8 index, const char *fileName, const std::string &dire
gci.Open(fileName, "wb");
std::string fileType;
SplitPath(fileName, NULL, NULL, &fileType);
SplitPath(fileName, nullptr, nullptr, &fileType);
if (!strcasecmp(fileType.c_str(), ".gcs"))
{
offset = GCS;

View File

@ -53,7 +53,7 @@ bool bMMU = false;
// Init() declarations
// ----------------
// Store the MemArena here
u8* base = NULL;
u8* base = nullptr;
// The MemArena class
MemArena g_arena;
@ -121,8 +121,8 @@ bool IsInitialized()
static const MemoryView views[] =
{
{&m_pRAM, &m_pPhysicalRAM, 0x00000000, RAM_SIZE, 0},
{NULL, &m_pVirtualCachedRAM, 0x80000000, RAM_SIZE, MV_MIRROR_PREVIOUS},
{NULL, &m_pVirtualUncachedRAM, 0xC0000000, RAM_SIZE, MV_MIRROR_PREVIOUS},
{nullptr, &m_pVirtualCachedRAM, 0x80000000, RAM_SIZE, MV_MIRROR_PREVIOUS},
{nullptr, &m_pVirtualUncachedRAM, 0xC0000000, RAM_SIZE, MV_MIRROR_PREVIOUS},
// Don't map any memory for the EFB. We want all access to this area to go
// through the hardware access handlers.
@ -134,8 +134,8 @@ static const MemoryView views[] =
{&m_pFakeVMEM, &m_pVirtualFakeVMEM, 0x7E000000, FAKEVMEM_SIZE, MV_FAKE_VMEM},
{&m_pEXRAM, &m_pPhysicalEXRAM, 0x10000000, EXRAM_SIZE, MV_WII_ONLY},
{NULL, &m_pVirtualCachedEXRAM, 0x90000000, EXRAM_SIZE, MV_WII_ONLY | MV_MIRROR_PREVIOUS},
{NULL, &m_pVirtualUncachedEXRAM, 0xD0000000, EXRAM_SIZE, MV_WII_ONLY | MV_MIRROR_PREVIOUS},
{nullptr, &m_pVirtualCachedEXRAM, 0x90000000, EXRAM_SIZE, MV_WII_ONLY | MV_MIRROR_PREVIOUS},
{nullptr, &m_pVirtualUncachedEXRAM, 0xD0000000, EXRAM_SIZE, MV_WII_ONLY | MV_MIRROR_PREVIOUS},
};
static const int num_views = sizeof(views) / sizeof(MemoryView);
@ -185,7 +185,7 @@ void Shutdown()
if (bFakeVMEM) flags |= MV_FAKE_VMEM;
MemoryMap_Shutdown(views, num_views, flags, &g_arena);
g_arena.ReleaseSpace();
base = NULL;
base = nullptr;
delete mmio_mapping;
INFO_LOG(MEMMAP, "Memory system shut down.");
}
@ -223,7 +223,7 @@ void WriteBigEData(const u8 *_pData, const u32 _Address, const size_t _iSize)
void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength)
{
u8 *ptr = GetPointer(_Address);
if (ptr != NULL)
if (ptr != nullptr)
{
memset(ptr,_iValue,_iLength);
}
@ -239,7 +239,7 @@ void DMA_LCToMemory(const u32 _MemAddr, const u32 _CacheAddr, const u32 _iNumBlo
const u8 *src = GetCachePtr() + (_CacheAddr & 0x3FFFF);
u8 *dst = GetPointer(_MemAddr);
if ((dst != NULL) && (src != NULL) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0)
if ((dst != nullptr) && (src != nullptr) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0)
{
memcpy(dst, src, 32 * _iNumBlocks);
}
@ -258,7 +258,7 @@ void DMA_MemoryToLC(const u32 _CacheAddr, const u32 _MemAddr, const u32 _iNumBlo
const u8 *src = GetPointer(_MemAddr);
u8 *dst = GetCachePtr() + (_CacheAddr & 0x3FFFF);
if ((dst != NULL) && (src != NULL) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0)
if ((dst != nullptr) && (src != nullptr) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0)
{
memcpy(dst, src, 32 * _iNumBlocks);
}
@ -343,7 +343,7 @@ u8 *GetPointer(const u32 _Address)
ERROR_LOG(MEMMAP, "Unknown Pointer %#8x PC %#8x LR %#8x", _Address, PC, LR);
return NULL;
return nullptr;
}

View File

@ -434,7 +434,7 @@ void GenerateSIInterrupt(SIInterruptType _SIInterrupt)
void RemoveDevice(int _iDeviceNumber)
{
delete g_Channel[_iDeviceNumber].m_pDevice;
g_Channel[_iDeviceNumber].m_pDevice = NULL;
g_Channel[_iDeviceNumber].m_pDevice = nullptr;
}
void AddDevice(ISIDevice* pDevice)

View File

@ -117,7 +117,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
case WM_SPACE_REGS2: {
const u8 region_offset = (u8)address;
void *region_ptr = NULL;
void *region_ptr = nullptr;
int region_size = 0;
switch(data[3])
@ -200,7 +200,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
address &= 0xFEFFFF;
u16 size = Common::swap16(rd->size);
u8 *const block = new u8[size];
void *region_ptr = NULL;
void *region_ptr = nullptr;
dataRep.push(((data[2]>>1)<<16) + ((data[3])<<8) + addressLO);
@ -948,7 +948,7 @@ void Wiimote::WriteData(const wm_write_data* const wd)
address &= 0xFF00FF;
const u8 region_offset = (u8)address;
void *region_ptr = NULL;
void *region_ptr = nullptr;
int region_size = 0;
switch (address >> 16)
@ -1093,7 +1093,7 @@ void Wiimote::ReadData(const wm_read_data* const rd)
address &= 0xFF00FF;
const u8 region_offset = (u8)address;
void *region_ptr = NULL;
void *region_ptr = nullptr;
int region_size = 0;
switch (address >> 16)

View File

@ -257,7 +257,7 @@ Wiimote::Wiimote( const unsigned int index )
: m_index(index)
, ir_sin(0)
, ir_cos(1)
// , m_sound_stream( NULL )
// , m_sound_stream( nullptr )
{
// ---- set up all the controls ----

View File

@ -153,7 +153,7 @@ private:
void ReportMode(const wm_report_mode* const dr);
void SendAck(const u8 _reportID);
void RequestStatus(const wm_request_status* const rs = NULL);
void RequestStatus(const wm_request_status* const rs = nullptr);
void ReadData(const wm_read_data* const rd);
void WriteData(const wm_write_data* const wd);
void SendReadDataReply(ReadRequest& _request);

View File

@ -22,7 +22,7 @@ void WiimoteScanner::Update()
void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimote* & found_board)
{
found_wiimotes.clear();
found_board = NULL;
found_board = nullptr;
}
bool WiimoteScanner::IsReady() const

View File

@ -19,7 +19,7 @@ WiimoteScanner::WiimoteScanner()
, device_sock(-1)
{
// Get the id of the first bluetooth device.
device_id = hci_get_route(NULL);
device_id = hci_get_route(nullptr);
if (device_id < 0)
{
NOTICE_LOG(WIIMOTE, "Bluetooth not found.");
@ -57,10 +57,10 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
int const max_infos = 255;
inquiry_info scan_infos[max_infos] = {};
auto* scan_infos_ptr = scan_infos;
found_board = NULL;
found_board = nullptr;
// Scan for bluetooth devices
int const found_devices = hci_inquiry(device_id, wait_len, max_infos, NULL, &scan_infos_ptr, IREQ_CACHE_FLUSH);
int const found_devices = hci_inquiry(device_id, wait_len, max_infos, nullptr, &scan_infos_ptr, IREQ_CACHE_FLUSH);
if (found_devices < 0)
{
ERROR_LOG(WIIMOTE, "Error searching for bluetooth devices.");
@ -211,7 +211,7 @@ int Wiimote::IORead(u8* buf)
FD_SET(int_sock, &fds);
FD_SET(wakeup_pipe_r, &fds);
if (select(int_sock + 1, &fds, NULL, NULL, NULL) == -1)
if (select(int_sock + 1, &fds, nullptr, nullptr, nullptr) == -1)
{
ERROR_LOG(WIIMOTE, "Unable to select wiimote %i input socket.", index + 1);
return -1;

View File

@ -51,25 +51,25 @@ typedef DWORD (__stdcall *PBth_BluetoothSetServiceState)(HANDLE, const BLUETOOTH
typedef DWORD (__stdcall *PBth_BluetoothAuthenticateDevice)(HWND, HANDLE, BLUETOOTH_DEVICE_INFO*, PWCHAR, ULONG);
typedef DWORD (__stdcall *PBth_BluetoothEnumerateInstalledServices)(HANDLE, BLUETOOTH_DEVICE_INFO*, DWORD*, GUID*);
PHidD_GetHidGuid HidD_GetHidGuid = NULL;
PHidD_GetAttributes HidD_GetAttributes = NULL;
PHidD_SetOutputReport HidD_SetOutputReport = NULL;
PHidD_GetProductString HidD_GetProductString = NULL;
PHidD_GetHidGuid HidD_GetHidGuid = nullptr;
PHidD_GetAttributes HidD_GetAttributes = nullptr;
PHidD_SetOutputReport HidD_SetOutputReport = nullptr;
PHidD_GetProductString HidD_GetProductString = nullptr;
PBth_BluetoothFindDeviceClose Bth_BluetoothFindDeviceClose = NULL;
PBth_BluetoothFindFirstDevice Bth_BluetoothFindFirstDevice = NULL;
PBth_BluetoothFindFirstRadio Bth_BluetoothFindFirstRadio = NULL;
PBth_BluetoothFindNextDevice Bth_BluetoothFindNextDevice = NULL;
PBth_BluetoothFindNextRadio Bth_BluetoothFindNextRadio = NULL;
PBth_BluetoothFindRadioClose Bth_BluetoothFindRadioClose = NULL;
PBth_BluetoothGetRadioInfo Bth_BluetoothGetRadioInfo = NULL;
PBth_BluetoothRemoveDevice Bth_BluetoothRemoveDevice = NULL;
PBth_BluetoothSetServiceState Bth_BluetoothSetServiceState = NULL;
PBth_BluetoothAuthenticateDevice Bth_BluetoothAuthenticateDevice = NULL;
PBth_BluetoothEnumerateInstalledServices Bth_BluetoothEnumerateInstalledServices = NULL;
PBth_BluetoothFindDeviceClose Bth_BluetoothFindDeviceClose = nullptr;
PBth_BluetoothFindFirstDevice Bth_BluetoothFindFirstDevice = nullptr;
PBth_BluetoothFindFirstRadio Bth_BluetoothFindFirstRadio = nullptr;
PBth_BluetoothFindNextDevice Bth_BluetoothFindNextDevice = nullptr;
PBth_BluetoothFindNextRadio Bth_BluetoothFindNextRadio = nullptr;
PBth_BluetoothFindRadioClose Bth_BluetoothFindRadioClose = nullptr;
PBth_BluetoothGetRadioInfo Bth_BluetoothGetRadioInfo = nullptr;
PBth_BluetoothRemoveDevice Bth_BluetoothRemoveDevice = nullptr;
PBth_BluetoothSetServiceState Bth_BluetoothSetServiceState = nullptr;
PBth_BluetoothAuthenticateDevice Bth_BluetoothAuthenticateDevice = nullptr;
PBth_BluetoothEnumerateInstalledServices Bth_BluetoothEnumerateInstalledServices = nullptr;
HINSTANCE hid_lib = NULL;
HINSTANCE bthprops_lib = NULL;
HINSTANCE hid_lib = nullptr;
HINSTANCE bthprops_lib = nullptr;
static int initialized = 0;
@ -201,22 +201,22 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
HidD_GetHidGuid(&device_id);
// Get all hid devices connected
HDEVINFO const device_info = SetupDiGetClassDevs(&device_id, NULL, NULL, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT));
HDEVINFO const device_info = SetupDiGetClassDevs(&device_id, nullptr, nullptr, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT));
SP_DEVICE_INTERFACE_DATA device_data;
device_data.cbSize = sizeof(device_data);
PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL;
PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = nullptr;
for (int index = 0; SetupDiEnumDeviceInterfaces(device_info, NULL, &device_id, index, &device_data); ++index)
for (int index = 0; SetupDiEnumDeviceInterfaces(device_info, nullptr, &device_id, index, &device_data); ++index)
{
// Get the size of the data block required
DWORD len;
SetupDiGetDeviceInterfaceDetail(device_info, &device_data, NULL, 0, &len, NULL);
SetupDiGetDeviceInterfaceDetail(device_info, &device_data, nullptr, 0, &len, nullptr);
detail_data = (PSP_DEVICE_INTERFACE_DETAIL_DATA)malloc(len);
detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
// Query the data for this device
if (SetupDiGetDeviceInterfaceDetail(device_info, &device_data, detail_data, len, NULL, NULL))
if (SetupDiGetDeviceInterfaceDetail(device_info, &device_data, detail_data, len, nullptr, nullptr))
{
auto const wm = new Wiimote;
wm->devicepath = detail_data->DevicePath;
@ -250,7 +250,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, size_t size, int attempts)
{
OVERLAPPED hid_overlap_write = OVERLAPPED();
hid_overlap_write.hEvent = CreateEvent(NULL, true, false, NULL);
hid_overlap_write.hEvent = CreateEvent(nullptr, true, false, nullptr);
enum win_bt_stack_t stack = MSBT_STACK_UNKNOWN;
DWORD written = 0;
@ -287,7 +287,7 @@ int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, size_t size, int at
int CheckDeviceType_Read(HANDLE &dev_handle, u8* buf, int attempts)
{
OVERLAPPED hid_overlap_read = OVERLAPPED();
hid_overlap_read.hEvent = CreateEvent(NULL, true, false, NULL);
hid_overlap_read.hEvent = CreateEvent(nullptr, true, false, nullptr);
int read = 0;
for (; attempts>0; --attempts)
{
@ -318,8 +318,8 @@ void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool
HANDLE dev_handle = CreateFile(devicepath.c_str(),
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED,
NULL);
nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED,
nullptr);
if (dev_handle == INVALID_HANDLE_VALUE)
return;
// enable to only check for official nintendo wiimotes/bb's
@ -447,7 +447,7 @@ bool WiimoteScanner::IsReady() const
HANDLE hRadio;
HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio);
if (NULL != hFindRadio)
if (nullptr != hFindRadio)
{
Bth_BluetoothFindRadioClose(hFindRadio);
return true;
@ -480,7 +480,7 @@ bool Wiimote::ConnectInternal()
dev_handle = CreateFile(devicepath.c_str(),
GENERIC_READ | GENERIC_WRITE, open_flags,
NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr);
if (dev_handle == INVALID_HANDLE_VALUE)
{
@ -549,10 +549,10 @@ void Wiimote::InitInternal()
stack = MSBT_STACK_UNKNOWN;
hid_overlap_read = OVERLAPPED();
hid_overlap_read.hEvent = CreateEvent(NULL, true, false, NULL);
hid_overlap_read.hEvent = CreateEvent(nullptr, true, false, nullptr);
hid_overlap_write = OVERLAPPED();
hid_overlap_write.hEvent = CreateEvent(NULL, true, false, NULL);
hid_overlap_write.hEvent = CreateEvent(nullptr, true, false, nullptr);
}
void Wiimote::TeardownInternal()
@ -620,7 +620,7 @@ int _IORead(HANDLE &dev_handle, OVERLAPPED &hid_overlap_read, u8* buf, int index
}
}
WiimoteEmu::Spy(NULL, buf, bytes + 1);
WiimoteEmu::Spy(nullptr, buf, bytes + 1);
return bytes + 1;
}
@ -642,7 +642,7 @@ int Wiimote::IORead(u8* buf)
int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, size_t len)
{
WiimoteEmu::Spy(NULL, buf, len);
WiimoteEmu::Spy(nullptr, buf, len);
switch (stack)
{
@ -772,7 +772,7 @@ void ProcessWiimotes(bool new_scan, T& callback)
if (false == Bth_BluetoothFindNextDevice(hFindDevice, &btdi))
{
Bth_BluetoothFindDeviceClose(hFindDevice);
hFindDevice = NULL;
hFindDevice = nullptr;
}
}
}
@ -780,7 +780,7 @@ void ProcessWiimotes(bool new_scan, T& callback)
if (false == Bth_BluetoothFindNextRadio(hFindRadio, &hRadio))
{
Bth_BluetoothFindRadioClose(hFindRadio);
hFindRadio = NULL;
hFindRadio = nullptr;
}
}
}
@ -810,7 +810,7 @@ bool AttachWiimote(HANDLE hRadio, const BLUETOOTH_RADIO_INFO& radio_info, BLUETO
#if defined(AUTHENTICATE_WIIMOTES)
// Authenticate
auto const& radio_addr = radio_info.address.rgBytes;
const DWORD auth_result = Bth_BluetoothAuthenticateDevice(NULL, hRadio, &btdi,
const DWORD auth_result = Bth_BluetoothAuthenticateDevice(nullptr, hRadio, &btdi,
std::vector<WCHAR>(radio_addr, radio_addr + 6).data(), 6);
if (ERROR_SUCCESS != auth_result)

View File

@ -40,19 +40,19 @@
length: (NSUInteger) length
{
IOBluetoothDevice *device = [l2capChannel device];
WiimoteReal::Wiimote *wm = NULL;
WiimoteReal::Wiimote *wm = nullptr;
std::lock_guard<std::recursive_mutex> lk(WiimoteReal::g_refresh_lock);
for (int i = 0; i < MAX_WIIMOTES; i++)
{
if (WiimoteReal::g_wiimotes[i] == NULL)
if (WiimoteReal::g_wiimotes[i] == nullptr)
continue;
if ([device isEqual: WiimoteReal::g_wiimotes[i]->btd] == TRUE)
wm = WiimoteReal::g_wiimotes[i];
}
if (wm == NULL) {
if (wm == nullptr) {
ERROR_LOG(WIIMOTE, "Received packet for unknown wiimote");
return;
}
@ -79,19 +79,19 @@
- (void) l2capChannelClosed: (IOBluetoothL2CAPChannel *) l2capChannel
{
IOBluetoothDevice *device = [l2capChannel device];
WiimoteReal::Wiimote *wm = NULL;
WiimoteReal::Wiimote *wm = nullptr;
std::lock_guard<std::recursive_mutex> lk(WiimoteReal::g_refresh_lock);
for (int i = 0; i < MAX_WIIMOTES; i++)
{
if (WiimoteReal::g_wiimotes[i] == NULL)
if (WiimoteReal::g_wiimotes[i] == nullptr)
continue;
if ([device isEqual: WiimoteReal::g_wiimotes[i]->btd] == TRUE)
wm = WiimoteReal::g_wiimotes[i];
}
if (wm == NULL) {
if (wm == nullptr) {
ERROR_LOG(WIIMOTE, "Channel for unknown wiimote was closed");
return;
}
@ -123,7 +123,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
IOBluetoothDeviceInquiry *bti;
SearchBT *sbt;
NSEnumerator *en;
found_board = NULL;
found_board = nullptr;
bth = [[IOBluetoothHostController alloc] init];
if ([bth addressAsString] == nil)
@ -191,7 +191,7 @@ void Wiimote::InitInternal()
{
inputlen = 0;
m_connected = false;
m_wiimote_thread_run_loop = NULL;
m_wiimote_thread_run_loop = nullptr;
btd = nil;
}
@ -200,7 +200,7 @@ void Wiimote::TeardownInternal()
if (m_wiimote_thread_run_loop)
{
CFRelease(m_wiimote_thread_run_loop);
m_wiimote_thread_run_loop = NULL;
m_wiimote_thread_run_loop = nullptr;
}
[btd release];
btd = nil;

View File

@ -445,7 +445,7 @@ void WiimoteScanner::ThreadFunc()
while (m_run_thread)
{
std::vector<Wiimote*> found_wiimotes;
Wiimote* found_board = NULL;
Wiimote* found_board = nullptr;
//NOTICE_LOG(WIIMOTE, "In loop");
@ -592,7 +592,7 @@ void Initialize(bool wait)
{
int timeout = 100;
std::vector<Wiimote*> found_wiimotes;
Wiimote* found_board = NULL;
Wiimote* found_board = nullptr;
g_wiimote_scanner.FindWiimotes(found_wiimotes, found_board);
if (SConfig::GetInstance().m_WiimoteContinuousScanning)
{
@ -694,7 +694,7 @@ void TryToConnectWiimote(Wiimote* wm)
{
if (TryToConnectWiimoteN(wm, i))
{
wm = NULL;
wm = nullptr;
break;
}
}
@ -712,7 +712,7 @@ void TryToConnectBalanceBoard(Wiimote* wm)
if (TryToConnectWiimoteN(wm, WIIMOTE_BALANCE_BOARD))
{
wm = NULL;
wm = nullptr;
}
g_wiimote_scanner.WantBB(0 != CalculateWantedBB());
@ -730,7 +730,7 @@ void DoneWithWiimote(int index)
if (wm)
{
g_wiimotes[index] = NULL;
g_wiimotes[index] = nullptr;
// First see if we can use this real Wiimote in another slot.
TryToConnectWiimote(wm);
}
@ -741,7 +741,7 @@ void DoneWithWiimote(int index)
void HandleWiimoteDisconnect(int index)
{
Wiimote* wm = NULL;
Wiimote* wm = nullptr;
{
std::lock_guard<std::recursive_mutex> lk(g_refresh_lock);
@ -771,7 +771,7 @@ void Refresh()
{
std::unique_lock<std::recursive_mutex> lk(g_refresh_lock);
std::vector<Wiimote*> found_wiimotes;
Wiimote* found_board = NULL;
Wiimote* found_board = nullptr;
if (0 != CalculateWantedWiimotes() || 0 != CalculateWantedBB())
{

View File

@ -82,7 +82,7 @@ int icmp_echo_rep(const u32 s, sockaddr_in *addr, const u32 timeout, const u32 d
timeval t;
t.tv_sec = timeout / 1000;
if (select(0, &read_fds, NULL, NULL, &t) > 0)
if (select(0, &read_fds, nullptr, nullptr, &t) > 0)
{
num_bytes = recvfrom((SOCKET)s, (LPSTR)workspace,
IP_HDR_LEN + ICMP_HDR_LEN + data_length,

View File

@ -95,7 +95,7 @@ void Init()
for (IWII_IPC_HLE_Device*& dev : g_FdMap)
{
dev = NULL;
dev = nullptr;
}
u32 i = 0;
@ -139,14 +139,14 @@ void Reset(bool _bHard)
for (IWII_IPC_HLE_Device*& dev : g_FdMap)
{
if (dev != NULL && !dev->IsHardware())
if (dev != nullptr && !dev->IsHardware())
{
// close all files and delete their resources
dev->Close(0, true);
delete dev;
}
dev = NULL;
dev = nullptr;
}
for (bool& in_use : es_inuse)
@ -214,7 +214,7 @@ int getFreeDeviceId()
{
for (u32 i=0; i<IPC_MAX_FDS; i++)
{
if (g_FdMap[i] == NULL)
if (g_FdMap[i] == nullptr)
{
return i;
}
@ -233,7 +233,7 @@ IWII_IPC_HLE_Device* GetDeviceByName(const std::string& _rDeviceName)
}
}
return NULL;
return nullptr;
}
IWII_IPC_HLE_Device* AccessDeviceByID(u32 _ID)
@ -243,14 +243,14 @@ IWII_IPC_HLE_Device* AccessDeviceByID(u32 _ID)
return g_DeviceMap[_ID];
}
return NULL;
return nullptr;
}
// This is called from ExecuteCommand() COMMAND_OPEN_DEVICE
IWII_IPC_HLE_Device* CreateFileIO(u32 _DeviceID, const std::string& _rDeviceName)
{
// scan device name and create the right one
IWII_IPC_HLE_Device* pDevice = NULL;
IWII_IPC_HLE_Device* pDevice = nullptr;
INFO_LOG(WII_IPC_FILEIO, "IOP: Create FileIO %s", _rDeviceName.c_str());
pDevice = new CWII_IPC_HLE_Device_FileIO(_DeviceID, _rDeviceName);
@ -299,7 +299,7 @@ void DoState(PointerWrap &p)
}
else
{
g_FdMap[i] = NULL;
g_FdMap[i] = nullptr;
}
}
@ -350,7 +350,7 @@ void ExecuteCommand(u32 _Address)
ECommandType Command = static_cast<ECommandType>(Memory::Read_U32(_Address));
volatile s32 DeviceID = Memory::Read_U32(_Address + 8);
IWII_IPC_HLE_Device* pDevice = (DeviceID >= 0 && DeviceID < IPC_MAX_FDS) ? g_FdMap[DeviceID] : NULL;
IWII_IPC_HLE_Device* pDevice = (DeviceID >= 0 && DeviceID < IPC_MAX_FDS) ? g_FdMap[DeviceID] : nullptr;
INFO_LOG(WII_IPC_HLE, "-->> Execute Command Address: 0x%08x (code: %x, device: %x) %p", _Address, Command, DeviceID, pDevice);
@ -420,7 +420,7 @@ void ExecuteCommand(u32 _Address)
else
{
delete pDevice;
pDevice = NULL;
pDevice = nullptr;
}
}
}
@ -445,13 +445,13 @@ void ExecuteCommand(u32 _Address)
}
}
g_FdMap[DeviceID] = NULL;
g_FdMap[DeviceID] = nullptr;
// Don't delete hardware
if (!pDevice->IsHardware())
{
delete pDevice;
pDevice = NULL;
pDevice = nullptr;
}
}
else

View File

@ -29,7 +29,7 @@ using namespace DVDInterface;
CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName )
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
, m_pFileSystem(NULL)
, m_pFileSystem(nullptr)
, m_ErrorStatus(0)
, m_CoverStatus(DI_COVER_REG_NO_DISC)
{}
@ -39,7 +39,7 @@ CWII_IPC_HLE_Device_di::~CWII_IPC_HLE_Device_di()
if (m_pFileSystem)
{
delete m_pFileSystem;
m_pFileSystem = NULL;
m_pFileSystem = nullptr;
}
}
@ -61,7 +61,7 @@ bool CWII_IPC_HLE_Device_di::Close(u32 _CommandAddress, bool _bForce)
if (m_pFileSystem)
{
delete m_pFileSystem;
m_pFileSystem = NULL;
m_pFileSystem = nullptr;
}
m_ErrorStatus = 0;
if (!_bForce)
@ -159,7 +159,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
if(m_pFileSystem && !VolumeHandler::IsValid())
{
delete m_pFileSystem;
m_pFileSystem = NULL;
m_pFileSystem = nullptr;
m_CoverStatus |= DI_COVER_REG_NO_DISC;
}
@ -201,10 +201,10 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
// Don't do anything if the log is unselected
if (LogManager::GetInstance()->IsEnabled(LogTypes::FILEMON))
{
const char *pFilename = NULL;
const char *pFilename = nullptr;
if (m_pFileSystem)
pFilename = m_pFileSystem->GetFileName(DVDAddress);
if (pFilename != NULL)
if (pFilename != nullptr)
{
INFO_LOG(WII_IPC_DVD, "DVDLowRead: %s (0x%" PRIx64 ") - (DVDAddr: 0x%" PRIx64 ", Size: 0x%x)",
pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress, Size);
@ -339,10 +339,10 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
case DVDLowSeek:
{
u64 DVDAddress = Memory::Read_U32(_BufferIn + 0x4) << 2;
const char *pFilename = NULL;
const char *pFilename = nullptr;
if (m_pFileSystem)
pFilename = m_pFileSystem->GetFileName(DVDAddress);
if (pFilename != NULL)
if (pFilename != nullptr)
{
INFO_LOG(WII_IPC_DVD, "DVDLowSeek: %s (0x%" PRIx64 ") - (DVDAddr: 0x%" PRIx64 ")",
pFilename, m_pFileSystem->GetFileSize(pFilename), DVDAddress);

View File

@ -61,7 +61,7 @@ std::string CWII_IPC_HLE_Device_es::m_ContentFile;
CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
, m_pContentLoader(NULL)
, m_pContentLoader(nullptr)
, m_TitleID(-1)
, m_AccessIdentID(0x6000000)
{
@ -190,7 +190,7 @@ bool CWII_IPC_HLE_Device_es::Close(u32 _CommandAddress, bool _bForce)
delete pair.second.m_pFile;
}
m_ContentAccessMap.clear();
m_pContentLoader = NULL;
m_pContentLoader = nullptr;
m_TitleIDs.clear();
m_TitleID = -1;
m_AccessIdentID = 0x6000000;
@ -214,7 +214,7 @@ u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index)
const DiscIO::SNANDContent* pContent = Loader.GetContentByIndex(Index);
if (pContent == NULL)
if (pContent == nullptr)
{
return 0xffffffff; //TODO: what is the correct error value here?
}
@ -223,7 +223,7 @@ u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index)
Access.m_Position = 0;
Access.m_pContent = pContent;
Access.m_TitleID = TitleID;
Access.m_pFile = NULL;
Access.m_pFile = nullptr;
if (!pContent->m_pData)
{
@ -393,7 +393,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
}
SContentAccess& rContent = itr->second;
_dbg_assert_(WII_IPC_ES, rContent.m_pContent->m_pData != NULL);
_dbg_assert_(WII_IPC_ES, rContent.m_pContent->m_pData != nullptr);
u8* pDest = Memory::GetPointer(Addr);

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