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

Get rid of NEW(), TRACKED_NEW, and ZERO().

This commit is contained in:
Darryl Pogue
2012-01-21 01:09:48 -08:00
committed by Adam Johnson
parent 30430d3024
commit 5013a978eb
423 changed files with 2500 additions and 2503 deletions

View File

@ -91,7 +91,7 @@ plBSDiffBuffer::plBSDiffBuffer( void *buffer, uint32_t length )
if (!buffer || length < 32)
hsAssert(false, "Corrupt Patch Buffer!");
if((fPatchBuffer=TRACKED_NEW unsigned char[length+1])!=nil)
if((fPatchBuffer=new unsigned char[length+1])!=nil)
{
fPatchLength = length;
memcpy(fPatchBuffer, buffer, fPatchLength);
@ -142,8 +142,8 @@ uint32_t plBSDiffBuffer::Diff( uint32_t oldLength, void *oldBuffer, uint32_t new
oldbuf = (unsigned char *)oldBuffer;
newbuf = (unsigned char *)newBuffer;
if(((I=TRACKED_NEW int32_t[oldLength+1])==nil) ||
((V=TRACKED_NEW int32_t[oldLength+1])==nil))
if(((I=new int32_t[oldLength+1])==nil) ||
((V=new int32_t[oldLength+1])==nil))
{
delete[] I;
delete[] V;
@ -157,9 +157,9 @@ uint32_t plBSDiffBuffer::Diff( uint32_t oldLength, void *oldBuffer, uint32_t new
/*
* These could probably be smaller, especially cb.
*/
if(((cb=TRACKED_NEW unsigned char[newLength+1])==nil) ||
((db=TRACKED_NEW unsigned char[newLength+1])==nil) ||
((eb=TRACKED_NEW unsigned char[newLength+1])==nil))
if(((cb=new unsigned char[newLength+1])==nil) ||
((db=new unsigned char[newLength+1])==nil) ||
((eb=new unsigned char[newLength+1])==nil))
{
delete[] I;
delete[] cb;
@ -263,7 +263,7 @@ uint32_t plBSDiffBuffer::Diff( uint32_t oldLength, void *oldBuffer, uint32_t new
fPatchLength = 32 + cblen + dblen + eblen;
fPatchBuffer = nil;
if((fPatchBuffer=TRACKED_NEW unsigned char[fPatchLength])!=nil)
if((fPatchBuffer=new unsigned char[fPatchLength])!=nil)
{
memcpy(fPatchBuffer,header,32);
memcpy(fPatchBuffer+32,cb,cblen);
@ -390,7 +390,7 @@ uint32_t plBSDiffBuffer::Patch( uint32_t oldLength, void *oldBuffer, uint32_t &n
extrapipe=diffpipe+datalen;
};
if((newBuffer=(void *)TRACKED_NEW unsigned char[newLength+1])==nil) return(-1);
if((newBuffer=(void *)new unsigned char[newLength+1])==nil) return(-1);
newpos = (unsigned char *)newBuffer;
newend = (unsigned char *)newBuffer + newLength;
oldpos = (unsigned char *)oldBuffer;

View File

@ -86,7 +86,7 @@ plDiffBuffer::plDiffBuffer( uint32_t newLength, uint32_t oldLength )
f16BitMode = false;
fNewLength = newLength;
fStream = TRACKED_NEW hsRAMStream();
fStream = new hsRAMStream();
fStream->WriteLE32( fNewLength );
fStream->WriteBool( f16BitMode );
fWriting = true;
@ -109,12 +109,12 @@ plDiffBuffer::plDiffBuffer( void *buffer, uint32_t length )
memcmp(buffer,"BSDIFF40",8)==0 )
{
// This is a bsdiff buffer. Use plBSDiffBuffer to handle it.
fBSDiffBuffer = TRACKED_NEW plBSDiffBuffer(buffer, length);
fBSDiffBuffer = new plBSDiffBuffer(buffer, length);
fIsBSDiff = true;
}
else
{
fStream = TRACKED_NEW hsRAMStream();
fStream = new hsRAMStream();
fStream->Write( length, buffer );
fStream->Rewind();
@ -187,7 +187,7 @@ void plDiffBuffer::GetBuffer( uint32_t &length, void *&bufferPtr )
hsAssert( fWriting, "Trying to GetBuffer() on a difference buffer that's reading" );
length = fStream->GetPosition();
bufferPtr = (void *)TRACKED_NEW uint8_t[ length ];
bufferPtr = (void *)new uint8_t[ length ];
fStream->Rewind();
fStream->Read( length, bufferPtr );
@ -218,7 +218,7 @@ void plDiffBuffer::Apply( uint32_t oldLength, void *oldBuffer, uint32_t &newL
/// Step 1: Allocate the new buffer
newLength = fNewLength;
uint8_t *new8Buffer = TRACKED_NEW uint8_t[ newLength ];
uint8_t *new8Buffer = new uint8_t[ newLength ];
uint8_t *old8Buffer = (uint8_t *)oldBuffer;
newBuffer = (void *)new8Buffer;

View File

@ -332,7 +332,7 @@ void plRegistryKeyList::Read(hsStream* s)
for (int i = 0; i < numKeys; i++)
{
plKeyImp* newKey = TRACKED_NEW plKeyImp;
plKeyImp* newKey = new plKeyImp;
newKey->Read(s);
fStaticKeys[i] = newKey;
}

View File

@ -186,7 +186,7 @@ void plRegistryPageNode::LoadKeys()
plRegistryKeyList* keyList = IGetKeyList(classType);
if (!keyList)
{
keyList = TRACKED_NEW plRegistryKeyList(classType);
keyList = new plRegistryKeyList(classType);
fKeyLists[classType] = keyList;
}
keyList->Read(stream);
@ -333,7 +333,7 @@ void plRegistryPageNode::AddKey(plKeyImp* key)
plRegistryKeyList* keys = fKeyLists[classType];
if (keys == nil)
{
keys = TRACKED_NEW plRegistryKeyList(classType);
keys = new plRegistryKeyList(classType);
fKeyLists[classType] = keys;
}

View File

@ -139,7 +139,7 @@ hsBool plResManager::IInit()
char fileName[kFolderIterator_MaxPath];
pathIterator.GetPathAndName(fileName);
plRegistryPageNode* node = TRACKED_NEW plRegistryPageNode(fileName);
plRegistryPageNode* node = new plRegistryPageNode(fileName);
fAllPages.insert(node);
}
}
@ -148,12 +148,12 @@ hsBool plResManager::IInit()
CreatePage(plLocation::kGlobalFixedLoc, "Global", "FixedKeys");
hsAssert(!fDispatch, "Dispatch already set");
fDispatch = TRACKED_NEW plDispatch;
fDispatch = new plDispatch;
plgTimerCallbackMgr::Init();
// Init our helper
fMyHelper = TRACKED_NEW plResManagerHelper(this);
fMyHelper = new plResManagerHelper(this);
fMyHelper->Init();
hsAssert(fMyHelper->GetKey() != nil, "ResManager helper didn't init properly!" );
@ -234,7 +234,7 @@ void plResManager::IShutdown()
void plResManager::AddSinglePage(const char* pagePath)
{
plRegistryPageNode* node = TRACKED_NEW plRegistryPageNode(pagePath);
plRegistryPageNode* node = new plRegistryPageNode(pagePath);
AddPage(node);
}
@ -573,7 +573,7 @@ plKey plResManager::FindOriginalKey(const plUoid& uoid)
// Note: startPos of -1 means we didn't read it from disk, but 0 length
// is our special key that we're a passively created key
foundKey = TRACKED_NEW plKeyImp(uoid, uint32_t(-1), uint32_t(0));
foundKey = new plKeyImp(uoid, uint32_t(-1), uint32_t(0));
key = plKey::Make(foundKey);
}
@ -755,7 +755,7 @@ plKey plResManager::NewKey(plUoid& newUoid, hsKeyedObject* object)
{
hsAssert(fInited, "Attempting to create a new key before we're inited!");
plKeyImp* newKey = TRACKED_NEW plKeyImp;
plKeyImp* newKey = new plKeyImp;
newKey->SetUoid(newUoid);
AddKey(newKey);
@ -816,7 +816,7 @@ plKey plResManager::ReRegister(const char* nm, const plUoid& oid)
}
}
plKeyImp* pKey = TRACKED_NEW plKeyImp;
plKeyImp* pKey = new plKeyImp;
if (canClone && pOrigKey)
{
pKey->CopyForClone((plKeyImp*)pOrigKey, fCurClonePlayerID, fCurCloneID);
@ -926,7 +926,7 @@ plKey plResManager::ICloneKey(const plUoid& objUoid, uint32_t playerID, uint32_t
fCurCloneID = 0;
// Then notify NetClientMgr when object loads
plObjRefMsg* refMsg = TRACKED_NEW plObjRefMsg(plNetClientApp::GetInstance()->GetKey(), plRefMsg::kOnCreate, 0, 0);
plObjRefMsg* refMsg = new plObjRefMsg(plNetClientApp::GetInstance()->GetKey(), plRefMsg::kOnCreate, 0, 0);
AddViaNotify(cloneKey, refMsg, plRefFlags::kPassiveRef);
return cloneKey;
@ -1064,7 +1064,7 @@ void plResManager::LoadAgeKeys(const char* age)
kResMgrLog(1, ILog(1, "Loading age keys for age %s", age));
hsStatusMessageF("*** Loading age keys for age %s ***\n", age);
plResAgeHolder* holder = TRACKED_NEW plResAgeHolder(age);
plResAgeHolder* holder = new plResAgeHolder(age);
fHeldAgeKeys[age] = holder;
// Go find pages that match this age, load the keys, and ref them all
plResHolderIterator iter(age, holder->fKeys, this);
@ -1260,7 +1260,7 @@ public:
plPageInAgeIter(plKey destKey, const char *ageName) : fDestKey(destKey), fAgeName(ageName) {}
~plPageInAgeIter()
{
plClientMsg* pMsg1 = TRACKED_NEW plClientMsg(plClientMsg::kLoadRoomHold);
plClientMsg* pMsg1 = new plClientMsg(plClientMsg::kLoadRoomHold);
for (int i = 0; i < fLocations.size(); i++)
{
pMsg1->AddRoomLoc(fLocations[i]);
@ -1287,7 +1287,7 @@ void plResManager::PageInAge(const char *age)
plKey clientKey = hsgResMgr::ResMgr()->FindKey(lu);
// Tell the client to load all the keys for this age, to make the loading process work better
plClientMsg *loadAgeKeysMsg = TRACKED_NEW plClientMsg(plClientMsg::kLoadAgeKeys);
plClientMsg *loadAgeKeysMsg = new plClientMsg(plClientMsg::kLoadAgeKeys);
loadAgeKeysMsg->SetAgeName(age);
loadAgeKeysMsg->Send(clientKey);
@ -1511,7 +1511,7 @@ void plResManager::DumpUnusedKeys(plRegistryPageNode* page) const
plRegistryPageNode* plResManager::CreatePage(const plLocation& location, const char* age, const char* page)
{
plRegistryPageNode* pageNode = TRACKED_NEW plRegistryPageNode(location, age, page, fDataPath.c_str());
plRegistryPageNode* pageNode = new plRegistryPageNode(location, age, page, fDataPath.c_str());
fAllPages.insert(pageNode);
return pageNode;

View File

@ -174,8 +174,8 @@ void plResManagerHelper::LoadAndHoldPageKeys( plRegistryPageNode *page )
hsAssert( GetKey() != nil, "Can't load and hold keys when we don't have a key for the helper" );
// Create our msg
plResMgrHelperMsg *refferMsg = TRACKED_NEW plResMgrHelperMsg( plResMgrHelperMsg::kKeyRefList );
refferMsg->fKeyList = TRACKED_NEW plResPageKeyRefList;
plResMgrHelperMsg *refferMsg = new plResMgrHelperMsg( plResMgrHelperMsg::kKeyRefList );
refferMsg->fKeyList = new plResPageKeyRefList;
fResManager->LoadPageKeys(page);
page->IterateKeys( refferMsg->fKeyList );
@ -240,7 +240,7 @@ class plResMgrDebugInterface : public plInputInterface
}
else if( pKeyMsg->GetKeyCode() == KEY_ESCAPE )
{
plResMgrHelperMsg *msg = TRACKED_NEW plResMgrHelperMsg( plResMgrHelperMsg::kDisableDebugScreen );
plResMgrHelperMsg *msg = new plResMgrHelperMsg( plResMgrHelperMsg::kDisableDebugScreen );
msg->Send( fParent->GetKey() );
return true;
}
@ -286,12 +286,12 @@ void plResManagerHelper::EnableDebugScreen( hsBool enable )
fDebugScreen = plStatusLogMgr::GetInstance().CreateStatusLog( kLogSize, "ResManager Status", plStatusLog::kFilledBackground | plStatusLog::kDontWriteFile );
fRefreshing = true;
plResMgrHelperMsg *msg = TRACKED_NEW plResMgrHelperMsg( plResMgrHelperMsg::kUpdateDebugScreen );
plResMgrHelperMsg *msg = new plResMgrHelperMsg( plResMgrHelperMsg::kUpdateDebugScreen );
// msg->SetTimeStamp( hsTimer::GetSysSeconds() + kUpdateDelay );
msg->Send( GetKey() );
fDebugInput = TRACKED_NEW plResMgrDebugInterface( this );
plInputIfaceMgrMsg *imsg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kAddInterface );
fDebugInput = new plResMgrDebugInterface( this );
plInputIfaceMgrMsg *imsg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kAddInterface );
imsg->SetIFace( fDebugInput );
imsg->Send();
}
@ -304,7 +304,7 @@ void plResManagerHelper::EnableDebugScreen( hsBool enable )
delete fDebugScreen;
fDebugScreen = nil;
plInputIfaceMgrMsg *imsg = TRACKED_NEW plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface );
plInputIfaceMgrMsg *imsg = new plInputIfaceMgrMsg( plInputIfaceMgrMsg::kRemoveInterface );
imsg->SetIFace( fDebugInput );
imsg->Send();
@ -507,7 +507,7 @@ void plResManagerHelper::IUpdateDebugScreen( hsBool force )
// Repump our update
if( !force )
{
plResMgrHelperMsg *msg = TRACKED_NEW plResMgrHelperMsg( plResMgrHelperMsg::kUpdateDebugScreen );
plResMgrHelperMsg *msg = new plResMgrHelperMsg( plResMgrHelperMsg::kUpdateDebugScreen );
msg->SetTimeStamp( hsTimer::GetSysSeconds() + kUpdateDelay );
msg->Send( GetKey() );
}