1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Lazy fix for new changes to cpp fmt library.

This commit is contained in:
Sandu Liviu Catalin 2021-07-03 14:09:58 +03:00
parent 69d1b6a919
commit a710ceebff
19 changed files with 92 additions and 92 deletions

View File

@ -730,7 +730,7 @@ int32_t AABB::IsSphereInsideFastEx(Value x, Value y, Value z, Value r) const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
String AABB::Format(StackStrF & str) 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_x", min.x)
, fmt::arg("min_y", min.y) , fmt::arg("min_y", min.y)
, fmt::arg("min_z", min.z) , fmt::arg("min_z", min.z)

View File

@ -496,7 +496,7 @@ Array Circle::ToPointsArray(SQInteger num_segments) const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
String Circle::Format(StackStrF & str) 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("x", pos.x)
, fmt::arg("y", pos.y) , fmt::arg("y", pos.y)
, fmt::arg("r", rad) , fmt::arg("r", rad)

View File

@ -658,7 +658,7 @@ LightObj Color3::ToHex4() const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
String Color3::Format(StackStrF & str) 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("r", r)
, fmt::arg("g", g) , fmt::arg("g", g)
, fmt::arg("b", b) , fmt::arg("b", b)

View File

@ -693,7 +693,7 @@ LightObj Color4::ToHex3() const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
String Color4::Format(StackStrF & str) 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("r", r)
, fmt::arg("g", g) , fmt::arg("g", g)
, fmt::arg("b", b) , fmt::arg("b", b)

View File

