refactor(Core): replace NULL with nullptr (#4593)

This commit is contained in:
Kitzunu
2021-03-02 01:34:20 +01:00
committed by GitHub
parent dbefa17a53
commit 28f1dc5c0c
231 changed files with 923 additions and 923 deletions

View File

@@ -116,7 +116,7 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
else if (target_account)
target_sec = AccountMgr::GetSecurity(target_account, realmID);
else
return true; // caller must report error for (target == NULL && target_account == 0)
return true; // caller must report error for (target == nullptr && target_account == 0)
AccountTypes target_ac_sec = AccountTypes(target_sec);
if (m_session->GetSecurity() < target_ac_sec || (strong && m_session->GetSecurity() <= target_ac_sec))
@@ -276,7 +276,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
if (!ExecuteCommandInTable(table[i].ChildCommands, text, fullcmd.c_str()))
{
#ifdef ELUNA
if (!sEluna->OnCommand(GetSession() ? GetSession()->GetPlayer() : NULL, oldtext))
if (!sEluna->OnCommand(GetSession() ? GetSession()->GetPlayer() : nullptr, oldtext))
return true;
#endif
if (text[0] != '\0')
@@ -429,7 +429,7 @@ bool ChatHandler::ParseCommands(char const* text)
if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd))
{
#ifdef ELUNA
if (!sEluna->OnCommand(GetSession() ? GetSession()->GetPlayer() : NULL, text))
if (!sEluna->OnCommand(GetSession() ? GetSession()->GetPlayer() : nullptr, text))
return true;
#endif
if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity()))
@@ -1084,7 +1084,7 @@ std::string ChatHandler::extractPlayerNameFromLink(char* text)
return name;
}
bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* player_guid /*=NULL*/, std::string* player_name /*= NULL*/)
bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* player_guid /*=nullptr*/, std::string* player_name /*= nullptr*/)
{
if (args && *args)
{
@@ -1171,7 +1171,7 @@ char* ChatHandler::extractQuotedArg(char* args)
continue;
}
// return NULL if we reached the end of the string
// return nullptr if we reached the end of the string
if (!*args)
return nullptr;

View File

@@ -93,7 +93,7 @@ public:
char* extractKeyFromLink(char* text, char const* linkType, char** something1 = nullptr);
char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = nullptr);
// if args have single value then it return in arg2 and arg1 == NULL
// if args have single value then it return in arg2 and arg1 == nullptr
void extractOptFirstArg(char* args, char** arg1, char** arg2);
char* extractQuotedArg(char* args);
@@ -103,7 +103,7 @@ public:
bool GetPlayerGroupAndGUIDByName(const char* cname, Player*& player, Group*& group, uint64& guid, bool offline = false);
std::string extractPlayerNameFromLink(char* text);
// select by arg (name/link) or in-game selection online/offline player
bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = nullptr);
bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = nullptr, std::string* player_name = nullptr);
std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:" + name + "|h[" + name + "]|h|r" : name; }
std::string GetNameLink(Player* chr) const;
@@ -123,7 +123,7 @@ protected:
bool ShowHelpForSubCommands(std::vector<ChatCommand> const& table, char const* cmd, char const* subcmd);
private:
WorldSession* m_session; // != NULL for chat command call and NULL for CLI command
WorldSession* m_session; // != nullptr for chat command call and nullptr for CLI command
// common global flag
static bool load_command_table;

View File

@@ -173,7 +173,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
inline std::string ItemChatLink::FormatName(uint8 index, ItemLocale const* locale, char* const* suffixStrings) const
{
std::stringstream ss;
if (locale == NULL || index >= locale->Name.size())
if (locale == nullptr || index >= locale->Name.size())
ss << _item->Name1;
else
ss << locale->Name[index];
@@ -188,7 +188,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context)
char* const* suffixStrings = _suffix ? _suffix->nameSuffix : (_property ? _property->nameSuffix : nullptr);
bool res = (FormatName(LOCALE_enUS, NULL, suffixStrings) == buffer);
bool res = (FormatName(LOCALE_enUS, nullptr, suffixStrings) == buffer);
if (!res)
{