[General] Fix warnings and errors found by PVS Studio in Server

ffi-server-rewrite
Koncord 6 years ago
parent 7ab7c4c9c2
commit 5519572b22

@ -206,4 +206,4 @@ endif (MSVC)
pvs_studio_add_target(TARGET tes3mp-server.analyze ALL
OUTPUT FORMAT errorfile
ANALYZE tes3mp-server
LOG target.err)
LOG target_tes3mp-server.err)

@ -55,7 +55,7 @@ void Cell::addPlayer(Player *player)
void Cell::removePlayer(Player *player, bool cleanPlayer)
{
for (Iterator it = begin(); it != end(); it++)
for (auto it = begin(); it != end(); ++it)
{
if (*it == player)
{
@ -161,7 +161,7 @@ void Cell::removeActors(const mwmp::BaseActorList *newActorList)
}
if (!foundActor)
it++;
++it;
}
cellActorList.count = cellActorList.baseActors.size();

@ -64,7 +64,7 @@ Cell *CellController::getCellByXY(int x, int y)
return *it;
}
Cell *CellController::getCellByName(std::string cellName)
Cell *CellController::getCellByName(const std::string &cellName)
{
auto it = find_if(cells.begin(), cells.end(), [cellName](const Cell *c)
{
@ -80,7 +80,7 @@ Cell *CellController::getCellByName(std::string cellName)
return *it;
}
Cell *CellController::addCell(ESM::Cell cellData)
Cell *CellController::addCell(const ESM::Cell &cellData)
{
LOG_APPEND(Log::LOG_INFO, "- Loaded cells: %d", cells.size());
auto it = find_if(cells.begin(), cells.end(), [cellData](const Cell *c) {

@ -27,14 +27,14 @@ public:
typedef std::deque<Cell*> TContainer;
typedef TContainer::iterator TIter;
Cell * addCell(ESM::Cell cell);
Cell * addCell(const ESM::Cell &cell);
void removeCell(Cell *);
void deletePlayer(Player *player);
Cell *getCell(ESM::Cell *esmCell);
Cell *getCellByXY(int x, int y);
Cell *getCellByName(std::string cellName);
Cell *getCellByName(const std::string &cellName);
void update(Player *player);

@ -51,7 +51,7 @@ void MasterClient::SetMaxPlayers(unsigned pl)
mutexData.unlock();
}
void MasterClient::SetHostname(std::string hostname)
void MasterClient::SetHostname(const std::string &hostname)
{
mutexData.lock();
string substr = hostname.substr(0, 200);
@ -63,7 +63,7 @@ void MasterClient::SetHostname(std::string hostname)
mutexData.unlock();
}
void MasterClient::SetModname(std::string modname)
void MasterClient::SetModname(const std::string &modname)
{
mutexData.lock();
string substr = modname.substr(0, 200);
@ -75,7 +75,7 @@ void MasterClient::SetModname(std::string modname)
mutexData.unlock();
}
void MasterClient::SetRuleString(std::string key, std::string value)
void MasterClient::SetRuleString(const std::string &key, std::string value)
{
mutexData.lock();
if (queryData.rules.find(key) == queryData.rules.end() || queryData.rules[key].type != 's'
@ -90,7 +90,7 @@ void MasterClient::SetRuleString(std::string key, std::string value)
mutexData.unlock();
}
void MasterClient::SetRuleValue(std::string key, double value)
void MasterClient::SetRuleValue(const std::string &key, double value)
{
mutexData.lock();
if (queryData.rules.find(key) == queryData.rules.end() || queryData.rules[key].type != 'v'
@ -105,7 +105,7 @@ void MasterClient::SetRuleValue(std::string key, double value)
mutexData.unlock();
}
void MasterClient::PushPlugin(Plugin plugin)
void MasterClient::PushPlugin(const Plugin &plugin)
{
mutexData.lock();
queryData.plugins.push_back(plugin);
@ -208,7 +208,7 @@ void MasterClient::Thread()
}
else
{
for (int i = 0; pIt != players->end(); i++, pIt++)
for (int i = 0; pIt != players->end(); i++, ++pIt)
{
if (queryData.players[i] != pIt->second->npc.mName)
{
@ -258,5 +258,6 @@ void MasterClient::SetUpdateRate(unsigned int rate)
timeout = min_rate;
else if (timeout > max_rate)
timeout = max_rate;
else
timeout = rate;
}

@ -22,11 +22,11 @@ public:
MasterClient(RakNet::RakPeerInterface *peer, std::string queryAddr, unsigned short queryPort);
void SetPlayers(unsigned pl);
void SetMaxPlayers(unsigned pl);
void SetHostname(std::string hostname);
void SetModname(std::string hostname);
void SetRuleString(std::string key, std::string value);
void SetRuleValue(std::string key, double value);
void PushPlugin(Plugin plugin);
void SetHostname(const std::string &hostname);
void SetModname(const std::string &hostname);
void SetRuleString(const std::string &key, std::string value);
void SetRuleValue(const std::string &key, double value);
void PushPlugin(const Plugin &plugin);
bool Process(RakNet::Packet *packet);
void Start();

@ -75,7 +75,7 @@ Networking::~Networking()
delete worldstatePacketController;
}
void Networking::setServerPassword(std::string password) noexcept
void Networking::setServerPassword(const std::string &passw) noexcept
{
serverPassword = password.empty() ? TES3MP_DEFAULT_PASSW : password;
}
@ -245,7 +245,7 @@ bool Networking::preInit(RakNet::Packet *packet, RakNet::BitStream &bsIn)
auto plugin = plugins.begin();
if (samples.size() == plugins.size())
{
for (int i = 0; plugin != plugins.end(); plugin++, i++)
for (int i = 0; plugin != plugins.end(); ++plugin, i++)
{
LOG_APPEND(Log::LOG_VERBOSE, "- %X\t%s", plugin->second[0], plugin->first.c_str());
// Check if the filenames match, ignoring case
@ -317,7 +317,7 @@ void Networking::update(RakNet::Packet *packet, RakNet::BitStream &bsIn)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Unhandled RakNet packet with identifier %i has arrived", packet->data[0]);
}
void Networking::newPlayer(RakNet::RakNetGUID guid)
void Networking::newPlayer(const RakNet::RakNetGUID &guid)
{
playerPacketController->GetPacket(ID_PLAYER_BASEINFO)->RequestData(guid);
playerPacketController->GetPacket(ID_PLAYER_STATS_DYNAMIC)->RequestData(guid);
@ -327,27 +327,27 @@ void Networking::newPlayer(RakNet::RakNetGUID guid)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Sending info about other players to %lu", guid.g);
for (TPlayers::iterator pl = players->begin(); pl != players->end(); pl++) //sending other players to new player
for (auto &player : *players) //sending other players to new player
{
// If we are iterating over the new player, don't send the packets below
if (pl->first == guid) continue;
if (player.first == guid) continue;
// If an invalid key makes it into the Players map, ignore it
else if (pl->first == RakNet::UNASSIGNED_CRABNET_GUID) continue;
else if (player.first == RakNet::UNASSIGNED_CRABNET_GUID) continue;
// if player not fully connected
else if (pl->second == nullptr) continue;
else if (player.second == nullptr) continue;
// If we are iterating over a player who has inputted their name, proceed
else if (pl->second->getLoadState() == Player::POSTLOADED)
else if (player.second->getLoadState() == Player::POSTLOADED)
{
playerPacketController->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(pl->second);
playerPacketController->GetPacket(ID_PLAYER_STATS_DYNAMIC)->setPlayer(pl->second);
playerPacketController->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(pl->second);
playerPacketController->GetPacket(ID_PLAYER_SKILL)->setPlayer(pl->second);
playerPacketController->GetPacket(ID_PLAYER_POSITION)->setPlayer(pl->second);
playerPacketController->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(pl->second);
playerPacketController->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(pl->second);
playerPacketController->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(player.second);
playerPacketController->GetPacket(ID_PLAYER_STATS_DYNAMIC)->setPlayer(player.second);
playerPacketController->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(player.second);
playerPacketController->GetPacket(ID_PLAYER_SKILL)->setPlayer(player.second);
playerPacketController->GetPacket(ID_PLAYER_POSITION)->setPlayer(player.second);
playerPacketController->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(player.second);
playerPacketController->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(player.second);
playerPacketController->GetPacket(ID_PLAYER_BASEINFO)->Send(guid);
playerPacketController->GetPacket(ID_PLAYER_STATS_DYNAMIC)->Send(guid);
@ -363,7 +363,7 @@ void Networking::newPlayer(RakNet::RakNetGUID guid)
}
void Networking::disconnectPlayer(RakNet::RakNetGUID guid)
void Networking::disconnectPlayer(const RakNet::RakNetGUID &guid)
{
Player *player = Players::getPlayer(guid);
if (!player)
@ -458,7 +458,7 @@ Networking *Networking::getPtr()
return sThis;
}
RakNet::SystemAddress Networking::getSystemAddress(RakNet::RakNetGUID guid)
RakNet::SystemAddress Networking::getSystemAddress(const RakNet::RakNetGUID &guid)
{
return peer->GetSystemAddressFromGuid(guid);
}
@ -538,7 +538,7 @@ int Networking::mainLoop()
return exitCode;
}
void Networking::kickPlayer(RakNet::RakNetGUID guid, bool sendNotification)
void Networking::kickPlayer(const RakNet::RakNetGUID &guid, bool sendNotification)
{
peer->CloseConnection(guid, sendNotification);
}
@ -563,7 +563,7 @@ unsigned int Networking::maxConnections() const
return peer->GetMaximumIncomingConnections();
}
int Networking::getAvgPing(RakNet::AddressOrGUID addr) const
int Networking::getAvgPing(const RakNet::AddressOrGUID &addr) const
{
return peer->GetAveragePing(addr);
}
@ -578,7 +578,7 @@ MasterClient *Networking::getMasterClient()
return mclient;
}
void Networking::InitQuery(std::string queryAddr, unsigned short queryPort)
void Networking::InitQuery(const std::string &queryAddr, unsigned short queryPort)
{
mclient = new MasterClient(peer, queryAddr, queryPort);
}

@ -17,13 +17,13 @@ namespace mwmp
Networking(RakNet::RakPeerInterface *peer);
~Networking();
void newPlayer(RakNet::RakNetGUID guid);
void disconnectPlayer(RakNet::RakNetGUID guid);
void kickPlayer(RakNet::RakNetGUID guid, bool sendNotification = true);
void newPlayer(const RakNet::RakNetGUID &guid);
void disconnectPlayer(const RakNet::RakNetGUID &guid);
void kickPlayer(const RakNet::RakNetGUID &guid, bool sendNotification = true);
void banAddress(const char *ipAddress);
void unbanAddress(const char *ipAddress);
RakNet::SystemAddress getSystemAddress(RakNet::RakNetGUID guid);
RakNet::SystemAddress getSystemAddress(const RakNet::RakNetGUID &guid);
void processPlayerPacket(RakNet::Packet *packet);
void processActorPacket(RakNet::Packet *packet);
@ -33,7 +33,7 @@ namespace mwmp
unsigned short numberOfConnections() const;
unsigned int maxConnections() const;
int getAvgPing(RakNet::AddressOrGUID) const;
int getAvgPing(const RakNet::AddressOrGUID &) const;
unsigned short getPort() const;
int mainLoop();
@ -60,8 +60,8 @@ namespace mwmp
void setScriptErrorIgnoringState(bool state);
MasterClient *getMasterClient();
void InitQuery(std::string queryAddr, unsigned short queryPort);
void setServerPassword(std::string passw) noexcept;
void InitQuery(const std::string &queryAddr, unsigned short queryPort);
void setServerPassword(const std::string &passw) noexcept;
bool isPassworded() const;
static const Networking &get();

@ -10,7 +10,7 @@ TSlots Players::slots;
using namespace std;
void Players::deletePlayer(RakNet::RakNetGUID guid)
void Players::deletePlayer(const RakNet::RakNetGUID &guid)
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Deleting player with guid %lu", guid.g);
@ -26,7 +26,7 @@ void Players::deletePlayer(RakNet::RakNetGUID guid)
}
}
void Players::newPlayer(RakNet::RakNetGUID guid)
void Players::newPlayer(const RakNet::RakNetGUID &guid)
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Creating new player with guid %lu", guid.g);
@ -41,7 +41,7 @@ void Players::newPlayer(RakNet::RakNetGUID guid)
for (unsigned int i = 0; i < mwmp::Networking::get().maxConnections(); i++)
{
if (slots[i] == 0)
if (slots[i] == nullptr)
{
LOG_APPEND(Log::LOG_INFO, "- Storing in slot %i", i);
@ -52,7 +52,7 @@ void Players::newPlayer(RakNet::RakNetGUID guid)
}
}
Player *Players::getPlayer(RakNet::RakNetGUID guid)
Player *Players::getPlayer(const RakNet::RakNetGUID &guid)
{
auto it = players.find(guid);
if (it == players.end())
@ -70,7 +70,7 @@ unsigned short Players::getLastPlayerId()
return slots.rbegin()->first;
}
Player::Player(RakNet::RakNetGUID guid) : BasePlayer(guid)
Player::Player(const RakNet::RakNetGUID &guid) : BasePlayer(guid), id(InvalidID)
{
handshakeCounter = 0;
loadState = NOTLOADED;
@ -81,7 +81,7 @@ Player::~Player()
}
unsigned short Player::getId()
unsigned int Player::getId()
{
return id;
}
@ -177,7 +177,7 @@ void Player::forEachLoaded(std::function<void(Player *pl, Player *other)> func)
}
}
bool Players::doesPlayerExist(RakNet::RakNetGUID guid)
bool Players::doesPlayerExist(const RakNet::RakNetGUID &guid)
{
return players.find(guid) != players.end();
}

@ -28,13 +28,13 @@ typedef std::map<unsigned short, Player*> TSlots;
class Players
{
public:
static void newPlayer(RakNet::RakNetGUID guid);
static void deletePlayer(RakNet::RakNetGUID guid);
static Player *getPlayer(RakNet::RakNetGUID guid);
static void newPlayer(const RakNet::RakNetGUID &guid);
static void deletePlayer(const RakNet::RakNetGUID &guid);
static Player *getPlayer(const RakNet::RakNetGUID &guid);
static Player *getPlayer(unsigned short id);
static TPlayers *getPlayers();
static unsigned short getLastPlayerId();
static bool doesPlayerExist(RakNet::RakNetGUID guid);
static bool doesPlayerExist(const RakNet::RakNetGUID &guid);
private:
static TPlayers players;
@ -44,9 +44,8 @@ private:
class Player : public mwmp::BasePlayer
{
friend class Cell;
unsigned short id;
public:
const unsigned int InvalidID = (unsigned int) -1;
enum
{
NOTLOADED=0,
@ -54,9 +53,9 @@ public:
POSTLOADED,
KICKED
};
Player(RakNet::RakNetGUID guid);
Player(const RakNet::RakNetGUID &guid);
unsigned short getId();
unsigned int getId();
void setId(unsigned short id);
bool isHandshaked();
@ -78,6 +77,7 @@ private:
CellController::TContainer cells;
int loadState;
int handshakeCounter;
unsigned int id;
};

@ -61,7 +61,7 @@ bool Public::IsLua(const std::string &name)
void Public::DeleteAll()
{
for (auto it = publics.begin(); it != publics.end(); it++)
for (auto it = publics.begin(); it != publics.end(); ++it)
{
Public *_public = it->second;
delete _public;

@ -6,18 +6,18 @@
using namespace mwmp;
using namespace std;
Timer::Timer(ScriptFunc callback, long msec, const std::string& def, std::vector<boost::any> args) : ScriptFunction(callback, 'v', def)
Timer::Timer(ScriptFunc callback, long msec, const std::string& def, std::vector<boost::any> args) : ScriptFunction(callback, 'v', def), args(args)
{
startTime = 0;
targetMsec = msec;
this->args = args;
isEnded = true;
}
#if defined(ENABLE_LUA)
Timer::Timer(lua_State *lua, ScriptFuncLua callback, long msec, const std::string& def, std::vector<boost::any> args): ScriptFunction(callback, lua, 'v', def)
Timer::Timer(lua_State *lua, ScriptFuncLua callback, long msec, const std::string& def, std::vector<boost::any> args): ScriptFunction(callback, lua, 'v', def), args(args)
{
startTime = 0;
targetMsec = msec;
this->args = args;
isEnded = true;
}
#endif
@ -90,7 +90,7 @@ int TimerAPI::CreateTimerLua(lua_State *lua, ScriptFuncLua callback, long msec,
#endif
int TimerAPI::CreateTimer(ScriptFunc callback, long msec, const std::string &def, std::vector<boost::any> args)
int TimerAPI::CreateTimer(ScriptFunc callback, long msec, const std::string &def, const std::vector<boost::any> &args)
{
int id = -1;

@ -29,9 +29,9 @@ namespace mwmp
void Restart(int msec);
private:
double startTime, targetMsec;
std::string publ, arg_types;
//std::string publ, arg_types;
std::vector<boost::any> args;
Script *scr;
//Script *scr;
bool isEnded;
};

@ -45,7 +45,7 @@ extern "C" const char *CellFunctions::GetCell(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player, 0);
tempCellDescription = player->cell.getDescription().c_str();
tempCellDescription = player->cell.getDescription();
return tempCellDescription.c_str();
}

@ -99,7 +99,7 @@ extern "C" void CharClassFunctions::SetClassName(unsigned short pid, const char
GET_PLAYER(pid, player,);
player->charClass.mName = name;
player->charClass.mId = "";
player->charClass.mId.clear();
}
extern "C" void CharClassFunctions::SetClassDesc(unsigned short pid, const char *desc) noexcept

@ -24,7 +24,7 @@ extern "C" const char *MechanicsFunctions::GetMarkCell(unsigned short pid) noexc
Player *player;
GET_PLAYER(pid, player, 0);
tempCellDescription = player->cell.getDescription().c_str();
tempCellDescription = player->cell.getDescription();
return tempCellDescription.c_str();
}

@ -151,7 +151,7 @@ extern "C" void ServerFunctions::AddPluginHash(const char *pluginName, const cha
unsigned hash = 0;
if (strlen(hashStr) != 0)
if (hashStr[0] != '\0')
{
hash = (unsigned) std::stoul(hashStr);
hashList.push_back(hash);

@ -239,7 +239,7 @@ extern "C" int StatsFunctions::GetSkillIncrease(unsigned short pid, unsigned int
Player *player;
GET_PLAYER(pid, player, 0);
if (attributeId > Attribute::Length)
if (attributeId >= Attribute::Length)
return 0;
return player->npcStats.mSkillIncrease[attributeId];
@ -484,7 +484,7 @@ extern "C" void StatsFunctions::SetSkillIncrease(unsigned short pid, unsigned in
Player *player;
GET_PLAYER(pid, player,);
if (attributeId > Attribute::Length)
if (attributeId >= Attribute::Length)
return;
player->npcStats.mSkillIncrease[attributeId] = value;

@ -252,7 +252,7 @@ boost::any LangLua::Call(const char *name, const char *argl, int buf, ...)
break;
default:
throw runtime_error("C++ call: Unknown argument identifier " + argl[index]);
throw runtime_error(std::string("C++ call: Unknown argument identifier ") + argl[index]);
}
}
@ -304,7 +304,7 @@ boost::any LangLua::Call(const char *name, const char *argl, const std::vector<b
luabridge::Stack<bool>::push(lua, boost::any_cast<int>(args.at(index)));
break;
default:
throw runtime_error("Lua call: Unknown argument identifier " + argl[index]);
throw runtime_error(std::string("Lua call: Unknown argument identifier ") + argl[index]);
}
}

@ -9,7 +9,7 @@
using namespace std;
inline vector<boost::any> DefToVec(lua_State *lua, string types, int args_begin, int args_n)
inline vector<boost::any> DefToVec(lua_State *lua, const string &types, int args_begin, int args_n)
{
vector<boost::any> args;
@ -93,13 +93,15 @@ int LangLua::CallPublic(lua_State *lua)
if (result.empty())
return 0;
if (result.type().hash_code() == typeid(signed int).hash_code())
auto retTypeHash = result.type().hash_code();
if (retTypeHash == typeid(signed int).hash_code())
luabridge::Stack<signed int>::push(lua, boost::any_cast<signed int>(result));
else if (result.type().hash_code() == typeid(unsigned int).hash_code())
else if (retTypeHash == typeid(unsigned int).hash_code())
luabridge::Stack<unsigned int>::push(lua, boost::any_cast<unsigned int>(result));
else if (result.type().hash_code() == typeid(double).hash_code())
else if (retTypeHash == typeid(double).hash_code())
luabridge::Stack<double>::push(lua, boost::any_cast<double>(result));
else if (result.type().hash_code() == typeid(const char*).hash_code())
else if (retTypeHash == typeid(const char*).hash_code())
luabridge::Stack<const char*>::push(lua, boost::any_cast<const char*>(result));
return 1;
}

@ -91,7 +91,7 @@ lib_t LangNative::GetInterface()
}
LangNative::LangNative()
LangNative::LangNative(): lib(nullptr)
{
}

@ -56,7 +56,7 @@ void ScriptFunctions::GetArguments(std::vector<boost::any> &params, va_list args
break;
default:
throw runtime_error("C++ call: Unknown argument identifier " + c);
throw runtime_error(std::string("C++ call: Unknown argument identifier ") + c);
}
}
}

@ -17,7 +17,6 @@ const vector<string> Utils::split(const string &str, int delimiter)
else if (!buffer.empty())
{
result.push_back(move(buffer));
buffer.clear();
}
if (!buffer.empty())
result.push_back(move(buffer));
@ -25,7 +24,7 @@ const vector<string> Utils::split(const string &str, int delimiter)
return result;
}
ESM::Cell Utils::getCellFromDescription(std::string cellDescription)
ESM::Cell Utils::getCellFromDescription(const std::string &cellDescription)
{
ESM::Cell cell;
cell.blank();

@ -25,7 +25,7 @@ namespace Utils
{
const std::vector<std::string> split(const std::string &str, int delimiter);
ESM::Cell getCellFromDescription(std::string cellDescription);
ESM::Cell getCellFromDescription(const std::string &cellDescription);
template<size_t N>
constexpr unsigned int hash(const char(&str)[N], size_t I = N)

@ -309,13 +309,15 @@ int main(int argc, char *argv[])
}
networking.InitQuery(masterAddr, (unsigned short) masterPort);
networking.getMasterClient()->SetMaxPlayers((unsigned) players);
networking.getMasterClient()->SetUpdateRate((unsigned) updateRate);
auto masterClient = networking.getMasterClient();
masterClient->SetMaxPlayers((unsigned) players);
masterClient->SetUpdateRate((unsigned) updateRate);
string hostname = mgr.getString("hostname", "General");
networking.getMasterClient()->SetHostname(hostname);
networking.getMasterClient()->SetRuleString("CommitHash", version.mCommitHash.substr(0, 10));
masterClient->SetHostname(hostname);
masterClient->SetRuleString("CommitHash", version.mCommitHash.substr(0, 10));
networking.getMasterClient()->Start();
masterClient->Start();
}
networking.postInit();

@ -31,7 +31,7 @@ bool ActorProcessor::Process(RakNet::Packet &packet, BaseActorList &actorList) n
if (!processor.second->avoidReading)
myPacket->Read();
if (actorList.isValid)
if (actorList.isValid) // -V547
processor.second->Do(*myPacket, *player, actorList);
else
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Received %s that failed integrity check and was ignored!", processor.second->strPacketID.c_str());

@ -31,7 +31,7 @@ bool ObjectProcessor::Process(RakNet::Packet &packet, BaseObjectList &objectList
if (!processor.second->avoidReading)
myPacket->Read();
if (objectList.isValid)
if (objectList.isValid) // -V547
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());

@ -28,7 +28,7 @@ bool WorldstateProcessor::Process(RakNet::Packet &packet, BaseWorldstate &worlds
if (!processor.second->avoidReading)
myPacket->Read();
if (worldstate.isValid)
if (worldstate.isValid) // -V547
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());

@ -61,7 +61,7 @@ namespace mwmp
{
public:
BaseActorList()
BaseActorList(): count(0), action(0), isValid(false)
{
}

@ -81,12 +81,13 @@ namespace mwmp
{
public:
BaseObjectList(RakNet::RakNetGUID guid) : guid(guid)
BaseObjectList(RakNet::RakNetGUID guid) : guid(guid), baseObjectCount(0), packetOrigin(0), action(0),
containerSubAction(0), isValid(false)
{
}
BaseObjectList()
BaseObjectList(): baseObjectCount(0), packetOrigin(0), action(0), containerSubAction(0), isValid(false)
{
}

@ -43,15 +43,15 @@ struct QueryData
QueryData()
{
rules["name"].type = ServerRule::Type::string;
rules["name"].str = "";
rules["name"].str.clear();
rules["version"].type = ServerRule::Type::string;
rules["version"].str = "";
rules["version"].str.clear();
rules["players"].type = ServerRule::Type::number;
rules["players"].val = 0;
rules["maxPlayers"].type = ServerRule::Type::number;
rules["maxPlayers"].val = 0;
rules["gamemode"].type = ServerRule::Type::string;
rules["gamemode"].str = "";
rules["gamemode"].str.clear();
rules["passw"].type = ServerRule::Type::number;
rules["passw"].val = 0;
}

@ -114,7 +114,7 @@ namespace mwmp
str = rstr.C_String();
}
else
str = std::string();
str.clear();
}
return res;
}

Loading…
Cancel
Save