diff --git a/module/Core.cpp b/module/Core.cpp index 3bbc811f..f8c9a9e2 100644 --- a/module/Core.cpp +++ b/module/Core.cpp @@ -769,7 +769,7 @@ void Core::SetIncomingName(const SQChar * name) // Does the name satisfy the minimum length required? else if (len < 2) { - STHROWF("The specified name needs to be at least 2 characters: %zu", len); + STHROWF("The specified name needs to be at least 2 characters: {}", len); } // Copy the specified name to the assigned buffer std::strncpy(m_IncomingNameBuffer, name, m_IncomingNameCapacity); @@ -1085,7 +1085,7 @@ BlipInst & Core::AllocBlip(int32_t id, bool owned, int32_t header, LightObj & pa // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_BLIP_POOL)) { - STHROWF("Cannot allocate blip with invalid identifier: %d", id); + STHROWF("Cannot allocate blip with invalid identifier: {}", id); } // Retrieve the specified entity instance BlipInst & inst = m_Blips[id]; @@ -1107,7 +1107,7 @@ BlipInst & Core::AllocBlip(int32_t id, bool owned, int32_t header, LightObj & pa { inst.ResetInstance(); // Now we can throw the error - STHROWF("Unable to create a blip instance for: %d", id); + STHROWF("Unable to create a blip instance for: {}", id); } // Assign the specified entity identifier inst.mID = id; @@ -1134,7 +1134,7 @@ CheckpointInst & Core::AllocCheckpoint(int32_t id, bool owned, int32_t header, L // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_CHECKPOINT_POOL)) { - STHROWF("Cannot allocate checkpoint with invalid identifier: %d", id); + STHROWF("Cannot allocate checkpoint with invalid identifier: {}", id); } // Retrieve the specified entity instance CheckpointInst & inst = m_Checkpoints[id]; @@ -1156,7 +1156,7 @@ CheckpointInst & Core::AllocCheckpoint(int32_t id, bool owned, int32_t header, L { inst.ResetInstance(); // Now we can throw the error - STHROWF("Unable to create a checkpoint instance for: %d", id); + STHROWF("Unable to create a checkpoint instance for: {}", id); } // Assign the specified entity identifier inst.mID = id; @@ -1183,7 +1183,7 @@ KeyBindInst & Core::AllocKeyBind(int32_t id, bool owned, int32_t header, LightOb // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_KEYBIND_POOL)) { - STHROWF("Cannot allocate keybind with invalid identifier: %d", id); + STHROWF("Cannot allocate keybind with invalid identifier: {}", id); } // Retrieve the specified entity instance KeyBindInst & inst = m_KeyBinds[id]; @@ -1205,7 +1205,7 @@ KeyBindInst & Core::AllocKeyBind(int32_t id, bool owned, int32_t header, LightOb { inst.ResetInstance(); // Now we can throw the error - STHROWF("Unable to create a keybind instance for: %d", id); + STHROWF("Unable to create a keybind instance for: {}", id); } // Assign the specified entity identifier inst.mID = id; @@ -1232,7 +1232,7 @@ ObjectInst & Core::AllocObject(int32_t id, bool owned, int32_t header, LightObj // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_OBJECT_POOL)) { - STHROWF("Cannot allocate object with invalid identifier: %d", id); + STHROWF("Cannot allocate object with invalid identifier: {}", id); } // Retrieve the specified entity instance ObjectInst & inst = m_Objects[id]; @@ -1254,7 +1254,7 @@ ObjectInst & Core::AllocObject(int32_t id, bool owned, int32_t header, LightObj { inst.ResetInstance(); // Now we can throw the error - STHROWF("Unable to create a object instance for: %d", id); + STHROWF("Unable to create a object instance for: {}", id); } // Assign the specified entity identifier inst.mID = id; @@ -1281,7 +1281,7 @@ PickupInst & Core::AllocPickup(int32_t id, bool owned, int32_t header, LightObj // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_PICKUP_POOL)) { - STHROWF("Cannot allocate pickup with invalid identifier: %d", id); + STHROWF("Cannot allocate pickup with invalid identifier: {}", id); } // Retrieve the specified entity instance PickupInst & inst = m_Pickups[id]; @@ -1303,7 +1303,7 @@ PickupInst & Core::AllocPickup(int32_t id, bool owned, int32_t header, LightObj { inst.ResetInstance(); // Now we can throw the error - STHROWF("Unable to create a pickup instance for: %d", id); + STHROWF("Unable to create a pickup instance for: {}", id); } // Assign the specified entity identifier inst.mID = id; @@ -1330,7 +1330,7 @@ VehicleInst & Core::AllocVehicle(int32_t id, bool owned, int32_t header, LightOb // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_VEHICLE_POOL)) { - STHROWF("Cannot allocate vehicle with invalid identifier: %d", id); + STHROWF("Cannot allocate vehicle with invalid identifier: {}", id); } // Retrieve the specified entity instance VehicleInst & inst = m_Vehicles[id]; @@ -1352,7 +1352,7 @@ VehicleInst & Core::AllocVehicle(int32_t id, bool owned, int32_t header, LightOb { inst.ResetInstance(); // Now we can throw the error - STHROWF("Unable to create a vehicle instance for: %d", id); + STHROWF("Unable to create a vehicle instance for: {}", id); } // Assign the specified entity identifier inst.mID = id; @@ -1384,7 +1384,7 @@ void Core::DeallocBlip(int32_t id, bool destroy, int32_t header, LightObj & payl // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_BLIP_POOL)) { - STHROWF("Cannot deallocate blip with invalid identifier: %d", id); + STHROWF("Cannot deallocate blip with invalid identifier: {}", id); } // Retrieve the specified entity instance BlipInst & inst = m_Blips[id]; @@ -1401,7 +1401,7 @@ void Core::DeallocCheckpoint(int32_t id, bool destroy, int32_t header, LightObj // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_CHECKPOINT_POOL)) { - STHROWF("Cannot deallocate checkpoint with invalid identifier: %d", id); + STHROWF("Cannot deallocate checkpoint with invalid identifier: {}", id); } // Retrieve the specified entity instance CheckpointInst & inst = m_Checkpoints[id]; @@ -1418,7 +1418,7 @@ void Core::DeallocKeyBind(int32_t id, bool destroy, int32_t header, LightObj & p // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_KEYBIND_POOL)) { - STHROWF("Cannot deallocate keybind with invalid identifier: %d", id); + STHROWF("Cannot deallocate keybind with invalid identifier: {}", id); } // Retrieve the specified entity instance KeyBindInst & inst = m_KeyBinds[id]; @@ -1435,7 +1435,7 @@ void Core::DeallocObject(int32_t id, bool destroy, int32_t header, LightObj & pa // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_OBJECT_POOL)) { - STHROWF("Cannot deallocate object with invalid identifier: %d", id); + STHROWF("Cannot deallocate object with invalid identifier: {}", id); } // Retrieve the specified entity instance ObjectInst & inst = m_Objects[id]; @@ -1452,7 +1452,7 @@ void Core::DeallocPickup(int32_t id, bool destroy, int32_t header, LightObj & pa // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_PICKUP_POOL)) { - STHROWF("Cannot deallocate pickup with invalid identifier: %d", id); + STHROWF("Cannot deallocate pickup with invalid identifier: {}", id); } // Retrieve the specified entity instance PickupInst & inst = m_Pickups[id]; @@ -1469,7 +1469,7 @@ void Core::DeallocVehicle(int32_t id, bool destroy, int32_t header, LightObj & p // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_VEHICLE_POOL)) { - STHROWF("Cannot deallocate vehicle with invalid identifier: %d", id); + STHROWF("Cannot deallocate vehicle with invalid identifier: {}", id); } // Retrieve the specified entity instance VehicleInst & inst = m_Vehicles[id]; @@ -1490,12 +1490,12 @@ LightObj & Core::NewBlip(int32_t index, int32_t world, float x, float y, float z // See if the entity creation failed on the server if (_Func->GetLastError() == vcmpErrorPoolExhausted) { - STHROWF("Blip pool was exhausted: %d", id); + STHROWF("Blip pool was exhausted: {}", id); } // Validate the identifier returned by the server else if (INVALID_ENTITYEX(id, SQMOD_BLIP_POOL)) { - STHROWF("Server returned invalid blip: %d", id); + STHROWF("Server returned invalid blip: {}", id); } // Attempt to allocate this entity and grab the reference to the instance BlipInst & inst = AllocBlip(id, true, header, payload); @@ -1518,16 +1518,16 @@ LightObj & Core::NewCheckpoint(int32_t player, int32_t world, bool sphere, float // See if the entity creation failed on the server if (_Func->GetLastError() == vcmpErrorNoSuchEntity) { - STHROWF("Invalid player reference: %d", player); + STHROWF("Invalid player reference: {}", player); } else if (_Func->GetLastError() == vcmpErrorPoolExhausted) { - STHROWF("Checkpoint pool was exhausted: %d", id); + STHROWF("Checkpoint pool was exhausted: {}", id); } // Validate the identifier returned by the server else if (INVALID_ENTITYEX(id, SQMOD_CHECKPOINT_POOL)) { - STHROWF("Server returned invalid checkpoint: %d", id); + STHROWF("Server returned invalid checkpoint: {}", id); } // Attempt to allocate this entity and grab the reference to the instance CheckpointInst & inst = AllocCheckpoint(id, true, header, payload); @@ -1552,14 +1552,14 @@ LightObj & Core::NewKeyBind(int32_t slot, bool release, int32_t primary, int32_t // Validate the keybind slot returned by the server if (INVALID_ENTITYEX(slot, SQMOD_KEYBIND_POOL)) { - STHROWF("Server returned invalid keybind slot: %d", slot); + STHROWF("Server returned invalid keybind slot: {}", slot); } // Request the server to create this entity const vcmpError result = _Func->RegisterKeyBind(slot, release, primary, secondary, alternative); // See if the entity creation failed on the server if (result == vcmpErrorArgumentOutOfBounds) { - STHROWF("Out of bounds keybind argument: %d", slot); + STHROWF("Out of bounds keybind argument: {}", slot); } // Attempt to allocate this entity and grab the reference to the instance KeyBindInst & inst = AllocKeyBind(slot, true, header, payload); @@ -1581,12 +1581,12 @@ LightObj & Core::NewObject(int32_t model, int32_t world, float x, float y, float // See if the entity creation failed on the server if (_Func->GetLastError() == vcmpErrorPoolExhausted) { - STHROWF("Object pool was exhausted: %d", id); + STHROWF("Object pool was exhausted: {}", id); } // Validate the identifier returned by the server else if (INVALID_ENTITYEX(id, SQMOD_OBJECT_POOL)) { - STHROWF("Server returned invalid object: %d", id); + STHROWF("Server returned invalid object: {}", id); } // Attempt to allocate this entity and grab the reference to the instance ObjectInst & inst = AllocObject(id, true, header, payload); @@ -1609,12 +1609,12 @@ LightObj & Core::NewPickup(int32_t model, int32_t world, int32_t quantity, // See if the entity creation failed on the server if (_Func->GetLastError() == vcmpErrorPoolExhausted) { - STHROWF("Pickup pool was exhausted: %d", id); + STHROWF("Pickup pool was exhausted: {}", id); } // Validate the identifier returned by the server else if (INVALID_ENTITYEX(id, SQMOD_PICKUP_POOL)) { - STHROWF("Server returned invalid pickup: %d", id); + STHROWF("Server returned invalid pickup: {}", id); } // Attempt to allocate this entity and grab the reference to the instance PickupInst & inst = AllocPickup(id, true, header, payload); @@ -1638,16 +1638,16 @@ LightObj & Core::NewVehicle(int32_t model, int32_t world, float x, float y, floa // See if the entity creation failed on the server if (_Func->GetLastError() == vcmpErrorArgumentOutOfBounds) { - STHROWF("Out of bounds vehicle argument: %d", id); + STHROWF("Out of bounds vehicle argument: {}", id); } else if (_Func->GetLastError() == vcmpErrorPoolExhausted) { - STHROWF("Vehicle pool was exhausted: %d", id); + STHROWF("Vehicle pool was exhausted: {}", id); } // Validate the identifier returned by the server else if (INVALID_ENTITYEX(id, SQMOD_VEHICLE_POOL)) { - STHROWF("Server returned invalid vehicle: %d", id); + STHROWF("Server returned invalid vehicle: {}", id); } // Attempt to allocate this entity and grab the reference to the instance VehicleInst & inst = AllocVehicle(id, true, header, payload); @@ -1720,7 +1720,7 @@ void Core::ConnectPlayer(int32_t id, int32_t header, LightObj & payload) // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_PLAYER_POOL)) { - STHROWF("Cannot allocate player with invalid identifier: %d", id); + STHROWF("Cannot allocate player with invalid identifier: {}", id); } // Retrieve the specified entity instance PlayerInst & inst = m_Players[id]; @@ -1741,7 +1741,7 @@ void Core::ConnectPlayer(int32_t id, int32_t header, LightObj & payload) if (!inst.mInst || inst.mObj.IsNull()) { inst.ResetInstance(); - STHROWF("Unable to create a player instance for: %d", id); + STHROWF("Unable to create a player instance for: {}", id); } // Assign the specified entity identifier inst.mID = id; @@ -1769,7 +1769,7 @@ void Core::DisconnectPlayer(int32_t id, int32_t header, LightObj & payload) // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(id, SQMOD_PLAYER_POOL)) { - STHROWF("Cannot deallocate player with invalid identifier: %d", id); + STHROWF("Cannot deallocate player with invalid identifier: {}", id); } // Retrieve the specified entity instance PlayerInst & inst = m_Players[id]; @@ -2290,7 +2290,7 @@ static LightObj & SqGetBlip(int32_t id) // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_BLIP_POOL)) { - STHROWF("Out of range blip identifier: %d", id); + STHROWF("Out of range blip identifier: {}", id); } // Return the requested information return Core::Get().GetBlip(id).mObj; @@ -2302,7 +2302,7 @@ static LightObj & SqGetCheckpoint(int32_t id) // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_CHECKPOINT_POOL)) { - STHROWF("Out of range checkpoint identifier: %d", id); + STHROWF("Out of range checkpoint identifier: {}", id); } // Return the requested information return Core::Get().GetCheckpoint(id).mObj; @@ -2314,7 +2314,7 @@ static LightObj & SqGetKeyBind(int32_t id) // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_KEYBIND_POOL)) { - STHROWF("Out of range keybind identifier: %d", id); + STHROWF("Out of range keybind identifier: {}", id); } // Return the requested information return Core::Get().GetKeyBind(id).mObj; @@ -2326,7 +2326,7 @@ static LightObj & SqGetObj(int32_t id) // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_OBJECT_POOL)) { - STHROWF("Out of range object identifier: %d", id); + STHROWF("Out of range object identifier: {}", id); } // Return the requested information return Core::Get().GetObj(id).mObj; @@ -2338,7 +2338,7 @@ static LightObj & SqGetPickup(int32_t id) // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_PICKUP_POOL)) { - STHROWF("Out of range blip identifier: %d", id); + STHROWF("Out of range blip identifier: {}", id); } // Return the requested information return Core::Get().GetPickup(id).mObj; @@ -2350,7 +2350,7 @@ static LightObj & SqGetPlayer(int32_t id) // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_PLAYER_POOL)) { - STHROWF("Out of range player identifier: %d", id); + STHROWF("Out of range player identifier: {}", id); } // Return the requested information return Core::Get().GetPlayer(id).mObj; @@ -2362,7 +2362,7 @@ static LightObj & SqGetVehicle(int32_t id) // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_VEHICLE_POOL)) { - STHROWF("Out of range vehicle identifier: %d", id); + STHROWF("Out of range vehicle identifier: {}", id); } // Return the requested information return Core::Get().GetVehicle(id).mObj; @@ -2374,7 +2374,7 @@ static bool SqDelBlip(int32_t id, int32_t header, LightObj & payload) // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_BLIP_POOL)) { - STHROWF("Out of range blip identifier: %d", id); + STHROWF("Out of range blip identifier: {}", id); } // Perform the requested operation return Core::Get().DelBlip(id, header, payload); @@ -2386,7 +2386,7 @@ static bool SqDelCheckpoint(int32_t id, int32_t header, LightObj & payload) // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_CHECKPOINT_POOL)) { - STHROWF("Out of range checkpoint identifier: %d", id); + STHROWF("Out of range checkpoint identifier: {}", id); } // Perform the requested operation return Core::Get().DelCheckpoint(id, header, payload); @@ -2398,7 +2398,7 @@ static bool SqDelKeyBind(int32_t id, int32_t header, LightObj & payload) // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_KEYBIND_POOL)) { - STHROWF("Out of range keybind identifier: %d", id); + STHROWF("Out of range keybind identifier: {}", id); } // Perform the requested operation return Core::Get().DelKeyBind(id, header, payload); @@ -2410,7 +2410,7 @@ static bool SqDelObject(int32_t id, int32_t header, LightObj & payload) // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_OBJECT_POOL)) { - STHROWF("Out of range object identifier: %d", id); + STHROWF("Out of range object identifier: {}", id); } // Perform the requested operation return Core::Get().DelObject(id, header, payload); @@ -2422,7 +2422,7 @@ static bool SqDelPickup(int32_t id, int32_t header, LightObj & payload) // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_PICKUP_POOL)) { - STHROWF("Out of range blip identifier: %d", id); + STHROWF("Out of range blip identifier: {}", id); } // Perform the requested operation return Core::Get().DelPickup(id, header, payload); @@ -2434,7 +2434,7 @@ static bool SqDelVehicle(int32_t id, int32_t header, LightObj & payload) // Validate the identifier first if (INVALID_ENTITYEX(id, SQMOD_VEHICLE_POOL)) { - STHROWF("Out of range vehicle identifier: %d", id); + STHROWF("Out of range vehicle identifier: {}", id); } // Perform the requested operation return Core::Get().DelVehicle(id, header, payload); diff --git a/module/Core/Command.cpp b/module/Core/Command.cpp index a7229aa2..e65222a5 100644 --- a/module/Core/Command.cpp +++ b/module/Core/Command.cpp @@ -140,7 +140,7 @@ Object & Controller::Attach(Object && obj, Listener * ptr) if (cmd.mHash == hash) { // Include information necessary to help identify hash collisions! - STHROWF("Command '%s' already exists as '%s' for hash (%zu)", + STHROWF("Command '{}' already exists as '{}' for hash ({})", name.c_str(), cmd.mName.c_str(), hash); } } @@ -916,7 +916,7 @@ void Listener::ProcSpec(const SQChar * str) { if (idx >= SQMOD_MAX_CMD_ARGS) { - STHROWF("Extraneous type specifiers: %d >= %d", idx, SQMOD_MAX_CMD_ARGS); + STHROWF("Extraneous type specifiers: {} >= {}", idx, SQMOD_MAX_CMD_ARGS); } // Move to the next character ++str; @@ -1005,7 +1005,7 @@ void Listener::ProcSpec(const SQChar * str) } } break; // Unknown type! - default: STHROWF("Unknown type specifier (%c) at argument: %u", *str, idx); + default: STHROWF("Unknown type specifier ({:c}) at argument: {}", *str, idx); } } } diff --git a/module/Core/Command.hpp b/module/Core/Command.hpp index 578b682c..180c3540 100644 --- a/module/Core/Command.hpp +++ b/module/Core/Command.hpp @@ -1529,7 +1529,7 @@ public: } else { - STHROWF("Argument tag (%u) is out of range (%d)", max, SQMOD_MAX_CMD_ARGS); + STHROWF("Argument tag ({}) is out of range ({})", max, SQMOD_MAX_CMD_ARGS); } } @@ -1669,11 +1669,11 @@ public: // Perform a range check on the specified argument index if (val >= SQMOD_MAX_CMD_ARGS) { - STHROWF("Argument (%d) is out of total range (%d)", val, SQMOD_MAX_CMD_ARGS); + STHROWF("Argument ({}) is out of total range ({})", val, SQMOD_MAX_CMD_ARGS); } else if (static_cast< uint8_t >(val) > m_MaxArgc) { - STHROWF("Minimum argument (%d) exceeds maximum (%u)", val, m_MaxArgc); + STHROWF("Minimum argument ({}) exceeds maximum ({})", val, m_MaxArgc); } // Apply the specified value m_MinArgc = static_cast< uint8_t >(val); @@ -1697,11 +1697,11 @@ public: // Perform a range check on the specified argument index if (val >= SQMOD_MAX_CMD_ARGS) { - STHROWF("Argument (%d) is out of total range (%d)", val, SQMOD_MAX_CMD_ARGS); + STHROWF("Argument ({}) is out of total range ({})", val, SQMOD_MAX_CMD_ARGS); } else if (static_cast< uint8_t >(val) < m_MinArgc) { - STHROWF("Maximum argument (%d) exceeds minimum (%u)", val, m_MinArgc); + STHROWF("Maximum argument ({}) exceeds minimum ({})", val, m_MinArgc); } // Apply the specified value m_MaxArgc = static_cast< uint8_t >(val); @@ -1779,7 +1779,7 @@ public: // Perform a range check on the specified argument index if (arg >= SQMOD_MAX_CMD_ARGS) { - STHROWF("Argument (%u) is out of total range (%u)", arg, SQMOD_MAX_CMD_ARGS); + STHROWF("Argument ({}) is out of total range ({})", arg, SQMOD_MAX_CMD_ARGS); } // Return the requested information return m_ArgTags[arg]; @@ -1793,7 +1793,7 @@ public: // Perform a range check on the specified argument index if (arg >= SQMOD_MAX_CMD_ARGS) { - STHROWF("Argument (%u) is out of total range (%u)", arg, SQMOD_MAX_CMD_ARGS); + STHROWF("Argument ({}) is out of total range ({})", arg, SQMOD_MAX_CMD_ARGS); } else if ((SQ_FAILED(name.Proc()))) { @@ -1819,7 +1819,7 @@ public: // Perform a range check on the specified argument index if (idx >= SQMOD_MAX_CMD_ARGS) { - STHROWF("Argument (%u) is out of total range (%u)", idx, SQMOD_MAX_CMD_ARGS); + STHROWF("Argument ({}) is out of total range ({})", idx, SQMOD_MAX_CMD_ARGS); } // Return the requested information return m_ArgSpec[idx]; @@ -1833,7 +1833,7 @@ public: // Perform a range check on the specified argument index if (arg >= SQMOD_MAX_CMD_ARGS) { - STHROWF("Argument (%u) is out of total range (%u)", arg, SQMOD_MAX_CMD_ARGS); + STHROWF("Argument ({}) is out of total range ({})", arg, SQMOD_MAX_CMD_ARGS); } // Retrieve the argument flags const uint8_t f = m_ArgSpec[arg]; diff --git a/module/Core/Common.cpp b/module/Core/Common.cpp index cb5ab5bf..ed6f1cc6 100644 --- a/module/Core/Common.cpp +++ b/module/Core/Common.cpp @@ -133,7 +133,7 @@ void SqThrowLastF(const SQChar * msg, ...) if(error_num == 0) { // Invoker is responsible for making sure this doesn't happen! - SqThrowF("%s [Unknown error]", b.Data()); + SqThrowF("{} [Unknown error]", b.Data()); } // The resulted message buffer LPSTR msg_buff = nullptr; @@ -147,9 +147,9 @@ void SqThrowLastF(const SQChar * msg, ...) //Free the message buffer LocalFree(msg_buff); // Now it's safe to throw the error - SqThrowF("%s [%s]", b.Data(), message.c_str()); + SqThrowF("{} [{}]", b.Data(), message); #else - SqThrowF("%s [%s]", b.Data(), std::strerror(errno)); + SqThrowF("{} [{}]", b.Data(), std::strerror(errno)); #endif // SQMOD_OS_WINDOWS } @@ -266,7 +266,7 @@ LightObj BufferToStrObj(const Buffer & b, uint32_t size) // Perform a range check on the specified buffer if (size > b.Capacity()) { - STHROWF("The specified buffer size is out of range: %u >= %u", size, b.Capacity()); + STHROWF("The specified buffer size is out of range: {} >= {}", size, b.Capacity()); } // Obtain the initial stack size const StackGuard sg(SqVM()); diff --git a/module/Core/Events.inc b/module/Core/Events.inc index 5ba1e848..88587f1e 100644 --- a/module/Core/Events.inc +++ b/module/Core/Events.inc @@ -1384,14 +1384,14 @@ void Core::EmitEntityPool(vcmpEntityPool entity_type, int32_t entity_id, bool is // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(entity_id, SQMOD_BLIP_POOL)) { - STHROWF("Cannot allocate blip with invalid identifier: %d", entity_id); + STHROWF("Cannot allocate blip with invalid identifier: {}", entity_id); } // Retrieve the specified entity instance BlipInst & inst = m_Blips[entity_id]; // Make sure that the instance isn't already allocated if (VALID_ENTITY(inst.mID)) { - STHROWF("Cannot allocate blip that already exists: %d", entity_id); + STHROWF("Cannot allocate blip that already exists: {}", entity_id); } // Information about the blip entity int32_t world, scale, sprid; @@ -1436,7 +1436,7 @@ void Core::EmitPlayerUpdate(int32_t player_id, vcmpPlayerUpdate update_type) // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(player_id, SQMOD_PLAYER_POOL)) { - STHROWF("Cannot update player with invalid identifier: %d", player_id); + STHROWF("Cannot update player with invalid identifier: {}", player_id); } // Retrieve the associated tracking instance PlayerInst & inst = m_Players[player_id]; @@ -1631,7 +1631,7 @@ void Core::EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityP // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(player_id, SQMOD_PLAYER_POOL)) { - STHROWF("Cannot notify player with invalid identifier about streaming: %d", player_id); + STHROWF("Cannot notify player with invalid identifier about streaming: {}", player_id); } // See what type of entity changed switch (entity_type) @@ -1640,7 +1640,7 @@ void Core::EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityP // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(entity_id, SQMOD_VEHICLE_POOL)) { - STHROWF("Cannot stream vehicle with invalid identifier: %d", entity_id); + STHROWF("Cannot stream vehicle with invalid identifier: {}", entity_id); } // Forward the event to the dedicated handler EmitVehicleStream(player_id, entity_id, is_deleted); @@ -1649,7 +1649,7 @@ void Core::EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityP // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(entity_id, SQMOD_OBJECT_POOL)) { - STHROWF("Cannot stream object with invalid identifier: %d", entity_id); + STHROWF("Cannot stream object with invalid identifier: {}", entity_id); } // Forward the event to the dedicated handler EmitObjectStream(player_id, entity_id, is_deleted); @@ -1658,7 +1658,7 @@ void Core::EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityP // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(entity_id, SQMOD_PICKUP_POOL)) { - STHROWF("Cannot stream pickup with invalid identifier: %d", entity_id); + STHROWF("Cannot stream pickup with invalid identifier: {}", entity_id); } // Forward the event to the dedicated handler EmitPickupStream(player_id, entity_id, is_deleted); @@ -1667,7 +1667,7 @@ void Core::EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityP // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(entity_id, SQMOD_PLAYER_POOL)) { - STHROWF("Cannot stream player with invalid identifier: %d", entity_id); + STHROWF("Cannot stream player with invalid identifier: {}", entity_id); } // Forward the event to the dedicated handler EmitPlayerStream(player_id, entity_id, is_deleted); @@ -1676,7 +1676,7 @@ void Core::EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityP // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(entity_id, SQMOD_CHECKPOINT_POOL)) { - STHROWF("Cannot stream checkpoint with invalid identifier: %d", entity_id); + STHROWF("Cannot stream checkpoint with invalid identifier: {}", entity_id); } // Forward the event to the dedicated handler EmitCheckpointStream(player_id, entity_id, is_deleted); @@ -1694,7 +1694,7 @@ void Core::EmitVehicleUpdate(int32_t vehicle_id, vcmpVehicleUpdate update_type) // Make sure that the specified entity identifier is valid if (INVALID_ENTITYEX(vehicle_id, SQMOD_VEHICLE_POOL)) { - STHROWF("Cannot update vehicle with invalid identifier: %d", vehicle_id); + STHROWF("Cannot update vehicle with invalid identifier: {}", vehicle_id); } // Retrieve the associated instance VehicleInst & inst = m_Vehicles[vehicle_id]; @@ -1850,7 +1850,7 @@ void Core::EmitClientScriptData(int32_t player_id, const uint8_t * data, size_t } catch (const std::exception & e) { - STHROWF("%s", e.what()); // Re-package + STHROWF("{}", e.what()); // Re-package } // Make sure the buffer cannot be null at this point if (o.IsNull()) diff --git a/module/Core/Routine.hpp b/module/Core/Routine.hpp index e9e0a8b5..f59d7a43 100644 --- a/module/Core/Routine.hpp +++ b/module/Core/Routine.hpp @@ -328,7 +328,7 @@ public: } } // Unable to find such routine - STHROWF("Unable to find a routine with tag (%s)", tag.mPtr); + STHROWF("Unable to find a routine with tag ({})", tag.mPtr); // Should not reach this point but if it did, we have to return something #ifdef __clang__ #pragma clang diagnostic push @@ -470,7 +470,7 @@ public: // Validate the specified if (!sq_isclosure(func.GetFunc()) && !sq_isnativeclosure(func.GetFunc())) { - STHROWF("Invalid callback type %s", SqTypeName(GetValid().mFunc.GetType())); + STHROWF("Invalid callback type {}", SqTypeName(GetValid().mFunc.GetType())); } // Store the function without the environment GetValid().mFunc = LightObj(func.GetFunc()); @@ -644,7 +644,7 @@ public: // Validate the specified index if (idx >= 14) { - STHROWF("The specified index is out of range: %u >= %u", idx, 14); + STHROWF("The specified index is out of range: {} >= {}", idx, 14); } // Return the requested argument return GetValid().mArgv[idx]; diff --git a/module/Core/Script.cpp b/module/Core/Script.cpp index 160eb59f..e3f8f6d1 100644 --- a/module/Core/Script.cpp +++ b/module/Core/Script.cpp @@ -27,7 +27,7 @@ public: { if (!mFile) { - STHROWF("Unable to open script source (%s)", path); + STHROWF("Unable to open script source ({})", path); } } diff --git a/module/Core/Signal.cpp b/module/Core/Signal.cpp index 882260fa..7723bfa6 100644 --- a/module/Core/Signal.cpp +++ b/module/Core/Signal.cpp @@ -1621,7 +1621,7 @@ const LightObj & Signal::Fetch(StackStrF & name) } } // No such signal exists - STHROWF("Unknown signal named (%s)", sname.c_str()); + STHROWF("Unknown signal named ({})", sname); // SHOULD NOT REACH THIS POINT! static LightObj slo; return slo; diff --git a/module/Core/Tasks.cpp b/module/Core/Tasks.cpp index a7d26a7d..5845abcc 100644 --- a/module/Core/Tasks.cpp +++ b/module/Core/Tasks.cpp @@ -459,7 +459,7 @@ const Tasks::Task & Tasks::FindByTag(int32_t id, int32_t type, StackStrF & tag) } } // Unable to find such task - STHROWF("Unable to find a task with tag (%s)", tag.mPtr); + STHROWF("Unable to find a task with tag ({})", tag.mPtr); // Should not reach this point but if it did, we have to return something SQ_UNREACHABLE } diff --git a/module/Core/Tasks.hpp b/module/Core/Tasks.hpp index af224e0d..3a396d1c 100644 --- a/module/Core/Tasks.hpp +++ b/module/Core/Tasks.hpp @@ -176,7 +176,7 @@ private: // Validate the specified if (!sq_isclosure(func.GetFunc()) && !sq_isnativeclosure(func.GetFunc())) { - STHROWF("Invalid callback type %s", SqTypeName(mFunc.GetType())); + STHROWF("Invalid callback type {}", SqTypeName(mFunc.GetType())); } // Grab the virtual machine once HSQUIRRELVM vm = SqVM(); @@ -257,7 +257,7 @@ private: // Validate the specified index if (idx >= argvn) { - STHROWF("The specified index is out of range: %u >= %u", idx, argvn); + STHROWF("The specified index is out of range: {} >= {}", idx, argvn); } // Return the requested argument return mArgv[idx]; diff --git a/module/Entity/Blip.hpp b/module/Entity/Blip.hpp index f902f019..5917037b 100644 --- a/module/Entity/Blip.hpp +++ b/module/Entity/Blip.hpp @@ -71,7 +71,7 @@ public: { if (INVALID_ENTITY(m_ID)) { - STHROWF("Invalid blip reference [%s]", m_Tag.c_str()); + STHROWF("Invalid blip reference [{}]", m_Tag); } } diff --git a/module/Entity/Checkpoint.hpp b/module/Entity/Checkpoint.hpp index 819ccf18..82eeb0da 100644 --- a/module/Entity/Checkpoint.hpp +++ b/module/Entity/Checkpoint.hpp @@ -85,7 +85,7 @@ public: { if (INVALID_ENTITY(m_ID)) { - STHROWF("Invalid checkpoint reference [%s]", m_Tag.c_str()); + STHROWF("Invalid checkpoint reference [{}]", m_Tag); } } diff --git a/module/Entity/KeyBind.hpp b/module/Entity/KeyBind.hpp index d920b0b0..7e12aa8a 100644 --- a/module/Entity/KeyBind.hpp +++ b/module/Entity/KeyBind.hpp @@ -71,7 +71,7 @@ public: { if (INVALID_ENTITY(m_ID)) { - STHROWF("Invalid keybind reference [%s]", m_Tag.c_str()); + STHROWF("Invalid keybind reference [{}]", m_Tag); } } diff --git a/module/Entity/Object.hpp b/module/Entity/Object.hpp index 119bc50d..1427a432 100644 --- a/module/Entity/Object.hpp +++ b/module/Entity/Object.hpp @@ -104,7 +104,7 @@ public: { if (INVALID_ENTITY(m_ID)) { - STHROWF("Invalid object reference [%s]", m_Tag.c_str()); + STHROWF("Invalid object reference [{}]", m_Tag); } } diff --git a/module/Entity/Pickup.cpp b/module/Entity/Pickup.cpp index ffc8ebea..f34d0dd6 100644 --- a/module/Entity/Pickup.cpp +++ b/module/Entity/Pickup.cpp @@ -134,7 +134,7 @@ bool CPickup::GetOption(int32_t option_id) const // Check for errors if (_Func->GetLastError() == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid option identifier: %d", option_id); + STHROWF("Invalid option identifier: {}", option_id); } // Return the requested value return value; @@ -149,7 +149,7 @@ void CPickup::SetOption(int32_t option_id, bool toggle) if (_Func->SetPickupOption(m_ID, static_cast< vcmpPickupOption >(option_id), static_cast< uint8_t >(toggle)) == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid option identifier: %d", option_id); + STHROWF("Invalid option identifier: {}", option_id); } else if (!(m_CircularLocks & PICKUPCL_EMIT_PICKUP_OPTION)) { @@ -169,7 +169,7 @@ void CPickup::SetOptionEx(int32_t option_id, bool toggle, int32_t header, LightO if (_Func->SetPickupOption(m_ID, static_cast< vcmpPickupOption >(option_id), static_cast< uint8_t >(toggle)) == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid option identifier: %d", option_id); + STHROWF("Invalid option identifier: {}", option_id); } else if (!(m_CircularLocks & PICKUPCL_EMIT_PICKUP_OPTION)) { diff --git a/module/Entity/Pickup.hpp b/module/Entity/Pickup.hpp index d47edfbb..8b384de0 100644 --- a/module/Entity/Pickup.hpp +++ b/module/Entity/Pickup.hpp @@ -88,7 +88,7 @@ public: { if (INVALID_ENTITY(m_ID)) { - STHROWF("Invalid pickup reference [%s]", m_Tag.c_str()); + STHROWF("Invalid pickup reference [{}]", m_Tag); } } diff --git a/module/Entity/Player.cpp b/module/Entity/Player.cpp index 6a564d71..7b43cb4a 100644 --- a/module/Entity/Player.cpp +++ b/module/Entity/Player.cpp @@ -324,11 +324,11 @@ void CPlayer::SetName(StackStrF & name) const } else if (ret == vcmpErrorInvalidName) { - STHROWF("The specified name is invalid: %s", name.mPtr); + STHROWF("The specified name is invalid: {}", name.mPtr); } else if (ret == vcmpErrorTooLargeInput) { - STHROWF("The specified name is too large: %" PRINT_INT_FMT, name.mLen); + STHROWF("The specified name is too large: {}", name.mLen); } } @@ -349,7 +349,7 @@ int32_t CPlayer::GetOption(int32_t option_id) const // Check for errors if (_Func->GetLastError() == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid option identifier: %d", option_id); + STHROWF("Invalid option identifier: {}", option_id); } // Return the requested value return value; @@ -378,7 +378,7 @@ void CPlayer::SetOptionEx(int32_t option_id, bool toggle, int32_t header, LightO static_cast< vcmpPlayerOption >(option_id), static_cast< uint8_t >(toggle)) == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid option identifier: %d", option_id); + STHROWF("Invalid option identifier: {}", option_id); } // Avoid infinite recursive event loops else if (!(m_CircularLocks & PLAYERCL_EMIT_PLAYER_OPTION)) @@ -529,7 +529,7 @@ void CPlayer::SetTeam(int32_t team) // Avoid property unwind from a recursive call else if (_Func->SetPlayerTeam(m_ID, team) == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid team identifier: %d", team); + STHROWF("Invalid team identifier: {}", team); } // Avoid infinite recursive event loops else if (!(m_CircularLocks & PLAYERCL_EMIT_PLAYER_TEAM)) @@ -565,7 +565,7 @@ void CPlayer::SetSkin(int32_t skin) // Avoid property unwind from a recursive call else if (_Func->SetPlayerSkin(m_ID, skin) == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid skin identifier: %d", skin); + STHROWF("Invalid skin identifier: {}", skin); } // Avoid infinite recursive event loops else if (!(m_CircularLocks & PLAYERCL_EMIT_PLAYER_SKIN)) @@ -1143,7 +1143,7 @@ void CPlayer::SetWeapon(int32_t wep) const // Perform the requested operation if (_Func->SetPlayerWeapon(m_ID, wep, mDefaultAmmo) == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid weapon identifier: %d", wep); + STHROWF("Invalid weapon identifier: {}", wep); } } @@ -1155,7 +1155,7 @@ void CPlayer::SetWeaponEx(int32_t wep, int32_t ammo) const // Perform the requested operation if (_Func->SetPlayerWeapon(m_ID, wep, ammo) == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid weapon ammo: %d", ammo); + STHROWF("Invalid weapon ammo: {}", ammo); } } @@ -1167,7 +1167,7 @@ void CPlayer::GiveWeapon(int32_t wep, int32_t ammo) const // Perform the requested operation if (_Func->GivePlayerWeapon(m_ID, wep, ammo) == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid weapon ammo: %d", ammo); + STHROWF("Invalid weapon ammo: {}", ammo); } } @@ -1197,7 +1197,7 @@ void CPlayer::SetWeaponSlot(int32_t slot) const // Perform the requested operation if (_Func->SetPlayerWeaponSlot(m_ID, slot) == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid weapon slot: %d", slot); + STHROWF("Invalid weapon slot: {}", slot); } } @@ -1209,7 +1209,7 @@ int32_t CPlayer::GetWeaponAtSlot(int32_t slot) const // Check for errors if (_Func->GetLastError() == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid weapon slot: %d", slot); + STHROWF("Invalid weapon slot: {}", slot); } // Return the requested information return id; @@ -1223,7 +1223,7 @@ int32_t CPlayer::GetAmmoAtSlot(int32_t slot) const // Check for errors if (_Func->GetLastError() == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid weapon slot: %d", slot); + STHROWF("Invalid weapon slot: {}", slot); } // Return the requested information return ammo; @@ -1460,7 +1460,7 @@ void CPlayer::Redirect(StackStrF & ip, uint32_t port, StackStrF & nick, if (_Func->RedirectPlayerToServer(m_ID, ip.mPtr, port, nick.mPtr, server_pass.mPtr, user_pass.mPtr) == vcmpErrorNullArgument) { - STHROWF("Invalid arguments encountered: `%s:%u` `%s` `%s` %s", + STHROWF("Invalid arguments encountered: `{}:{}` `{}` `{}` {}", ip.mPtr, port, nick.mPtr, server_pass.mPtr, user_pass.mPtr); } } @@ -1666,7 +1666,7 @@ const String & CPlayer::GetMessagePrefix(uint32_t index) const // Perform a range check on the specified prefix index if (index >= SQMOD_PLAYER_MSG_PREFIXES) { - STHROWF("Prefix index is out of range: %u >= %d", index, SQMOD_PLAYER_MSG_PREFIXES); + STHROWF("Prefix index is out of range: {} >= {}", index, SQMOD_PLAYER_MSG_PREFIXES); } // Validate the managed identifier Validate(); @@ -1680,7 +1680,7 @@ void CPlayer::SetMessagePrefix(uint32_t index, StackStrF & prefix) // Perform a range check on the specified prefix index if (index >= SQMOD_PLAYER_MSG_PREFIXES) { - STHROWF("Prefix index is out of range: %u >= %d", index, SQMOD_PLAYER_MSG_PREFIXES); + STHROWF("Prefix index is out of range: {} >= {}", index, SQMOD_PLAYER_MSG_PREFIXES); } // Validate the managed identifier Validate(); @@ -1942,7 +1942,7 @@ void CPlayer::FlushStream(bool reset) // Check for errors if (result == vcmpErrorTooLargeInput) { - STHROWF("Stream buffer is too big: %u", m_Buffer.Position()); + STHROWF("Stream buffer is too big: {}", m_Buffer.Position()); } } @@ -1970,7 +1970,7 @@ void CPlayer::SendBuffer(const SqBuffer & buffer) const // Check for errors if (result == vcmpErrorTooLargeInput) { - STHROWF("Stream buffer is too big: %u", buffer.GetRef()->Position()); + STHROWF("Stream buffer is too big: {}", buffer.GetRef()->Position()); } } diff --git a/module/Entity/Player.hpp b/module/Entity/Player.hpp index 9635b121..e2989505 100644 --- a/module/Entity/Player.hpp +++ b/module/Entity/Player.hpp @@ -155,7 +155,7 @@ public: { if (INVALID_ENTITY(m_ID)) { - STHROWF("Invalid player reference [%s]", m_Tag.c_str()); + STHROWF("Invalid player reference [{}]", m_Tag); } } diff --git a/module/Entity/Vehicle.cpp b/module/Entity/Vehicle.cpp index 103553f6..49bca0a9 100644 --- a/module/Entity/Vehicle.cpp +++ b/module/Entity/Vehicle.cpp @@ -137,7 +137,7 @@ bool CVehicle::GetOption(int32_t option_id) const // Check for errors if (_Func->GetLastError() == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid option identifier: %d", option_id); + STHROWF("Invalid option identifier: {}", option_id); } // Return the requested value return value; @@ -152,7 +152,7 @@ void CVehicle::SetOption(int32_t option_id, bool toggle) if (_Func->SetVehicleOption(m_ID, static_cast< vcmpVehicleOption >(option_id), static_cast< uint8_t >(toggle)) == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid option identifier: %d", option_id); + STHROWF("Invalid option identifier: {}", option_id); } else if (!(m_CircularLocks & VEHICLECL_EMIT_VEHICLE_OPTION)) { @@ -172,7 +172,7 @@ void CVehicle::SetOptionEx(int32_t option_id, bool toggle, int32_t header, Light if (_Func->SetVehicleOption(m_ID, static_cast< vcmpVehicleOption >(option_id), static_cast< uint8_t >(toggle)) == vcmpErrorArgumentOutOfBounds) { - STHROWF("Invalid option identifier: %d", option_id); + STHROWF("Invalid option identifier: {}", option_id); } else if (!(m_CircularLocks & VEHICLECL_EMIT_VEHICLE_OPTION)) { diff --git a/module/Entity/Vehicle.hpp b/module/Entity/Vehicle.hpp index dbee1e4a..053aafa6 100644 --- a/module/Entity/Vehicle.hpp +++ b/module/Entity/Vehicle.hpp @@ -91,7 +91,7 @@ public: { if (INVALID_ENTITY(m_ID)) { - STHROWF("Invalid vehicle reference [%s]", m_Tag.c_str()); + STHROWF("Invalid vehicle reference [{}]", m_Tag); } } diff --git a/module/Library/Chrono.cpp b/module/Library/Chrono.cpp index ccc7eb70..0a6f6a58 100644 --- a/module/Library/Chrono.cpp +++ b/module/Library/Chrono.cpp @@ -161,7 +161,7 @@ uint8_t Chrono::DaysInMonth(uint16_t year, uint8_t month) // Is the specified month within range? if (month > 12) { - STHROWF("Month value is out of range: %u > 12", month); + STHROWF("Month value is out of range: {} > 12", month); } // Obtain the days in this month uint8_t days = *(MonthLengths + month); diff --git a/module/Library/Chrono/Date.cpp b/module/Library/Chrono/Date.cpp index c646c1f7..c9d2c623 100644 --- a/module/Library/Chrono/Date.cpp +++ b/module/Library/Chrono/Date.cpp @@ -79,7 +79,7 @@ void Date::Set(uint16_t year, uint8_t month, uint8_t day) { if (!Chrono::ValidDate(year, month, day)) { - STHROWF("Invalid date: %04u%c%02u%c%02u" , m_Year, m_Delimiter, m_Month, m_Delimiter, m_Day); + STHROWF("Invalid date: {:04}{:c}{:02}{:c}{:02}" , m_Year, m_Delimiter, m_Month, m_Delimiter, m_Day); } // Assign the specified values m_Year = year; @@ -133,7 +133,7 @@ void Date::SetYear(uint16_t year) // Make sure the year is valid if (!year) { - STHROWF("Invalid year: %u", year); + STHROWF("Invalid year: {}", year); } // Assign the value m_Year = year; @@ -151,7 +151,7 @@ void Date::SetMonth(uint8_t month) // Make sure the month is valid if (month == 0 || month > 12) { - STHROWF("Invalid month: %u", month); + STHROWF("Invalid month: {}", month); } // Assign the value m_Month = month; @@ -170,11 +170,11 @@ void Date::SetDay(uint8_t day) // Make sure the day is valid if (day == 0) { - STHROWF("Invalid day: %u", day); + STHROWF("Invalid day: {}", day); } else if (day > dim) { - STHROWF("Day is out of range: %u > %u", day, dim); + STHROWF("Day is out of range: {} > {}", day, dim); } // Assign the value m_Day = day; diff --git a/module/Library/Chrono/Datetime.cpp b/module/Library/Chrono/Datetime.cpp index 27d841db..5d20fe2c 100644 --- a/module/Library/Chrono/Datetime.cpp +++ b/module/Library/Chrono/Datetime.cpp @@ -122,7 +122,7 @@ void Datetime::Set(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint // Validate the specified date if (!Chrono::ValidDate(year, month, day)) { - STHROWF("Invalid date: %04u%c%02u%c%02u%c%u" + STHROWF("Invalid date: {:04}{:c}{:02}{:c}{:02}{:c}{}" , m_DateDelim, m_Year , m_DateDelim, m_Month , m_DateDelim, m_Day @@ -131,22 +131,22 @@ void Datetime::Set(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint // Is the specified hour within range? else if (hour >= 24) { - STHROWF("Hour value is out of range: %u >= 24", hour); + STHROWF("Hour value is out of range: {} >= 24", hour); } // Is the specified minute within range? else if (minute >= 60) { - STHROWF("Minute value is out of range: %u >= 60", minute); + STHROWF("Minute value is out of range: {} >= 60", minute); } // Is the specified second within range? else if (second >= 60) { - STHROWF("Second value is out of range: %u >= 60", second); + STHROWF("Second value is out of range: {} >= 60", second); } // Is the specified millisecond within range? else if (millisecond >= 1000) { - STHROWF("Millisecond value is out of range: %u >= 1000", millisecond); + STHROWF("Millisecond value is out of range: {} >= 1000", millisecond); } // Assign the specified values m_Year = year; @@ -216,7 +216,7 @@ void Datetime::SetYear(uint16_t year) // Make sure the year is valid if (!year) { - STHROWF("Invalid year: %u", year); + STHROWF("Invalid year: {}", year); } // Assign the value m_Year = year; @@ -234,7 +234,7 @@ void Datetime::SetMonth(uint8_t month) // Make sure the month is valid if (month == 0 || month > 12) { - STHROWF("Invalid month: %u", month); + STHROWF("Invalid month: {}", month); } // Assign the value m_Month = month; @@ -253,11 +253,11 @@ void Datetime::SetDay(uint8_t day) // Make sure the day is valid if (day == 0) { - STHROWF("Invalid day: %u", day); + STHROWF("Invalid day: {}", day); } else if (day > dim) { - STHROWF("Day is out of range: %u > %u", day, dim); + STHROWF("Day is out of range: {} > {}", day, dim); } // Assign the value m_Day = day; @@ -269,7 +269,7 @@ void Datetime::SetHour(uint8_t hour) // Is the specified hour within range? if (hour >= 24) { - STHROWF("Hour value is out of range: %u >= 24", hour); + STHROWF("Hour value is out of range: {} >= 24", hour); } // Now it's safe to assign the value m_Hour = hour; @@ -281,7 +281,7 @@ void Datetime::SetMinute(uint8_t minute) // Is the specified minute within range? if (minute >= 60) { - STHROWF("Minute value is out of range: %u >= 60", minute); + STHROWF("Minute value is out of range: {} >= 60", minute); } // Now it's safe to assign the value m_Minute = minute; @@ -293,7 +293,7 @@ void Datetime::SetSecond(uint8_t second) // Is the specified second within range? if (second >= 60) { - STHROWF("Second value is out of range: %u >= 60", second); + STHROWF("Second value is out of range: {} >= 60", second); } // Now it's safe to assign the value m_Second = second; @@ -305,7 +305,7 @@ void Datetime::SetMillisecond(uint16_t millisecond) // Is the specified millisecond within range? if (millisecond >= 1000) { - STHROWF("Millisecond value is out of range: %u >= 1000", millisecond); + STHROWF("Millisecond value is out of range: {} >= 1000", millisecond); } // Now it's safe to assign the value m_Millisecond = millisecond; diff --git a/module/Library/Chrono/Time.cpp b/module/Library/Chrono/Time.cpp index 7c23279c..df0fad28 100644 --- a/module/Library/Chrono/Time.cpp +++ b/module/Library/Chrono/Time.cpp @@ -93,22 +93,22 @@ void Time::Set(uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecon // Is the specified hour within range? if (hour >= 24) { - STHROWF("Hour value is out of range: %u >= 24", hour); + STHROWF("Hour value is out of range: {} >= 24", hour); } // Is the specified minute within range? else if (minute >= 60) { - STHROWF("Minute value is out of range: %u >= 60", minute); + STHROWF("Minute value is out of range: {} >= 60", minute); } // Is the specified second within range? else if (second >= 60) { - STHROWF("Second value is out of range: %u >= 60", second); + STHROWF("Second value is out of range: {} >= 60", second); } // Is the specified millisecond within range? else if (millisecond >= 1000) { - STHROWF("Millisecond value is out of range: %u >= 1000", millisecond); + STHROWF("Millisecond value is out of range: {} >= 1000", millisecond); } // Now it's safe to assign the values m_Hour = hour; @@ -155,7 +155,7 @@ void Time::SetHour(uint8_t hour) // Is the specified hour within range? if (hour >= 24) { - STHROWF("Hour value is out of range: %u >= 24", hour); + STHROWF("Hour value is out of range: {} >= 24", hour); } // Now it's safe to assign the value m_Hour = hour; @@ -167,7 +167,7 @@ void Time::SetMinute(uint8_t minute) // Is the specified minute within range? if (minute >= 60) { - STHROWF("Minute value is out of range: %u >= 60", minute); + STHROWF("Minute value is out of range: {} >= 60", minute); } // Now it's safe to assign the value m_Minute = minute; @@ -179,7 +179,7 @@ void Time::SetSecond(uint8_t second) // Is the specified second within range? if (second >= 60) { - STHROWF("Second value is out of range: %u >= 60", second); + STHROWF("Second value is out of range: {} >= 60", second); } // Now it's safe to assign the value m_Second = second; @@ -191,7 +191,7 @@ void Time::SetMillisecond(uint16_t millisecond) // Is the specified millisecond within range? if (millisecond >= 1000) { - STHROWF("Millisecond value is out of range: %u >= 1000", millisecond); + STHROWF("Millisecond value is out of range: {} >= 1000", millisecond); } // Now it's safe to assign the value m_Millisecond = millisecond; diff --git a/module/Library/IO/Buffer.cpp b/module/Library/IO/Buffer.cpp index 1379734d..f1183c8e 100644 --- a/module/Library/IO/Buffer.cpp +++ b/module/Library/IO/Buffer.cpp @@ -223,7 +223,7 @@ LightObj SqBuffer::ReadRawString(SQInteger length) // Validate the obtained length if ((m_Buffer->Position() + len) > m_Buffer->Capacity()) { - STHROWF("String of size (%u) starting at (%u) is out of buffer capacity (%u)", + STHROWF("String of size ({}) starting at ({}) is out of buffer capacity ({})", len, m_Buffer->Position(), m_Buffer->Capacity()); } // Remember the current stack size @@ -248,7 +248,7 @@ LightObj SqBuffer::ReadClientString() // Validate the obtained length if ((m_Buffer->Position() + sizeof(uint16_t) + length) > m_Buffer->Capacity()) { - STHROWF("String of size (%u) starting at (%u) is out of buffer capacity (%u)", + STHROWF("String of size ({}) starting at ({}) is out of buffer capacity ({})", length, m_Buffer->Position() + sizeof(uint16_t), m_Buffer->Capacity()); } // Advance the buffer to the actual string diff --git a/module/Library/IO/Buffer.hpp b/module/Library/IO/Buffer.hpp index f5726269..a2adc4af 100644 --- a/module/Library/IO/Buffer.hpp +++ b/module/Library/IO/Buffer.hpp @@ -481,7 +481,7 @@ public: } catch (const std::exception & e) { - STHROWF("%s", e.what()); // Re-package + STHROWF("{}", e.what()); // Re-package } } diff --git a/module/Library/IO/INI.cpp b/module/Library/IO/INI.cpp index 60845963..aa34e843 100644 --- a/module/Library/IO/INI.cpp +++ b/module/Library/IO/INI.cpp @@ -19,20 +19,20 @@ void IniResult::Check() const switch (m_Result) { case SI_FAIL: - STHROWF("Unable to %s. Probably invalid", m_Action.c_str()); + STHROWF("Unable to {}. Probably invalid", m_Action); break; case SI_NOMEM: - STHROWF("Unable to %s. Ran out of memory", m_Action.c_str()); + STHROWF("Unable to {}. Ran out of memory", m_Action); break; case SI_FILE: - STHROWF("Unable to %s. %s", strerror(errno)); + STHROWF("Unable to {}. {}", m_Action, strerror(errno)); break; case SI_OK: case SI_UPDATED: case SI_INSERTED: break; /* These are not error messages. */ default: - STHROWF("Unable to %s for some unforeseen reason", m_Action.c_str()); + STHROWF("Unable to {} for some unforeseen reason", m_Action); } } diff --git a/module/Library/MMDB.cpp b/module/Library/MMDB.cpp index 4c7e4802..47366375 100644 --- a/module/Library/MMDB.cpp +++ b/module/Library/MMDB.cpp @@ -145,7 +145,7 @@ bool GetEntryAsBool(const MMDB_entry_data_s & ed) value = ConvTo< bool >::From(ed.float_value); } break; default: - STHROWF("Unsupported conversion from (%s) to (boolean)", AsTypeStr(ed.type)); + STHROWF("Unsupported conversion from ({}) to (boolean)", AsTypeStr(ed.type)); } // Return the extracted value return value; @@ -199,7 +199,7 @@ SQInteger GetEntryAsInteger(const MMDB_entry_data_s & ed) value = ConvTo< SQInteger >::From(ed.float_value); } break; default: - STHROWF("Unsupported conversion from (%s) to (integer)", AsTypeStr(ed.type)); + STHROWF("Unsupported conversion from ({}) to (integer)", AsTypeStr(ed.type)); } // Return the extracted value return value; @@ -258,7 +258,7 @@ SQFloat GetEntryAsFloat(const MMDB_entry_data_s & ed) value = ConvTo< SQFloat >::From(ed.float_value); } break; default: - STHROWF("Unsupported conversion from (%s) to (float)", AsTypeStr(ed.type)); + STHROWF("Unsupported conversion from ({}) to (float)", AsTypeStr(ed.type)); } // Return the extracted value return value; @@ -312,7 +312,7 @@ LightObj GetEntryAsLong(const MMDB_entry_data_s & ed) value = ConvTo< uint64_t >::From(ed.float_value); } break; default: - STHROWF("Unsupported conversion from (%s) to (long)", AsTypeStr(ed.type)); + STHROWF("Unsupported conversion from ({}) to (long)", AsTypeStr(ed.type)); } // Return a long integer instance with the requested value return LightObj(SqTypeIdentity< ULongInt >{}, SqVM(), value); @@ -366,7 +366,7 @@ LightObj GetEntryAsString(const MMDB_entry_data_s & ed) sq_pushstring(vm, fmt::format("{}", ed.float_value).c_str(), -1); } break; default: - STHROWF("Unsupported conversion from (%s) to (string)", AsTypeStr(ed.type)); + STHROWF("Unsupported conversion from ({}) to (string)", AsTypeStr(ed.type)); } // Obtain the object from the stack and return it return LightObj(-1); @@ -424,7 +424,7 @@ LightObj GetEntryAsBytes(const MMDB_entry_data_s & ed) sizeof(ed.float_value), 0); } default: - STHROWF("Unsupported conversion from (%s) to (buffer)", AsTypeStr(ed.type)); + STHROWF("Unsupported conversion from ({}) to (buffer)", AsTypeStr(ed.type)); } // Return a null object (shouldn't reach here) return LightObj{}; @@ -444,7 +444,7 @@ void SockAddr::Validate(CCStr file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid sockaddr structure handle =>[%s:%d]", file, line); + SqThrowF("Invalid sockaddr structure handle =>[{}:{}]", file, line); } } #else @@ -494,9 +494,9 @@ SockAddr::SockAddr(const SQChar * addr) } // Now it's safe to throw the error #if defined(UNICODE) || defined(_UNICODE) - STHROWF("Unable to query the specified address for information [%s]", gai_strerrorA(status)); + STHROWF("Unable to query the specified address for information [{}]", gai_strerrorA(status)); #else - STHROWF("Unable to query the specified address for information [%s]", gai_strerror(status)); + STHROWF("Unable to query the specified address for information [{}]", gai_strerror(status)); #endif } // Save the specified string address @@ -526,7 +526,7 @@ DbHnd::DbHnd(const SQChar * filepath, uint32_t flags) // Validate the result of the operation if (status != MMDB_SUCCESS) { - STHROWF("Unable to open the specified database [%s]", MMDB_strerror(status)); + STHROWF("Unable to open the specified database [{}]", MMDB_strerror(status)); } } @@ -551,7 +551,7 @@ void Database::Validate(CCStr file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[%s:%d]", file, line); + SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); } } #else @@ -594,7 +594,7 @@ LightObj Database::GetMetadataAsEntryDataList() const // Validate the status code if (status != MMDB_SUCCESS) { - STHROWF("Unable to get meta-data entry data list [%s]", MMDB_strerror(status)); + STHROWF("Unable to get meta-data entry data list [{}]", MMDB_strerror(status)); } // Return the resulted list return LightObj(SqTypeIdentity< EntryDataList >{}, SqVM(), m_Handle, entry_data_list); @@ -618,15 +618,15 @@ LookupResult Database::LookupString(const SQChar * addr) if (gai_error != 0) { #if defined(UNICODE) || defined(_UNICODE) - STHROWF("Unable to resolve address (%s) because [%s]", addr, gai_strerrorA(gai_error)); + STHROWF("Unable to resolve address ({}) because [{}]", addr, gai_strerrorA(gai_error)); #else - STHROWF("Unable to resolve address (%s) because [%s]", addr, gai_strerror(gai_error)); + STHROWF("Unable to resolve address ({}) because [{}]", addr, gai_strerror(gai_error)); #endif } // Validate the lookup status code else if (mmdb_error != MMDB_SUCCESS) { - STHROWF("Unable to lookup address (%s) because [%s]", addr, MMDB_strerror(mmdb_error)); + STHROWF("Unable to lookup address ({}) because [{}]", addr, MMDB_strerror(mmdb_error)); } // Now it's safe to return the lookup result return LookupResult(m_Handle, result); @@ -649,7 +649,7 @@ LookupResult Database::LookupSockAddr(SockAddr & addr) // Validate the lookup status code if (mmdb_error != MMDB_SUCCESS) { - STHROWF("Unable to lookup address (%s) because [%s]", addr.GetAddress(), MMDB_strerror(mmdb_error)); + STHROWF("Unable to lookup address ({}) because [{}]", addr.GetAddress(), MMDB_strerror(mmdb_error)); } // Now it's safe to return the lookup result return LookupResult(m_Handle, result); @@ -667,7 +667,7 @@ SearchNode Database::ReadNode(uint32_t node) const // Validate the status code if (status != MMDB_SUCCESS) { - STHROWF("Unable to get node [%s]", MMDB_strerror(status)); + STHROWF("Unable to get node [{}]", MMDB_strerror(status)); } // Return the resulted list return SearchNode(m_Handle, search_node); @@ -687,7 +687,7 @@ void Description::Validate(CCStr file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[%s:%d]", file, line); + SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); } } #else @@ -708,7 +708,7 @@ Description::Pointer Description::GetValid(CCStr file, int32_t line) const // Validate the referenced description if (!m_Description) { - SqThrowF("Invalid Maxmind meta-data description reference =>[%s:%d]", file, line); + SqThrowF("Invalid Maxmind meta-data description reference =>[{}:{}]", file, line); } // Return the description pointer return m_Description; @@ -747,7 +747,7 @@ void EntryData::Validate(CCStr file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[%s:%d]", file, line); + SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); } } #else @@ -768,7 +768,7 @@ EntryData::ConstRef EntryData::GetValid(CCStr file, int32_t line) const // See if the entry has any data if (!m_Entry.has_data) { - SqThrowF("The referenced entry has no data =>[%s:%d]", file, line); + SqThrowF("The referenced entry has no data =>[{}:{}]", file, line); } // Return the entry return m_Entry; @@ -821,7 +821,7 @@ void EntryDataList::Validate(CCStr file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[%s:%d]", file, line); + SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); } } #else @@ -842,7 +842,7 @@ EntryDataList::Pointer EntryDataList::GetValid(CCStr file, int32_t line) const // Validate the managed list if (!m_List) { - SqThrowF("Invalid Maxmind entry data list reference =>[%s:%d]", file, line); + SqThrowF("Invalid Maxmind entry data list reference =>[{}:{}]", file, line); } // return the list return m_List; @@ -869,7 +869,7 @@ EntryDataList::Pointer EntryDataList::GetValidElem(CCStr file, int32_t line) con // Validate the current element if (!m_List) { - SqThrowF("Invalid Maxmind entry data element reference =>[%s:%d]", file, line); + SqThrowF("Invalid Maxmind entry data element reference =>[{}:{}]", file, line); } // return the element return m_Elem; @@ -952,7 +952,7 @@ void EntryDataList::DumpTo(const SQChar * filepath, int32_t indent) const // Validate the file handle if (!fp) { - STHROWF("Unable to open file %s", filepath); + STHROWF("Unable to open file {}", filepath); } // Attempt to dump the entry data list int32_t status = MMDB_dump_entry_data_list(fp, ptr, indent); @@ -961,7 +961,7 @@ void EntryDataList::DumpTo(const SQChar * filepath, int32_t indent) const // Validate the result of the operation if (status != MMDB_SUCCESS) { - STHROWF("Unable to dump the list [%s]", MMDB_strerror(status)); + STHROWF("Unable to dump the list [{}]", MMDB_strerror(status)); } } @@ -979,7 +979,7 @@ void LookupResult::Validate(CCStr file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[%s:%d]", file, line); + SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); } } #else @@ -1042,7 +1042,7 @@ Object LookupResult::GetEntryDataList() // Validate the status code if (status != MMDB_SUCCESS) { - STHROWF("Unable to get entry data list [%s]", MMDB_strerror(status)); + STHROWF("Unable to get entry data list [{}]", MMDB_strerror(status)); } // Return the resulted list return Object(new EntryDataList(m_Handle, entry_data_list)); @@ -1139,7 +1139,7 @@ void Metadata::Validate(CCStr file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[%s:%d]", file, line); + SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); } } #else @@ -1160,7 +1160,7 @@ Metadata::Pointer Metadata::GetValid(CCStr file, int32_t line) const // Validate the referenced meta-data if (!m_Metadata) { - SqThrowF("Invalid Maxmind meta-data reference =>[%s:%d]", file, line); + SqThrowF("Invalid Maxmind meta-data reference =>[{}:{}]", file, line); } // Return the meta-data pointer return m_Metadata; @@ -1191,7 +1191,7 @@ Description Metadata::GetDescriptionHandle(uint32_t idx) const // Validate the specified index if (idx > SQMOD_GET_VALID(*this)->description.count) { - STHROWF("The specified description index is out of range: %u > %u", idx, m_Metadata->description.count); + STHROWF("The specified description index is out of range: {} > {}", idx, m_Metadata->description.count); } // Return the requested description return Description(m_Handle, m_Metadata->description.descriptions[idx]); @@ -1211,7 +1211,7 @@ void SearchNode::Validate(CCStr file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[%s:%d]", file, line); + SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); } } #else @@ -1269,7 +1269,7 @@ Object SearchNode::GetLeftRecordEntryDataList() // Validate the status code if (status != MMDB_SUCCESS) { - STHROWF("Unable to get entry data list [%s]", MMDB_strerror(status)); + STHROWF("Unable to get entry data list [{}]", MMDB_strerror(status)); } // Return the resulted list return Object(new EntryDataList(m_Handle, entry_data_list)); @@ -1285,7 +1285,7 @@ Object SearchNode::GetRightRecordEntryDataList() // Validate the status code if (status != MMDB_SUCCESS) { - STHROWF("Unable to get entry data list [%s]", MMDB_strerror(status)); + STHROWF("Unable to get entry data list [{}]", MMDB_strerror(status)); } // Return the resulted list return Object(new EntryDataList(m_Handle, entry_data_list)); diff --git a/module/Library/MMDB.hpp b/module/Library/MMDB.hpp index 1bf8a901..2a134159 100644 --- a/module/Library/MMDB.hpp +++ b/module/Library/MMDB.hpp @@ -1467,7 +1467,7 @@ public: // Validate the specified index if (idx > SQMOD_GET_VALID(*this)->languages.count) { - STHROWF("The specified language index is out of range: %u > %u", idx, m_Metadata->languages.count); + STHROWF("The specified language index is out of range: {} > {}", idx, m_Metadata->languages.count); } // Return the requested name return m_Metadata->languages.names[idx]; @@ -1518,7 +1518,7 @@ public: // Validate the specified index if (idx > SQMOD_GET_VALID(*this)->description.count) { - STHROWF("The specified description index is out of range: %u > %u", idx, m_Metadata->description.count); + STHROWF("The specified description index is out of range: {} > {}", idx, m_Metadata->description.count); } // Return the requested description value return m_Metadata->description.descriptions[idx]->description; @@ -1532,7 +1532,7 @@ public: // Validate the specified index if (idx > SQMOD_GET_VALID(*this)->description.count) { - STHROWF("The specified description index is out of range: %u > %u", idx, m_Metadata->description.count); + STHROWF("The specified description index is out of range: {} > {}", idx, m_Metadata->description.count); } // Return the requested description language return m_Metadata->description.descriptions[idx]->language; diff --git a/module/Library/Numeric/Math.cpp b/module/Library/Numeric/Math.cpp index dea724ab..f30b2b94 100644 --- a/module/Library/Numeric/Math.cpp +++ b/module/Library/Numeric/Math.cpp @@ -1115,7 +1115,7 @@ SQFloat SqIToF(int64_t sigv, int64_t expv, int32_t padn, bool negf) // Is the number of pad characters out of range? if (static_cast< uint32_t >(padn) >= sizeof(padb)) { - STHROWF("Pad characters out of range: %d >= %d", padn, sizeof(padb)); + STHROWF("Pad characters out of range: {} >= {}", padn, sizeof(padb)); } // Write the padding characters std::memset(padb, '0', padn); diff --git a/module/Library/System/Dir.hpp b/module/Library/System/Dir.hpp index 8d41ac03..49a2623c 100644 --- a/module/Library/System/Dir.hpp +++ b/module/Library/System/Dir.hpp @@ -45,7 +45,7 @@ public: { if (!mHandle) { - STHROWF("Cannot %s. Invalid directory handle.", action); + STHROWF("Cannot {}. Invalid directory handle.", action); } } @@ -396,7 +396,7 @@ public: { if (!mHandle) { - STHROWF("Cannot %s. Invalid file handle.", action); + STHROWF("Cannot {}. Invalid file handle.", action); } } @@ -527,11 +527,11 @@ public: // Now we can throw the exception if (errno != 0) { - STHROWF("Failed to open file: %s [%s]", path.mPtr, strerror(errno)); + STHROWF("Failed to open file: {} [{}]", path.mPtr, strerror(errno)); } else { - STHROWLASTF("Failed to open file: %s", path.mPtr); + STHROWLASTF("Failed to open file: {}", path.mPtr); } } } diff --git a/module/Library/System/Path.cpp b/module/Library/System/Path.cpp index b62a760e..eb67d466 100644 --- a/module/Library/System/Path.cpp +++ b/module/Library/System/Path.cpp @@ -376,7 +376,7 @@ SysPath & SysPath::Assign(const Buffer & path, int32_t size) } else { - STHROWF("The specified path size is out of range: %u >= %u", size, path.Capacity()); + STHROWF("The specified path size is out of range: {} >= {}", size, path.Capacity()); } // Allow chaining return *this; @@ -445,7 +445,7 @@ SysPath & SysPath::Assign(const Buffer & path, Style style, int32_t size) } else { - STHROWF("The specified path size is out of range: %u >= %u", size, path.Capacity()); + STHROWF("The specified path size is out of range: {} >= {}", size, path.Capacity()); } // Allow chaining return *this; diff --git a/module/Library/Utils/Vector.hpp b/module/Library/Utils/Vector.hpp index c4894435..0c85eded 100644 --- a/module/Library/Utils/Vector.hpp +++ b/module/Library/Utils/Vector.hpp @@ -222,7 +222,7 @@ template < class T > struct SqVector { if (static_cast< size_t >(i) >= mC->size()) { - STHROWF("Invalid vector container index(%d" PRINT_INT_FMT ")", i); + STHROWF("Invalid vector container index({})", i); } return *mC; } @@ -234,7 +234,7 @@ template < class T > struct SqVector { if (static_cast< size_t >(i) >= mC->size()) { - STHROWF("Invalid vector container index(%d" PRINT_INT_FMT ")", i); + STHROWF("Invalid vector container index({})", i); } return *mC; } @@ -623,7 +623,7 @@ template < class T > struct SqVector Validate(); if (static_cast< size_t >(p) >= mC->size()) { - STHROWF("Invalid container index (%d" PRINT_INT_FMT ")", p); + STHROWF("Invalid container index ({})", p); } for (auto i = static_cast< size_t >(p); n--; ++i) { @@ -646,7 +646,7 @@ template < class T > struct SqVector } else if (static_cast< size_t >(p + n) >= mC->size()) { - STHROWF("Invalid container index (%d" PRINT_INT_FMT ")", p + n); + STHROWF("Invalid container index ({})", p + n); } for (n = (p + n); p <= n; ++p) { diff --git a/module/Logger.cpp b/module/Logger.cpp index 87986901..4944d201 100644 --- a/module/Logger.cpp +++ b/module/Logger.cpp @@ -354,7 +354,7 @@ void Logger::BindCb(uint8_t level, Function & func) // Is the log level valid? if (idx > 6) { - STHROWF("Out of range log level index: %d > 4", int(idx)); + STHROWF("Out of range log level index: {} > 4", int(idx)); } // Obtain the function instance called for this log level Function & cb = m_LogCb[idx]; diff --git a/module/Misc/Algo.cpp b/module/Misc/Algo.cpp index 87063419..0399cfb8 100644 --- a/module/Misc/Algo.cpp +++ b/module/Misc/Algo.cpp @@ -116,7 +116,7 @@ static const LightObj & Blip_FindBySprID(int32_t spr_id) // Perform a range check on the specified identifier if (spr_id < 0) { - STHROWF("The specified sprite identifier is invalid: %d", spr_id); + STHROWF("The specified sprite identifier is invalid: {}", spr_id); } // Obtain the ends of the entity pool auto itr = Core::Get().GetBlips().cbegin(); diff --git a/module/Misc/Algo.hpp b/module/Misc/Algo.hpp index 26b4e5c5..770bcd06 100644 --- a/module/Misc/Algo.hpp +++ b/module/Misc/Algo.hpp @@ -911,7 +911,7 @@ template < typename T > struct AppendElemFunc // Append the object at the back of the array if (SQ_FAILED(sq_arrayappend(mVM, mIdx))) { - STHROWF("Unable to append %s instance to the list", InstSpec< T >::LcName); + STHROWF("Unable to append {} instance to the list", InstSpec< T >::LcName); } } }; @@ -1187,7 +1187,7 @@ public: // Perform a range check on the specified identifier if (INVALID_ENTITYEX(id, Inst::Max)) { - STHROWF("The specified %s identifier is invalid: %d", Inst::LcName, id); + STHROWF("The specified {} identifier is invalid: {}", Inst::LcName, id); } // Obtain the ends of the entity pool typename Inst::Instances::const_iterator itr = Inst::CBegin(); diff --git a/module/Misc/Functions.cpp b/module/Misc/Functions.cpp index c6e75136..35f7d256 100644 --- a/module/Misc/Functions.cpp +++ b/module/Misc/Functions.cpp @@ -146,7 +146,7 @@ Table GetPluginInfo(int32_t plugin_id) // Attempt to update the plug-in info structure if (_Func->GetPluginInfo(plugin_id, &g_PluginInfo) == vcmpErrorNoSuchEntity) { - STHROWF("Unknown plug-in identifier: %d", plugin_id); + STHROWF("Unknown plug-in identifier: {}", plugin_id); } // Allocate a script table Table tbl; @@ -260,7 +260,7 @@ const SQChar * GetServerName() // Populate the buffer //if (_Func->GetServerName(g_SvNameBuff, SQMOD_SVNAMELENGTH) == vcmpErrorBufferTooSmall) //{ - // STHROWF("Server name was too big for the available buffer: %u", sizeof(g_SvNameBuff)); + // STHROWF("Server name was too big for the available buffer: {}", sizeof(g_SvNameBuff)); //} // TEMPORARY WROKAROUND @@ -287,7 +287,7 @@ const SQChar * GetServerPassword() // Populate the buffer //if (_Func->GetServerPassword(g_PasswdBuff, SQMOD_PASSWDLENGTH) == vcmpErrorBufferTooSmall) //{ - // STHROWF("Server password was too big for the available buffer: %u", sizeof(g_PasswdBuff)); + // STHROWF("Server password was too big for the available buffer: {}", sizeof(g_PasswdBuff)); //} // TEMPORARY WROKAROUND @@ -314,7 +314,7 @@ const SQChar * GetGameModeText() // Populate the buffer //if (_Func->GetGameModeText(g_GmNameBuff, SQMOD_GMNAMELENGTH) == vcmpErrorBufferTooSmall) //{ - // STHROWF("Game-mode text was too big for the available buffer: %u", sizeof(g_GmNameBuff)); + // STHROWF("Game-mode text was too big for the available buffer: {}", sizeof(g_GmNameBuff)); //} // TEMPORARY WROKAROUND @@ -369,7 +369,7 @@ bool GetServerOption(int32_t option_id) // Check for errors if (_Func->GetLastError() == vcmpErrorArgumentOutOfBounds) { - STHROWF("Unknown option identifier: %d", option_id); + STHROWF("Unknown option identifier: {}", option_id); } // Return the obtained value return value; @@ -381,7 +381,7 @@ void SetServerOption(int32_t option_id, bool toggle) if (_Func->SetServerOption(static_cast< vcmpServerOption >(option_id), static_cast< uint8_t >(toggle)) == vcmpErrorArgumentOutOfBounds) { - STHROWF("Unknown option identifier: %d", option_id); + STHROWF("Unknown option identifier: {}", option_id); } else { @@ -395,7 +395,7 @@ void SetServerOptionEx(int32_t option_id, bool toggle, int32_t header, LightObj if (_Func->SetServerOption(static_cast< vcmpServerOption >(option_id), static_cast< uint8_t >(toggle)) == vcmpErrorArgumentOutOfBounds) { - STHROWF("Unknown option identifier: %d", option_id); + STHROWF("Unknown option identifier: {}", option_id); } else { diff --git a/module/Misc/Vehicle.cpp b/module/Misc/Vehicle.cpp index bd46b6e5..64f83ad1 100644 --- a/module/Misc/Vehicle.cpp +++ b/module/Misc/Vehicle.cpp @@ -94,7 +94,7 @@ String GetAutomobileName(uint32_t id) } else { - STHROWF("Vehicle identifier breaks these demands (%u > 129 and %u < 237) or (%u > 6399 and %u < 6500)", id, id, id, id); + STHROWF("Vehicle identifier breaks these demands ({} > 129 and {} < 237) or ({} > 6399 and {} < 6500)", id, id, id, id); } // Should never reach this point return NullString(); @@ -113,7 +113,7 @@ void SetAutomobileName(uint32_t id, StackStrF & name) } else { - STHROWF("Vehicle identifier breaks these demands (%u > 129 and %u < 237) or (%u > 6399 and %u < 6500)", id, id, id, id); + STHROWF("Vehicle identifier breaks these demands ({} > 129 and {} < 237) or ({} > 6399 and {} < 6500)", id, id, id, id); } } diff --git a/module/PocoLib/Data.cpp b/module/PocoLib/Data.cpp index 1d12e1e0..214d9fdd 100644 --- a/module/PocoLib/Data.cpp +++ b/module/PocoLib/Data.cpp @@ -149,7 +149,7 @@ void SqDataStatement::UseEx(LightObj & obj, const std::string & name, Poco::Data case OT_BOOL: case OT_STRING: STHROWF("Use Bind(...) for non-reference types."); break; case OT_INSTANCE: UseInst_(obj, name, dir); break; - default: STHROWF("Can't use (%s) values", SqTypeName(obj.GetType())); break; + default: STHROWF("Can't use ({}) values", SqTypeName(obj.GetType())); break; } } @@ -200,7 +200,7 @@ void SqDataStatement::UseInst_(LightObj & obj, const std::string & name, Poco::D Var< LightObj >::push(SqVM(), obj); String type_name = SqTypeName(SqVM(), -1); sq_poptop(SqVM()); - STHROWF("Can't use (%s) values", type_name.c_str()); + STHROWF("Can't use {}) values", type_name); } } @@ -239,7 +239,7 @@ void SqDataStatement::BindEx(LightObj & obj, const std::string & name, Poco::Dat } break; // Special? case OT_INSTANCE: BindInst_(obj, name, dir); break; - default: STHROWF("Can't bind (%s) values", SqTypeName(obj.GetType())); break; + default: STHROWF("Can't bind ({}) values", SqTypeName(obj.GetType())); break; } } @@ -287,7 +287,7 @@ void SqDataStatement::BindInst_(LightObj & obj, const std::string & name, Poco:: Var< LightObj >::push(SqVM(), obj); String type_name = SqTypeName(SqVM(), -1); sq_poptop(SqVM()); - STHROWF("Can't bind (%s) values", type_name.c_str()); + STHROWF("Can't bind ({}) values", type_name); } } @@ -335,7 +335,7 @@ SqDataStatement & SqDataStatement::Into(LightObj & obj) Var< LightObj >::push(SqVM(), obj); String type_name = SqTypeName(SqVM(), -1); sq_poptop(SqVM()); - STHROWF("Can't extract (%s) values", type_name.c_str()); + STHROWF("Can't extract ({}) values", type_name); } return *this; } @@ -384,7 +384,7 @@ SqDataStatement & SqDataStatement::Into_(LightObj & obj, LightObj & def) Var< LightObj >::push(SqVM(), obj); String type_name = SqTypeName(SqVM(), -1); sq_poptop(SqVM()); - STHROWF("Can't extract (%s) values", type_name.c_str()); + STHROWF("Can't extract ({}) values", type_name); } return *this; }