feat(Core/Common): add support fmt style for ASSERT and ABORT (#10355)
* feat(Core/Common): add support fmt style for ASSERT and ABORT * correct CheckCompactArrayMaskOverflow * 1 * Update src/server/game/Spells/Spell.cpp
This commit is contained in:
@@ -262,7 +262,7 @@ std::vector<uint8> Field::GetBinary() const
|
||||
|
||||
void Field::GetBinarySizeChecked(uint8* buf, size_t length) const
|
||||
{
|
||||
ASSERT(data.value && (data.length == length), "Expected %zu-byte binary blob, got %sdata (%u bytes) instead", length, data.value ? "" : "no ", data.length);
|
||||
ASSERT(data.value && (data.length == length), "Expected {}-byte binary blob, got {}data ({} bytes) instead", length, data.value ? "" : "no ", data.length);
|
||||
memcpy(buf, data.value, length);
|
||||
}
|
||||
|
||||
|
||||
@@ -467,8 +467,8 @@ uint32 MySQLConnection::GetServerVersion() const
|
||||
|
||||
MySQLPreparedStatement* MySQLConnection::GetPreparedStatement(uint32 index)
|
||||
{
|
||||
ASSERT(index < m_stmts.size(), "Tried to access invalid prepared statement index %u (max index " SZFMTD ") on database `%s`, connection type: %s",
|
||||
index, m_stmts.size(), m_connectionInfo.database.c_str(), (m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous");
|
||||
ASSERT(index < m_stmts.size(), "Tried to access invalid prepared statement index {} (max index {}) on database `{}`, connection type: {}",
|
||||
index, m_stmts.size(), m_connectionInfo.database, (m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous");
|
||||
MySQLPreparedStatement* ret = m_stmts[index].get();
|
||||
if (!ret)
|
||||
LOG_ERROR("sql.sql", "Could not fetch prepared statement %u on database `%s`, connection type: %s.",
|
||||
|
||||
@@ -37,7 +37,7 @@ bool SQLQueryHolderBase::SetPreparedQueryImpl(size_t index, PreparedStatementBas
|
||||
PreparedQueryResult SQLQueryHolderBase::GetPreparedResult(size_t index) const
|
||||
{
|
||||
// Don't call to this function if the index is of a prepared statement
|
||||
ASSERT(index < m_queries.size(), "Query holder result index out of range, tried to access index " SZFMTD " but there are only " SZFMTD " results",
|
||||
ASSERT(index < m_queries.size(), "Query holder result index out of range, tried to access index {} but there are only {} results",
|
||||
index, m_queries.size());
|
||||
|
||||
return m_queries[index].second;
|
||||
|
||||
@@ -675,7 +675,7 @@ void Pet::Update(uint32 diff)
|
||||
if (owner->GetPetGUID() != GetGUID())
|
||||
{
|
||||
LOG_ERROR("entities.pet", "Pet %u is not pet of owner %s, removed", GetEntry(), GetOwner()->GetName().c_str());
|
||||
ASSERT(getPetType() != HUNTER_PET, "Unexpected unlinked pet found for owner %s", owner->GetSession()->GetPlayerInfo().c_str());
|
||||
ASSERT(getPetType() != HUNTER_PET, "Unexpected unlinked pet found for owner {}", owner->GetSession()->GetPlayerInfo());
|
||||
Remove(PET_SAVE_NOT_IN_SLOT);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,5 +66,5 @@ WorldPackets::PacketArrayMaxCapacityException::PacketArrayMaxCapacityException(s
|
||||
|
||||
void WorldPackets::CheckCompactArrayMaskOverflow(std::size_t index, std::size_t limit)
|
||||
{
|
||||
ASSERT(index < limit, "Attempted to insert " SZFMTD " values into CompactArray but it can only hold " SZFMTD, index, limit);
|
||||
ASSERT(index < limit, "Attempted to insert {} values into CompactArray but it can only hold {}", index, limit);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
|
||||
// Check if sql index pos is valid
|
||||
if (int32(result->GetFieldCount() - 1) < _sqlIndexPos)
|
||||
{
|
||||
ASSERT(false, "Invalid index pos for dbc: '%s'", _sqlTableName);
|
||||
ASSERT(false, "Invalid index pos for dbc: '{}'", _sqlTableName);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -106,14 +106,14 @@ char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
|
||||
case FT_NA:
|
||||
break;
|
||||
default:
|
||||
ASSERT(false, "Unsupported data type '%c' in table '%s'", *dbcFormat, _sqlTableName);
|
||||
ASSERT(false, "Unsupported data type '%c' in table '{}'", *dbcFormat, _sqlTableName);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
++sqlColumnNumber;
|
||||
}
|
||||
|
||||
ASSERT(sqlColumnNumber == result->GetFieldCount(), "SQL format string does not match database for table: '%s'", _sqlTableName);
|
||||
ASSERT(sqlColumnNumber == result->GetFieldCount(), "SQL format string does not match database for table: '{}'", _sqlTableName);
|
||||
ASSERT(dataOffset == _recordSize);
|
||||
} while (result->NextRow());
|
||||
|
||||
|
||||
@@ -110,8 +110,8 @@ uint32 ByteBuffer::ReadPackedTime()
|
||||
|
||||
void ByteBuffer::append(uint8 const* src, size_t cnt)
|
||||
{
|
||||
ASSERT(src, "Attempted to put a NULL-pointer in ByteBuffer (pos: " SZFMTD " size: " SZFMTD ")", _wpos, size());
|
||||
ASSERT(cnt, "Attempted to put a zero-sized value in ByteBuffer (pos: " SZFMTD " size: " SZFMTD ")", _wpos, size());
|
||||
ASSERT(src, "Attempted to put a NULL-pointer in ByteBuffer (pos: {} size: {})", _wpos, size());
|
||||
ASSERT(cnt, "Attempted to put a zero-sized value in ByteBuffer (pos: {} size: {})", _wpos, size());
|
||||
ASSERT(size() < 10000000);
|
||||
|
||||
size_t const newSize = _wpos + cnt;
|
||||
@@ -143,9 +143,9 @@ void ByteBuffer::AppendPackedTime(time_t time)
|
||||
|
||||
void ByteBuffer::put(size_t pos, uint8 const* src, size_t cnt)
|
||||
{
|
||||
ASSERT(pos + cnt <= size(), "Attempted to put value with size: " SZFMTD " in ByteBuffer (pos: " SZFMTD " size: " SZFMTD ")", cnt, pos, size());
|
||||
ASSERT(src, "Attempted to put a NULL-pointer in ByteBuffer (pos: " SZFMTD " size: " SZFMTD ")", pos, size());
|
||||
ASSERT(cnt, "Attempted to put a zero-sized value in ByteBuffer (pos: " SZFMTD " size: " SZFMTD ")", pos, size());
|
||||
ASSERT(pos + cnt <= size(), "Attempted to put value with size: {} in ByteBuffer (pos: {} size: {})", cnt, pos, size());
|
||||
ASSERT(src, "Attempted to put a NULL-pointer in ByteBuffer (pos: {} size: {})", pos, size());
|
||||
ASSERT(cnt, "Attempted to put a zero-sized value in ByteBuffer (pos: {} size: {})", pos, size());
|
||||
|
||||
std::memcpy(&_storage[pos], src, cnt);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user