@ -719,7 +719,7 @@ const Quaternion & Quaternion::Get(StackStrF & str)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
String Quaternion::Format(StackStrF & str) const String Quaternion::Format(StackStrF & str) const
{ {
return fmt::format(str.ToStr() return fmt::format(fmt::runtime(str.ToStr())
, fmt::arg("x", x) , fmt::arg("x", x)
, fmt::arg("y", y) , fmt::arg("y", y)
, fmt::arg("z", z) , fmt::arg("z", z)

View File

@ -955,11 +955,11 @@ struct SqAssertResult
// Default? // Default?
if (s.mLen <= 0) 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 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 // Allow chaining
return *this; return *this;
@ -1120,7 +1120,7 @@ template < class C > static SQInteger SqAssertValue(HSQUIRRELVM vm)
if (C{}(r) == false) if (C{}(r) == false)
{ {
// Throw the error // 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 to return assert result
try try
@ -1165,7 +1165,7 @@ template < class C > static SQInteger SqAssertSame(HSQUIRRELVM vm)
if (C{}(r) == false) if (C{}(r) == false)
{ {
// Throw the error // 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 to return assert result
try try

View File

@ -469,7 +469,7 @@ Sphere Sphere::Abs() const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
String Sphere::Format(StackStrF & str) 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("x", pos.x)
, fmt::arg("y", pos.y) , fmt::arg("y", pos.y)
, fmt::arg("z", pos.z) , fmt::arg("z", pos.z)

View File

@ -375,7 +375,7 @@ Vector2 Vector2::Abs() const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
String Vector2::Format(StackStrF & str) 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("x", x)
, fmt::arg("y", y) , fmt::arg("y", y)
); );

View File

@ -521,7 +521,7 @@ Vector2i Vector2i::Abs() const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
String Vector2i::Format(StackStrF & str) 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("x", x)
, fmt::arg("y", y) , fmt::arg("y", y)
); );

View File

@ -628,7 +628,7 @@ void Vector3::CenterRotateYZBy(Value degrees, const Vector3 & center)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
String Vector3::Format(StackStrF & str) const String Vector3::Format(StackStrF & str) const
{ {
return fmt::format(str.ToStr() return fmt::format(fmt::runtime(str.ToStr())
, fmt::arg("x", x) , fmt::arg("x", x)
, fmt::arg("y", y) , fmt::arg("y", y)
, fmt::arg("z", z) , fmt::arg("z", z)

View File

@ -470,7 +470,7 @@ const Vector4 & Vector4::Get(StackStrF & str)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
String Vector4::Format(StackStrF & str) const String Vector4::Format(StackStrF & str) const
{ {
return fmt::format(str.ToStr() return fmt::format(fmt::runtime(str.ToStr())
, fmt::arg("x", x) , fmt::arg("x", x)
, fmt::arg("y", y) , fmt::arg("y", y)
, fmt::arg("z", z) , fmt::arg("z", z)

View File

@ -283,13 +283,13 @@ public:
// Make sure that the buffer can host at least one element of this type // Make sure that the buffer can host at least one element of this type
if (m_Cap < sizeof(T)) 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)); m_Cap, sizeof(T));
} }
// Make sure that the specified element is withing buffer range // Make sure that the specified element is withing buffer range
else if (n > (m_Cap - sizeof(T))) 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); sizeof(T), n, m_Cap);
} }
// Return the requested element // Return the requested element
@ -304,13 +304,13 @@ public:
// Make sure that the buffer can host at least one element of this type // Make sure that the buffer can host at least one element of this type
if (m_Cap < sizeof(T)) 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)); m_Cap, sizeof(T));
} }
// Make sure that the specified element is withing buffer range // Make sure that the specified element is withing buffer range
else if (n > (m_Cap - sizeof(T))) 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); sizeof(T), n, m_Cap);
} }
// Return the requested element // Return the requested element
@ -357,7 +357,7 @@ public:
// Make sure that the buffer can host at least one element of this type // Make sure that the buffer can host at least one element of this type
if (m_Cap < sizeof(T)) 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)); m_Cap, sizeof(T));
} }
// Return the requested element // Return the requested element
@ -372,7 +372,7 @@ public:
// Make sure that the buffer can host at least one element of this type // Make sure that the buffer can host at least one element of this type
if (m_Cap < sizeof(T)) 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)); m_Cap, sizeof(T));
} }
// Return the requested element // Return the requested element
@ -387,7 +387,7 @@ public:
// Make sure that the buffer can host at least two elements of this type // Make sure that the buffer can host at least two elements of this type
if (m_Cap < (sizeof(T) * 2)) 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)); m_Cap, sizeof(T));
} }
// Return the requested element // Return the requested element
@ -402,7 +402,7 @@ public:
// Make sure that the buffer can host at least two elements of this type // Make sure that the buffer can host at least two elements of this type
if (m_Cap < (sizeof(T) * 2)) 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)); m_Cap, sizeof(T));
} }
// Return the requested element // Return the requested element
@ -417,7 +417,7 @@ public:
// Make sure that the buffer can host at least one element of this type // Make sure that the buffer can host at least one element of this type
if (m_Cap < sizeof(T)) 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)); m_Cap, sizeof(T));
} }
// Return the requested element // Return the requested element
@ -432,7 +432,7 @@ public:
// Make sure that the buffer can host at least one element of this type // Make sure that the buffer can host at least one element of this type
if (m_Cap < sizeof(T)) 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)); m_Cap, sizeof(T));
} }
// Return the requested element // Return the requested element
@ -447,7 +447,7 @@ public:
// Make sure that the buffer can host at least two elements of this type // Make sure that the buffer can host at least two elements of this type
if (m_Cap < (sizeof(T) * 2)) 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)); m_Cap, sizeof(T));
} }
// Return the requested element // Return the requested element
@ -462,7 +462,7 @@ public:
// Make sure that the buffer can host at least two elements of this type // Make sure that the buffer can host at least two elements of this type
if (m_Cap < (sizeof(T) * 2)) 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)); m_Cap, sizeof(T));
} }
// Return the requested element // Return the requested element
@ -538,7 +538,7 @@ public:
// Make sure that at least one element of this type exists after the cursor // Make sure that at least one element of this type exists after the cursor
if ((m_Cur + sizeof(T)) > m_Cap) 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); sizeof(T), m_Cur, m_Cap);
} }
// Return the requested element // Return the requested element
@ -553,7 +553,7 @@ public:
// Make sure that at least one element of this type exists after the cursor // Make sure that at least one element of this type exists after the cursor
if ((m_Cur + sizeof(T)) > m_Cap) 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); sizeof(T), m_Cur, m_Cap);
} }
// Return the requested element // Return the requested element
@ -568,7 +568,7 @@ public:
// The cursor must have at least one element of this type behind // The cursor must have at least one element of this type behind
if (m_Cur < sizeof(T)) 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); sizeof(T), m_Cur);
} }
// Return the requested element // Return the requested element
@ -583,7 +583,7 @@ public:
// The cursor must have at least one element of this type behind // The cursor must have at least one element of this type behind
if (m_Cur < sizeof(T)) 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); sizeof(T), m_Cur);
} }
// Return the requested element // Return the requested element
@ -598,13 +598,13 @@ public:
// Make sure that the buffer can host at least one element of this type // Make sure that the buffer can host at least one element of this type
if (m_Cap < sizeof(T)) 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)); m_Cap, sizeof(T));
} }
// There must be buffer left for at least two elements of this type after the cursor // 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) 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); sizeof(T), m_Cur + sizeof(T), m_Cap);
} }
// Return the requested element // Return the requested element
@ -619,13 +619,13 @@ public:
// Make sure that the buffer can host at least one element of this type // Make sure that the buffer can host at least one element of this type
if (m_Cap < sizeof(T)) 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)); m_Cap, sizeof(T));
} }
// There must be buffer left for at least two elements of this type after the cursor // 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) 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); sizeof(T), m_Cur + sizeof(T), m_Cap);
} }
// Return the requested element // Return the requested element
@ -706,7 +706,7 @@ public:
// See if the requested capacity doesn't exceed the limit // See if the requested capacity doesn't exceed the limit
if (n > Max< T >()) 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? // Is there an existing buffer?
else if (n && !m_Cap) else if (n && !m_Cap)

