From a710ceebff8d2d7f391a913fd16fd295cac84dc9 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Sat, 3 Jul 2021 14:09:58 +0300 Subject: [PATCH] Lazy fix for new changes to cpp fmt library. --- module/Base/AABB.cpp | 2 +- module/Base/Circle.cpp | 2 +- module/Base/Color3.cpp | 2 +- module/Base/Color4.cpp | 2 +- module/Base/Quaternion.cpp | 2 +- module/Base/Shared.cpp | 8 ++++---- module/Base/Sphere.cpp | 2 +- module/Base/Vector2.cpp | 2 +- module/Base/Vector2i.cpp | 2 +- module/Base/Vector3.cpp | 2 +- module/Base/Vector4.cpp | 2 +- module/Core/Buffer.hpp | 42 +++++++++++++++++++------------------- module/Core/Common.cpp | 4 ++-- module/Core/Script.cpp | 2 +- module/Library/Format.hpp | 2 +- module/Library/MMDB.cpp | 28 ++++++++++++------------- module/Library/MySQL.cpp | 34 +++++++++++++++--------------- module/Library/SQLite.cpp | 42 +++++++++++++++++++------------------- module/SqBase.hpp | 2 +- 19 files changed, 92 insertions(+), 92 deletions(-) diff --git a/module/Base/AABB.cpp b/module/Base/AABB.cpp index 46e0fb19..bf0259f6 100644 --- a/module/Base/AABB.cpp +++ b/module/Base/AABB.cpp @@ -730,7 +730,7 @@ int32_t AABB::IsSphereInsideFastEx(Value x, Value y, Value z, Value r) const // ------------------------------------------------------------------------------------------------ String AABB::Format(StackStrF & str) const { - return fmt::format(str.ToStr() + return fmt::format(fmt::runtime(str.ToStr()) , fmt::arg("min_x", min.x) , fmt::arg("min_y", min.y) , fmt::arg("min_z", min.z) diff --git a/module/Base/Circle.cpp b/module/Base/Circle.cpp index d00dc6ef..802b1478 100644 --- a/module/Base/Circle.cpp +++ b/module/Base/Circle.cpp @@ -496,7 +496,7 @@ Array Circle::ToPointsArray(SQInteger num_segments) const // ------------------------------------------------------------------------------------------------ String Circle::Format(StackStrF & str) const { - return fmt::format(str.ToStr() + return fmt::format(fmt::runtime(str.ToStr()) , fmt::arg("x", pos.x) , fmt::arg("y", pos.y) , fmt::arg("r", rad) diff --git a/module/Base/Color3.cpp b/module/Base/Color3.cpp index 347de311..f6ca2903 100644 --- a/module/Base/Color3.cpp +++ b/module/Base/Color3.cpp @@ -658,7 +658,7 @@ LightObj Color3::ToHex4() const // ------------------------------------------------------------------------------------------------ String Color3::Format(StackStrF & str) const { - return fmt::format(str.ToStr() + return fmt::format(fmt::runtime(str.ToStr()) , fmt::arg("r", r) , fmt::arg("g", g) , fmt::arg("b", b) diff --git a/module/Base/Color4.cpp b/module/Base/Color4.cpp index c07416ec..542eaa9e 100644 --- a/module/Base/Color4.cpp +++ b/module/Base/Color4.cpp @@ -693,7 +693,7 @@ LightObj Color4::ToHex3() const // ------------------------------------------------------------------------------------------------ String Color4::Format(StackStrF & str) const { - return fmt::format(str.ToStr() + return fmt::format(fmt::runtime(str.ToStr()) , fmt::arg("r", r) , fmt::arg("g", g) , fmt::arg("b", b) diff --git a/module/Base/Quaternion.cpp b/module/Base/Quaternion.cpp index d3b13e71..968b0fe3 100644 --- a/module/Base/Quaternion.cpp +++ b/module/Base/Quaternion.cpp @@ -719,7 +719,7 @@ const Quaternion & Quaternion::Get(StackStrF & str) // ------------------------------------------------------------------------------------------------ String Quaternion::Format(StackStrF & str) const { - return fmt::format(str.ToStr() + return fmt::format(fmt::runtime(str.ToStr()) , fmt::arg("x", x) , fmt::arg("y", y) , fmt::arg("z", z) diff --git a/module/Base/Shared.cpp b/module/Base/Shared.cpp index 1d6e1d8f..2f950c49 100644 --- a/module/Base/Shared.cpp +++ b/module/Base/Shared.cpp @@ -955,11 +955,11 @@ struct SqAssertResult // Default? if (s.mLen <= 0) { - LogScs("%s", fmt::format(mFStr, mA, mB).c_str()); + LogScs("%s", fmt::format(fmt::runtime(mFStr), mA, mB).c_str()); } else { - LogScs("%s", fmt::format(s.ToStr(), mA, mB).c_str()); + LogScs("%s", fmt::format(fmt::runtime(s.ToStr()), mA, mB).c_str()); } // Allow chaining return *this; @@ -1120,7 +1120,7 @@ template < class C > static SQInteger SqAssertValue(HSQUIRRELVM vm) if (C{}(r) == false) { // Throw the error - return sq_throwerrorf(vm, fmt::format(C::FSTRV, ar.Get()->mA, ar.Get()->mB).c_str()); + return sq_throwerrorf(vm, fmt::format(fmt::runtime(C::FSTRV), ar.Get()->mA, ar.Get()->mB).c_str()); } // Try to return assert result try @@ -1165,7 +1165,7 @@ template < class C > static SQInteger SqAssertSame(HSQUIRRELVM vm) if (C{}(r) == false) { // Throw the error - return sq_throwerrorf(vm, fmt::format(C::FSTRV, ar.Get()->mA, ar.Get()->mB).c_str()); + return sq_throwerrorf(vm, fmt::format(fmt::runtime(C::FSTRV), ar.Get()->mA, ar.Get()->mB).c_str()); } // Try to return assert result try diff --git a/module/Base/Sphere.cpp b/module/Base/Sphere.cpp index 689a1152..f03a3fb3 100644 --- a/module/Base/Sphere.cpp +++ b/module/Base/Sphere.cpp @@ -469,7 +469,7 @@ Sphere Sphere::Abs() const // ------------------------------------------------------------------------------------------------ String Sphere::Format(StackStrF & str) const { - return fmt::format(str.ToStr() + return fmt::format(fmt::runtime(str.ToStr()) , fmt::arg("x", pos.x) , fmt::arg("y", pos.y) , fmt::arg("z", pos.z) diff --git a/module/Base/Vector2.cpp b/module/Base/Vector2.cpp index be061892..5b27fb8d 100644 --- a/module/Base/Vector2.cpp +++ b/module/Base/Vector2.cpp @@ -375,7 +375,7 @@ Vector2 Vector2::Abs() const // ------------------------------------------------------------------------------------------------ String Vector2::Format(StackStrF & str) const { - return fmt::format(str.ToStr() + return fmt::format(fmt::runtime(str.ToStr()) , fmt::arg("x", x) , fmt::arg("y", y) ); diff --git a/module/Base/Vector2i.cpp b/module/Base/Vector2i.cpp index ffebfcaf..e173389d 100644 --- a/module/Base/Vector2i.cpp +++ b/module/Base/Vector2i.cpp @@ -521,7 +521,7 @@ Vector2i Vector2i::Abs() const // ------------------------------------------------------------------------------------------------ String Vector2i::Format(StackStrF & str) const { - return fmt::format(str.ToStr() + return fmt::format(fmt::runtime(str.ToStr()) , fmt::arg("x", x) , fmt::arg("y", y) ); diff --git a/module/Base/Vector3.cpp b/module/Base/Vector3.cpp index 059d6ce3..a58f9c7e 100644 --- a/module/Base/Vector3.cpp +++ b/module/Base/Vector3.cpp @@ -628,7 +628,7 @@ void Vector3::CenterRotateYZBy(Value degrees, const Vector3 & center) // ------------------------------------------------------------------------------------------------ String Vector3::Format(StackStrF & str) const { - return fmt::format(str.ToStr() + return fmt::format(fmt::runtime(str.ToStr()) , fmt::arg("x", x) , fmt::arg("y", y) , fmt::arg("z", z) diff --git a/module/Base/Vector4.cpp b/module/Base/Vector4.cpp index acd84371..a95fbb07 100644 --- a/module/Base/Vector4.cpp +++ b/module/Base/Vector4.cpp @@ -470,7 +470,7 @@ const Vector4 & Vector4::Get(StackStrF & str) // ------------------------------------------------------------------------------------------------ String Vector4::Format(StackStrF & str) const { - return fmt::format(str.ToStr() + return fmt::format(fmt::runtime(str.ToStr()) , fmt::arg("x", x) , fmt::arg("y", y) , fmt::arg("z", z) diff --git a/module/Core/Buffer.hpp b/module/Core/Buffer.hpp index f3a5881c..1435d71c 100644 --- a/module/Core/Buffer.hpp +++ b/module/Core/Buffer.hpp @@ -283,13 +283,13 @@ public: // Make sure that the buffer can host at least one element of this type if (m_Cap < sizeof(T)) { - ThrowMemExcept("Buffer capacity of (%u) is unable to host an element of size (%u)", + ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"), m_Cap, sizeof(T)); } // Make sure that the specified element is withing buffer range else if (n > (m_Cap - sizeof(T))) { - ThrowMemExcept("Element of size (%d) at index (%u) is out of buffer capacity (%u)", + ThrowMemExcept(fmt::runtime("Element of size (%d) at index (%u) is out of buffer capacity (%u)"), sizeof(T), n, m_Cap); } // Return the requested element @@ -304,13 +304,13 @@ public: // Make sure that the buffer can host at least one element of this type if (m_Cap < sizeof(T)) { - ThrowMemExcept("Buffer capacity of (%u) is unable to host an element of size (%u)", + ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"), m_Cap, sizeof(T)); } // Make sure that the specified element is withing buffer range else if (n > (m_Cap - sizeof(T))) { - ThrowMemExcept("Element of size (%d) at index (%u) is out of buffer capacity (%u)", + ThrowMemExcept(fmt::runtime("Element of size (%d) at index (%u) is out of buffer capacity (%u)"), sizeof(T), n, m_Cap); } // Return the requested element @@ -357,7 +357,7 @@ public: // Make sure that the buffer can host at least one element of this type if (m_Cap < sizeof(T)) { - ThrowMemExcept("Buffer capacity of (%u) is unable to host an element of size (%u)", + ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"), m_Cap, sizeof(T)); } // Return the requested element @@ -372,7 +372,7 @@ public: // Make sure that the buffer can host at least one element of this type if (m_Cap < sizeof(T)) { - ThrowMemExcept("Buffer capacity of (%u) is unable to host an element of size (%u)", + ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"), m_Cap, sizeof(T)); } // Return the requested element @@ -387,7 +387,7 @@ public: // Make sure that the buffer can host at least two elements of this type if (m_Cap < (sizeof(T) * 2)) { - ThrowMemExcept("Buffer capacity of (%u) is unable to host two elements of size (%u)", + ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host two elements of size (%u)"), m_Cap, sizeof(T)); } // Return the requested element @@ -402,7 +402,7 @@ public: // Make sure that the buffer can host at least two elements of this type if (m_Cap < (sizeof(T) * 2)) { - ThrowMemExcept("Buffer capacity of (%u) is unable to host two elements of size (%u)", + ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host two elements of size (%u)"), m_Cap, sizeof(T)); } // Return the requested element @@ -417,7 +417,7 @@ public: // Make sure that the buffer can host at least one element of this type if (m_Cap < sizeof(T)) { - ThrowMemExcept("Buffer capacity of (%u) is unable to host an element of size (%u)", + ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"), m_Cap, sizeof(T)); } // Return the requested element @@ -432,7 +432,7 @@ public: // Make sure that the buffer can host at least one element of this type if (m_Cap < sizeof(T)) { - ThrowMemExcept("Buffer capacity of (%u) is unable to host an element of size (%u)", + ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"), m_Cap, sizeof(T)); } // Return the requested element @@ -447,7 +447,7 @@ public: // Make sure that the buffer can host at least two elements of this type if (m_Cap < (sizeof(T) * 2)) { - ThrowMemExcept("Buffer capacity of (%u) is unable to host two elements of size (%u)", + ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host two elements of size (%u)"), m_Cap, sizeof(T)); } // Return the requested element @@ -462,7 +462,7 @@ public: // Make sure that the buffer can host at least two elements of this type if (m_Cap < (sizeof(T) * 2)) { - ThrowMemExcept("Buffer capacity of (%u) is unable to host two elements of size (%u)", + ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host two elements of size (%u)"), m_Cap, sizeof(T)); } // Return the requested element @@ -538,7 +538,7 @@ public: // Make sure that at least one element of this type exists after the cursor if ((m_Cur + sizeof(T)) > m_Cap) { - ThrowMemExcept("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)", + ThrowMemExcept(fmt::runtime("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)"), sizeof(T), m_Cur, m_Cap); } // Return the requested element @@ -553,7 +553,7 @@ public: // Make sure that at least one element of this type exists after the cursor if ((m_Cur + sizeof(T)) > m_Cap) { - ThrowMemExcept("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)", + ThrowMemExcept(fmt::runtime("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)"), sizeof(T), m_Cur, m_Cap); } // Return the requested element @@ -568,7 +568,7 @@ public: // The cursor must have at least one element of this type behind if (m_Cur < sizeof(T)) { - ThrowMemExcept("Cannot read an element of size (%u) before the cursor at (%u)", + ThrowMemExcept(fmt::runtime("Cannot read an element of size (%u) before the cursor at (%u)"), sizeof(T), m_Cur); } // Return the requested element @@ -583,7 +583,7 @@ public: // The cursor must have at least one element of this type behind if (m_Cur < sizeof(T)) { - ThrowMemExcept("Cannot read an element of size (%u) before the cursor at (%u)", + ThrowMemExcept(fmt::runtime("Cannot read an element of size (%u) before the cursor at (%u)"), sizeof(T), m_Cur); } // Return the requested element @@ -598,13 +598,13 @@ public: // Make sure that the buffer can host at least one element of this type if (m_Cap < sizeof(T)) { - ThrowMemExcept("Buffer capacity of (%u) is unable to host an element of size (%u)", + ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"), m_Cap, sizeof(T)); } // There must be buffer left for at least two elements of this type after the cursor else if ((m_Cur + (sizeof(T) * 2)) > m_Cap) { - ThrowMemExcept("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)", + ThrowMemExcept(fmt::runtime("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)"), sizeof(T), m_Cur + sizeof(T), m_Cap); } // Return the requested element @@ -619,13 +619,13 @@ public: // Make sure that the buffer can host at least one element of this type if (m_Cap < sizeof(T)) { - ThrowMemExcept("Buffer capacity of (%u) is unable to host an element of size (%u)", + ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"), m_Cap, sizeof(T)); } // There must be buffer left for at least two elements of this type after the cursor else if ((m_Cur + (sizeof(T) * 2)) > m_Cap) { - ThrowMemExcept("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)", + ThrowMemExcept(fmt::runtime("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)"), sizeof(T), m_Cur + sizeof(T), m_Cap); } // Return the requested element @@ -706,7 +706,7 @@ public: // See if the requested capacity doesn't exceed the limit if (n > Max< T >()) { - ThrowMemExcept("Requested buffer of (%u) elements exceeds the (%u) limit", n, Max< T >()); + ThrowMemExcept(fmt::runtime("Requested buffer of (%u) elements exceeds the (%u) limit"), n, Max< T >()); } // Is there an existing buffer? else if (n && !m_Cap) diff --git a/module/Core/Common.cpp b/module/Core/Common.cpp index b057ec2b..90442f70 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("{} [Unknown error]", b.Data()); + SqThrowF(fmt::runtime("{} [Unknown error]"), b.Data()); } // The resulted message buffer LPSTR msg_buff = nullptr; @@ -147,7 +147,7 @@ void SqThrowLastF(const SQChar * msg, ...) //Free the message buffer LocalFree(msg_buff); // Now it's safe to throw the error - SqThrowF("{} [{}]", b.Data(), message); + SqThrowF(fmt::runtime("{} [{}]"), b.Data(), message); #else SqThrowF("{} [{}]", b.Data(), std::strerror(errno)); #endif // SQMOD_OS_WINDOWS diff --git a/module/Core/Script.cpp b/module/Core/Script.cpp index e3f8f6d1..9b6f0b4f 100644 --- a/module/Core/Script.cpp +++ b/module/Core/Script.cpp @@ -99,7 +99,7 @@ void ScriptSrc::Process() // Read completely? if (r != static_cast< size_t >(length)) { - return SqThrowF("Failed to read script contents."); // Not cool + return SqThrowF(fmt::runtime("Failed to read script contents.")); // Not cool } // Where the last line ended size_t line_start = 0, line_end = 0; diff --git a/module/Library/Format.hpp b/module/Library/Format.hpp index 5775b353..f10ebd03 100644 --- a/module/Library/Format.hpp +++ b/module/Library/Format.hpp @@ -6,7 +6,7 @@ // ------------------------------------------------------------------------------------------------ #include #include -#include +#include // ------------------------------------------------------------------------------------------------ namespace SqMod { diff --git a/module/Library/MMDB.cpp b/module/Library/MMDB.cpp index d2d28551..88978fe8 100644 --- a/module/Library/MMDB.cpp +++ b/module/Library/MMDB.cpp @@ -329,7 +329,7 @@ LightObj GetEntryAsString(const MMDB_entry_data_s & ed) switch (ed.type) { case MMDB_DATA_TYPE_POINTER: { - sq_pushstring(vm, fmt::format("{:p}", ed.pointer).c_str(), -1); + sq_pushstring(vm, fmt::format(fmt::runtime("{:p}"), ed.pointer).c_str(), -1); } break; case MMDB_DATA_TYPE_UTF8_STRING: { sq_pushstring(vm, ed.utf8_string, ed.data_size); @@ -452,7 +452,7 @@ void SockAddr::Validate() const { if (!m_Handle) { - SqThrowF("Invalid sockaddr structure handle"); + SqThrowF(fmt::runtime("Invalid sockaddr structure handle")); } } #endif // _DEBUG @@ -559,7 +559,7 @@ void Database::Validate() const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference"); + SqThrowF(fmt::runtime("Invalid Maxmind database reference")); } } #endif // _DEBUG @@ -695,7 +695,7 @@ void Description::Validate() const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference"); + SqThrowF(fmt::runtime("Invalid Maxmind database reference")); } } #endif // _DEBUG @@ -720,7 +720,7 @@ Description::Pointer Description::GetValid() const // Validate the referenced description if (!m_Description) { - SqThrowF("Invalid Maxmind meta-data description reference"); + SqThrowF(fmt::runtime("Invalid Maxmind meta-data description reference")); } // Return the description pointer return m_Description; @@ -755,7 +755,7 @@ void EntryData::Validate() const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference"); + SqThrowF(fmt::runtime("Invalid Maxmind database reference")); } } #endif // _DEBUG @@ -780,7 +780,7 @@ EntryData::ConstRef EntryData::GetValid() const // See if the entry has any data if (!m_Entry.has_data) { - SqThrowF("The referenced entry has no data"); + SqThrowF(fmt::runtime("The referenced entry has no data")); } // Return the entry return m_Entry; @@ -829,7 +829,7 @@ void EntryDataList::Validate() const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference"); + SqThrowF(fmt::runtime("Invalid Maxmind database reference")); } } #endif // _DEBUG @@ -854,7 +854,7 @@ EntryDataList::Pointer EntryDataList::GetValid() const // Validate the managed list if (!m_List) { - SqThrowF("Invalid Maxmind entry data list reference"); + SqThrowF(fmt::runtime("Invalid Maxmind entry data list reference")); } // return the list return m_List; @@ -881,7 +881,7 @@ EntryDataList::Pointer EntryDataList::GetValidElem() const // Validate the current element if (!m_List) { - SqThrowF("Invalid Maxmind entry data element reference"); + SqThrowF(fmt::runtime("Invalid Maxmind entry data element reference")); } // return the element return m_Elem; @@ -987,7 +987,7 @@ void LookupResult::Validate() const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference"); + SqThrowF(fmt::runtime("Invalid Maxmind database reference")); } } #endif // _DEBUG @@ -1147,7 +1147,7 @@ void Metadata::Validate() const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference"); + SqThrowF(fmt::runtime("Invalid Maxmind database reference")); } } #endif // _DEBUG @@ -1172,7 +1172,7 @@ Metadata::Pointer Metadata::GetValid() const // Validate the referenced meta-data if (!m_Metadata) { - SqThrowF("Invalid Maxmind meta-data reference"); + SqThrowF(fmt::runtime("Invalid Maxmind meta-data reference")); } // Return the meta-data pointer return m_Metadata; @@ -1219,7 +1219,7 @@ void SearchNode::Validate() const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference"); + SqThrowF(fmt::runtime("Invalid Maxmind database reference")); } } #endif // _DEBUG diff --git a/module/Library/MySQL.cpp b/module/Library/MySQL.cpp index 74f76571..8c8e5ab9 100644 --- a/module/Library/MySQL.cpp +++ b/module/Library/MySQL.cpp @@ -1631,7 +1631,7 @@ void Connection::Validate() const { if (!m_Handle) { - SqThrowF("Invalid MySQL connection reference"); + SqThrowF(fmt::runtime("Invalid MySQL connection reference")); } } #endif // _DEBUG @@ -1654,11 +1654,11 @@ void Connection::ValidateCreated() const { if (!m_Handle) { - SqThrowF("Invalid MySQL connection reference"); + SqThrowF(fmt::runtime("Invalid MySQL connection reference")); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid MySQL connection"); + SqThrowF(fmt::runtime("Invalid MySQL connection")); } } #endif // _DEBUG @@ -1976,12 +1976,12 @@ void Field::Validate() const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference"); + SqThrowF(fmt::runtime("Invalid MySQL result-set reference")); } // Are we pointing to a valid index? else if (m_Index >= m_Handle->mFieldCount) { - SqThrowF("Field index is out of range: {} >= {}", m_Index, m_Handle->mFieldCount); + SqThrowF(fmt::runtime("Field index is out of range: {} >= {}"), m_Index, m_Handle->mFieldCount); } } #endif // _DEBUG @@ -2004,7 +2004,7 @@ void Field::ValidateCreated() const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference"); + SqThrowF(fmt::runtime("Invalid MySQL result-set reference")); } // Are we pointing to a valid index? m_Handle->ValidateField(m_Index); @@ -2034,12 +2034,12 @@ void Field::ValidateStepped() const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference"); + SqThrowF(fmt::runtime("Invalid MySQL result-set reference")); } // Do we have a valid row available? else if (m_Handle->mRow == nullptr) { - SqThrowF("No row available in MySQL result-set"); + SqThrowF(fmt::runtime("No row available in MySQL result-set")); } // Are we pointing to a valid index? m_Handle->ValidateField(m_Index); @@ -2109,7 +2109,7 @@ void Field::ValidateField(uint32_t idx) const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference"); + SqThrowF(fmt::runtime("Invalid MySQL result-set reference")); } // Validate the specified field index m_Handle->ValidateField(idx); @@ -2480,7 +2480,7 @@ void ResultSet::Validate() const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference"); + SqThrowF(fmt::runtime("Invalid MySQL result-set reference")); } } #endif // _DEBUG @@ -2505,11 +2505,11 @@ void ResultSet::ValidateCreated() const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference"); + SqThrowF(fmt::runtime("Invalid MySQL result-set reference")); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid MySQL result-set"); + SqThrowF(fmt::runtime("Invalid MySQL result-set")); } } #endif // _DEBUG @@ -2535,12 +2535,12 @@ void ResultSet::ValidateStepped() const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference"); + SqThrowF(fmt::runtime("Invalid MySQL result-set reference")); } // Do we have a valid row available? else if (m_Handle->mRow == nullptr) { - SqThrowF("No row available in MySQL result-set"); + SqThrowF(fmt::runtime("No row available in MySQL result-set")); } } #endif // _DEBUG @@ -2761,7 +2761,7 @@ void Statement::Validate() const { if (!m_Handle) { - SqThrowF("Invalid MySQL statement reference"); + SqThrowF(fmt::runtime("Invalid MySQL statement reference")); } } #endif // _DEBUG @@ -2784,11 +2784,11 @@ void Statement::ValidateCreated() const { if (!m_Handle) { - SqThrowF("Invalid MySQL statement reference"); + SqThrowF(fmt::runtime("Invalid MySQL statement reference")); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid MySQL statement"); + SqThrowF(fmt::runtime("Invalid MySQL statement")); } } #endif // _DEBUG diff --git a/module/Library/SQLite.cpp b/module/Library/SQLite.cpp index a7a6eb86..45fc862a 100644 --- a/module/Library/SQLite.cpp +++ b/module/Library/SQLite.cpp @@ -903,7 +903,7 @@ void SQLiteConnection::Validate() const { if (!m_Handle) { - SqThrowF("Invalid SQLite connection reference"); + SqThrowF(fmt::runtime("Invalid SQLite connection reference")); } } #endif // _DEBUG @@ -926,11 +926,11 @@ void SQLiteConnection::ValidateCreated() const { if (!m_Handle) { - SqThrowF("Invalid SQLite connection reference"); + SqThrowF(fmt::runtime("Invalid SQLite connection reference")); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid SQLite connection"); + SqThrowF(fmt::runtime("Invalid SQLite connection")); } } #endif // _DEBUG @@ -1241,12 +1241,12 @@ void SQLiteParameter::Validate() const // Are we pointing to a valid index? if (m_Index < 0) { - SqThrowF("Invalid column index: {} < 0", m_Index); + SqThrowF(fmt::runtime("Invalid column index: {} < 0"), m_Index); } // Do we have a valid statement handle? else if (!m_Handle) { - SqThrowF("Invalid SQLite statement reference"); + SqThrowF(fmt::runtime("Invalid SQLite statement reference")); } } #endif // _DEBUG @@ -1275,15 +1275,15 @@ void SQLiteParameter::ValidateCreated() const // Are we pointing to a valid index? if (m_Index < 0) { - SqThrowF("Invalid column index: {} < 0", m_Index); + SqThrowF(fmt::runtime("Invalid column index: {} < 0"), m_Index); } else if (!m_Handle) { - SqThrowF("Invalid SQLite statement reference"); + SqThrowF(fmt::runtime("Invalid SQLite statement reference")); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid SQLite statement"); + SqThrowF(fmt::runtime("Invalid SQLite statement")); } } #endif // _DEBUG @@ -1337,7 +1337,7 @@ void SQLiteParameter::ValidateParam(int32_t idx) const // Is the specified index in range? if (!m_Handle->CheckParameter(idx)) { - SqThrowF("SQLiteParameter index is out of range ({}:{})", idx, m_Handle->mParameters); + SqThrowF(fmt::runtime("SQLiteParameter index is out of range ({}:{})"), idx, m_Handle->mParameters); } } #endif // _DEBUG @@ -1947,12 +1947,12 @@ void SQLiteColumn::Validate() const // Are we pointing to a valid index? if (m_Index < 0) { - SqThrowF("Invalid column index: {} < 0", m_Index); + SqThrowF(fmt::runtime("Invalid column index: {} < 0"), m_Index); } // Do we have a valid statement handle? else if (!m_Handle) { - SqThrowF("Invalid SQLite statement reference"); + SqThrowF(fmt::runtime("Invalid SQLite statement reference")); } } #endif // _DEBUG @@ -1981,15 +1981,15 @@ void SQLiteColumn::ValidateCreated() const // Are we pointing to a valid index? if (m_Index < 0) { - SqThrowF("Invalid column index: {} < 0", m_Index); + SqThrowF(fmt::runtime("Invalid column index: {} < 0"), m_Index); } else if (!m_Handle) { - SqThrowF("Invalid SQLite statement reference"); + SqThrowF(fmt::runtime("Invalid SQLite statement reference")); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid SQLite statement"); + SqThrowF(fmt::runtime("Invalid SQLite statement")); } } #endif // _DEBUG @@ -2043,7 +2043,7 @@ void SQLiteColumn::ValidateColumn(int32_t idx) const // Is the specified index in range? if (!m_Handle->CheckColumn(idx)) { - SqThrowF("Column index is out of range: {}:{}", idx, m_Handle->mColumns); + SqThrowF(fmt::runtime("Column index is out of range: {}:{}"), idx, m_Handle->mColumns); } } #endif // _DEBUG @@ -2415,7 +2415,7 @@ void SQLiteStatement::Validate() const { if (!m_Handle) { - SqThrowF("Invalid SQLite statement reference"); + SqThrowF(fmt::runtime("Invalid SQLite statement reference")); } } #endif // _DEBUG @@ -2438,11 +2438,11 @@ void SQLiteStatement::ValidateCreated() const { if (!m_Handle) { - SqThrowF("Invalid SQLite statement reference"); + SqThrowF(fmt::runtime("Invalid SQLite statement reference")); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid SQLite statement"); + SqThrowF(fmt::runtime("Invalid SQLite statement")); } } #endif // _DEBUG @@ -2495,7 +2495,7 @@ void SQLiteStatement::ValidateColumn(int32_t idx) const // Is the specified index in range? if (!m_Handle->CheckColumn(idx)) { - SqThrowF("Column index is out of range: {}:{}", idx, m_Handle->mColumns); + SqThrowF(fmt::runtime("Column index is out of range: {}:{}"), idx, m_Handle->mColumns); } } #endif // _DEBUG @@ -2518,7 +2518,7 @@ void SQLiteStatement::ValidateParam(int32_t idx) const // Is the specified index in range? if (!m_Handle->CheckParameter(idx)) { - SqThrowF("Parameter index is out of range: {}:{}", idx, m_Handle->mParameters); + SqThrowF(fmt::runtime("Parameter index is out of range: {}:{}"), idx, m_Handle->mParameters); } } #endif // _DEBUG @@ -2541,7 +2541,7 @@ void SQLiteStatement::ValidateRow() const // Do we have any rows available? if (!m_Handle->mGood) { - SqThrowF("No row available"); + SqThrowF(fmt::runtime("No row available")); } } #endif // _DEBUG diff --git a/module/SqBase.hpp b/module/SqBase.hpp index 30127050..3c4d0244 100644 --- a/module/SqBase.hpp +++ b/module/SqBase.hpp @@ -529,7 +529,7 @@ enum EntityType #define STHROWLASTF(m, ...) SqThrowLastF(m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] ", ##__VA_ARGS__) #else #define STHROW(e, m, ...) throw e(m, ##__VA_ARGS__) - #define STHROWF(m, ...) SqThrowF(m, ##__VA_ARGS__) + #define STHROWF(m, ...) SqThrowF(fmt::runtime(m), ##__VA_ARGS__) #define STHROWLASTF(m, ...) SqThrowLastF(m, ##__VA_ARGS__) #endif // _DEBUG