mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 00:08:01 +00:00
refactor(Core/Misc): enforce east-const style and add codestyle check (#26492)
Co-authored-by: Ludwig <sudlud@users.noreply.github.com>
This commit is contained in:
@@ -399,7 +399,7 @@ int MySQLConnection::ExecuteTransaction(std::shared_ptr<TransactionBase> transac
|
||||
{
|
||||
stmt = std::get<PreparedStatementBase*>(data.element);
|
||||
}
|
||||
catch (const std::bad_variant_access& ex)
|
||||
catch (std::bad_variant_access const& ex)
|
||||
{
|
||||
LOG_FATAL("sql.sql", "> PreparedStatementBase not found in SQLElementData. {}", ex.what());
|
||||
ABORT();
|
||||
@@ -424,7 +424,7 @@ int MySQLConnection::ExecuteTransaction(std::shared_ptr<TransactionBase> transac
|
||||
{
|
||||
sql = std::get<std::string>(data.element);
|
||||
}
|
||||
catch (const std::bad_variant_access& ex)
|
||||
catch (std::bad_variant_access const& ex)
|
||||
{
|
||||
LOG_FATAL("sql.sql", "> std::string not found in SQLElementData. {}", ex.what());
|
||||
ABORT();
|
||||
@@ -453,7 +453,7 @@ int MySQLConnection::ExecuteTransaction(std::shared_ptr<TransactionBase> transac
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::size_t MySQLConnection::EscapeString(char* to, const char* from, std::size_t length)
|
||||
std::size_t MySQLConnection::EscapeString(char* to, char const* from, std::size_t length)
|
||||
{
|
||||
return mysql_real_escape_string(m_Mysql, to, from, length);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
void RollbackTransaction();
|
||||
void CommitTransaction();
|
||||
int ExecuteTransaction(std::shared_ptr<TransactionBase> transaction);
|
||||
std::size_t EscapeString(char* to, const char* from, std::size_t length);
|
||||
std::size_t EscapeString(char* to, char const* from, std::size_t length);
|
||||
void Ping();
|
||||
|
||||
uint32 GetLastError();
|
||||
|
||||
@@ -39,7 +39,7 @@ struct ResultIterator
|
||||
pointer operator->() { return _ptr; }
|
||||
ResultIterator& operator++() { if (!_ptr->NextRow()) _ptr = nullptr; return *this; }
|
||||
|
||||
bool operator!=(const ResultIterator& right) { return _ptr != right._ptr; }
|
||||
bool operator!=(ResultIterator const& right) { return _ptr != right._ptr; }
|
||||
|
||||
private:
|
||||
pointer _ptr;
|
||||
|
||||
@@ -66,7 +66,7 @@ void TransactionBase::Cleanup()
|
||||
|
||||
delete stmt;
|
||||
}
|
||||
catch (const std::bad_variant_access& ex)
|
||||
catch (std::bad_variant_access const& ex)
|
||||
{
|
||||
LOG_FATAL("sql.sql", "> PreparedStatementBase not found in SQLElementData. {}", ex.what());
|
||||
ABORT();
|
||||
@@ -79,7 +79,7 @@ void TransactionBase::Cleanup()
|
||||
{
|
||||
std::get<std::string>(data.element).clear();
|
||||
}
|
||||
catch (const std::bad_variant_access& ex)
|
||||
catch (std::bad_variant_access const& ex)
|
||||
{
|
||||
LOG_FATAL("sql.sql", "> std::string not found in SQLElementData. {}", ex.what());
|
||||
ABORT();
|
||||
|
||||
@@ -175,7 +175,7 @@ bool DBUpdater<T>::Create(DatabaseWorkerPool<T>& pool)
|
||||
{
|
||||
LOG_WARN("sql.updates", "Database \"{}\" does not exist", pool.GetConnectionInfo()->database);
|
||||
|
||||
const char* disableInteractive = std::getenv("AC_DISABLE_INTERACTIVE");
|
||||
char const* disableInteractive = std::getenv("AC_DISABLE_INTERACTIVE");
|
||||
|
||||
if (!sConfigMgr->isDryRun() && (disableInteractive == nullptr || std::strcmp(disableInteractive, "1") != 0))
|
||||
{
|
||||
@@ -402,7 +402,7 @@ bool DBUpdater<T>::Populate(DatabaseWorkerPool<T>& pool)
|
||||
|
||||
std::vector<std::filesystem::path> sqlFiles;
|
||||
|
||||
for (const auto &entry : std::filesystem::directory_iterator(DirPath))
|
||||
for (auto const& entry : std::filesystem::directory_iterator(DirPath))
|
||||
{
|
||||
if (entry.path().extension() == ".sql")
|
||||
sqlFiles.push_back(entry.path());
|
||||
@@ -410,7 +410,7 @@ bool DBUpdater<T>::Populate(DatabaseWorkerPool<T>& pool)
|
||||
|
||||
std::sort(sqlFiles.begin(), sqlFiles.end());
|
||||
|
||||
for (const auto &file : sqlFiles)
|
||||
for (auto const& file : sqlFiles)
|
||||
{
|
||||
LOG_INFO("sql.updates", ">> Applying \'{}\'...", file.filename().generic_string());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user