View File

@ -133,7 +133,7 @@ void SqThrowLastF(const SQChar * msg, ...)
if(error_num == 0) if(error_num == 0)
{ {
// Invoker is responsible for making sure this doesn't happen! // 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 // The resulted message buffer
LPSTR msg_buff = nullptr; LPSTR msg_buff = nullptr;
@ -147,7 +147,7 @@ void SqThrowLastF(const SQChar * msg, ...)
//Free the message buffer //Free the message buffer
LocalFree(msg_buff); LocalFree(msg_buff);
// Now it's safe to throw the error // Now it's safe to throw the error
SqThrowF("{} [{}]", b.Data(), message); SqThrowF(fmt::runtime("{} [{}]"), b.Data(), message);
#else #else
SqThrowF("{} [{}]", b.Data(), std::strerror(errno)); SqThrowF("{} [{}]", b.Data(), std::strerror(errno));
#endif // SQMOD_OS_WINDOWS #endif // SQMOD_OS_WINDOWS

View File

@ -99,7 +99,7 @@ void ScriptSrc::Process()
// Read completely? // Read completely?
if (r != static_cast< size_t >(length)) 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 // Where the last line ended
size_t line_start = 0, line_end = 0; size_t line_start = 0, line_end = 0;

View File

@ -6,7 +6,7 @@
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
#include <fmt/args.h> #include <fmt/args.h>
#include <fmt/format.h> #include <fmt/format.h>
#include <fmt/locale.h> #include <fmt/xchar.h>
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
namespace SqMod { namespace SqMod {

View File

@ -329,7 +329,7 @@ LightObj GetEntryAsString(const MMDB_entry_data_s & ed)
switch (ed.type) switch (ed.type)
{ {
case MMDB_DATA_TYPE_POINTER: { 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; } break;
case MMDB_DATA_TYPE_UTF8_STRING: { case MMDB_DATA_TYPE_UTF8_STRING: {
sq_pushstring(vm, ed.utf8_string, ed.data_size); sq_pushstring(vm, ed.utf8_string, ed.data_size);
@ -452,7 +452,7 @@ void SockAddr::Validate() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid sockaddr structure handle"); SqThrowF(fmt::runtime("Invalid sockaddr structure handle"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -559,7 +559,7 @@ void Database::Validate() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference"); SqThrowF(fmt::runtime("Invalid Maxmind database reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -695,7 +695,7 @@ void Description::Validate() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference"); SqThrowF(fmt::runtime("Invalid Maxmind database reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -720,7 +720,7 @@ Description::Pointer Description::GetValid() const
// Validate the referenced description // Validate the referenced description
if (!m_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 the description pointer
return m_Description; return m_Description;
@ -755,7 +755,7 @@ void EntryData::Validate() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference"); SqThrowF(fmt::runtime("Invalid Maxmind database reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -780,7 +780,7 @@ EntryData::ConstRef EntryData::GetValid() const
// See if the entry has any data // See if the entry has any data
if (!m_Entry.has_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 the entry
return m_Entry; return m_Entry;
@ -829,7 +829,7 @@ void EntryDataList::Validate() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference"); SqThrowF(fmt::runtime("Invalid Maxmind database reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -854,7 +854,7 @@ EntryDataList::Pointer EntryDataList::GetValid() const
// Validate the managed list // Validate the managed list
if (!m_List) if (!m_List)
{ {
SqThrowF("Invalid Maxmind entry data list reference"); SqThrowF(fmt::runtime("Invalid Maxmind entry data list reference"));
} }
// return the list // return the list
return m_List; return m_List;
@ -881,7 +881,7 @@ EntryDataList::Pointer EntryDataList::GetValidElem() const
// Validate the current element // Validate the current element
if (!m_List) if (!m_List)
{ {
SqThrowF("Invalid Maxmind entry data element reference"); SqThrowF(fmt::runtime("Invalid Maxmind entry data element reference"));
} }
// return the element // return the element
return m_Elem; return m_Elem;
@ -987,7 +987,7 @@ void LookupResult::Validate() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference"); SqThrowF(fmt::runtime("Invalid Maxmind database reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -1147,7 +1147,7 @@ void Metadata::Validate() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference"); SqThrowF(fmt::runtime("Invalid Maxmind database reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -1172,7 +1172,7 @@ Metadata::Pointer Metadata::GetValid() const
// Validate the referenced meta-data // Validate the referenced meta-data
if (!m_Metadata) if (!m_Metadata)
{ {
SqThrowF("Invalid Maxmind meta-data reference"); SqThrowF(fmt::runtime("Invalid Maxmind meta-data reference"));
} }
// Return the meta-data pointer // Return the meta-data pointer
return m_Metadata; return m_Metadata;
@ -1219,7 +1219,7 @@ void SearchNode::Validate() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference"); SqThrowF(fmt::runtime("Invalid Maxmind database reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG

View File

@ -1631,7 +1631,7 @@ void Connection::Validate() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid MySQL connection reference"); SqThrowF(fmt::runtime("Invalid MySQL connection reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -1654,11 +1654,11 @@ void Connection::ValidateCreated() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid MySQL connection reference"); SqThrowF(fmt::runtime("Invalid MySQL connection reference"));
} }
else if (m_Handle->mPtr == nullptr) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid MySQL connection"); SqThrowF(fmt::runtime("Invalid MySQL connection"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -1976,12 +1976,12 @@ void Field::Validate() const
// Do we have a valid result-set handle? // Do we have a valid result-set handle?
if (!m_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? // Are we pointing to a valid index?
else if (m_Index >= m_Handle->mFieldCount) 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 #endif // _DEBUG
@ -2004,7 +2004,7 @@ void Field::ValidateCreated() const
// Do we have a valid result-set handle? // Do we have a valid result-set handle?
if (!m_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? // Are we pointing to a valid index?
m_Handle->ValidateField(m_Index); m_Handle->ValidateField(m_Index);
@ -2034,12 +2034,12 @@ void Field::ValidateStepped() const
// Do we have a valid result-set handle? // Do we have a valid result-set handle?
if (!m_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? // Do we have a valid row available?
else if (m_Handle->mRow == nullptr) 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? // Are we pointing to a valid index?
m_Handle->ValidateField(m_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? // Do we have a valid result-set handle?
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid MySQL result-set reference"); SqThrowF(fmt::runtime("Invalid MySQL result-set reference"));
} }
// Validate the specified field index // Validate the specified field index
m_Handle->ValidateField(idx); m_Handle->ValidateField(idx);
@ -2480,7 +2480,7 @@ void ResultSet::Validate() const
// Do we have a valid result-set handle? // Do we have a valid result-set handle?
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid MySQL result-set reference"); SqThrowF(fmt::runtime("Invalid MySQL result-set reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -2505,11 +2505,11 @@ void ResultSet::ValidateCreated() const
// Do we have a valid result-set handle? // Do we have a valid result-set handle?
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid MySQL result-set reference"); SqThrowF(fmt::runtime("Invalid MySQL result-set reference"));
} }
else if (m_Handle->mPtr == nullptr) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid MySQL result-set"); SqThrowF(fmt::runtime("Invalid MySQL result-set"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -2535,12 +2535,12 @@ void ResultSet::ValidateStepped() const
// Do we have a valid result-set handle? // Do we have a valid result-set handle?
if (!m_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? // Do we have a valid row available?
else if (m_Handle->mRow == nullptr) 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 #endif // _DEBUG
@ -2761,7 +2761,7 @@ void Statement::Validate() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid MySQL statement reference"); SqThrowF(fmt::runtime("Invalid MySQL statement reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -2784,11 +2784,11 @@ void Statement::ValidateCreated() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid MySQL statement reference"); SqThrowF(fmt::runtime("Invalid MySQL statement reference"));
} }
else if (m_Handle->mPtr == nullptr) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid MySQL statement"); SqThrowF(fmt::runtime("Invalid MySQL statement"));
} }
} }
#endif // _DEBUG #endif // _DEBUG

View File

@ -903,7 +903,7 @@ void SQLiteConnection::Validate() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid SQLite connection reference"); SqThrowF(fmt::runtime("Invalid SQLite connection reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -926,11 +926,11 @@ void SQLiteConnection::ValidateCreated() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid SQLite connection reference"); SqThrowF(fmt::runtime("Invalid SQLite connection reference"));
} }
else if (m_Handle->mPtr == nullptr) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid SQLite connection"); SqThrowF(fmt::runtime("Invalid SQLite connection"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -1241,12 +1241,12 @@ void SQLiteParameter::Validate() const
// Are we pointing to a valid index? // Are we pointing to a valid index?
if (m_Index < 0) 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? // Do we have a valid statement handle?
else if (!m_Handle) else if (!m_Handle)
{ {
SqThrowF("Invalid SQLite statement reference"); SqThrowF(fmt::runtime("Invalid SQLite statement reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -1275,15 +1275,15 @@ void SQLiteParameter::ValidateCreated() const
// Are we pointing to a valid index? // Are we pointing to a valid index?
if (m_Index < 0) if (m_Index < 0)
{ {
SqThrowF("Invalid column index: {} < 0", m_Index); SqThrowF(fmt::runtime("Invalid column index: {} < 0"), m_Index);
} }
else if (!m_Handle) else if (!m_Handle)
{ {
SqThrowF("Invalid SQLite statement reference"); SqThrowF(fmt::runtime("Invalid SQLite statement reference"));
} }
else if (m_Handle->mPtr == nullptr) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid SQLite statement"); SqThrowF(fmt::runtime("Invalid SQLite statement"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -1337,7 +1337,7 @@ void SQLiteParameter::ValidateParam(int32_t idx) const
// Is the specified index in range? // Is the specified index in range?
if (!m_Handle->CheckParameter(idx)) 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 #endif // _DEBUG
@ -1947,12 +1947,12 @@ void SQLiteColumn::Validate() const
// Are we pointing to a valid index? // Are we pointing to a valid index?
if (m_Index < 0) 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? // Do we have a valid statement handle?
else if (!m_Handle) else if (!m_Handle)
{ {
SqThrowF("Invalid SQLite statement reference"); SqThrowF(fmt::runtime("Invalid SQLite statement reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -1981,15 +1981,15 @@ void SQLiteColumn::ValidateCreated() const
// Are we pointing to a valid index? // Are we pointing to a valid index?
if (m_Index < 0) if (m_Index < 0)
{ {
SqThrowF("Invalid column index: {} < 0", m_Index); SqThrowF(fmt::runtime("Invalid column index: {} < 0"), m_Index);
} }
else if (!m_Handle) else if (!m_Handle)
{ {
SqThrowF("Invalid SQLite statement reference"); SqThrowF(fmt::runtime("Invalid SQLite statement reference"));
} }
else if (m_Handle->mPtr == nullptr) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid SQLite statement"); SqThrowF(fmt::runtime("Invalid SQLite statement"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -2043,7 +2043,7 @@ void SQLiteColumn::ValidateColumn(int32_t idx) const
// Is the specified index in range? // Is the specified index in range?
if (!m_Handle->CheckColumn(idx)) 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 #endif // _DEBUG
@ -2415,7 +2415,7 @@ void SQLiteStatement::Validate() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid SQLite statement reference"); SqThrowF(fmt::runtime("Invalid SQLite statement reference"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -2438,11 +2438,11 @@ void SQLiteStatement::ValidateCreated() const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid SQLite statement reference"); SqThrowF(fmt::runtime("Invalid SQLite statement reference"));
} }
else if (m_Handle->mPtr == nullptr) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid SQLite statement"); SqThrowF(fmt::runtime("Invalid SQLite statement"));
} }
} }
#endif // _DEBUG #endif // _DEBUG
@ -2495,7 +2495,7 @@ void SQLiteStatement::ValidateColumn(int32_t idx) const
// Is the specified index in range? // Is the specified index in range?
if (!m_Handle->CheckColumn(idx)) 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 #endif // _DEBUG
@ -2518,7 +2518,7 @@ void SQLiteStatement::ValidateParam(int32_t idx) const
// Is the specified index in range? // Is the specified index in range?
if (!m_Handle->CheckParameter(idx)) 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 #endif // _DEBUG
@ -2541,7 +2541,7 @@ void SQLiteStatement::ValidateRow() const
// Do we have any rows available? // Do we have any rows available?
if (!m_Handle->mGood) if (!m_Handle->mGood)
{ {
SqThrowF("No row available"); SqThrowF(fmt::runtime("No row available"));
} }
} }
#endif // _DEBUG #endif // _DEBUG

View File

@ -529,7 +529,7 @@ enum EntityType
#define STHROWLASTF(m, ...) SqThrowLastF(m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] ", ##__VA_ARGS__) #define STHROWLASTF(m, ...) SqThrowLastF(m " =>[" __FILE__ ":" SQMOD_STRINGIZEWRAP(__LINE__) "] ", ##__VA_ARGS__)
#else #else
#define STHROW(e, m, ...) throw e(m, ##__VA_ARGS__) #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__) #define STHROWLASTF(m, ...) SqThrowLastF(m, ##__VA_ARGS__)
#endif // _DEBUG #endif // _DEBUG