1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Re-define nil as nullptr, cleaning up some potential issues along the way

This commit is contained in:
2013-01-20 20:48:41 -08:00
parent c65ac61fb8
commit f86b549293
36 changed files with 123 additions and 130 deletions

View File

@ -198,7 +198,7 @@ void plAudioSystem::IEnumerateDevices()
char *devices = (char *)alcGetString(nil, ALC_DEVICE_SPECIFIER);
int major, minor;
while(*devices != nil)
while (*devices)
{
ALCdevice *device = alcOpenDevice(devices);
if (device)

View File

@ -125,7 +125,7 @@ void plDSoundBuffer::IRelease( void )
// Release stuff
fEAXSource.Release();
alSourcei(source, AL_BUFFER, nil);
alSourcei(source, AL_BUFFER, 0);
alDeleteSources(1, &source);
if(buffer)
alDeleteBuffers( 1, &buffer );
@ -173,7 +173,7 @@ bool plDSoundBuffer::FillBuffer(void *data, unsigned bytes, plWAVHeader *header)
{
if(source)
{
alSourcei(source, AL_BUFFER, nil);
alSourcei(source, AL_BUFFER, 0);
alDeleteSources(1, &source);
}
if(buffer)
@ -278,7 +278,7 @@ bool plDSoundBuffer::SetupStreamingSource(plAudioFileReader *stream)
plStatusLog::AddLineS("audio.log", "Failed to create audio source %d %d", error, source);
return false;
}
alSourcei(source, AL_BUFFER, nil);
alSourcei(source, AL_BUFFER, 0);
SetScalarVolume(0);
@ -344,7 +344,7 @@ bool plDSoundBuffer::SetupStreamingSource(void *data, unsigned bytes)
plStatusLog::AddLineS("audio.log", "Failed to create audio source %d %d", error, source);
return false;
}
alSourcei(source, AL_BUFFER, nil);
alSourcei(source, AL_BUFFER, 0);
SetScalarVolume(0);
alSourcef(source, AL_ROLLOFF_FACTOR, 0.3048);
@ -512,7 +512,7 @@ bool plDSoundBuffer::SetupVoiceSource()
{
return false;
}
alSourcei(source, AL_BUFFER, nil);
alSourcei(source, AL_BUFFER, 0);
alGetError();
//alSourcei(source, AL_PITCH, 0);

View File

