mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-16 07:07:13 +02:00
Move away from C format to cpp::fmt.
This commit is contained in:
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -481,7 +481,7 @@ public:
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
STHROWF("%s", e.what()); // Re-package
|
||||
STHROWF("{}", e.what()); // Re-package
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user