Change things -Wcatch-value complains about to references

This commit is contained in:
Michael Cook (mackal) 2020-01-16 19:03:36 -05:00
parent baf4cc62eb
commit 139b6c34e5
7 changed files with 71 additions and 71 deletions

View File

@ -165,7 +165,7 @@ class EQEmuConfig
fconfig >> _config->_root;
_config->parse_config();
}
catch (std::exception) {
catch (std::exception &) {
return false;
}
return true;

View File

@ -32,7 +32,7 @@ EQ::JsonConfigFile EQ::JsonConfigFile::Load(
try {
ifs >> ret.m_root;
}
catch (std::exception) {
catch (std::exception &) {
return ret;
}
@ -81,7 +81,7 @@ std::string EQ::JsonConfigFile::GetVariableString(
return m_root[title][parameter].asString();
}
}
catch (std::exception) {
catch (std::exception &) {
return default_value;
}
@ -105,7 +105,7 @@ int EQ::JsonConfigFile::GetVariableInt(
return m_root[title][parameter].asInt();
}
}
catch (std::exception) {
catch (std::exception &) {
return default_value;
}
@ -129,7 +129,7 @@ bool EQ::JsonConfigFile::GetVariableBool(
return m_root[title][parameter].asBool();
}
}
catch (std::exception) {
catch (std::exception &) {
return default_value;
}
@ -153,7 +153,7 @@ double EQ::JsonConfigFile::GetVariableDouble(
return m_root[title][parameter].asDouble();
}
}
catch (std::exception) {
catch (std::exception &) {
return default_value;
}

View File

@ -61,7 +61,7 @@ EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
auto &connection = iter->second;
connection->GetWebsocketConnection()->ping("keepalive");
}
catch (std::exception) {
catch (std::exception &) {
iter->second->GetTCPConnection()->Disconnect();
}
@ -157,7 +157,7 @@ void EQ::Net::WebsocketServer::DispatchEvent(WebsocketSubscriptionEvent evt, Jso
}
}
}
catch (std::exception) {
catch (std::exception &) {
}
}
@ -190,7 +190,7 @@ Json::Value EQ::Net::WebsocketServer::Login(WebsocketServerConnection *connectio
return ret;
}
catch (std::exception) {
catch (std::exception &) {
throw WebsocketException("Unable to process login request");
}
}
@ -212,7 +212,7 @@ Json::Value EQ::Net::WebsocketServer::Subscribe(WebsocketServerConnection *conne
catch (WebsocketException &ex) {
throw ex;
}
catch (std::exception) {
catch (std::exception &) {
throw WebsocketException("Unable to process unsubscribe request");
}
}
@ -234,7 +234,7 @@ Json::Value EQ::Net::WebsocketServer::Unsubscribe(WebsocketServerConnection *con
catch (WebsocketException &ex) {
throw ex;
}
catch (std::exception) {
catch (std::exception &) {
throw WebsocketException("Unable to process unsubscribe request");
}
}

View File

@ -24,7 +24,7 @@ void WebInterface::OnCall(uint16 opcode, EQ::Net::Packet &p)
std::stringstream ss(json_str);
ss >> root;
}
catch (std::exception) {
catch (std::exception &) {
SendError("Could not parse request");
return;
}
@ -40,7 +40,7 @@ void WebInterface::OnCall(uint16 opcode, EQ::Net::Packet &p)
return;
}
}
catch (std::exception) {
catch (std::exception &) {
SendError("Invalid request: method not supplied");
return;
}
@ -49,7 +49,7 @@ void WebInterface::OnCall(uint16 opcode, EQ::Net::Packet &p)
try {
params = root["params"];
}
catch (std::exception) {
catch (std::exception &) {
params = nullptr;
}
@ -57,7 +57,7 @@ void WebInterface::OnCall(uint16 opcode, EQ::Net::Packet &p)
try {
id = root["id"].asString();
}
catch (std::exception) {
catch (std::exception &) {
id = "";
}
@ -82,7 +82,7 @@ void WebInterface::Send(const Json::Value &value)
p.PutString(0, ss.str());
m_connection->Send(ServerOP_WebInterfaceCall, p);
}
catch (std::exception) {
catch (std::exception &) {
//Log error
}
}
@ -116,7 +116,7 @@ void WebInterface::SendEvent(const Json::Value &value)
p.PutString(0, ss.str());
m_connection->Send(ServerOP_WebInterfaceEvent, p);
}
catch (std::exception) {
catch (std::exception &) {
//Log error
}
}

View File

@ -1397,7 +1397,7 @@ void Lua_Client::QuestReward(Lua_Mob target, luabind::adl::object reward) {
if (luabind::type(cur) != LUA_TNIL) {
try {
copper = luabind::object_cast<uint32>(cur);
} catch (luabind::cast_failed) {
} catch (luabind::cast_failed &) {
}
}
@ -1405,7 +1405,7 @@ void Lua_Client::QuestReward(Lua_Mob target, luabind::adl::object reward) {
if (luabind::type(cur) != LUA_TNIL) {
try {
silver = luabind::object_cast<uint32>(cur);
} catch (luabind::cast_failed) {
} catch (luabind::cast_failed &) {
}
}
@ -1413,7 +1413,7 @@ void Lua_Client::QuestReward(Lua_Mob target, luabind::adl::object reward) {
if (luabind::type(cur) != LUA_TNIL) {
try {
gold = luabind::object_cast<uint32>(cur);
} catch (luabind::cast_failed) {
} catch (luabind::cast_failed &) {
}
}
@ -1421,7 +1421,7 @@ void Lua_Client::QuestReward(Lua_Mob target, luabind::adl::object reward) {
if (luabind::type(cur) != LUA_TNIL) {
try {
platinum = luabind::object_cast<uint32>(cur);
} catch (luabind::cast_failed) {
} catch (luabind::cast_failed &) {
}
}
@ -1429,7 +1429,7 @@ void Lua_Client::QuestReward(Lua_Mob target, luabind::adl::object reward) {
if (luabind::type(cur) != LUA_TNIL) {
try {
itemid = luabind::object_cast<uint32>(cur);
} catch (luabind::cast_failed) {
} catch (luabind::cast_failed &) {
}
}
@ -1437,7 +1437,7 @@ void Lua_Client::QuestReward(Lua_Mob target, luabind::adl::object reward) {
if (luabind::type(cur) != LUA_TNIL) {
try {
exp = luabind::object_cast<uint32>(cur);
} catch (luabind::cast_failed) {
} catch (luabind::cast_failed &) {
}
}
@ -1445,7 +1445,7 @@ void Lua_Client::QuestReward(Lua_Mob target, luabind::adl::object reward) {
if (luabind::type(cur) != LUA_TNIL) {
try {
faction = luabind::object_cast<bool>(cur);
} catch (luabind::cast_failed) {
} catch (luabind::cast_failed &) {
}
}

View File

@ -571,7 +571,7 @@ void lua_task_selector(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
cur_value = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
} else {
count = i - 1;
@ -601,7 +601,7 @@ void lua_enable_task(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
cur_value = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
} else {
count = i - 1;
@ -628,7 +628,7 @@ void lua_disable_task(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
cur_value = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
} else {
count = i - 1;
@ -1156,7 +1156,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
spawn2_id = luabind::object_cast<uint32>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
return;
}
} else {
@ -1167,7 +1167,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
spawngroup_id = luabind::object_cast<uint32>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
return;
}
} else {
@ -1178,7 +1178,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
x = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
return;
}
} else {
@ -1189,7 +1189,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
y = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
return;
}
} else {
@ -1200,7 +1200,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
z = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
return;
}
} else {
@ -1211,7 +1211,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
heading = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
return;
}
} else {
@ -1222,7 +1222,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
respawn = luabind::object_cast<uint32>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
return;
}
} else {
@ -1233,7 +1233,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
variance = luabind::object_cast<uint32>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
return;
}
} else {
@ -1244,7 +1244,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
timeleft = luabind::object_cast<uint32>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1252,7 +1252,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
grid = luabind::object_cast<uint32>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1260,7 +1260,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
condition_id = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1268,7 +1268,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
condition_min_value = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1276,7 +1276,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
enabled = luabind::object_cast<bool>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1284,7 +1284,7 @@ void lua_add_spawn_point(luabind::adl::object table) {
if(luabind::type(cur) != LUA_TNIL) {
try {
animation = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1399,7 +1399,7 @@ void lua_update_zone_header(std::string type, std::string value) {
try { \
npc_type->name = luabind::object_cast<c_type>(cur); \
} \
catch(luabind::cast_failed) { \
catch(luabind::cast_failed &) { \
npc_type->size = default_value; \
} \
} \
@ -1415,7 +1415,7 @@ void lua_update_zone_header(std::string type, std::string value) {
std::string tmp = luabind::object_cast<std::string>(cur); \
strncpy(npc_type->name, tmp.c_str(), str_length); \
} \
catch(luabind::cast_failed) { \
catch(luabind::cast_failed &) { \
strncpy(npc_type->name, default_value, str_length); \
} \
} \

View File

@ -113,7 +113,7 @@ bool Lua_Mob::Attack(Lua_Mob other, int hand, bool from_riposte, bool is_striket
if(luabind::type(cur) != LUA_TNIL) {
try {
options.armor_pen_flat = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -121,7 +121,7 @@ bool Lua_Mob::Attack(Lua_Mob other, int hand, bool from_riposte, bool is_striket
if(luabind::type(cur) != LUA_TNIL) {
try {
options.crit_flat = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -129,7 +129,7 @@ bool Lua_Mob::Attack(Lua_Mob other, int hand, bool from_riposte, bool is_striket
if(luabind::type(cur) != LUA_TNIL) {
try {
options.damage_flat = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -137,7 +137,7 @@ bool Lua_Mob::Attack(Lua_Mob other, int hand, bool from_riposte, bool is_striket
if(luabind::type(cur) != LUA_TNIL) {
try {
options.hate_flat = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -145,7 +145,7 @@ bool Lua_Mob::Attack(Lua_Mob other, int hand, bool from_riposte, bool is_striket
if(luabind::type(cur) != LUA_TNIL) {
try {
options.armor_pen_percent = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -153,7 +153,7 @@ bool Lua_Mob::Attack(Lua_Mob other, int hand, bool from_riposte, bool is_striket
if(luabind::type(cur) != LUA_TNIL) {
try {
options.crit_percent = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -161,7 +161,7 @@ bool Lua_Mob::Attack(Lua_Mob other, int hand, bool from_riposte, bool is_striket
if(luabind::type(cur) != LUA_TNIL) {
try {
options.damage_percent = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -169,7 +169,7 @@ bool Lua_Mob::Attack(Lua_Mob other, int hand, bool from_riposte, bool is_striket
if(luabind::type(cur) != LUA_TNIL) {
try {
options.hate_percent = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
}
@ -785,7 +785,7 @@ void Lua_Mob::QuestSay(Lua_Client client, const char *message, luabind::adl::obj
if (luabind::type(cur) != LUA_TNIL) {
try {
journal_opts.speak_mode = static_cast<Journal::SpeakMode>(luabind::object_cast<int>(cur));
} catch (luabind::cast_failed) {
} catch (luabind::cast_failed &) {
}
}
@ -793,7 +793,7 @@ void Lua_Mob::QuestSay(Lua_Client client, const char *message, luabind::adl::obj
if (luabind::type(cur) != LUA_TNIL) {
try {
journal_opts.journal_mode = static_cast<Journal::Mode>(luabind::object_cast<int>(cur));
} catch (luabind::cast_failed) {
} catch (luabind::cast_failed &) {
}
}
@ -801,7 +801,7 @@ void Lua_Mob::QuestSay(Lua_Client client, const char *message, luabind::adl::obj
if (luabind::type(cur) != LUA_TNIL) {
try {
journal_opts.language = luabind::object_cast<int>(cur);
} catch (luabind::cast_failed) {
} catch (luabind::cast_failed &) {
}
}
@ -809,7 +809,7 @@ void Lua_Mob::QuestSay(Lua_Client client, const char *message, luabind::adl::obj
if (luabind::type(cur) != LUA_TNIL) {
try {
journal_opts.message_type = luabind::object_cast<int>(cur);
} catch (luabind::cast_failed) {
} catch (luabind::cast_failed &) {
}
}
}
@ -1568,7 +1568,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
race = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1576,7 +1576,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
gender = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1584,7 +1584,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
texture = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1592,7 +1592,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
helmtexture = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1600,7 +1600,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
haircolor = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1608,7 +1608,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
beardcolor = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1616,7 +1616,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
eyecolor1 = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1624,7 +1624,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
eyecolor2 = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1632,7 +1632,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
hairstyle = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1640,7 +1640,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
luclinface = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1648,7 +1648,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
beard = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1656,7 +1656,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
aa_title = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1664,7 +1664,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
drakkin_heritage = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1672,7 +1672,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
drakkin_tattoo = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1680,7 +1680,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
drakkin_details = luabind::object_cast<int>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}
@ -1688,7 +1688,7 @@ void Lua_Mob::SendIllusionPacket(luabind::adl::object illusion) {
if(luabind::type(cur) != LUA_TNIL) {
try {
size = luabind::object_cast<float>(cur);
} catch(luabind::cast_failed) {
} catch(luabind::cast_failed &) {
}
}