@ -149,9 +149,9 @@ plWinMicLevel::plWinMicLevel()
if( sNumMixers == 0 )
return;
if( ::mixerOpen( &sMixerHandle, 0,
nil, // Window handle to receive callback messages
nil, MIXER_OBJECTF_MIXER ) != MMSYSERR_NOERROR )
if( ::mixerOpen( &sMixerHandle, 0,
0, // Window handle to receive callback messages
0, MIXER_OBJECTF_MIXER ) != MMSYSERR_NOERROR )
{
sMixerHandle = nil; // Just to be sure
return;

View File

@ -1339,7 +1339,7 @@ bool plArmatureMod::MsgReceive(plMessage* msg)
}
else
{
if (cloneMsg->GetCloneKey() == GetFollowerParticleSystemSO())
if (cloneMsg->GetCloneKey() == GetFollowerParticleSystemSO()->GetKey())
{
SetFollowerParticleSystemSO(nil);
return true;

View File

@ -159,10 +159,10 @@ void plAvTask::IUndoLimitPlayersInput(plArmatureMod *avatar)
plAvSeekTask::plAvSeekTask()
: fAnimName(nil),
fAlign(kAlignHandle),
fDuration(0.25f),
fDuration(0.25),
fTarget(nil),
fAnimInstance(nil),
fTargetTime(nil),
fTargetTime(0),
fPhysicalAtStart(false),
fCleanup(false)
{
@ -171,10 +171,10 @@ plAvSeekTask::plAvSeekTask()
// CTOR target, align, animName
plAvSeekTask::plAvSeekTask(plKey target, plAvAlignment align, const char *animName)
: fAlign(align),
fDuration(0.25f),
fDuration(0.25),
fTarget(target),
fAnimInstance(nil),
fTargetTime(nil),
fTargetTime(0),
fPhysicalAtStart(false),
fCleanup(false)
{
@ -185,10 +185,10 @@ plAvSeekTask::plAvSeekTask(plKey target, plAvAlignment align, const char *animNa
plAvSeekTask::plAvSeekTask(plKey target)
: fAnimName(nil),
fAlign(kAlignHandle),
fDuration(0.25f),
fDuration(0.25),
fTarget(target),
fAnimInstance(nil),
fTargetTime(nil),
fTargetTime(0),
fPhysicalAtStart(false),
fCleanup(false)
{

View File

@ -74,7 +74,7 @@ public:
uint32_t GetFlags() { return fFlags; }
void SetFlags(uint32_t f) { fFlags = f; }
virtual void HandleKeyEvent(plOSMsg message, plKeyDef key, bool bKeyDown, bool bKeyRepeat, wchar_t c = nil) {;}
virtual void HandleKeyEvent(plOSMsg message, plKeyDef key, bool bKeyDown, bool bKeyRepeat, wchar_t c = 0) {;}
virtual void HandleMouseEvent(plOSMsg message, plMouseState state) {;}
virtual void HandleWindowActivate(bool bActive, hsWindowHndl hWnd) {;}
virtual bool MsgReceive(plMessage* msg) {return false;}
@ -116,7 +116,7 @@ public:
void SetControlMode(int i) { fControlMode = i; }
const char* GetInputName() { return "keyboard"; }
void HandleKeyEvent(plOSMsg message, plKeyDef key, bool bKeyDown, bool bKeyRepeat, wchar_t c = nil);
void HandleKeyEvent(plOSMsg message, plKeyDef key, bool bKeyDown, bool bKeyRepeat, wchar_t c = 0);
virtual void HandleWindowActivate(bool bActive, hsWindowHndl hWnd);
virtual bool IsCapsLockKeyOn();
virtual void Shutdown();

View File

@ -335,12 +335,12 @@ bool plAxisAnimModifier::MsgReceive(plMessage* msg)
hsRefCnt_SafeUnRef( pCall1 );
hsRefCnt_SafeUnRef( pCall2 );
plgDispatch::MsgSend(pMsg);
plgDispatch::MsgSend(pMsg);
}
else
if (pRefMsg->fType == kTypeLogic)
{
SetNotificationKey(pRefMsg->GetRef());
SetNotificationKey(pRefMsg->GetRef()->GetKey());
}
}
else

View File

@ -279,7 +279,7 @@ const char* ProcessTab(const char* fmt)
//
bool plNetClientMgr::Log(const char* str) const
{
if (strlen(str)==nil)
if (strlen(str) == 0)
return true;
// prepend raw time

View File

@ -403,12 +403,10 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgVoice)
const char* buf = m->GetVoiceData();
uint8_t flags = m->GetFlags();
uint8_t numFrames = m->GetNumFrames();
plKey key = NULL;
plKey key;
// plKey key=hsgResMgr::ResMgr()->FindKey(m->ObjectInfo()->GetUoid());
// Filter ignored sender
if ( VaultAmIgnoringPlayer( m->GetPlayerID() ) )
{

View File

@ -1719,15 +1719,15 @@ void CliAuConn::StopAutoPing () {
void CliAuConn::TimerPing () {
// Send a ping request
pingSendTimeMs = GetNonZeroTimeMs();
const uintptr_t msg[] = {
kCli2Auth_PingRequest,
pingSendTimeMs,
0, // not a transaction
0, // no payload
nil
reinterpret_cast<uintptr_t>(nullptr)
};
Send(msg, arrsize(msg));
}
@ -5093,8 +5093,7 @@ bool AuthQueryConnected () {
bool result;
s_critsect.Enter();
{
if (nil != (result = s_active))
result &= (nil != s_active->cli);
result = (s_active && s_active->cli);
}
s_critsect.Leave();
return result;

View File

@ -756,8 +756,7 @@ bool GameQueryConnected () {
bool result;
s_critsect.Enter();
{
if (nil != (result = s_active))
result &= (nil != s_active->cli);
result = (s_active && s_active->cli);
}
s_critsect.Leave();
return result;

View File

@ -655,15 +655,15 @@ void CliGkConn::StopAutoPing () {
void CliGkConn::TimerPing () {
// Send a ping request
pingSendTimeMs = GetNonZeroTimeMs();
const uintptr_t msg[] = {
kCli2GateKeeper_PingRequest,
pingSendTimeMs,
0, // not a transaction
0, // no payload
nil
reinterpret_cast<uintptr_t>(nullptr)
};
Send(msg, arrsize(msg));
}
@ -1032,8 +1032,7 @@ bool GateKeeperQueryConnected () {
bool result;
s_critsect.Enter();
{
if (nil != (result = s_active))
result &= (nil != s_active->cli);
result = (s_active && s_active->cli);
}
s_critsect.Leave();
return result;

View File

@ -752,7 +752,7 @@ void plDXPipeline::IClearMembers()
fULutTextureRef = nil;
for( i = 0; i < kMaxRenderTargetNext; i++ )
fBlurVBuffers[i] = nil;
fBlurVSHandle = nil;
fBlurVSHandle = 0;
fD3DObject = nil;
fD3DDevice = nil;
@ -4352,7 +4352,7 @@ bool plDXPipeline::CaptureScreen( plMipmap *dest, bool flipVertical, uint16_t d
surface->UnlockRect();
ReleaseObject( surface );
if( desiredWidth != 0 && desiredHeight != nil )
if( desiredWidth != 0 && desiredHeight != 0 )
{
// Rescale to the right size
dest->ResizeNicely( desiredWidth, desiredHeight, plMipmap::kDefaultFilter );
@ -11889,7 +11889,7 @@ void plDXPipeline::ISetErrorMessage( char *errStr )
plStatusLog::AddLineS("pipeline.log", fSettings.fErrorStr);
}
else
fSettings.fErrorStr[ 0 ] = nil;
fSettings.fErrorStr[ 0 ] = 0;
}
// IGetD3DError /////////////////////////////////////////////////////////////////

View File

@ -120,7 +120,7 @@ void plDXTextFont::ICreateTexture( uint16_t *data )
// Lock the texture and write our values out
fD3DTexture->LockRect( 0, &lockInfo, 0, 0 );
memcpy( lockInfo.pBits, data, fTextureWidth * fTextureHeight * sizeof( uint16_t ) );
fD3DTexture->UnlockRect( nil );
fD3DTexture->UnlockRect( 0 );
}
void plDXTextFont::CreateShared(IDirect3DDevice9* device)

View File

@ -61,7 +61,7 @@ plPageInfo::plPageInfo( const plLocation &loc )
void plPageInfo::IInit()
{
fAge = fPage = nil;
fAge = fPage = "";
fLocation.Invalidate();
SetMajorVersion(plVersion::GetMajorVersion());
fClassVersions.clear();
@ -71,7 +71,7 @@ void plPageInfo::IInit()
plPageInfo::~plPageInfo()
{
SetStrings( nil, nil );
SetStrings("", "");
}
plPageInfo::plPageInfo( const plPageInfo &src )

View File

@ -1715,7 +1715,7 @@ public:
bool plResManager::IterateKeys(plRegistryKeyIterator* iterator)
{
plKeyIterEater myEater(iterator);
return IteratePages(&myEater, nil);
return IteratePages(&myEater);
}
bool plResManager::IterateKeys(plRegistryKeyIterator* iterator, const plLocation& pageToRestrictTo)

View File

@ -67,7 +67,7 @@ void plSDLParser::DebugMsg(const char* fmt, ...) const
void plSDLParser::DebugMsgV(const char* fmt, va_list args) const
{
if (strlen(fmt)==nil)
if (strlen(fmt) == 0)
return;
hsStatusMessage(plString::IFormat(fmt,args).c_str());
}