From 4225cbae02f2d47d6f2c3dc15a084257bc70e5ef Mon Sep 17 00:00:00 2001 From: Koncord Date: Fri, 4 Jan 2019 13:03:31 +0800 Subject: [PATCH] [General] Add comments to false-positive PVS messages --- apps/openmw-mp/processors/ObjectProcessor.cpp | 2 +- apps/openmw-mp/processors/WorldstateProcessor.cpp | 2 +- apps/openmw/mwmp/MechanicsHelper.cpp | 13 +++++-------- apps/openmw/mwmp/RecordHelper.cpp | 2 -- apps/openmw/mwmp/processors/ActorProcessor.cpp | 2 +- apps/openmw/mwmp/processors/ObjectProcessor.cpp | 2 +- apps/openmw/mwmp/processors/WorldstateProcessor.cpp | 2 +- .../processors/player/ProcessorPlayerCellState.hpp | 2 +- .../mwmp/processors/player/ProcessorPlayerDeath.hpp | 2 +- .../processors/player/ProcessorUserDisconnected.hpp | 2 +- 10 files changed, 13 insertions(+), 18 deletions(-) diff --git a/apps/openmw-mp/processors/ObjectProcessor.cpp b/apps/openmw-mp/processors/ObjectProcessor.cpp index 1a634b2d5..530044ad1 100644 --- a/apps/openmw-mp/processors/ObjectProcessor.cpp +++ b/apps/openmw-mp/processors/ObjectProcessor.cpp @@ -31,7 +31,7 @@ bool ObjectProcessor::Process(RakNet::Packet &packet, BaseObjectList &objectList if (!processor.second->avoidReading) myPacket->Read(); - if (objectList.isValid) // -V547 + if (objectList.isValid) // -V547 (PVS Studio false-positive warning) processor.second->Do(*myPacket, *player, objectList); else LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Received %s that failed integrity check and was ignored!", processor.second->strPacketID.c_str()); diff --git a/apps/openmw-mp/processors/WorldstateProcessor.cpp b/apps/openmw-mp/processors/WorldstateProcessor.cpp index 9daa937b3..2e0c73da1 100644 --- a/apps/openmw-mp/processors/WorldstateProcessor.cpp +++ b/apps/openmw-mp/processors/WorldstateProcessor.cpp @@ -28,7 +28,7 @@ bool WorldstateProcessor::Process(RakNet::Packet &packet, BaseWorldstate &worlds if (!processor.second->avoidReading) myPacket->Read(); - if (worldstate.isValid) // -V547 + if (worldstate.isValid) // -V547 (PVS Studio false-positive warning) processor.second->Do(*myPacket, *player, worldstate); else LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Received %s that failed integrity check and was ignored!", processor.second->strPacketID.c_str()); diff --git a/apps/openmw/mwmp/MechanicsHelper.cpp b/apps/openmw/mwmp/MechanicsHelper.cpp index 1e324e60a..1a25098e2 100644 --- a/apps/openmw/mwmp/MechanicsHelper.cpp +++ b/apps/openmw/mwmp/MechanicsHelper.cpp @@ -146,14 +146,11 @@ mwmp::Target MechanicsHelper::getTarget(const MWWorld::Ptr& ptr) { MWWorld::CellRef *ptrRef = &ptr.getCellRef(); - if (ptrRef) - { - target.isPlayer = false; - target.refId = ptrRef->getRefId(); - target.refNum = ptrRef->getRefNum().mIndex; - target.mpNum = ptrRef->getMpNum(); - target.name = ptr.getClass().getName(ptr); - } + target.isPlayer = false; + target.refId = ptrRef->getRefId(); + target.refNum = ptrRef->getRefNum().mIndex; + target.mpNum = ptrRef->getMpNum(); + target.name = ptr.getClass().getName(ptr); } } diff --git a/apps/openmw/mwmp/RecordHelper.cpp b/apps/openmw/mwmp/RecordHelper.cpp index 86cc6417d..6e31ac301 100644 --- a/apps/openmw/mwmp/RecordHelper.cpp +++ b/apps/openmw/mwmp/RecordHelper.cpp @@ -453,8 +453,6 @@ void RecordHelper::overrideArmorRecord(const mwmp::ArmorRecord& record) ESM::Armor finalData = *baseData; finalData.mId = recordData.mId; - finalData.mParts.mParts.at(0); - if (record.baseOverrides.hasName) finalData.mName = recordData.mName; diff --git a/apps/openmw/mwmp/processors/ActorProcessor.cpp b/apps/openmw/mwmp/processors/ActorProcessor.cpp index 42c46881c..dfe231798 100644 --- a/apps/openmw/mwmp/processors/ActorProcessor.cpp +++ b/apps/openmw/mwmp/processors/ActorProcessor.cpp @@ -36,7 +36,7 @@ bool ActorProcessor::Process(RakNet::Packet &packet, ActorList &actorList) myPacket->Read(); } - if (actorList.isValid) + if (actorList.isValid) // -V547 (PVS Studio false-positive warning) processor.second->Do(*myPacket, actorList); else LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Received %s that failed integrity check and was ignored!", processor.second->strPacketID.c_str()); diff --git a/apps/openmw/mwmp/processors/ObjectProcessor.cpp b/apps/openmw/mwmp/processors/ObjectProcessor.cpp index 33cce8352..e2d28f726 100644 --- a/apps/openmw/mwmp/processors/ObjectProcessor.cpp +++ b/apps/openmw/mwmp/processors/ObjectProcessor.cpp @@ -31,7 +31,7 @@ bool ObjectProcessor::Process(RakNet::Packet &packet, ObjectList &objectList) if (!request && !processor.second->avoidReading) myPacket->Read(); - if (objectList.isValid) + if (objectList.isValid) // -V547 (PVS Studio false-positive warning) processor.second->Do(*myPacket, objectList); else LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Received %s that failed integrity check and was ignored!", processor.second->strPacketID.c_str()); diff --git a/apps/openmw/mwmp/processors/WorldstateProcessor.cpp b/apps/openmw/mwmp/processors/WorldstateProcessor.cpp index 210815c58..4344059e9 100644 --- a/apps/openmw/mwmp/processors/WorldstateProcessor.cpp +++ b/apps/openmw/mwmp/processors/WorldstateProcessor.cpp @@ -31,7 +31,7 @@ bool WorldstateProcessor::Process(RakNet::Packet &packet, Worldstate &worldstate if (!request && !processor.second->avoidReading) myPacket->Read(); - if (worldstate.isValid) + if (worldstate.isValid) // -V547 (PVS Studio false-positive warning) processor.second->Do(*myPacket, worldstate); else LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Received %s that failed integrity check and was ignored!", processor.second->strPacketID.c_str()); diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerCellState.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerCellState.hpp index f75e1ec08..735098644 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorPlayerCellState.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerCellState.hpp @@ -11,7 +11,7 @@ namespace mwmp ProcessorPlayerCellState() { BPP_INIT(ID_PLAYER_CELL_STATE) - avoidReading = true; + avoidReading = true; // -V519 (PVS Studio false-positive warning) } virtual void Do(PlayerPacket &packet, BasePlayer *player) diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerDeath.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerDeath.hpp index c6958eca3..670bf82d2 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorPlayerDeath.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerDeath.hpp @@ -16,7 +16,7 @@ namespace mwmp ProcessorPlayerDeath() { BPP_INIT(ID_PLAYER_DEATH) - avoidReading = true; + avoidReading = true; // -V519 (PVS Studio false-positive warning) } virtual void Do(PlayerPacket &packet, BasePlayer *player) diff --git a/apps/openmw/mwmp/processors/player/ProcessorUserDisconnected.hpp b/apps/openmw/mwmp/processors/player/ProcessorUserDisconnected.hpp index 68eabfda4..7d64dc8aa 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorUserDisconnected.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorUserDisconnected.hpp @@ -18,7 +18,7 @@ namespace mwmp ProcessorUserDisconnected() { BPP_INIT(ID_USER_DISCONNECTED) - avoidReading = true; + avoidReading = true; // -V519 (PVS Studio false-positive warning) } virtual void Do(PlayerPacket &packet, BasePlayer *player)