From 54a215d1ba2cb7b6d6eb4bcb4920c3c8da01e225 Mon Sep 17 00:00:00 2001 From: Emagi Date: Wed, 5 Mar 2025 08:37:52 -0500 Subject: [PATCH] code warning fixes --- source/WorldServer/Bots/BotCommands.cpp | 4 ++-- source/WorldServer/Commands/Commands.cpp | 2 +- source/WorldServer/LuaFunctions.cpp | 2 +- source/WorldServer/Web/HTTPSClientPool.cpp | 4 ++-- source/WorldServer/Web/HTTPSClientPool.h | 2 +- source/WorldServer/World.cpp | 6 +++--- source/WorldServer/Zone/region_map.cpp | 2 +- source/WorldServer/client.cpp | 5 +++-- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/source/WorldServer/Bots/BotCommands.cpp b/source/WorldServer/Bots/BotCommands.cpp index 10934bb..2fa9281 100644 --- a/source/WorldServer/Bots/BotCommands.cpp +++ b/source/WorldServer/Bots/BotCommands.cpp @@ -767,7 +767,7 @@ void Commands::Command_Bot_Help(Client* client, Seperator* sep) { details += "18\tSarnak\n"; details += "19\tVampire\n"; details += "20\tAerakyn\n"; - client->SendShowBook(client->GetPlayer(), title, 0, 1, details); + client->SendShowBook(client->GetPlayer(), title, 0, 1, details.c_str()); return; } else if (strncasecmp("class", sep->arg[0], 5) == 0) { @@ -822,7 +822,7 @@ void Commands::Command_Bot_Help(Client* client, Seperator* sep) { details3 += "43\tSHAPER\n"; details3 += "44\tCHANNELER\n"; - client->SendShowBook(client->GetPlayer(), title, 0, 3, details, details2, details3); + client->SendShowBook(client->GetPlayer(), title, 0, 3, details.c_str(), details2.c_str(), details3.c_str()); return; } } diff --git a/source/WorldServer/Commands/Commands.cpp b/source/WorldServer/Commands/Commands.cpp index f50d124..3efb5a8 100644 --- a/source/WorldServer/Commands/Commands.cpp +++ b/source/WorldServer/Commands/Commands.cpp @@ -4974,7 +4974,7 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie details4 += "\nSpawnScript: " + std::string(spawnScriptMsg) + "\n"; string title = string(spawn->GetName()) + "(" + to_string(spawn->GetDatabaseID()) + ")"; - client->SendShowBook(client->GetPlayer(), title, 0, 4, details, details2, details3, details4); + client->SendShowBook(client->GetPlayer(), title, 0, 4, details.c_str(), details2.c_str(), details3.c_str(), details4.c_str()); } else { client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Syntax: /spawn details (radius)"); diff --git a/source/WorldServer/LuaFunctions.cpp b/source/WorldServer/LuaFunctions.cpp index 5ccfe6c..e2a76a7 100644 --- a/source/WorldServer/LuaFunctions.cpp +++ b/source/WorldServer/LuaFunctions.cpp @@ -6673,7 +6673,7 @@ int EQ2Emu_lua_GetWardValue(lua_State* state) { else if (boost::iequals(type, "maxhitcount")) lua_interface->SetInt32Value(state, ward->MaxHitCount); else - lua_interface->LogError("%s: LUA GetWardValue command argument type '%s' did not match any options", lua_interface->GetScriptName(state), type); + lua_interface->LogError("%s: LUA GetWardValue command argument type '%s' did not match any options", lua_interface->GetScriptName(state), type.c_str()); spell->MSpellTargets.releasereadlock(__FUNCTION__, __LINE__); return 1; diff --git a/source/WorldServer/Web/HTTPSClientPool.cpp b/source/WorldServer/Web/HTTPSClientPool.cpp index 036c8b3..ae9aee2 100644 --- a/source/WorldServer/Web/HTTPSClientPool.cpp +++ b/source/WorldServer/Web/HTTPSClientPool.cpp @@ -689,7 +689,7 @@ void HTTPSClientPool::pollPeerHealth(const std::string& server, const std::strin else if (!peer_manager.hasPrimary()) { std::string newPrimary = peer_manager.getPriorityPeer(); if (newPrimary.size() > 0) { - LogWrite(PEERING__INFO, 0, "Peering", "%s: NEW PRIMARY %s", __FUNCTION__, newPrimary); + LogWrite(PEERING__INFO, 0, "Peering", "%s: NEW PRIMARY %s", __FUNCTION__, newPrimary.c_str()); peer_manager.setPrimary(newPrimary); net.SetPrimary(false); } @@ -710,7 +710,7 @@ void HTTPSClientPool::pollPeerHealth(const std::string& server, const std::strin } } -void HTTPSClientPool::pollPeerHealthData(auto client, const std::string& id, const std::string& server, const std::string& port) { +void HTTPSClientPool::pollPeerHealthData(std::shared_ptr client, const std::string& id, const std::string& server, const std::string& port) { if (client == nullptr) { } diff --git a/source/WorldServer/Web/HTTPSClientPool.h b/source/WorldServer/Web/HTTPSClientPool.h index d980cfd..7a4817a 100644 --- a/source/WorldServer/Web/HTTPSClientPool.h +++ b/source/WorldServer/Web/HTTPSClientPool.h @@ -58,7 +58,7 @@ public: // Send a request to a peer by ID and parse response as a ptree boost::property_tree::ptree sendRequestToPeer(const std::string& peerId, const std::string& target); boost::property_tree::ptree sendPostRequestToPeer(const std::string& peerId, const std::string& target, const std::string& jsonPayload); - void pollPeerHealthData(auto client, const std::string& id, const std::string& server, const std::string& port); + void pollPeerHealthData(std::shared_ptr client, const std::string& id, const std::string& server, const std::string& port); void startPolling(); // Starts asynchronous polling of peers void stopPolling(); // Stops the polling process diff --git a/source/WorldServer/World.cpp b/source/WorldServer/World.cpp index fc962d2..0df0c2c 100644 --- a/source/WorldServer/World.cpp +++ b/source/WorldServer/World.cpp @@ -829,7 +829,7 @@ bool ZoneList::GetZoneByInstance(ZoneChangeDetails* zone_details, int32 instance if(!ret && check_peers) { std::string peerId = peer_manager.getZonePeerId("", 0, instance_id, zone_details); if(peerId.size() > 0) { - LogWrite(WORLD__ERROR, 0, "World", "Peer %s is providing instanced zone %s for zone id %u instance id %u", peerId.c_str(), zone_details->zoneName, zone_id, instance_id); + LogWrite(WORLD__ERROR, 0, "World", "Peer %s is providing instanced zone %s for zone id %u instance id %u", peerId.c_str(), zone_details->zoneName.c_str(), zone_id, instance_id); return true; } } @@ -3261,7 +3261,7 @@ void ZoneList::WatchdogHeartbeat() if (oldest_process.size() > 0) { map::iterator itr = oldest_process.begin(); if(itr != oldest_process.end()) - LogWrite(WORLD__ERROR, 1, "World", "Zone %s is hung for %i milliseconds.. while waiting for %s to reload...attempting shutdown", tmp->GetZoneName(), diff, itr->first); + LogWrite(WORLD__ERROR, 1, "World", "Zone %s is hung for %i milliseconds.. while waiting for %s to reload...attempting shutdown", tmp->GetZoneName(), diff, itr->first.c_str()); else LogWrite(WORLD__ERROR, 1, "World", "Zone %s is hung for %i milliseconds... attempting shutdown", tmp->GetZoneName(), diff); @@ -3279,7 +3279,7 @@ void ZoneList::WatchdogHeartbeat() if (oldest_process.size() > 0) { map::iterator itr = oldest_process.begin(); if(itr != oldest_process.end()) - LogWrite(WORLD__ERROR, 1, "World", "Zone %s is hung for %i milliseconds.. while waiting for %s to reload...", tmp->GetZoneName(), diff, itr->first); + LogWrite(WORLD__ERROR, 1, "World", "Zone %s is hung for %i milliseconds.. while waiting for %s to reload...", tmp->GetZoneName(), diff, itr->first.c_str()); else LogWrite(WORLD__ERROR, 1, "World", "Zone %s is hung for %i milliseconds...", tmp->GetZoneName(), diff); } diff --git a/source/WorldServer/Zone/region_map.cpp b/source/WorldServer/Zone/region_map.cpp index 981f050..a908edd 100644 --- a/source/WorldServer/Zone/region_map.cpp +++ b/source/WorldServer/Zone/region_map.cpp @@ -67,7 +67,7 @@ RegionMap* RegionMap::LoadRegionMapfile(std::string filename, std::string zone_n // Make sure file contents are for the correct zone if (found == std::string::npos) { fclose(f); - LogWrite(REGION__ERROR, 0, "Region", "RegionMap::LoadRegionMapfile() map contents (%s) do not match its name (%s).", inFileName, zoneNameLwr.c_str()); + LogWrite(REGION__ERROR, 0, "Region", "RegionMap::LoadRegionMapfile() map contents (%s) do not match its name (%s).", inFileName.c_str(), zoneNameLwr.c_str()); return nullptr; } diff --git a/source/WorldServer/client.cpp b/source/WorldServer/client.cpp index cb36df5..cc405cb 100644 --- a/source/WorldServer/client.cpp +++ b/source/WorldServer/client.cpp @@ -12310,7 +12310,7 @@ void Client::SendShowBook(Spawn* sender, string title, int8 language, int8 num_p { if (!sender) { - LogWrite(CCLIENT__ERROR, 0, "Client", "SendShowBook missing sender for Player %s, book title %s", GetPlayer()->GetName(), title); + LogWrite(CCLIENT__ERROR, 0, "Client", "SendShowBook missing sender for Player %s, book title %s", GetPlayer()->GetName(), title.c_str()); return; } @@ -12336,7 +12336,8 @@ void Client::SendShowBook(Spawn* sender, string title, int8 language, int8 num_p std::string endString(""); for (int8 p = 0; p < num_pages; p++) { - std::string page = va_arg(args, string); + const char* pageChars = va_arg(args, const char*); + std::string page(pageChars); switch (GetVersion()) { // release client