summaryrefslogtreecommitdiff
path: root/plugins/Boltun/src
diff options
context:
space:
mode:
authorGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:03:31 +0100
committerGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:07:33 +0100
commita7c24ca48995cf2bf436156302f96b91bf135409 (patch)
tree953835509ff1b778833e78fd7b74b05e05e77c84 /plugins/Boltun/src
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/Boltun/src')
-rw-r--r--plugins/Boltun/src/Engine/Mind.cpp2
-rw-r--r--plugins/Boltun/src/actionQueue.cpp12
-rw-r--r--plugins/Boltun/src/boltun.cpp22
3 files changed, 18 insertions, 18 deletions
diff --git a/plugins/Boltun/src/Engine/Mind.cpp b/plugins/Boltun/src/Engine/Mind.cpp
index cfee26fbf0..59ca243b41 100644
--- a/plugins/Boltun/src/Engine/Mind.cpp
+++ b/plugins/Boltun/src/Engine/Mind.cpp
@@ -102,7 +102,7 @@ void Mind::Load(wstring filename)
file.open(filename.c_str(), ios_base::in | ios_base::binary);
wstring s1, st;
- wchar_t *c, *co = NULL;
+ wchar_t *c, *co = nullptr;
size_t count;
int error = 0;
int line = 1;
diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp
index f45a362dd8..ea9b89d215 100644
--- a/plugins/Boltun/src/actionQueue.cpp
+++ b/plugins/Boltun/src/actionQueue.cpp
@@ -37,7 +37,7 @@ typedef struct _QueueElement {
ActionHandler Handler;
bool Sticky;
int TimeOffset;
- _QueueElement(MCONTACT contact, ActionHandler handler, int timeOffset, const TalkBot::MessageInfo *info = NULL, bool sticky = false)
+ _QueueElement(MCONTACT contact, ActionHandler handler, int timeOffset, const TalkBot::MessageInfo *info = nullptr, bool sticky = false)
:hContact(contact), Handler(handler), TimeOffset(timeOffset), inf(info), Sticky(sticky)
{
}
@@ -66,9 +66,9 @@ VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
void UpdateTimer()
{
if (timerID)
- KillTimer(NULL, timerID);
+ KillTimer(nullptr, timerID);
if (actionQueue.size())
- timerID = SetTimer(NULL, 0, actionQueue.front().TimeOffset, TimerProc);
+ timerID = SetTimer(nullptr, 0, actionQueue.front().TimeOffset, TimerProc);
else
timerID = 0;
}
@@ -94,7 +94,7 @@ static void TimerAnswer(MCONTACT hContact, const TalkBot::MessageInfo* info)
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT;
dbei.szModule = BOLTUN_NAME;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
db_event_add(hContact, &dbei);
bot->AnswerGiven(hContact, *info);
@@ -148,7 +148,7 @@ void DoAnswer(MCONTACT hContact, const TalkBot::MessageInfo *info, bool sticky =
if (!actionQueue.empty() && actionQueue.front().hContact == hContact)
{
needTimerRearrange = true;
- KillTimer(NULL, timerID);
+ KillTimer(nullptr, timerID);
}
if (!actionQueue.empty())
{
@@ -184,7 +184,7 @@ void DoAnswer(MCONTACT hContact, const TalkBot::MessageInfo *info, bool sticky =
if (actionQueue.empty())
needTimerRearrange = true;
if (thinkTime)
- actionQueue.push_back(QueueElement(hContact, StartTyping, thinkTime, NULL, sticky));
+ actionQueue.push_back(QueueElement(hContact, StartTyping, thinkTime, nullptr, sticky));
actionQueue.push_back(QueueElement(hContact, TimerAnswer, waitTime, info, sticky));
if (needTimerRearrange)
UpdateTimer();
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp
index 920d325940..0c9e889d7b 100644
--- a/plugins/Boltun/src/boltun.cpp
+++ b/plugins/Boltun/src/boltun.cpp
@@ -22,7 +22,7 @@
int hLangpack;
-TalkBot* bot = NULL;
+TalkBot* bot = nullptr;
#define MAX_WARN_TEXT 1024
#define MAX_MIND_FILE 1024
@@ -80,7 +80,7 @@ wchar_t* GetFullName(const wchar_t *filename)
static bool LoadMind(const wchar_t* filename, int &line)
{
wchar_t* fullname = GetFullName(filename);
- HCURSOR newCur = LoadCursor(NULL, MAKEINTRESOURCE(IDC_WAIT));
+ HCURSOR newCur = LoadCursor(nullptr, MAKEINTRESOURCE(IDC_WAIT));
HCURSOR oldCur = SetCursor(newCur);
#ifdef DEBUG_LOAD_TIME
unsigned __int64 t = __rdtsc();
@@ -207,7 +207,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
return 0;
dbei.pBlob = (PBYTE)malloc(dbei.cbBlob);
- if (dbei.pBlob == NULL)
+ if (dbei.pBlob == nullptr)
return 0;
db_event_get(hDbEvent, &dbei);
@@ -402,7 +402,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
if (!bTranslated) {
wchar_t message[5000];
mir_snwprintf(message, TranslateW(FAILED_TO_LOAD_BASE), line, c);
- MessageBox(NULL, message, TranslateW(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK);
+ MessageBox(nullptr, message, TranslateW(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK);
}
}
break;
@@ -508,14 +508,14 @@ static int MessagePrebuild(WPARAM hContact, LPARAM)
}
else {
if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE))
- Menu_ModifyItem(hMenuItemAutoChat, NULL, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
+ Menu_ModifyItem(hMenuItemAutoChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
else
- Menu_ModifyItem(hMenuItemAutoChat, NULL, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);
+ Menu_ModifyItem(hMenuItemAutoChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);
if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE))
- Menu_ModifyItem(hMenuItemNotToChat, NULL, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
+ Menu_ModifyItem(hMenuItemNotToChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
else
- Menu_ModifyItem(hMenuItemNotToChat, NULL, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);
+ Menu_ModifyItem(hMenuItemNotToChat, nullptr, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);
}
return 0;
}
@@ -559,7 +559,7 @@ extern "C" int __declspec(dllexport) Load(void)
SET_UID(mi, 0x9e0117f3, 0xb7df, 0x4f1b, 0xae, 0xec, 0xc4, 0x72, 0x59, 0x72, 0xc8, 0x58);
mi.flags = CMIF_NOTOFFLINE;
mi.position = -50010000; //TODO: check the warning
- mi.hIcolibItem = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_RECVMSG));
+ mi.hIcolibItem = LoadIcon(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_RECVMSG));
mi.name.a = BOLTUN_START_CHATTING;
mi.pszService = SERV_CONTACT_START_CHATTING;
hMenuItemStartChatting = Menu_AddContactMenuItem(&mi);
@@ -570,7 +570,7 @@ extern "C" int __declspec(dllexport) Load(void)
if (!blInit) {
wchar_t path[2000];
mir_snwprintf(path, TranslateW(FAILED_TO_LOAD_BASE), line, (const wchar_t*)Config.MindFileName);
- MessageBox(NULL, path, TranslateW(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK);
+ MessageBox(nullptr, path, TranslateW(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK);
}
return 0;
}
@@ -578,7 +578,7 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
if (pTimer)
- KillTimer(NULL, pTimer);
+ KillTimer(nullptr, pTimer);
if (blInit) {
#if 0 //No need to save, we don't have studying algorithm
if (Config.MindFileName && !SaveMind(Config.MindFileName)) {