citra-emu
/
citra
Archived
1
0
Fork 0

Change NULLs to nullptrs.

This commit is contained in:
Rohit Nirmal 2014-12-03 12:57:57 -06:00
parent 63b1453dd8
commit 8a62423970
24 changed files with 115 additions and 115 deletions

View File

@ -76,9 +76,9 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc);
m_render_window = glfwCreateWindow(VideoCore::kScreenTopWidth, m_render_window = glfwCreateWindow(VideoCore::kScreenTopWidth,
(VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight), (VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight),
window_title.c_str(), NULL, NULL); window_title.c_str(), nullptr, nullptr);
if (m_render_window == NULL) { if (m_render_window == nullptr) {
ERROR_LOG(GUI, "Failed to create GLFW window! Exiting..."); ERROR_LOG(GUI, "Failed to create GLFW window! Exiting...");
exit(1); exit(1);
} }
@ -123,7 +123,7 @@ void EmuWindow_GLFW::MakeCurrent() {
/// Releases (dunno if this is the "right" word) the GLFW context from the caller thread /// Releases (dunno if this is the "right" word) the GLFW context from the caller thread
void EmuWindow_GLFW::DoneCurrent() { void EmuWindow_GLFW::DoneCurrent() {
glfwMakeContextCurrent(NULL); glfwMakeContextCurrent(nullptr);
} }
void EmuWindow_GLFW::ReloadSetKeymaps() { void EmuWindow_GLFW::ReloadSetKeymaps() {

View File

@ -230,7 +230,7 @@ QByteArray GRenderWindow::saveGeometry()
{ {
// If we are a top-level widget, store the current geometry // If we are a top-level widget, store the current geometry
// otherwise, store the last backup // otherwise, store the last backup
if (parent() == NULL) if (parent() == nullptr)
return ((QGLWidget*)this)->saveGeometry(); return ((QGLWidget*)this)->saveGeometry();
else else
return geometry; return geometry;

View File

@ -5,7 +5,7 @@
struct Hotkey struct Hotkey
{ {
Hotkey() : shortcut(NULL), context(Qt::WindowShortcut) {} Hotkey() : shortcut(nullptr), context(Qt::WindowShortcut) {}
QKeySequence keyseq; QKeySequence keyseq;
QShortcut* shortcut; QShortcut* shortcut;
@ -81,7 +81,7 @@ QShortcut* GetHotkey(const QString& group, const QString& action, QWidget* widge
Hotkey& hk = hotkey_groups[group][action]; Hotkey& hk = hotkey_groups[group][action];
if (!hk.shortcut) if (!hk.shortcut)
hk.shortcut = new QShortcut(hk.keyseq, widget, NULL, NULL, hk.context); hk.shortcut = new QShortcut(hk.keyseq, widget, nullptr, nullptr, hk.context);
return hk.shortcut; return hk.shortcut;
} }

View File

@ -131,7 +131,7 @@ GMainWindow::GMainWindow()
GMainWindow::~GMainWindow() GMainWindow::~GMainWindow()
{ {
// will get automatically deleted otherwise // will get automatically deleted otherwise
if (render_window->parent() == NULL) if (render_window->parent() == nullptr)
delete render_window; delete render_window;
} }
@ -213,14 +213,14 @@ void GMainWindow::OnOpenHotkeysDialog()
void GMainWindow::ToggleWindowMode() void GMainWindow::ToggleWindowMode()
{ {
bool enable = ui.action_Popout_Window_Mode->isChecked(); bool enable = ui.action_Popout_Window_Mode->isChecked();
if (enable && render_window->parent() != NULL) if (enable && render_window->parent() != nullptr)
{ {
ui.horizontalLayout->removeWidget(render_window); ui.horizontalLayout->removeWidget(render_window);
render_window->setParent(NULL); render_window->setParent(nullptr);
render_window->setVisible(true); render_window->setVisible(true);
render_window->RestoreGeometry(); render_window->RestoreGeometry();
} }
else if (!enable && render_window->parent() == NULL) else if (!enable && render_window->parent() == nullptr)
{ {
render_window->BackupGeometry(); render_window->BackupGeometry();
ui.horizontalLayout->addWidget(render_window); ui.horizontalLayout->addWidget(render_window);

View File

@ -204,11 +204,11 @@ public:
{ {
for (auto it = x.begin(), end = x.end(); it != end; ++it) for (auto it = x.begin(), end = x.end(); it != end; ++it)
{ {
if (it->second != NULL) if (it->second != nullptr)
delete it->second; delete it->second;
} }
} }
T *dv = NULL; T *dv = nullptr;
DoMap(x, dv); DoMap(x, dv);
} }
@ -264,11 +264,11 @@ public:
{ {
for (auto it = x.begin(), end = x.end(); it != end; ++it) for (auto it = x.begin(), end = x.end(); it != end; ++it)
{ {
if (it->second != NULL) if (it->second != nullptr)
delete it->second; delete it->second;
} }
} }
T *dv = NULL; T *dv = nullptr;
DoMultimap(x, dv); DoMultimap(x, dv);
} }
@ -320,7 +320,7 @@ public:
template<class T> template<class T>
void Do(std::vector<T *> &x) void Do(std::vector<T *> &x)
{ {
T *dv = NULL; T *dv = nullptr;
DoVector(x, dv); DoVector(x, dv);
} }
@ -369,7 +369,7 @@ public:
template<class T> template<class T>
void Do(std::deque<T *> &x) void Do(std::deque<T *> &x)
{ {
T *dv = NULL; T *dv = nullptr;
DoDeque(x, dv); DoDeque(x, dv);
} }
@ -395,7 +395,7 @@ public:
template<class T> template<class T>
void Do(std::list<T *> &x) void Do(std::list<T *> &x)
{ {
T *dv = NULL; T *dv = nullptr;
Do(x, dv); Do(x, dv);
} }
@ -433,7 +433,7 @@ public:
{ {
for (auto it = x.begin(), end = x.end(); it != end; ++it) for (auto it = x.begin(), end = x.end(); it != end; ++it)
{ {
if (*it != NULL) if (*it != nullptr)
delete *it; delete *it;
} }
} }
@ -518,7 +518,7 @@ public:
void DoClass(T *&x) { void DoClass(T *&x) {
if (mode == MODE_READ) if (mode == MODE_READ)
{ {
if (x != NULL) if (x != nullptr)
delete x; delete x;
x = new T(); x = new T();
} }
@ -567,7 +567,7 @@ public:
{ {
if (mode == MODE_READ) if (mode == MODE_READ)
{ {
cur->next = 0; cur->next = nullptr;
list_cur = cur; list_cur = cur;
if (prev) if (prev)
prev->next = cur; prev->next = cur;
@ -586,13 +586,13 @@ public:
if (mode == MODE_READ) if (mode == MODE_READ)
{ {
if (prev) if (prev)
prev->next = 0; prev->next = nullptr;
if (list_end) if (list_end)
*list_end = prev; *list_end = prev;
if (list_cur) if (list_cur)
{ {
if (list_start == list_cur) if (list_start == list_cur)
list_start = 0; list_start = nullptr;
do do
{ {
LinkedListItem<T>* next = list_cur->next; LinkedListItem<T>* next = list_cur->next;

View File

@ -106,7 +106,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){
// Restore the global locale // Restore the global locale
_configthreadlocale(_DISABLE_PER_THREAD_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 // Configure the thread to set the locale only for this thread
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE); _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);

View File

@ -16,7 +16,7 @@
ConsoleListener::ConsoleListener() ConsoleListener::ConsoleListener()
{ {
#ifdef _WIN32 #ifdef _WIN32
hConsole = NULL; hConsole = nullptr;
bUseColor = true; bUseColor = true;
#else #else
bUseColor = isatty(fileno(stdout)); bUseColor = isatty(fileno(stdout));
@ -66,19 +66,19 @@ void ConsoleListener::UpdateHandle()
void ConsoleListener::Close() void ConsoleListener::Close()
{ {
#ifdef _WIN32 #ifdef _WIN32
if (hConsole == NULL) if (hConsole == nullptr)
return; return;
FreeConsole(); FreeConsole();
hConsole = NULL; hConsole = nullptr;
#else #else
fflush(NULL); fflush(nullptr);
#endif #endif
} }
bool ConsoleListener::IsOpen() bool ConsoleListener::IsOpen()
{ {
#ifdef _WIN32 #ifdef _WIN32
return (hConsole != NULL); return (hConsole != nullptr);
#else #else
return true; return true;
#endif #endif

View File

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

View File

@ -57,7 +57,7 @@ public:
// advance the read pointer // advance the read pointer
m_read_ptr = m_read_ptr->next; m_read_ptr = m_read_ptr->next;
// set the next element to NULL to stop the recursive deletion // set the next element to NULL to stop the recursive deletion
tmpptr->next = NULL; tmpptr->next = nullptr;
delete tmpptr; // this also deletes the element delete tmpptr; // this also deletes the element
} }
@ -86,7 +86,7 @@ private:
class ElementPtr class ElementPtr
{ {
public: public:
ElementPtr() : current(NULL), next(NULL) {} ElementPtr() : current(nullptr), next(nullptr) {}
~ElementPtr() ~ElementPtr()
{ {

View File

@ -140,7 +140,7 @@ bool CreateDir(const std::string &path)
{ {
INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str()); INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str());
#ifdef _WIN32 #ifdef _WIN32
if (::CreateDirectory(Common::UTF8ToTStr(path).c_str(), NULL)) if (::CreateDirectory(Common::UTF8ToTStr(path).c_str(), nullptr))
return true; return true;
DWORD error = GetLastError(); DWORD error = GetLastError();
if (error == ERROR_ALREADY_EXISTS) if (error == ERROR_ALREADY_EXISTS)
@ -423,7 +423,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
FSTEntry entry; FSTEntry entry;
const std::string virtualName(Common::TStrToUTF8(ffd.cFileName)); const std::string virtualName(Common::TStrToUTF8(ffd.cFileName));
#else #else
struct dirent dirent, *result = NULL; struct dirent dirent, *result = nullptr;
DIR *dirp = opendir(directory.c_str()); DIR *dirp = opendir(directory.c_str());
if (!dirp) if (!dirp)
@ -491,7 +491,7 @@ bool DeleteDirRecursively(const std::string &directory)
{ {
const std::string virtualName(Common::TStrToUTF8(ffd.cFileName)); const std::string virtualName(Common::TStrToUTF8(ffd.cFileName));
#else #else
struct dirent dirent, *result = NULL; struct dirent dirent, *result = nullptr;
DIR *dirp = opendir(directory.c_str()); DIR *dirp = opendir(directory.c_str());
if (!dirp) if (!dirp)
return false; return false;
@ -552,7 +552,7 @@ void CopyDir(const std::string &source_path, const std::string &dest_path)
if (!FileUtil::Exists(source_path)) return; if (!FileUtil::Exists(source_path)) return;
if (!FileUtil::Exists(dest_path)) FileUtil::CreateFullPath(dest_path); if (!FileUtil::Exists(dest_path)) FileUtil::CreateFullPath(dest_path);
struct dirent dirent, *result = NULL; struct dirent dirent, *result = nullptr;
DIR *dirp = opendir(source_path.c_str()); DIR *dirp = opendir(source_path.c_str());
if (!dirp) return; if (!dirp) return;
@ -586,11 +586,11 @@ std::string GetCurrentDir()
{ {
char *dir; char *dir;
// Get the current working directory (getcwd uses malloc) // Get the current working directory (getcwd uses malloc)
if (!(dir = __getcwd(NULL, 0))) { if (!(dir = __getcwd(nullptr, 0))) {
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s",
GetLastErrorMsg()); GetLastErrorMsg());
return NULL; return nullptr;
} }
std::string strDir = dir; std::string strDir = dir;
free(dir); free(dir);
@ -626,7 +626,7 @@ std::string& GetExeDirectory()
if (DolphinPath.empty()) if (DolphinPath.empty())
{ {
TCHAR Dolphin_exe_Path[2048]; TCHAR Dolphin_exe_Path[2048];
GetModuleFileName(NULL, Dolphin_exe_Path, 2048); GetModuleFileName(nullptr, Dolphin_exe_Path, 2048);
DolphinPath = Common::TStrToUTF8(Dolphin_exe_Path); DolphinPath = Common::TStrToUTF8(Dolphin_exe_Path);
DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\')); DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\'));
} }
@ -826,7 +826,7 @@ void SplitFilename83(const std::string& filename, std::array<char, 9>& short_nam
} }
IOFile::IOFile() IOFile::IOFile()
: m_file(NULL), m_good(true) : m_file(nullptr), m_good(true)
{} {}
IOFile::IOFile(std::FILE* file) IOFile::IOFile(std::FILE* file)
@ -834,7 +834,7 @@ IOFile::IOFile(std::FILE* file)
{} {}
IOFile::IOFile(const std::string& filename, const char openmode[]) IOFile::IOFile(const std::string& filename, const char openmode[])
: m_file(NULL), m_good(true) : m_file(nullptr), m_good(true)
{ {
Open(filename, openmode); Open(filename, openmode);
} }
@ -845,7 +845,7 @@ IOFile::~IOFile()
} }
IOFile::IOFile(IOFile&& other) IOFile::IOFile(IOFile&& other)
: m_file(NULL), m_good(true) : m_file(nullptr), m_good(true)
{ {
Swap(other); Swap(other);
} }
@ -880,14 +880,14 @@ bool IOFile::Close()
if (!IsOpen() || 0 != std::fclose(m_file)) if (!IsOpen() || 0 != std::fclose(m_file))
m_good = false; m_good = false;
m_file = NULL; m_file = nullptr;
return m_good; return m_good;
} }
std::FILE* IOFile::ReleaseHandle() std::FILE* IOFile::ReleaseHandle()
{ {
std::FILE* const ret = m_file; std::FILE* const ret = m_file;
m_file = NULL; m_file = nullptr;
return ret; return ret;
} }

View File

@ -202,11 +202,11 @@ public:
return WriteArray(reinterpret_cast<const char*>(data), length); 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 // m_good is set to false when a read, write or other function fails
bool IsGood() { return m_good; } bool IsGood() { return m_good; }
operator void*() { return m_good ? m_file : NULL; } operator void*() { return m_good ? m_file : nullptr; }
std::FILE* ReleaseHandle(); std::FILE* ReleaseHandle();

View File

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

View File

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

View File

@ -30,7 +30,7 @@
#endif #endif
#ifdef IOS #ifdef IOS
void* globalbase = NULL; void* globalbase = nullptr;
#endif #endif
#ifdef ANDROID #ifdef ANDROID
@ -121,7 +121,7 @@ void MemArena::GrabLowMemSpace(size_t size)
{ {
#ifdef _WIN32 #ifdef _WIN32
#ifndef _XBOX #ifndef _XBOX
hMemoryMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, (DWORD)(size), NULL); hMemoryMapping = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, (DWORD)(size), nullptr);
GetSystemInfo(&sysInfo); GetSystemInfo(&sysInfo);
#endif #endif
#elif defined(ANDROID) #elif defined(ANDROID)
@ -178,7 +178,7 @@ void *MemArena::CreateView(s64 offset, size_t size, void *base)
#ifdef _XBOX #ifdef _XBOX
size = roundup(size); size = roundup(size);
// use 64kb pages // use 64kb pages
void * ptr = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE); void * ptr = VirtualAlloc(nullptr, size, MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE);
return ptr; return ptr;
#else #else
size = roundup(size); size = roundup(size);
@ -243,8 +243,8 @@ u8* MemArena::Find4GBBase()
return base; return base;
#else #else
#ifdef IOS #ifdef IOS
void* base = NULL; void* base = nullptr;
if (globalbase == NULL){ if (globalbase == nullptr){
base = mmap(0, 0x08000000, PROT_READ | PROT_WRITE, base = mmap(0, 0x08000000, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_SHARED, -1, 0); MAP_ANON | MAP_SHARED, -1, 0);
if (base == MAP_FAILED) { if (base == MAP_FAILED) {
@ -357,7 +357,7 @@ bail:
if (views[j].out_ptr_low && *views[j].out_ptr_low) if (views[j].out_ptr_low && *views[j].out_ptr_low)
{ {
arena->ReleaseView(*views[j].out_ptr_low, views[j].size); arena->ReleaseView(*views[j].out_ptr_low, views[j].size);
*views[j].out_ptr_low = NULL; *views[j].out_ptr_low = nullptr;
} }
if (*views[j].out_ptr) if (*views[j].out_ptr)
{ {
@ -369,7 +369,7 @@ bail:
arena->ReleaseView(*views[j].out_ptr, views[j].size); arena->ReleaseView(*views[j].out_ptr, views[j].size);
} }
#endif #endif
*views[j].out_ptr = NULL; *views[j].out_ptr = nullptr;
} }
} }
return false; return false;
@ -415,7 +415,7 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
#elif defined(_WIN32) #elif defined(_WIN32)
// Try a whole range of possible bases. Return once we got a valid one. // Try a whole range of possible bases. Return once we got a valid one.
u32 max_base_addr = 0x7FFF0000 - 0x10000000; u32 max_base_addr = 0x7FFF0000 - 0x10000000;
u8 *base = NULL; u8 *base = nullptr;
for (u32 base_addr = 0x01000000; base_addr < max_base_addr; base_addr += 0x400000) for (u32 base_addr = 0x01000000; base_addr < max_base_addr; base_addr += 0x400000)
{ {
@ -463,8 +463,8 @@ void MemoryMap_Shutdown(const MemoryView *views, int num_views, u32 flags, MemAr
arena->ReleaseView(*views[i].out_ptr_low, views[i].size); arena->ReleaseView(*views[i].out_ptr_low, views[i].size);
if (*views[i].out_ptr && (views[i].out_ptr_low && *views[i].out_ptr != *views[i].out_ptr_low)) if (*views[i].out_ptr && (views[i].out_ptr_low && *views[i].out_ptr != *views[i].out_ptr_low))
arena->ReleaseView(*views[i].out_ptr, views[i].size); arena->ReleaseView(*views[i].out_ptr, views[i].size);
*views[i].out_ptr = NULL; *views[i].out_ptr = nullptr;
if (views[i].out_ptr_low) if (views[i].out_ptr_low)
*views[i].out_ptr_low = NULL; *views[i].out_ptr_low = nullptr;
} }
} }

View File

@ -93,7 +93,7 @@ void* AllocateMemoryPages(size_t size)
// printf("Mapped memory at %p (size %ld)\n", ptr, // printf("Mapped memory at %p (size %ld)\n", ptr,
// (unsigned long)size); // (unsigned long)size);
if (ptr == NULL) if (ptr == nullptr)
PanicAlert("Failed to allocate raw memory"); PanicAlert("Failed to allocate raw memory");
return ptr; return ptr;
@ -104,7 +104,7 @@ void* AllocateAlignedMemory(size_t size,size_t alignment)
#ifdef _WIN32 #ifdef _WIN32
void* ptr = _aligned_malloc(size,alignment); void* ptr = _aligned_malloc(size,alignment);
#else #else
void* ptr = NULL; void* ptr = nullptr;
#ifdef ANDROID #ifdef ANDROID
ptr = memalign(alignment, size); ptr = memalign(alignment, size);
#else #else
@ -116,7 +116,7 @@ void* AllocateAlignedMemory(size_t size,size_t alignment)
// printf("Mapped memory at %p (size %ld)\n", ptr, // printf("Mapped memory at %p (size %ld)\n", ptr,
// (unsigned long)size); // (unsigned long)size);
if (ptr == NULL) if (ptr == nullptr)
PanicAlert("Failed to allocate aligned memory"); PanicAlert("Failed to allocate aligned memory");
return ptr; return ptr;
@ -130,7 +130,7 @@ void FreeMemoryPages(void* ptr, size_t size)
if (!VirtualFree(ptr, 0, MEM_RELEASE)) if (!VirtualFree(ptr, 0, MEM_RELEASE))
PanicAlert("FreeMemoryPages failed!\n%s", GetLastErrorMsg()); PanicAlert("FreeMemoryPages failed!\n%s", GetLastErrorMsg());
ptr = NULL; // Is this our responsibility? ptr = nullptr; // Is this our responsibility?
#else #else
munmap(ptr, size); munmap(ptr, size);
@ -184,7 +184,7 @@ std::string MemUsage()
// Print information about the memory usage of the process. // Print information about the memory usage of the process.
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); 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))) if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc)))
Ret = Common::StringFromFormat("%s K", Common::ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str()); Ret = Common::StringFromFormat("%s K", Common::ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str());

View File

@ -23,9 +23,9 @@ const char* GetLastErrorMsg()
#ifdef _WIN32 #ifdef _WIN32
static __declspec(thread) char err_str[buff_size] = {}; 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), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
err_str, buff_size, NULL); err_str, buff_size, nullptr);
#else #else
static __thread char err_str[buff_size] = {}; static __thread char err_str[buff_size] = {};

View File

@ -77,7 +77,7 @@
inline struct tm* localtime_r(const time_t *clock, struct tm *result) { inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
if (localtime_s(result, clock) == 0) if (localtime_s(result, clock) == 0)
return result; return result;
return NULL; return nullptr;
} }
#else #else

View File

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

View File

@ -37,7 +37,7 @@ struct ThreadQueueList {
~ThreadQueueList() { ~ThreadQueueList() {
for (int i = 0; i < NUM_QUEUES; ++i) for (int i = 0; i < NUM_QUEUES; ++i)
{ {
if (queues[i].data != NULL) if (queues[i].data != nullptr)
free(queues[i].data); free(queues[i].data);
} }
} }
@ -46,7 +46,7 @@ struct ThreadQueueList {
int contains(const IdType uid) { int contains(const IdType uid) {
for (int i = 0; i < NUM_QUEUES; ++i) for (int i = 0; i < NUM_QUEUES; ++i)
{ {
if (queues[i].data == NULL) if (queues[i].data == nullptr)
continue; continue;
Queue *cur = &queues[i]; Queue *cur = &queues[i];
@ -133,7 +133,7 @@ struct ThreadQueueList {
inline void clear() { inline void clear() {
for (int i = 0; i < NUM_QUEUES; ++i) for (int i = 0; i < NUM_QUEUES; ++i)
{ {
if (queues[i].data != NULL) if (queues[i].data != nullptr)
free(queues[i].data); free(queues[i].data);
} }
memset(queues, 0, sizeof(queues)); memset(queues, 0, sizeof(queues));
@ -147,7 +147,7 @@ struct ThreadQueueList {
inline void prepare(u32 priority) { inline void prepare(u32 priority) {
Queue *cur = &queues[priority]; Queue *cur = &queues[priority];
if (cur->next == NULL) if (cur->next == nullptr)
link(priority, INITIAL_CAPACITY); link(priority, INITIAL_CAPACITY);
} }
@ -176,7 +176,7 @@ private:
for (int i = (int) priority - 1; i >= 0; --i) for (int i = (int) priority - 1; i >= 0; --i)
{ {
if (queues[i].next != NULL) if (queues[i].next != nullptr)
{ {
cur->next = queues[i].next; cur->next = queues[i].next;
queues[i].next = cur; queues[i].next = cur;
@ -193,7 +193,7 @@ private:
int size = cur->end - cur->first; int size = cur->end - cur->first;
if (size >= cur->capacity - 2) { if (size >= cur->capacity - 2) {
IdType *new_data = (IdType *)realloc(cur->data, cur->capacity * 2 * sizeof(IdType)); IdType *new_data = (IdType *)realloc(cur->data, cur->capacity * 2 * sizeof(IdType));
if (new_data != NULL) { if (new_data != nullptr) {
cur->capacity *= 2; cur->capacity *= 2;
cur->data = new_data; cur->data = new_data;
} }

View File

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

View File

@ -281,28 +281,28 @@ int u8_read_escape_sequence(const char *str, u32 *dest)
do { do {
digs[dno++] = str[i++]; digs[dno++] = str[i++];
} while (octal_digit(str[i]) && dno < 3); } while (octal_digit(str[i]) && dno < 3);
ch = strtol(digs, NULL, 8); ch = strtol(digs, nullptr, 8);
} }
else if (str[0] == 'x') { else if (str[0] == 'x') {
while (hex_digit(str[i]) && dno < 2) { while (hex_digit(str[i]) && dno < 2) {
digs[dno++] = str[i++]; digs[dno++] = str[i++];
} }
if (dno > 0) if (dno > 0)
ch = strtol(digs, NULL, 16); ch = strtol(digs, nullptr, 16);
} }
else if (str[0] == 'u') { else if (str[0] == 'u') {
while (hex_digit(str[i]) && dno < 4) { while (hex_digit(str[i]) && dno < 4) {
digs[dno++] = str[i++]; digs[dno++] = str[i++];
} }
if (dno > 0) if (dno > 0)
ch = strtol(digs, NULL, 16); ch = strtol(digs, nullptr, 16);
} }
else if (str[0] == 'U') { else if (str[0] == 'U') {
while (hex_digit(str[i]) && dno < 8) { while (hex_digit(str[i]) && dno < 8) {
digs[dno++] = str[i++]; digs[dno++] = str[i++];
} }
if (dno > 0) if (dno > 0)
ch = strtol(digs, NULL, 16); ch = strtol(digs, nullptr, 16);
} }
*dest = ch; *dest = ch;
@ -353,7 +353,7 @@ const char *u8_strchr(const char *s, u32 ch, int *charn)
lasti = i; lasti = i;
(*charn)++; (*charn)++;
} }
return NULL; return nullptr;
} }
const char *u8_memchr(const char *s, u32 ch, size_t sz, int *charn) const char *u8_memchr(const char *s, u32 ch, size_t sz, int *charn)
@ -378,7 +378,7 @@ const char *u8_memchr(const char *s, u32 ch, size_t sz, int *charn)
lasti = i; lasti = i;
(*charn)++; (*charn)++;
} }
return NULL; return nullptr;
} }
int u8_is_locale_utf8(const char *locale) int u8_is_locale_utf8(const char *locale)
@ -419,35 +419,35 @@ bool UTF8StringHasNonASCII(const char *utf8string) {
std::string ConvertWStringToUTF8(const wchar_t *wstr) { std::string ConvertWStringToUTF8(const wchar_t *wstr) {
int len = (int)wcslen(wstr); int len = (int)wcslen(wstr);
int size = (int)WideCharToMultiByte(CP_UTF8, 0, wstr, len, 0, 0, NULL, NULL); int size = (int)WideCharToMultiByte(CP_UTF8, 0, wstr, len, 0, 0, nullptr, nullptr);
std::string s; std::string s;
s.resize(size); s.resize(size);
if (size > 0) { if (size > 0) {
WideCharToMultiByte(CP_UTF8, 0, wstr, len, &s[0], size, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, wstr, len, &s[0], size, nullptr, nullptr);
} }
return s; return s;
} }
std::string ConvertWStringToUTF8(const std::wstring &wstr) { std::string ConvertWStringToUTF8(const std::wstring &wstr) {
int len = (int)wstr.size(); int len = (int)wstr.size();
int size = (int)WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), len, 0, 0, NULL, NULL); int size = (int)WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), len, 0, 0, nullptr, nullptr);
std::string s; std::string s;
s.resize(size); s.resize(size);
if (size > 0) { if (size > 0) {
WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), len, &s[0], size, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), len, &s[0], size, nullptr, nullptr);
} }
return s; return s;
} }
void ConvertUTF8ToWString(wchar_t *dest, size_t destSize, const std::string &source) { void ConvertUTF8ToWString(wchar_t *dest, size_t destSize, const std::string &source) {
int len = (int)source.size(); int len = (int)source.size();
int size = (int)MultiByteToWideChar(CP_UTF8, 0, source.c_str(), len, NULL, 0); int size = (int)MultiByteToWideChar(CP_UTF8, 0, source.c_str(), len, nullptr, 0);
MultiByteToWideChar(CP_UTF8, 0, source.c_str(), len, dest, std::min((int)destSize, size)); MultiByteToWideChar(CP_UTF8, 0, source.c_str(), len, dest, std::min((int)destSize, size));
} }
std::wstring ConvertUTF8ToWString(const std::string &source) { std::wstring ConvertUTF8ToWString(const std::string &source) {
int len = (int)source.size(); int len = (int)source.size();
int size = (int)MultiByteToWideChar(CP_UTF8, 0, source.c_str(), len, NULL, 0); int size = (int)MultiByteToWideChar(CP_UTF8, 0, source.c_str(), len, nullptr, 0);
std::wstring str; std::wstring str;
str.resize(size); str.resize(size);
if (size > 0) { if (size > 0) {

View File

@ -67,7 +67,7 @@ s64 idledCycles;
static std::recursive_mutex externalEventSection; static std::recursive_mutex externalEventSection;
// Warning: not included in save state. // Warning: not included in save state.
void(*advanceCallback)(int cyclesExecuted) = NULL; void(*advanceCallback)(int cyclesExecuted) = nullptr;
void SetClockFrequencyMHz(int cpuMhz) void SetClockFrequencyMHz(int cpuMhz)
{ {
@ -231,7 +231,7 @@ void ClearPendingEvents()
void AddEventToQueue(Event* ne) void AddEventToQueue(Event* ne)
{ {
Event* prev = NULL; Event* prev = nullptr;
Event** pNext = &first; Event** pNext = &first;
for (;;) for (;;)
{ {
@ -327,7 +327,7 @@ s64 UnscheduleThreadsafeEvent(int event_type, u64 userdata)
} }
if (!tsFirst) if (!tsFirst)
{ {
tsLast = NULL; tsLast = nullptr;
return result; return result;
} }
@ -433,7 +433,7 @@ void RemoveThreadsafeEvent(int event_type)
} }
if (!tsFirst) if (!tsFirst)
{ {
tsLast = NULL; tsLast = nullptr;
return; return;
} }
Event *prev = tsFirst; Event *prev = tsFirst;
@ -495,7 +495,7 @@ void MoveEvents()
AddEventToQueue(tsFirst); AddEventToQueue(tsFirst);
tsFirst = next; tsFirst = next;
} }
tsLast = NULL; tsLast = nullptr;
// Move free events to threadsafe pool // Move free events to threadsafe pool
while (allocatedTsEvents > 0 && eventPool) while (allocatedTsEvents > 0 && eventPool)
@ -614,7 +614,7 @@ void DoState(PointerWrap &p)
// These (should) be filled in later by the modules. // These (should) be filled in later by the modules.
event_types.resize(n, EventType(AntiCrashCallback, "INVALID EVENT")); event_types.resize(n, EventType(AntiCrashCallback, "INVALID EVENT"));
p.DoLinkedList<BaseEvent, GetNewEvent, FreeEvent, Event_DoState>(first, (Event **)NULL); p.DoLinkedList<BaseEvent, GetNewEvent, FreeEvent, Event_DoState>(first, (Event **)nullptr);
p.DoLinkedList<BaseEvent, GetNewTsEvent, FreeTsEvent, Event_DoState>(tsFirst, &tsLast); p.DoLinkedList<BaseEvent, GetNewTsEvent, FreeTsEvent, Event_DoState>(tsFirst, &tsLast);
p.Do(g_clock_rate_arm11); p.Do(g_clock_rate_arm11);

View File

@ -22,7 +22,7 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) {
// Compile Vertex Shader // Compile Vertex Shader
DEBUG_LOG(GPU, "Compiling vertex shader."); DEBUG_LOG(GPU, "Compiling vertex shader.");
glShaderSource(vertex_shader_id, 1, &vertex_shader, NULL); glShaderSource(vertex_shader_id, 1, &vertex_shader, nullptr);
glCompileShader(vertex_shader_id); glCompileShader(vertex_shader_id);
// Check Vertex Shader // Check Vertex Shader
@ -31,14 +31,14 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) {
if (info_log_length > 1) { if (info_log_length > 1) {
std::vector<char> vertex_shader_error(info_log_length); std::vector<char> vertex_shader_error(info_log_length);
glGetShaderInfoLog(vertex_shader_id, info_log_length, NULL, &vertex_shader_error[0]); glGetShaderInfoLog(vertex_shader_id, info_log_length, nullptr, &vertex_shader_error[0]);
DEBUG_LOG(GPU, "%s", &vertex_shader_error[0]); DEBUG_LOG(GPU, "%s", &vertex_shader_error[0]);
} }
// Compile Fragment Shader // Compile Fragment Shader
DEBUG_LOG(GPU, "Compiling fragment shader."); DEBUG_LOG(GPU, "Compiling fragment shader.");
glShaderSource(fragment_shader_id, 1, &fragment_shader, NULL); glShaderSource(fragment_shader_id, 1, &fragment_shader, nullptr);
glCompileShader(fragment_shader_id); glCompileShader(fragment_shader_id);
// Check Fragment Shader // Check Fragment Shader
@ -47,7 +47,7 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) {
if (info_log_length > 1) { if (info_log_length > 1) {
std::vector<char> fragment_shader_error(info_log_length); std::vector<char> fragment_shader_error(info_log_length);
glGetShaderInfoLog(fragment_shader_id, info_log_length, NULL, &fragment_shader_error[0]); glGetShaderInfoLog(fragment_shader_id, info_log_length, nullptr, &fragment_shader_error[0]);
DEBUG_LOG(GPU, "%s", &fragment_shader_error[0]); DEBUG_LOG(GPU, "%s", &fragment_shader_error[0]);
} }
@ -65,7 +65,7 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) {
if (info_log_length > 1) { if (info_log_length > 1) {
std::vector<char> program_error(info_log_length); std::vector<char> program_error(info_log_length);
glGetProgramInfoLog(program_id, info_log_length, NULL, &program_error[0]); glGetProgramInfoLog(program_id, info_log_length, nullptr, &program_error[0]);
DEBUG_LOG(GPU, "%s", &program_error[0]); DEBUG_LOG(GPU, "%s", &program_error[0]);
} }

View File

@ -17,8 +17,8 @@
namespace VideoCore { namespace VideoCore {
EmuWindow* g_emu_window = NULL; ///< Frontend emulator window EmuWindow* g_emu_window = nullptr; ///< Frontend emulator window
RendererBase* g_renderer = NULL; ///< Renderer plugin RendererBase* g_renderer = nullptr; ///< Renderer plugin
int g_current_frame = 0; int g_current_frame = 0;
/// Initialize the video core /// Initialize the video core