The big NULL replacement party part 2.
This may take a bit. Trying to do this by operator/command.
This commit is contained in:
@@ -87,7 +87,7 @@ static int get_readable_ranges( const void **starts, const void **ends, int size
|
||||
while( got < size-1 )
|
||||
{
|
||||
char *p = (char *) memchr( file, '\n', file_used );
|
||||
if( p == NULL )
|
||||
if( p == nullptr )
|
||||
break;
|
||||
*p++ = 0;
|
||||
|
||||
@@ -98,13 +98,13 @@ static int get_readable_ranges( const void **starts, const void **ends, int size
|
||||
|
||||
/* Search for the hyphen. */
|
||||
char *hyphen = strchr( line, '-' );
|
||||
if( hyphen == NULL )
|
||||
if( hyphen == nullptr )
|
||||
continue; /* Parse error. */
|
||||
|
||||
|
||||
/* Search for the space. */
|
||||
char *space = strchr( hyphen, ' ' );
|
||||
if( space == NULL )
|
||||
if( space == nullptr )
|
||||
continue; /* Parse error. */
|
||||
|
||||
/* " rwxp". If space[1] isn't 'r', then the block isn't readable. */
|
||||
@@ -392,7 +392,7 @@ void GetBacktrace( const void **buf, size_t size, const BacktraceContext *ctx )
|
||||
InitializeBacktrace();
|
||||
|
||||
BacktraceContext CurrentCtx;
|
||||
if( ctx == NULL )
|
||||
if( ctx == nullptr )
|
||||
{
|
||||
ctx = &CurrentCtx;
|
||||
|
||||
@@ -528,7 +528,7 @@ void GetBacktrace( const void **buf, size_t size, const BacktraceContext *ctx )
|
||||
}
|
||||
|
||||
BacktraceContext CurrentCtx;
|
||||
if( ctx == NULL )
|
||||
if( ctx == nullptr )
|
||||
{
|
||||
ctx = &CurrentCtx;
|
||||
|
||||
@@ -649,7 +649,7 @@ void InitializeBacktrace() { }
|
||||
void GetBacktrace( const void **buf, size_t size, const BacktraceContext *ctx )
|
||||
{
|
||||
BacktraceContext CurrentCtx;
|
||||
if( ctx == NULL )
|
||||
if( ctx == nullptr )
|
||||
{
|
||||
ctx = &CurrentCtx;
|
||||
|
||||
@@ -698,7 +698,7 @@ void GetBacktrace( const void **buf, size_t size, const BacktraceContext *ctx )
|
||||
{
|
||||
BacktraceContext CurrentCtx;
|
||||
|
||||
if( ctx == NULL )
|
||||
if( ctx == nullptr )
|
||||
{
|
||||
ctx = &CurrentCtx;
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ void BacktraceNames::FromAddr( const void *p )
|
||||
* between one function and the next, because the first lookup will succeed.
|
||||
*/
|
||||
Dl_info di;
|
||||
if( !dladdr((void *) p, &di) || di.dli_sname == NULL )
|
||||
if( !dladdr((void *) p, &di) || di.dli_sname == nullptr )
|
||||
{
|
||||
if( !dladdr( ((char *) p) - 8, &di) )
|
||||
return;
|
||||
@@ -175,7 +175,7 @@ static int osx_find_image( const void *p )
|
||||
for( unsigned i = 0; i < image_count; i++ )
|
||||
{
|
||||
const struct mach_header *header = _dyld_get_image_header(i);
|
||||
if( header == NULL )
|
||||
if( header == nullptr )
|
||||
continue;
|
||||
|
||||
/* The load commands directly follow the mach_header. */
|
||||
@@ -233,7 +233,7 @@ void BacktraceNames::FromAddr( const void *p )
|
||||
|
||||
/* Find the link-edit pointer. */
|
||||
const char *link_edit = osx_find_link_edit( _dyld_get_image_header(index) );
|
||||
if( link_edit == NULL )
|
||||
if( link_edit == nullptr )
|
||||
return;
|
||||
link_edit += _dyld_get_image_vmaddr_slide( index );
|
||||
|
||||
@@ -297,7 +297,7 @@ void BacktraceNames::FromAddr( const void *p )
|
||||
Address = (intptr_t) p;
|
||||
|
||||
char **foo = backtrace_symbols(&p, 1);
|
||||
if( foo == NULL )
|
||||
if( foo == nullptr )
|
||||
return;
|
||||
FromString( foo[0] );
|
||||
free(foo);
|
||||
|
||||
@@ -30,7 +30,7 @@ static void safe_print( int fd, ... )
|
||||
while( true )
|
||||
{
|
||||
const char *p = va_arg( ap, const char * );
|
||||
if( p == NULL )
|
||||
if( p == nullptr )
|
||||
break;
|
||||
size_t len = strlen( p );
|
||||
while( len )
|
||||
@@ -203,7 +203,7 @@ static void parent_process( int to_child, const CrashData *crash )
|
||||
|
||||
static void RunCrashHandler( const CrashData *crash )
|
||||
{
|
||||
if( g_pCrashHandlerArgv0 == NULL )
|
||||
if( g_pCrashHandlerArgv0 == nullptr )
|
||||
{
|
||||
safe_print( fileno(stderr), "Crash handler failed: CrashHandlerHandleArgs was not called\n", NULL );
|
||||
_exit( 1 );
|
||||
|
||||
@@ -198,7 +198,7 @@ static void child_process()
|
||||
sCrashInfoPath += "/crashinfo.txt";
|
||||
|
||||
FILE *CrashDump = fopen( sCrashInfoPath, "w+" );
|
||||
if(CrashDump == NULL)
|
||||
if(CrashDump == nullptr)
|
||||
{
|
||||
fprintf( stderr, "Couldn't open " + sCrashInfoPath + ": %s\n", strerror(errno) );
|
||||
exit(1);
|
||||
@@ -277,7 +277,7 @@ static void child_process()
|
||||
/* stdout may have been inadvertently closed by the crash in the parent;
|
||||
* write to /dev/tty instead. */
|
||||
FILE *tty = fopen( "/dev/tty", "w" );
|
||||
if( tty == NULL )
|
||||
if( tty == nullptr )
|
||||
tty = stderr;
|
||||
|
||||
fputs( "\n"
|
||||
|
||||
@@ -141,7 +141,7 @@ static void *CreateStack( int size )
|
||||
/* Hook up events to fatal signals, so we can clean up if we're killed. */
|
||||
void SignalHandler::OnClose( handler h )
|
||||
{
|
||||
if( saved_sigs == NULL )
|
||||
if( saved_sigs == nullptr )
|
||||
{
|
||||
saved_sigs = new SaveSignals;
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ static Preference<RString> g_XWMName( "XWMName", PRODUCT_ID );
|
||||
|
||||
bool X11Helper::OpenXConnection()
|
||||
{
|
||||
DEBUG_ASSERT( Dpy == NULL && Win == None );
|
||||
DEBUG_ASSERT( Dpy == nullptr && Win == None );
|
||||
Dpy = XOpenDisplay(0);
|
||||
if( Dpy == NULL )
|
||||
if( Dpy == nullptr )
|
||||
return false;
|
||||
|
||||
XSetIOErrorHandler( FatalCallback );
|
||||
@@ -66,7 +66,7 @@ bool X11Helper::MakeWindow( Window &win, int screenNum, int depth, Visual *visua
|
||||
return false;
|
||||
|
||||
XClassHint *hint = XAllocClassHint();
|
||||
if ( hint == NULL ) {
|
||||
if ( hint == nullptr ) {
|
||||
LOG->Warn("Could not set class hint for X11 Window");
|
||||
} else {
|
||||
hint->res_name = (char*)g_XWMName.Get().c_str();
|
||||
|
||||
@@ -67,7 +67,7 @@ static void GetReason( const EXCEPTION_RECORD *pRecord, CrashInfo *crash )
|
||||
// fill out bomb reason
|
||||
const char *reason = LookupException( pRecord->ExceptionCode );
|
||||
|
||||
if( reason == NULL )
|
||||
if( reason == nullptr )
|
||||
wsprintf( crash->m_CrashReason, "unknown exception 0x%08lx", pRecord->ExceptionCode );
|
||||
else
|
||||
strcpy( crash->m_CrashReason, reason );
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace VDDebugInfo
|
||||
break;
|
||||
|
||||
char *pBuf = pctx->sRawBlock.GetBuffer( dwFileSize );
|
||||
if( pBuf == NULL )
|
||||
if( pBuf == nullptr )
|
||||
break;
|
||||
|
||||
DWORD dwActual;
|
||||
@@ -480,7 +480,7 @@ static void DoSave( const RString &sReport )
|
||||
|
||||
SetFileAttributes( sName, FILE_ATTRIBUTE_NORMAL );
|
||||
FILE *pFile = fopen( sName, "w+" );
|
||||
if( pFile == NULL )
|
||||
if( pFile == nullptr )
|
||||
return;
|
||||
fprintf( pFile, "%s", sReport.c_str() );
|
||||
|
||||
@@ -751,7 +751,7 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
break;
|
||||
case WM_TIMER:
|
||||
{
|
||||
if( m_pPost == NULL )
|
||||
if( m_pPost == nullptr )
|
||||
break;
|
||||
|
||||
float fProgress = m_pPost->GetProgress();
|
||||
|
||||
@@ -95,7 +95,7 @@ bool GetProcessFileName( uint32_t iProcessID, RString &sName )
|
||||
* kernel32.lib functions. */
|
||||
do {
|
||||
HANDLE hSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, iProcessID );
|
||||
if( hSnap == NULL )
|
||||
if( hSnap == nullptr )
|
||||
{
|
||||
sName = werr_ssprintf( GetLastError(), "CreateToolhelp32Snapshot" );
|
||||
break;
|
||||
@@ -128,7 +128,7 @@ bool GetProcessFileName( uint32_t iProcessID, RString &sName )
|
||||
bTried = true;
|
||||
|
||||
hPSApi = LoadLibrary("psapi.dll");
|
||||
if( hPSApi == NULL )
|
||||
if( hPSApi == nullptr )
|
||||
{
|
||||
sName = werr_ssprintf( GetLastError(), "LoadLibrary" );
|
||||
break;
|
||||
@@ -136,7 +136,7 @@ bool GetProcessFileName( uint32_t iProcessID, RString &sName )
|
||||
else
|
||||
{
|
||||
pGetProcessImageFileName = (pfnGetProcessImageFileNameA) GetProcAddress( hPSApi, "GetProcessImageFileNameA" );
|
||||
if( pGetProcessImageFileName == NULL )
|
||||
if( pGetProcessImageFileName == nullptr )
|
||||
{
|
||||
sName = werr_ssprintf( GetLastError(), "GetProcAddress" );
|
||||
break;
|
||||
@@ -147,7 +147,7 @@ bool GetProcessFileName( uint32_t iProcessID, RString &sName )
|
||||
if( pGetProcessImageFileName != nullptr )
|
||||
{
|
||||
HANDLE hProc = OpenProcess( PROCESS_VM_READ|PROCESS_QUERY_INFORMATION, NULL, iProcessID );
|
||||
if( hProc == NULL )
|
||||
if( hProc == nullptr )
|
||||
{
|
||||
sName = werr_ssprintf( GetLastError(), "OpenProcess" );
|
||||
break;
|
||||
|
||||
@@ -41,11 +41,11 @@ bool GotoURL( RString sUrl )
|
||||
return false;
|
||||
|
||||
char *szPos = strstr( key, "\"%1\"" );
|
||||
if( szPos == NULL )
|
||||
if( szPos == nullptr )
|
||||
{
|
||||
// No quotes found. Check for %1 without quotes
|
||||
szPos = strstr( key, "%1" );
|
||||
if( szPos == NULL )
|
||||
if( szPos == nullptr )
|
||||
szPos = key+lstrlen(key)-1; // No parameter.
|
||||
else
|
||||
*szPos = '\0'; // Remove the parameter
|
||||
|
||||
@@ -35,7 +35,7 @@ static UINT g_iQueryCancelAutoPlayMessage = 0;
|
||||
static RString GetNewWindow()
|
||||
{
|
||||
HWND h = GetForegroundWindow();
|
||||
if( h == NULL )
|
||||
if( h == nullptr )
|
||||
return "(NULL)";
|
||||
|
||||
DWORD iProcessID;
|
||||
@@ -277,14 +277,14 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForce
|
||||
// Adjust g_CurrentParams to reflect the actual display settings.
|
||||
AdjustVideoModeParams( g_CurrentParams );
|
||||
|
||||
if( g_hWndMain == NULL || bForceRecreateWindow )
|
||||
if( g_hWndMain == nullptr || bForceRecreateWindow )
|
||||
{
|
||||
int iWindowStyle = GetWindowStyle( p.windowed );
|
||||
|
||||
AppInstance inst;
|
||||
HWND hWnd = CreateWindow( g_sClassName, "app", iWindowStyle,
|
||||
0, 0, 0, 0, NULL, NULL, inst, NULL );
|
||||
if( hWnd == NULL )
|
||||
if( hWnd == nullptr )
|
||||
RageException::Throw( "%s", werr_ssprintf( GetLastError(), "CreateWindow" ).c_str() );
|
||||
|
||||
/* If an old window exists, transfer focus to the new window before
|
||||
|
||||
@@ -60,7 +60,7 @@ static HKEY OpenRegKey( const RString &sKey, RegKeyMode mode, bool bWarnOnError
|
||||
bool RegistryAccess::GetRegValue( const RString &sKey, const RString &sName, RString &sVal )
|
||||
{
|
||||
HKEY hKey = OpenRegKey( sKey, READ );
|
||||
if( hKey == NULL )
|
||||
if( hKey == nullptr )
|
||||
return false;
|
||||
|
||||
char sBuffer[MAX_PATH];
|
||||
@@ -86,7 +86,7 @@ bool RegistryAccess::GetRegValue( const RString &sKey, const RString &sName, RSt
|
||||
bool RegistryAccess::GetRegValue( const RString &sKey, const RString &sName, int &iVal, bool bWarnOnError )
|
||||
{
|
||||
HKEY hKey = OpenRegKey( sKey, READ, bWarnOnError );
|
||||
if( hKey == NULL )
|
||||
if( hKey == nullptr )
|
||||
return false;
|
||||
|
||||
DWORD iValue;
|
||||
@@ -115,7 +115,7 @@ bool RegistryAccess::GetRegValue( const RString &sKey, const RString &sName, boo
|
||||
bool RegistryAccess::GetRegSubKeys( const RString &sKey, vector<RString> &lst, const RString ®ex, bool bReturnPathToo )
|
||||
{
|
||||
HKEY hKey = OpenRegKey( sKey, READ );
|
||||
if( hKey == NULL )
|
||||
if( hKey == nullptr )
|
||||
return false;
|
||||
|
||||
Regex re(regex);
|
||||
@@ -155,7 +155,7 @@ bool RegistryAccess::GetRegSubKeys( const RString &sKey, vector<RString> &lst, c
|
||||
bool RegistryAccess::SetRegValue( const RString &sKey, const RString &sName, const RString &sVal )
|
||||
{
|
||||
HKEY hKey = OpenRegKey( sKey, WRITE );
|
||||
if( hKey == NULL )
|
||||
if( hKey == nullptr )
|
||||
return false;
|
||||
|
||||
bool bSuccess = true;
|
||||
@@ -177,7 +177,7 @@ bool RegistryAccess::SetRegValue( const RString &sKey, const RString &sName, con
|
||||
bool RegistryAccess::SetRegValue( const RString &sKey, const RString &sName, bool bVal )
|
||||
{
|
||||
HKEY hKey = OpenRegKey( sKey, WRITE );
|
||||
if( hKey == NULL )
|
||||
if( hKey == nullptr )
|
||||
return false;
|
||||
|
||||
bool bSuccess = true;
|
||||
|
||||
@@ -18,7 +18,7 @@ RString GetPrimaryVideoName()
|
||||
|
||||
// VC6 don't have a stub to static link with, so link dynamically.
|
||||
EnumDisplayDevices = (pfnEnumDisplayDevices)GetProcAddress(hInstUser32,"EnumDisplayDevicesA");
|
||||
if( EnumDisplayDevices == NULL )
|
||||
if( EnumDisplayDevices == nullptr )
|
||||
{
|
||||
FreeLibrary(hInstUser32);
|
||||
return RString();
|
||||
|
||||
@@ -80,7 +80,7 @@ HICON IconFromSurface( const RageSurface *pSrcImg )
|
||||
pImg = NULL;
|
||||
free( pBitmap );
|
||||
|
||||
if( icon == NULL )
|
||||
if( icon == nullptr )
|
||||
{
|
||||
LOG->Trace( "%s", werr_ssprintf( GetLastError(), "CreateIconFromResourceEx" ).c_str() );
|
||||
return NULL;
|
||||
@@ -93,7 +93,7 @@ HICON IconFromFile( const RString &sIconFile )
|
||||
{
|
||||
RString sError;
|
||||
RageSurface *pImg = RageSurfaceUtils::LoadFile( sIconFile, sError );
|
||||
if( pImg == NULL )
|
||||
if( pImg == nullptr )
|
||||
{
|
||||
LOG->Warn( "Couldn't open icon \"%s\": %s", sIconFile.c_str(), sError.c_str() );
|
||||
return NULL;
|
||||
|
||||
@@ -21,10 +21,10 @@ BOOL APIENTRY WindowsDialogBox::DlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPA
|
||||
SetProp( hDlg, "WindowsDialogBox", (HANDLE) lParam );
|
||||
|
||||
WindowsDialogBox *pThis = (WindowsDialogBox *) GetProp( hDlg, "WindowsDialogBox" );
|
||||
if( pThis == NULL )
|
||||
if( pThis == nullptr )
|
||||
return FALSE;
|
||||
|
||||
if( pThis->m_hWnd == NULL )
|
||||
if( pThis->m_hWnd == nullptr )
|
||||
pThis->m_hWnd = hDlg;
|
||||
|
||||
return pThis->HandleMessage( msg, wParam, lParam );
|
||||
|
||||
Reference in New Issue
Block a user