remove unnecessary null checks

This commit is contained in:
DarthArgus
2014-10-26 22:53:42 -07:00
parent eb2e7c78d8
commit 594b3a4254
56 changed files with 98 additions and 199 deletions
@@ -1171,11 +1171,9 @@ void PlayerCreatureController::handleMessage (const int message, const float val
if(recipientController)
{
ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage();
if(outMsg)
{
*outMsg = *inMsg;
recipientController->appendMessage(CM_imageDesignerChange, 0, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
*outMsg = *inMsg;
recipientController->appendMessage(CM_imageDesignerChange, 0, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
}
else
@@ -1188,11 +1186,9 @@ void PlayerCreatureController::handleMessage (const int message, const float val
if(recipientController)
{
ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage();
if(outMsg)
{
*outMsg = *inMsg;
recipientController->appendMessage(CM_imageDesignerChange, 0, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
*outMsg = *inMsg;
recipientController->appendMessage(CM_imageDesignerChange, 0, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
}
}
@@ -1209,12 +1205,10 @@ void PlayerCreatureController::handleMessage (const int message, const float val
if(designerController)
{
ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage();
if(outMsg)
{
*outMsg = *inMsg;
outMsg->setOrigin(ImageDesignChangeMessage::O_SERVER);
designerController->appendMessage(CM_imageDesignerChange, 0, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
*outMsg = *inMsg;
outMsg->setOrigin(ImageDesignChangeMessage::O_SERVER);
designerController->appendMessage(CM_imageDesignerChange, 0, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
}
else
@@ -1328,11 +1322,9 @@ void PlayerCreatureController::handleMessage (const int message, const float val
if(recipientController)
{
BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage();
if(outMsg)
{
*outMsg = *inMsg;
recipientController->appendMessage(CM_buffBuilderChange, 0, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
*outMsg = *inMsg;
recipientController->appendMessage(CM_buffBuilderChange, 0, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
}
else
@@ -1345,11 +1337,8 @@ void PlayerCreatureController::handleMessage (const int message, const float val
if(recipientController)
{
BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage();
if(outMsg)
{
*outMsg = *inMsg;
recipientController->appendMessage(CM_buffBuilderChange, 0, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
*outMsg = *inMsg;
recipientController->appendMessage(CM_buffBuilderChange, 0, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
}
}
@@ -1366,12 +1355,10 @@ void PlayerCreatureController::handleMessage (const int message, const float val
if(bufferController)
{
BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage();
if(outMsg)
{
*outMsg = *inMsg;
outMsg->setOrigin(BuffBuilderChangeMessage::O_SERVER);
bufferController->appendMessage(CM_buffBuilderChange, 0, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
*outMsg = *inMsg;
outMsg->setOrigin(BuffBuilderChangeMessage::O_SERVER);
bufferController->appendMessage(CM_buffBuilderChange, 0, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
}
else
@@ -148,13 +148,11 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network
if(bufferController)
{
BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage();
if(outMsg)
{
outMsg->setBufferId(bufferId);
outMsg->setRecipientId(recipientId);
outMsg->setOrigin(BuffBuilderChangeMessage::O_SERVER);
bufferController->appendMessage(static_cast<int>(CM_buffBuilderCancel), 0.0f, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
outMsg->setBufferId(bufferId);
outMsg->setRecipientId(recipientId);
outMsg->setOrigin(BuffBuilderChangeMessage::O_SERVER);
bufferController->appendMessage(static_cast<int>(CM_buffBuilderCancel), 0.0f, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
//send the cancel message to the recipient
@@ -163,13 +161,11 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network
if(recipientController && bufferController != recipientController)
{
BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage();
if(outMsg)
{
outMsg->setBufferId(bufferId);
outMsg->setRecipientId(recipientId);
outMsg->setOrigin(BuffBuilderChangeMessage::O_SERVER);
recipientController->appendMessage(static_cast<int>(CM_buffBuilderCancel), 0.0f, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
outMsg->setBufferId(bufferId);
outMsg->setRecipientId(recipientId);
outMsg->setOrigin(BuffBuilderChangeMessage::O_SERVER);
recipientController->appendMessage(static_cast<int>(CM_buffBuilderCancel), 0.0f, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
//send cancel trigger to buffer player
@@ -591,13 +591,11 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net
if(designerController)
{
ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage();
if(outMsg)
{
outMsg->setDesignerId(designerId);
outMsg->setRecipientId(recipientId);
outMsg->setOrigin(ImageDesignChangeMessage::O_SERVER);
designerController->appendMessage(static_cast<int>(CM_imageDesignerCancel), 0.0f, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
outMsg->setDesignerId(designerId);
outMsg->setRecipientId(recipientId);
outMsg->setOrigin(ImageDesignChangeMessage::O_SERVER);
designerController->appendMessage(static_cast<int>(CM_imageDesignerCancel), 0.0f, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
//send the cancel message to the recipient
@@ -606,13 +604,11 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net
if(recipientController && designerController != recipientController)
{
ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage();
if(outMsg)
{
outMsg->setDesignerId(designerId);
outMsg->setRecipientId(recipientId);
outMsg->setOrigin(ImageDesignChangeMessage::O_SERVER);
recipientController->appendMessage(static_cast<int>(CM_imageDesignerCancel), 0.0f, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
outMsg->setDesignerId(designerId);
outMsg->setRecipientId(recipientId);
outMsg->setOrigin(ImageDesignChangeMessage::O_SERVER);
recipientController->appendMessage(static_cast<int>(CM_imageDesignerCancel), 0.0f, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
//send cancel trigger to designer player
@@ -5450,14 +5450,6 @@ int CreatureObject::getInstrumentVisualId() const
return visualId;
}
// last, check the look at target if no weapon is equipped
if (!hasWeapon)
{
int visualId = internalGetInstrumentVisualId(getLookAtTarget());
if(visualId)
return visualId;
}
return 0;
}
@@ -231,7 +231,6 @@ void FactoryObject::removeDefaultTemplate()
Controller* FactoryObject::createDefaultController()
{
Controller* controller = new TangibleController(this);
NOT_NULL(controller);
setController(controller);
return controller;
@@ -130,7 +130,6 @@ GroupObject::~GroupObject()
Controller* GroupObject::createDefaultController()
{
Controller* controller = new GroupController(this);
NOT_NULL(controller);
setController(controller);
return controller;
@@ -114,7 +114,6 @@ GuildObject::~GuildObject()
Controller* GuildObject::createDefaultController()
{
Controller* controller = new GuildController(this);
NOT_NULL(controller);
setController(controller);
return controller;
@@ -93,7 +93,6 @@ HarvesterInstallationObject::~HarvesterInstallationObject()
Controller* HarvesterInstallationObject::createDefaultController(void)
{
Controller* _controller = new HarvesterInstallationController(this);
NOT_NULL(_controller);
setController(_controller);
return _controller;
@@ -129,7 +129,6 @@ void InstallationObject::removeDefaultTemplate(void)
Controller* InstallationObject::createDefaultController(void)
{
Controller* _controller = new InstallationController(this);
NOT_NULL(_controller);
setController(_controller);
return _controller;
@@ -190,7 +190,6 @@ void ManufactureInstallationObject::endBaselines()
Controller* ManufactureInstallationObject::createDefaultController()
{
Controller* const _controller = new ManufactureInstallationController(this);
NOT_NULL(_controller);
setController(_controller);
return _controller;
@@ -298,38 +298,37 @@ void ManufactureSchematicObject::endBaselines()
ServerSynchronizedUi * ManufactureSchematicObject::createSynchronizedUi ()
{
ManufactureSchematicSynchronizedUi * sync = new ManufactureSchematicSynchronizedUi(*this);
if (sync)
{
// set up the sync ui for our slots
int i;
int count;
const DraftSchematicObject * draft = DraftSchematicObject::getSchematic(
m_draftSchematic.get());
NOT_NULL(draft);
DynamicVariableList::NestedList slots(getObjVars(),OBJVAR_SLOTS);
{
Crafting::IngredientSlot slotData;
count = slots.getCount();
for (i = 0; i < count; ++i)
{
if (getSlot(i, slotData, false))
{
sync->createNewSlot(slotData.name, slotData.complexity);
sync->setSlotType(slotData.name, slotData.ingredientType);
sync->setSlotOption(slotData.name, slotData.draftSlotOption);
sync->setSlotIndex(slotData.name, slotData.draftSlotIndex);
}
}
}
count = draft->getExperimentalAttributesCount();
// set up the sync ui for our slots
int i;
int count;
const DraftSchematicObject * draft = DraftSchematicObject::getSchematic(
m_draftSchematic.get());
NOT_NULL(draft);
DynamicVariableList::NestedList slots(getObjVars(),OBJVAR_SLOTS);
{
Crafting::IngredientSlot slotData;
count = slots.getCount();
for (i = 0; i < count; ++i)
{
sync->setAttribute(draft->getExperimentalAttribute(i), 0);
if (getSlot(i, slotData, false))
{
sync->createNewSlot(slotData.name, slotData.complexity);
sync->setSlotType(slotData.name, slotData.ingredientType);
sync->setSlotOption(slotData.name, slotData.draftSlotOption);
sync->setSlotIndex(slotData.name, slotData.draftSlotIndex);
}
}
sync->setReady();
}
count = draft->getExperimentalAttributesCount();
for (i = 0; i < count; ++i)
{
sync->setAttribute(draft->getExperimentalAttribute(i), 0);
}
sync->setReady();
return sync;
}
@@ -647,8 +646,7 @@ bool ManufactureSchematicObject::getSlot(int index, Crafting::IngredientSlot & d
const DynamicVariableList::NestedList ingredient(slotIngredients,buffer);
Crafting::ComponentIngredient * const component = new Crafting::ComponentIngredient();
if (component == NULL)
return false;
data.ingredients.push_back(Crafting::SimpleIngredientPtr(component));
component->count = 1;
if (!ingredient.hasItem(OBJVAR_COMPONENT_NAME))
@@ -238,7 +238,6 @@ PlanetObject::~PlanetObject()
Controller* PlanetObject::createDefaultController(void)
{
Controller* controller = new PlanetController(this);
NOT_NULL(controller);
setController(controller);
return controller;
@@ -100,7 +100,6 @@ void ResourceContainerObject::removeDefaultTemplate(void)
Controller* ResourceContainerObject::createDefaultController(void)
{
Controller* _controller = new ResourceContainerController(this);
NOT_NULL(_controller);
setController(_controller);
return _controller;
@@ -1666,7 +1666,6 @@ void ServerObject::conclude()
Controller* ServerObject::createDefaultController(void)
{
Controller* controller = new ServerController(this);
NOT_NULL(controller);
setController(controller);
return controller;
@@ -1736,7 +1736,6 @@ void TangibleObject::setPvpRegion(Region const * pvpRegion)
Controller* TangibleObject::createDefaultController(void)
{
Controller* controller = new TangibleController(this);
NOT_NULL(controller);
setController(controller);
return controller;
@@ -87,7 +87,6 @@ void UniverseObject::removeDefaultTemplate(void)
Controller* UniverseObject::createDefaultController (void)
{
Controller* controller = new UniverseController(this);
NOT_NULL(controller);
setController(controller);
return controller;
@@ -38,7 +38,6 @@ VehicleObject::~VehicleObject()
Controller* VehicleObject::createDefaultController(void)
{
Controller* controller = new VehicleController(this);
NOT_NULL(controller);
setController(controller);
return controller;
@@ -151,7 +151,6 @@ void WeaponObject::onLoadedFromDatabase()
Controller* WeaponObject::createDefaultController(void)
{
Controller* controller = new WeaponController(this);
NOT_NULL(controller);
setController(controller);
return controller;
@@ -136,7 +136,6 @@ void ServerObjectTemplate::registerMe(void)
if (XpMap == NULL)
{
XpMap = new XP_MAP();
NOT_NULL(XpMap);
ExitChain::add(exit, "ServerObjectTemplate");
// @todo: fill in the rest of this map
@@ -20,7 +20,6 @@ randomNumberGenerator(0),
updateRate(newUpdateRate)
{
randomNumberGenerator = new RandomGenerator(unsigned(time(0))); //lint !e732 //loss of sign ok.
NOT_NULL(randomNumberGenerator);
Key k;
for(unsigned int i = 0; i < getKeyCount(); i ++)
{
@@ -22,7 +22,6 @@ cipherDataLen(newCipherDataLen),
dataLen(newDataLen)
{
cipherData = new unsigned char[cipherDataLen];
NOT_NULL(cipherData);
memcpy(cipherData, newCipherData, cipherDataLen);
memcpy(digest, newDigest, KeyShareConstants::keyLength);
}
@@ -35,7 +34,6 @@ cipherDataLen(source.cipherDataLen),
dataLen(source.dataLen)
{
cipherData = new unsigned char[cipherDataLen];
NOT_NULL(cipherData);
memcpy(cipherData, source.cipherData, cipherDataLen);
memcpy(digest, source.digest, KeyShareConstants::keyLength);
}
@@ -137,10 +135,6 @@ keys(0)
decryptors = new Crypto::TwofishDecryptor *[keyCount];
encryptors = new Crypto::TwofishEncryptor *[keyCount];
NOT_NULL(keys);
NOT_NULL(decryptors);
NOT_NULL(encryptors);
for(unsigned int i = 0; i < keyCount; i ++)
{
decryptors[i] = 0;
@@ -180,9 +174,6 @@ bool KeyShare::decipherToken(const KeyShare::Token & token, unsigned char * clea
unsigned char * cipherText = new unsigned char[cipherDataLen];
unsigned char * clearText = new unsigned char[cipherDataLen];
NOT_NULL(cipherText);
NOT_NULL(clearText);
memcpy(cipherText, token.getData(), cipherDataLen);
for(unsigned int i = 0; i < keyCount; i ++)
{
@@ -52,12 +52,9 @@ MessageQueue::Data * AiCreatureStateMessage::unpack(Archive::ReadIterator & sour
{
AiCreatureStateMessage * msg = new AiCreatureStateMessage();
if (msg != NULL)
if (GameServerMessageInterface::getInstance() != NULL)
{
if (GameServerMessageInterface::getInstance() != NULL)
{
GameServerMessageInterface::getInstance()->unpack(source, *msg);
}
GameServerMessageInterface::getInstance()->unpack(source, *msg);
}
return msg;
@@ -71,11 +71,10 @@ void AiMovementMessage::pack(const MessageQueue::Data* const data, Archive::Byte
MessageQueue::Data* AiMovementMessage::unpack(Archive::ReadIterator & source)
{
AiMovementMessage * msg = new AiMovementMessage();
if (msg)
{
if (GameServerMessageInterface::getInstance() != NULL)
GameServerMessageInterface::getInstance()->unpack(source, *msg);
}
if (GameServerMessageInterface::getInstance() != NULL)
GameServerMessageInterface::getInstance()->unpack(source, *msg);
return msg;
}
@@ -791,8 +791,6 @@ void CityPathGraphManager::moveBuilding ( BuildingObject * building, Vector cons
UNREF(oldPosition);
if(building == NULL) return;
NetworkIdList ids;
if (!building->getObjVars().getItem(OBJVAR_PATHFINDING_BUILDING_WAYPOINTS,ids)) return;
@@ -198,14 +198,12 @@ jboolean JNICALL ScriptMethodsBuffBuilderNamespace::buffBuilderValidated(JNIEnv
if(bufferController)
{
BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage();
if(outMsg)
{
outMsg->setBufferId(session.bufferId);
outMsg->setRecipientId(session.recipientId);
outMsg->setOrigin(BuffBuilderChangeMessage::O_SERVER);
outMsg->setAccepted(true);
bufferController->appendMessage(static_cast<int>(CM_buffBuilderChange), 0.0f, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
outMsg->setBufferId(session.bufferId);
outMsg->setRecipientId(session.recipientId);
outMsg->setOrigin(BuffBuilderChangeMessage::O_SERVER);
outMsg->setAccepted(true);
bufferController->appendMessage(static_cast<int>(CM_buffBuilderChange), 0.0f, outMsg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT);
}
}
@@ -1687,8 +1687,6 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doCombatResults(JNIEnv *env, jobj
// create a CombatAction message and fill it in
MessageQueueCombatAction * message = new MessageQueueCombatAction();
if (message == NULL)
return JNI_FALSE;
message->setActionId(animationString);
// @todo: change set postures to set locomotions
@@ -518,11 +518,9 @@ int i;
// Create a dummy object.
Object *dummyObject = new MemoryBlockManagedObject();
NOT_NULL(dummyObject);
// Create a CustomizationData instance.
CustomizationData *customizationData = new CustomizationData(*dummyObject);
NOT_NULL(customizationData);
customizationData->fetch();
// Retrieve CustomizationData for crafted object's appearance template name.
@@ -3238,7 +3238,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getCtsDestinationClusters
}
}
if (!s_ctsDestinationClusters || s_ctsDestinationClusters->empty())
if (s_ctsDestinationClusters->empty())
return 0;
LocalObjectArrayRefPtr valueArray = createNewObjectArray(s_ctsDestinationClusters->size(), JavaLibrary::getClsString());
@@ -36,7 +36,6 @@ void get(ReadIterator & source, std::vector<const std::vector<NetworkId> *> & ta
for (int i = 0; i < length; ++i)
{
std::vector<NetworkId> * inner = new std::vector<NetworkId>();
NOT_NULL(inner);
signed int innerLength = 0;
get(source, innerLength);
NetworkId id;
@@ -52,7 +52,7 @@ namespace DebugMonitorNamespace
DWORD type = 0;
DWORD size = sizeof(DWORD);
LONG result = RegQueryValueEx(registryKey, name, NULL, &type, reinterpret_cast<LPBYTE>(&value), &size);
if (result != ERROR_SUCCESS || type != REG_DWORD && size != sizeof(int))
if ((result != ERROR_SUCCESS || type != REG_DWORD) && (size != sizeof(int)))
value = defaultValue;
return value;
}
@@ -1612,9 +1612,9 @@ int MemoryManagerNamespace::quickGuessIsValidPointerFromHeap(void const * userPo
AllocatedBlock const * allocatedBlock = reinterpret_cast<AllocatedBlock const *>(reinterpret_cast<byte const *>(userPointer) - (cms_allocatedBlockSize + cms_guardBandSize));
ms_criticalSection->enter();
if (!result && allocatedBlock->getNext()->getPrevious() != allocatedBlock) result = 1;
if (!result && allocatedBlock->getPrevious()->getNext() != allocatedBlock) result = 2;
if (!result && allocatedBlock->isFree()) result = 3;
if (allocatedBlock->getNext()->getPrevious() != allocatedBlock) result = 1;
if (allocatedBlock->getPrevious()->getNext() != allocatedBlock) result = 2;
if (allocatedBlock->isFree()) result = 3;
ms_criticalSection->leave();
return result;
@@ -63,7 +63,6 @@ int property, value, itemCount;
UNREF(source);
MessageQueueCraftCustomization * msg = new MessageQueueCraftCustomization();
NOT_NULL(msg);
Archive::get(source, name);
msg->setName(name);
@@ -57,7 +57,6 @@ MessageQueue::Data* MessageQueueCraftExperiment::unpack(Archive::ReadIterator &
uint8 sequenceId;
Archive::get(source, sequenceId);
MessageQueueCraftExperiment* const msg = new MessageQueueCraftExperiment(sequenceId);
NOT_NULL(msg);
int count;
int attribute, points;
@@ -53,7 +53,6 @@ void MessageQueueCraftIngredients::pack(const MessageQueue::Data* const data, Ar
MessageQueue::Data* MessageQueueCraftIngredients::unpack(Archive::ReadIterator & source)
{
MessageQueueCraftIngredients* const msg = new MessageQueueCraftIngredients();
NOT_NULL(msg);
int count;
Unicode::String name;
@@ -61,7 +61,6 @@ void MessageQueueCreateSaga::pack(const MessageQueue::Data* const data, Archive:
MessageQueue::Data* MessageQueueCreateSaga::unpack(Archive::ReadIterator & source)
{
MessageQueueCreateSaga* const msg = new MessageQueueCreateSaga();
NOT_NULL(msg);
std::string questName;
std::string questDescription;
@@ -93,7 +93,6 @@ MessageQueue::Data* MessageQueueDraftSchematics::unpack(Archive::ReadIterator &
Archive::get(source, stationId);
MessageQueueDraftSchematics* const msg = new MessageQueueDraftSchematics(toolId, stationId);
NOT_NULL(msg);
int count, category;
uint32 serverCrc, sharedCrc;
@@ -71,7 +71,6 @@ MessageQueue::Data* MessageQueueDraftSlots::unpack(Archive::ReadIterator & sourc
Archive::get(source, canManufacture);
MessageQueueDraftSlots * const msg = new MessageQueueDraftSlots(toolId, manfSchemId);
NOT_NULL(msg);
msg->setPrototypeId(testProtoId);
msg->setVolume(volume);
@@ -83,7 +83,6 @@ MessageQueue::Data* MessageQueueDraftSlotsQueryResponse::unpack(Archive::ReadIte
Archive::get(source, canManufacture);
MessageQueueDraftSlotsQueryResponse * const msg = new MessageQueueDraftSlotsQueryResponse (crc);
NOT_NULL(msg);
msg->setComplexity(complexity);
msg->setVolume(volume);
msg->setCanManufacture(canManufacture);
@@ -44,7 +44,6 @@ void MessageQueueNpcConversationMessage::pack(const MessageQueue::Data* const da
MessageQueue::Data* MessageQueueNpcConversationMessage::unpack(Archive::ReadIterator & source)
{
MessageQueueNpcConversationMessage * msg = new MessageQueueNpcConversationMessage;
NOT_NULL(msg);
Unicode::String response;
Archive::get(source, response);
@@ -60,7 +60,6 @@ MessageQueue::Data* MessageQueueOpponentInfo::unpack(Archive::ReadIterator & sou
MessageQueueOpponentInfo * msg = new MessageQueueOpponentInfo();
msg->setOpponent(opponent);
msg->setAttributes(health, action, mind);
NOT_NULL(msg);
return msg;
}
@@ -76,7 +76,6 @@ MessageQueue::Data* MessageQueuePushCreature::unpack(Archive::ReadIterator & sou
Archive::get(source, distance);
MessageQueuePushCreature * const msg = new MessageQueuePushCreature(attacker, defender, attackerPos, defenderPos, distance);
NOT_NULL(msg);
return msg;
}
@@ -48,7 +48,6 @@ void MessageQueueStartNpcConversation::pack(const MessageQueue::Data* const data
MessageQueue::Data* MessageQueueStartNpcConversation::unpack(Archive::ReadIterator & source)
{
MessageQueueStartNpcConversation * msg = new MessageQueueStartNpcConversation;
NOT_NULL(msg);
NetworkId npc;
Archive::get(source, npc);
@@ -47,7 +47,6 @@ void MessageQueueStopNpcConversation::pack(const MessageQueue::Data* const data,
MessageQueue::Data* MessageQueueStopNpcConversation::unpack(Archive::ReadIterator & source)
{
MessageQueueStopNpcConversation * msg = new MessageQueueStopNpcConversation;
NOT_NULL(msg);
// npc
{
@@ -58,7 +58,6 @@ void MessageQueueStringList::pack(const MessageQueue::Data* const data, Archive:
MessageQueue::Data* MessageQueueStringList::unpack(Archive::ReadIterator & source)
{
MessageQueueStringList * msg = new MessageQueueStringList;
NOT_NULL(msg);
uint8 count;
Unicode::String string;
@@ -72,7 +72,6 @@ MessageQueue::Data* MessageQueueUpdateShipOnCollision::unpack(Archive::ReadItera
Archive::get(source, clampedStrengthOfImpact);
MessageQueueUpdateShipOnCollision * const msg = new MessageQueueUpdateShipOnCollision(deltaToMove, newVelocity, clampedStrengthOfImpact);
NOT_NULL(msg);
return msg;
}
@@ -259,7 +259,6 @@ void StructureFootprint::load_0000 (Iff& iff)
//-- allocate footprint
IS_NULL (m_data);
m_data = new LotType [static_cast<size_t> (m_width * m_height)];
NOT_NULL (m_data);
//-- convert string to footprint
const char* const buffer = footprint.c_str ();
@@ -53,7 +53,6 @@ void Portal::install()
{
delete ms_doorStyleTable;
ms_doorStyleTable = new DataTable();
NOT_NULL(ms_doorStyleTable);
ms_doorStyleTable->load(dataTableIff);
}
@@ -1918,7 +1918,6 @@ std::string name;
// now parse the objvar data
line = paramStart;
CompilerDynamicVariableParamData *newData = new CompilerDynamicVariableParamData(name, type);
NOT_NULL(newData);
switch (type)
{
case DynamicVariableParamData::INTEGER:
@@ -2431,7 +2430,6 @@ const char *parseWeightedList(
TpfFile &file, Q & param, const char *line)
{
LIST *list = new LIST;
NOT_NULL(list);
param.setValue(list);
int totalWeight = 0;
for (;;)
@@ -2439,7 +2437,6 @@ const char *parseWeightedList(
VALUE value;
Q *valueParam = NULL;
value.value = valueParam = new Q;
NOT_NULL(valueParam);
list->push_back(value);
VALUE *newValue = &list->back();
// test to see if we need to go to the next line
@@ -614,7 +614,6 @@ int DataTable::searchColumnString( int column, const std::string & searchValue )
if (!voidIndex)
{
std::pair<std::multimap<const std::string, int>, std::multimap<int, int> > * indexPair = new std::pair<std::multimap<const std::string, int>, std::multimap<int, int> >;
NOT_NULL(indexPair);
m_index[static_cast<size_t>(column)] = static_cast<void *>(indexPair);
@@ -653,7 +652,6 @@ int DataTable::searchColumnFloat( int column, float searchValue ) const
if (!voidIndex)
{
std::multimap<float, int> * index = new std::multimap<float, int>;
NOT_NULL(index);
m_index[static_cast<size_t>(column)] = static_cast<void *>(index);
@@ -692,7 +690,6 @@ int DataTable::searchColumnInt( int column, int searchValue ) const
if (columnType == DataTableColumnType::DT_Int)
{
std::multimap<int, int> * index = new std::multimap<int, int>;
NOT_NULL(index);
m_index[static_cast<size_t>(column)] = static_cast<void *>(index);
@@ -709,7 +706,6 @@ int DataTable::searchColumnInt( int column, int searchValue ) const
else if (columnType == DataTableColumnType::DT_String)
{
std::pair<std::multimap<const std::string, int>, std::multimap<int, int> > * indexPair = new std::pair<std::multimap<const std::string, int>, std::multimap<int, int> >;
NOT_NULL(indexPair);
m_index[static_cast<size_t>(column)] = static_cast<void *>(indexPair);
@@ -543,7 +543,6 @@ void DataTableWriter::_loadFromSpreadsheetTab(const char * filename)
int bufferLength = fileLength + 1;
char* buffer = new char[bufferLength];
memset(buffer, 0, bufferLength);
NOT_NULL(buffer);
int bytes_read = inputFile.read(buffer, fileLength);
FATAL(!bytes_read, ("Didn't read in any bytes when loading %s.", filename));
@@ -998,7 +998,6 @@ void DynamicVariableParamData::loadFromIff(Iff &file)
for (int i = 0; i < count; ++i)
{
DynamicVariableParamData *newData = new DynamicVariableParamData;
NOT_NULL(newData);
newData->loadFromIff(file);
m_data.lparam->push_back(newData);
}
@@ -99,11 +99,10 @@ XmlTreeDocument* XmlTreeDocument::createDocument(const char * rootNodeName)
XmlTreeDocument *treeDoc = new XmlTreeDocument(doc);
DEBUG_WARNING( !treeDoc, ("Attempted to make new XmlTreeDoc but failed") );
if (!treeDoc)
{
xmlFree(doc);
return 0;
}
xmlFree(doc);
return 0;
treeDoc->fetch();
return treeDoc;
}
@@ -120,12 +119,11 @@ XmlTreeDocument * XmlTreeDocument::buildDocumentFromText(const std::string &inpu
return 0;
}
XmlTreeDocument *treeDoc = new XmlTreeDocument(doc);
if(!treeDoc)
{
DEBUG_FATAL(true, ("Failure building XmlTreeDocument after successful parsing of memory buffer."));
xmlFree(doc);
return 0;
}
DEBUG_FATAL(true, ("Failure building XmlTreeDocument after successful parsing of memory buffer."));
xmlFree(doc);
return 0;
treeDoc->fetch();
return treeDoc;
}
+5 -6
View File
@@ -228,12 +228,11 @@ Unicode::String UTF8ToUnicode(const char *source)
Unicode::String s = narrowToWide("");
int length = strlen(source) + 1;
UTF16 *buffer = new UTF16[length];
if (buffer != NULL)
{
UTF8_convertToUTF16(const_cast<char *>(source) , buffer, length);
s =buffer;
delete [] buffer;
}
UTF8_convertToUTF16(const_cast<char *>(source) , buffer, length);
s =buffer;
delete [] buffer;
return s;
}
@@ -86,8 +86,6 @@ MessageQueue::Data* MessageQueueCombatDamageList::unpack(Archive::ReadIterator &
uint8 temp8;
MessageQueueCombatDamageList * msg = new MessageQueueCombatDamageList;
NOT_NULL(msg);
uint16 listCount;
Archive::get(source, listCount);
@@ -465,7 +465,6 @@ MessageQueue::Data* MessageQueueCombatAction::unpack(Archive::ReadIterator & sou
int actionNameCrc;
MessageQueueCombatAction * msg = new MessageQueueCombatAction;
NOT_NULL(msg);
Archive::get(source, actionId);
msg->setActionId(actionId);
@@ -88,9 +88,7 @@ MessageQueue::Data* MessageQueueCombatDamage::unpack(Archive::ReadIterator & sou
Attributes::Enumerator attribute;
Attributes::Value value;
MessageQueueCombatDamage * msg = new MessageQueueCombatDamage;
NOT_NULL(msg);
MessageQueueCombatDamage * msg = new MessageQueueCombatDamage;
Archive::get(source, actionId);
msg->setActionId(actionId);