summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorTillmann Karras <tilkax@gmail.com>2014-03-09 21:14:26 +0100
committerTillmann Karras <tilkax@gmail.com>2014-03-09 21:14:26 +0100
commitd802d392811be44d34ae9cd23f616db93e54c50f (patch)
treef9aa8831a0731ea246bd921d979f4bffa7f07bd0 /Source/Core/Common
parentf28116b7da6aac6069084596dc4dbf866bdebfd8 (diff)
clang-modernize -use-nullptr
and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/ArmCPUDetect.cpp10
-rw-r--r--Source/Core/Common/ArmEmitter.h4
-rw-r--r--Source/Core/Common/BreakPoints.cpp4
-rw-r--r--Source/Core/Common/CDUtils.cpp12
-rw-r--r--Source/Core/Common/ChunkFile.h10
-rw-r--r--Source/Core/Common/CommonFuncs.h2
-rw-r--r--Source/Core/Common/ConsoleListener.cpp14
-rw-r--r--Source/Core/Common/Crypto/ec.cpp2
-rw-r--r--Source/Core/Common/ExtendedTrace.cpp24
-rw-r--r--Source/Core/Common/FifoQueue.h8
-rw-r--r--Source/Core/Common/FileUtil.cpp38
-rw-r--r--Source/Core/Common/FileUtil.h6
-rw-r--r--Source/Core/Common/IniFile.cpp6
-rw-r--r--Source/Core/Common/LinearDiskCache.h2
-rw-r--r--Source/Core/Common/LogManager.cpp4
-rw-r--r--Source/Core/Common/MemArena.cpp12
-rw-r--r--Source/Core/Common/MemoryUtil.cpp16
-rw-r--r--Source/Core/Common/Misc.cpp4
-rw-r--r--Source/Core/Common/StdConditionVariable.h4
-rw-r--r--Source/Core/Common/StdMutex.h10
-rw-r--r--Source/Core/Common/StdThread.h6
-rw-r--r--Source/Core/Common/StringUtil.cpp8
-rw-r--r--Source/Core/Common/SymbolDB.cpp2
-rw-r--r--Source/Core/Common/SymbolDB.h6
-rw-r--r--Source/Core/Common/Timer.cpp6
-rw-r--r--Source/Core/Common/x64Emitter.h6
26 files changed, 113 insertions, 113 deletions
diff --git a/Source/Core/Common/ArmCPUDetect.cpp b/Source/Core/Common/ArmCPUDetect.cpp
index 12998e1bde..80908b8992 100644
--- a/Source/Core/Common/ArmCPUDetect.cpp
+++ b/Source/Core/Common/ArmCPUDetect.cpp
@@ -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, " ");
}
}
diff --git a/Source/Core/Common/ArmEmitter.h b/Source/Core/Common/ArmEmitter.h
index 405cacf991..841cc70176 100644
--- a/Source/Core/Common/ArmEmitter.h
+++ b/Source/Core/Common/ArmEmitter.h
@@ -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;
}
diff --git a/Source/Core/Common/BreakPoints.cpp b/Source/Core/Common/BreakPoints.cpp
index 4ee96a0a64..02924d639a 100644
--- a/Source/Core/Common/BreakPoints.cpp
+++ b/Source/Core/Common/BreakPoints.cpp
@@ -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)
diff --git a/Source/Core/Common/CDUtils.cpp b/Source/Core/Common/CDUtils.cpp
index 9652b98f08..2f1c24f146 100644
--- a/Source/Core/Common/CDUtils.cpp
+++ b/Source/Core/Common/CDUtils.cpp
@@ -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));
}
diff --git a/Source/Core/Common/ChunkFile.h b/Source/Core/Common/ChunkFile.h
index bc9da61b4d..e19d97793b 100644
--- a/Source/Core/Common/ChunkFile.h
+++ b/Source/Core/Common/ChunkFile.h
@@ -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;
diff --git a/Source/Core/Common/CommonFuncs.h b/Source/Core/Common/CommonFuncs.h
index f46cc47572..11f460ed96 100644
--- a/Source/Core/Common/CommonFuncs.h
+++ b/Source/Core/Common/CommonFuncs.h
@@ -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);
diff --git a/Source/Core/Common/ConsoleListener.cpp b/Source/Core/Common/ConsoleListener.cpp
index 5c4fbfd940..928c052756 100644
--- a/Source/Core/Common/ConsoleListener.cpp
+++ b/Source/Core/Common/ConsoleListener.cpp
@@ -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] = "";
diff --git a/Source/Core/Common/Crypto/ec.cpp b/Source/Core/Common/Crypto/ec.cpp
index acbbac1a8c..3a7968ba7d 100644
--- a/Source/Core/Common/Crypto/ec.cpp
+++ b/Source/Core/Common/Crypto/ec.cpp
@@ -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++)
{
diff --git a/Source/Core/Common/ExtendedTrace.cpp b/Source/Core/Common/ExtendedTrace.cpp
index 081d2969d9..3cf06aa29d 100644
--- a/Source/Core/Common/ExtendedTrace.cpp
+++ b/Source/Core/Common/ExtendedTrace.cpp
@@ -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;
diff --git a/Source/Core/Common/FifoQueue.h b/Source/Core/Common/FifoQueue.h
index 168b28ee1f..49f1dd977f 100644
--- a/Source/Core/Common/FifoQueue.h
+++ b/Source/Core/Common/FifoQueue.h
@@ -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()
{
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp
index 9765af6267..7483ec693f 100644
--- a/Source/Core/Common/FileUtil.cpp
+++ b/Source/Core/Common/FileUtil.cpp
@@ -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;
}
diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h
index 06ee32f326..deac3814c0 100644
--- a/Source/Core/Common/FileUtil.h
+++ b/Source/Core/Common/FileUtil.h
@@ -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();
diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp
index 2cc1a97e60..604aefc89c 100644
--- a/Source/Core/Common/IniFile.cpp
+++ b/Source/Core/Common/IniFile.cpp
@@ -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];
diff --git a/Source/Core/Common/LinearDiskCache.h b/Source/Core/Common/LinearDiskCache.h
index ea7ee1bcd1..876124ac2d 100644
--- a/Source/Core/Common/LinearDiskCache.h
+++ b/Source/Core/Common/LinearDiskCache.h
@@ -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;
diff --git a/Source/Core/Common/LogManager.cpp b/Source/Core/Common/LogManager.cpp
index f87bd0c3d9..0dfe90445e 100644
--- a/Source/Core/Common/LogManager.cpp
+++ b/Source/Core/Common/LogManager.cpp
@@ -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)
diff --git a/Source/Core/Common/MemArena.cpp b/Source/Core/Common/MemArena.cpp
index ac55dc0371..3ec119a79c 100644
--- a/Source/Core/Common/MemArena.cpp
+++ b/Source/Core/Common/MemArena.cpp
@@ -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;
}
}
}
diff --git a/Source/Core/Common/MemoryUtil.cpp b/Source/Core/Common/MemoryUtil.cpp
index 441ba2f10b..e664752910 100644
--- a/Source/Core/Common/MemoryUtil.cpp
+++ b/Source/Core/Common/MemoryUtil.cpp
@@ -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());
diff --git a/Source/Core/Common/Misc.cpp b/Source/Core/Common/Misc.cpp
index fdc11146dd..05293aa358 100644
--- a/Source/Core/Common/Misc.cpp
+++ b/Source/Core/Common/Misc.cpp
@@ -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] = {};
diff --git a/Source/Core/Common/StdConditionVariable.h b/Source/Core/Common/StdConditionVariable.h
index 05b753df73..f639acfdfd 100644
--- a/Source/Core/Common/StdConditionVariable.h
+++ b/Source/Core/Common/StdConditionVariable.h
@@ -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
}
diff --git a/Source/Core/Common/StdMutex.h b/Source/Core/Common/StdMutex.h
index 0559ee8fc9..94afc354f0 100644
--- a/Source/Core/Common/StdMutex.h
+++ b/Source/Core/Common/StdMutex.h
@@ -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;
diff --git a/Source/Core/Common/StdThread.h b/Source/Core/Common/StdThread.h
index 8b8357fd89..787f25a167 100644
--- a/Source/Core/Common/StdThread.h
+++ b/Source/Core/Common/StdThread.h
@@ -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);
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp
index 7f7ce5d794..1919083162 100644
--- a/Source/Core/Common/StringUtil.cpp
+++ b/Source/Core/Common/StringUtil.cpp
@@ -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;
diff --git a/Source/Core/Common/SymbolDB.cpp b/Source/Core/Common/SymbolDB.cpp
index 44a0913d22..c78a61ea8b 100644
--- a/Source/Core/Common/SymbolDB.cpp
+++ b/Source/Core/Common/SymbolDB.cpp
@@ -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)
diff --git a/Source/Core/Common/SymbolDB.h b/Source/Core/Common/SymbolDB.h
index b30fd3218b..26d0d2c4be 100644
--- a/Source/Core/Common/SymbolDB.h
+++ b/Source/Core/Common/SymbolDB.h
@@ -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;}
diff --git a/Source/Core/Common/Timer.cpp b/Source/Core/Common/Timer.cpp
index b1e52bb0d3..a8143c85f8 100644
--- a/Source/Core/Common/Timer.cpp
+++ b/Source/Core/Common/Timer.cpp
@@ -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();
diff --git a/Source/Core/Common/x64Emitter.h b/Source/Core/Common/x64Emitter.h
index b35fff3319..0af6b3b92a 100644
--- a/Source/Core/Common/x64Emitter.h
+++ b/Source/Core/Common/x64Emitter.h
@@ -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;
}