diff options
author | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:03:31 +0100 |
---|---|---|
committer | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-11-13 15:07:33 +0100 |
commit | a7c24ca48995cf2bf436156302f96b91bf135409 (patch) | |
tree | 953835509ff1b778833e78fd7b74b05e05e77c84 /plugins/BuddyExpectator/src | |
parent | 591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff) |
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/BuddyExpectator/src')
-rw-r--r-- | plugins/BuddyExpectator/src/BuddyExpectator.cpp | 22 | ||||
-rw-r--r-- | plugins/BuddyExpectator/src/options.cpp | 20 |
2 files changed, 21 insertions, 21 deletions
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 0814711a6e..d8b1ef3749 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -74,7 +74,7 @@ time_t getLastSeen(MCONTACT hContact) void setLastSeen(MCONTACT hContact)
{
- db_set_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)time(NULL));
+ db_set_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)time(nullptr));
if (db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0))
db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0);
}
@@ -214,7 +214,7 @@ bool isContactGoneFor(MCONTACT hContact, int days) {
time_t lastSeen = getLastSeen(hContact);
time_t lastInputMsg = getLastInputMsg(hContact);
- time_t currentTime = time(NULL);
+ time_t currentTime = time(nullptr);
int daysSinceOnline = -1;
if (lastSeen != -1) daysSinceOnline = (int)((currentTime - lastSeen) / (60 * 60 * 24));
@@ -271,7 +271,7 @@ void ReturnNotify(MCONTACT hContact, wchar_t *message) ppd.colorText = options.iPopupColorFore;
}
ppd.PluginWindowProc = PopupDlgProc;
- ppd.PluginData = NULL;
+ ppd.PluginData = nullptr;
ppd.iSeconds = options.iPopupDelay;
PUAddPopupT(&ppd);
}
@@ -308,7 +308,7 @@ void GoneNotify(MCONTACT hContact, wchar_t *message) ppd.colorText = options.iPopupColorFore;
}
ppd.PluginWindowProc = PopupDlgProcNoSet;
- ppd.PluginData = NULL;
+ ppd.PluginData = nullptr;
ppd.iSeconds = options.iPopupDelay;
PUAddPopupT(&ppd);
@@ -463,7 +463,7 @@ int SettingChanged(WPARAM hContact, LPARAM lParam) return 0;
char *proto = GetContactProto(hContact);
- if (proto == 0 || (db_get_b(hContact, proto, "ChatRoom", 0) == 1)
+ if (proto == nullptr || (db_get_b(hContact, proto, "ChatRoom", 0) == 1)
|| !(CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
return 0;
@@ -491,7 +491,7 @@ int SettingChanged(WPARAM hContact, LPARAM lParam) ppd.colorText = options.iPopupColorFore;
}
ppd.PluginWindowProc = MissYouPopupDlgProc;
- ppd.PluginData = NULL;
+ ppd.PluginData = nullptr;
ppd.iSeconds = -1;
missyouactions[0].flags = PAF_ENABLED;
@@ -579,7 +579,7 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) int ModulesLoaded2(WPARAM, LPARAM)
{
// check for 'still absent' contacts on startup
- TimerProc(0, 0, 0, 0);
+ TimerProc(nullptr, 0, 0, 0);
return 0;
}
@@ -597,7 +597,7 @@ int ModulesLoaded(WPARAM, LPARAM) Skin_AddSound("buddyExpectatorMissYou", LPGENW("BuddyExpectator"), LPGENW("Miss you event"));
Skin_AddSound("buddyExpectatorHide", LPGENW("BuddyExpectator"), LPGENW("Hide contact event"));
- timer_id = SetTimer(0, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours
+ timer_id = SetTimer(nullptr, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded2);
@@ -641,7 +641,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) int ContactAdded(WPARAM hContact, LPARAM)
{
- db_set_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)time(0));
+ db_set_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)time(nullptr));
return 0;
}
@@ -671,7 +671,7 @@ extern "C" int __declspec(dllexport) Load(void) // ensure all contacts are timestamped
DBVARIANT dbv;
- DWORD current_time = (DWORD)time(0);
+ DWORD current_time = (DWORD)time(nullptr);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if (!db_get(hContact, MODULE_NAME, "CreationTime", &dbv))
@@ -693,7 +693,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
- KillTimer(0, timer_id);
+ KillTimer(nullptr, timer_id);
return 0;
}
diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index 158e328583..d431c5af96 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -203,7 +203,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, switch (nmhdr->code) {
case PSN_APPLY:
//iAbsencePeriod
- int num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, 0, FALSE);
+ int num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE, nullptr, FALSE);
switch (SendDlgItemMessage(hwndDlg, IDC_COMBO_PERIOD, CB_GETCURSEL, 0, 0)) {
case 1: options.iAbsencePeriod = 7 * num; break;
case 2: options.iAbsencePeriod = 30 * num; break;
@@ -212,7 +212,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, }
//iAbsencePeriod2
- num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, 0, FALSE);
+ num = GetDlgItemInt(hwndDlg, IDC_EDIT_ABSENCE2, nullptr, FALSE);
switch (SendDlgItemMessage(hwndDlg, IDC_COMBO_PERIOD2, CB_GETCURSEL, 0, 0)) {
case 1: options.iAbsencePeriod2 = 7 * num; break;
case 2: options.iAbsencePeriod2 = 30 * num; break;
@@ -221,7 +221,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, }
//iSilencePeriod
- num = GetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, 0, FALSE);
+ num = GetDlgItemInt(hwndDlg, IDC_EDIT_SILENTFOR, nullptr, FALSE);
switch (SendDlgItemMessage(hwndDlg, IDC_COMBO_PERIOD3, CB_GETCURSEL, 0, 0)) {
case 1: options.iSilencePeriod = 7 * num; break;
case 2: options.iSilencePeriod = 30 * num; break;
@@ -251,9 +251,9 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0);
// restart timer & run check
- KillTimer(0, timer_id);
- timer_id = SetTimer(0, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours
- TimerProc(0, 0, 0, 0);
+ KillTimer(nullptr, timer_id);
+ timer_id = SetTimer(nullptr, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours
+ TimerProc(nullptr, 0, 0, 0);
return TRUE;
}
break;
@@ -317,7 +317,7 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP memset(&ppd, 0, sizeof(ppd));
//iPopupDelay
- options.iPopupDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 0, FALSE);
+ options.iPopupDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, nullptr, FALSE);
if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERM) == BST_CHECKED)
options.iPopupDelay = -1;
else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_DEF) == BST_CHECKED)
@@ -341,7 +341,7 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP ppd.colorBack = SendDlgItemMessage(hwndDlg, IDC_COLOR_BGR, CPM_GETCOLOUR, 0, 0);
ppd.colorText = SendDlgItemMessage(hwndDlg, IDC_COLOR_FRG, CPM_GETCOLOUR, 0, 0);
}
- ppd.PluginData = NULL;
+ ppd.PluginData = nullptr;
ppd.iSeconds = options.iPopupDelay;
CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, APF_NO_HISTORY);
@@ -409,7 +409,7 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP }
//iPopupDelay
- options.iPopupDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, 0, FALSE);
+ options.iPopupDelay = GetDlgItemInt(hwndDlg, IDC_EDIT_POPUPDELAY, nullptr, FALSE);
if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_PERM) == BST_CHECKED)
options.iPopupDelay = -1;
else if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_DEF) == BST_CHECKED)
@@ -502,7 +502,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lparam)->lParam;
if (hContact)
{
- db_set_dw(hContact, MODULE_NAME, "iAbsencePeriod", GetDlgItemInt(hdlg, IDC_EDITABSENCE, 0, FALSE));
+ db_set_dw(hContact, MODULE_NAME, "iAbsencePeriod", GetDlgItemInt(hdlg, IDC_EDITABSENCE, nullptr, FALSE));
db_set_b(hContact, MODULE_NAME, "MissYou", (IsDlgButtonChecked(hdlg, IDC_CHECK_MISSYOU) == BST_CHECKED) ? 1 : 0);
db_set_b(hContact, MODULE_NAME, "MissYouNotifyAlways", (IsDlgButtonChecked(hdlg, IDC_CHECK_NOTIFYALWAYS) == BST_CHECKED) ? 1 : 0);
db_set_b(hContact, MODULE_NAME, "NeverHide", (IsDlgButtonChecked(hdlg, IDC_CHECK_NEVERHIDE) == BST_CHECKED) ? 1 : 0);
|