summaryrefslogtreecommitdiff
path: root/plugins/NotesAndReminders
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/NotesAndReminders
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/NotesAndReminders')
-rw-r--r--plugins/NotesAndReminders/src/hotkeys.cpp16
-rw-r--r--plugins/NotesAndReminders/src/main.cpp32
-rw-r--r--plugins/NotesAndReminders/src/miscutils.cpp12
-rw-r--r--plugins/NotesAndReminders/src/notes.cpp170
-rw-r--r--plugins/NotesAndReminders/src/options.cpp28
-rw-r--r--plugins/NotesAndReminders/src/reminders.cpp110
6 files changed, 184 insertions, 184 deletions
diff --git a/plugins/NotesAndReminders/src/hotkeys.cpp b/plugins/NotesAndReminders/src/hotkeys.cpp
index 89e5133846..f04531cd9f 100644
--- a/plugins/NotesAndReminders/src/hotkeys.cpp
+++ b/plugins/NotesAndReminders/src/hotkeys.cpp
@@ -47,7 +47,7 @@ LRESULT CALLBACK NotifyHotKeyWndProc(HWND AHwnd, UINT Message, WPARAM wParam, LP
case WM_TIMER:
KillTimer(HKHwnd, 1026);
BOOL b = CheckRemindersAndStart();
- SetTimer(HKHwnd, 1026, b ? REMINDER_UPDATE_INTERVAL_SHORT : REMINDER_UPDATE_INTERVAL, 0);
+ SetTimer(HKHwnd, 1026, b ? REMINDER_UPDATE_INTERVAL_SHORT : REMINDER_UPDATE_INTERVAL, nullptr);
return FALSE;
}
@@ -57,7 +57,7 @@ LRESULT CALLBACK NotifyHotKeyWndProc(HWND AHwnd, UINT Message, WPARAM wParam, LP
void CreateMsgWindow(void)
{
- HWND hParent = NULL;
+ HWND hParent = nullptr;
WNDCLASSEX TWC = { 0 };
if (!GetClassInfoEx(hmiranda, MSG_WND_CLASS, &TWC)) {
@@ -65,10 +65,10 @@ void CreateMsgWindow(void)
TWC.cbClsExtra = 0;
TWC.cbWndExtra = 0;
TWC.hInstance = hmiranda;
- TWC.hIcon = 0;
- TWC.hCursor = 0;
- TWC.hbrBackground = 0;
- TWC.lpszMenuName = NULL;
+ TWC.hIcon = nullptr;
+ TWC.hCursor = nullptr;
+ TWC.hbrBackground = nullptr;
+ TWC.lpszMenuName = nullptr;
TWC.lpszClassName = MSG_WND_CLASS;
TWC.cbSize = sizeof(TWC);
TWC.lpfnWndProc = NotifyHotKeyWndProc;
@@ -77,8 +77,8 @@ void CreateMsgWindow(void)
hParent = HWND_MESSAGE;
- HKHwnd = CreateWindowEx(WS_EX_TOOLWINDOW, MSG_WND_CLASS, "StickyNotes", 0, 0, 0, 0, 0, hParent, NULL, hmiranda, NULL);
- SetTimer(HKHwnd, 1026, REMINDER_UPDATE_INTERVAL, 0);
+ HKHwnd = CreateWindowEx(WS_EX_TOOLWINDOW, MSG_WND_CLASS, "StickyNotes", 0, 0, 0, 0, 0, hParent, nullptr, hmiranda, nullptr);
+ SetTimer(HKHwnd, 1026, REMINDER_UPDATE_INTERVAL, nullptr);
}
void DestroyMsgWindow(void)
diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp
index e006e4f13b..0ea7fd65e3 100644
--- a/plugins/NotesAndReminders/src/main.cpp
+++ b/plugins/NotesAndReminders/src/main.cpp
@@ -1,16 +1,16 @@
#include "globals.h"
CLIST_INTERFACE *pcli;
-HINSTANCE hinstance = NULL;
-HINSTANCE hmiranda = NULL;
+HINSTANCE hinstance = nullptr;
+HINSTANCE hmiranda = nullptr;
int hLangpack;
-HANDLE hkOptInit = NULL;
-HANDLE hkTopToolbarInit = NULL;
-HANDLE hkModulesLoaded = NULL;
-HANDLE hkFontChange = NULL;
-HANDLE hkColorChange = NULL;
-HMODULE hRichedDll = NULL;
+HANDLE hkOptInit = nullptr;
+HANDLE hkTopToolbarInit = nullptr;
+HANDLE hkModulesLoaded = nullptr;
+HANDLE hkFontChange = nullptr;
+HANDLE hkColorChange = nullptr;
+HMODULE hRichedDll = nullptr;
extern TREEELEMENT *g_Stickies;
extern TREEELEMENT *RemindersList;
@@ -39,7 +39,7 @@ void CloseReminderList();
INT_PTR PluginMenuCommandAddNew(WPARAM, LPARAM)
{
- STICKYNOTE *PSN = NewNote(0,0,0,0,NULL,NULL,TRUE,TRUE,0);
+ STICKYNOTE *PSN = NewNote(0,0,0,0,nullptr,nullptr,TRUE,TRUE,0);
if(PSN)
SetFocus(PSN->REHwnd);
return 0;
@@ -47,7 +47,7 @@ INT_PTR PluginMenuCommandAddNew(WPARAM, LPARAM)
INT_PTR PluginMenuCommandDeleteAll(WPARAM, LPARAM)
{
- if (g_Stickies && MessageBox(NULL, Translate("Are you sure you want to delete all notes?"), Translate(SECTIONNAME), MB_OKCANCEL) == IDOK)
+ if (g_Stickies && MessageBox(nullptr, Translate("Are you sure you want to delete all notes?"), Translate(SECTIONNAME), MB_OKCANCEL) == IDOK)
DeleteNotes();
return 0;
}
@@ -66,7 +66,7 @@ static INT_PTR PluginMenuCommandViewNotes(WPARAM, LPARAM)
static INT_PTR PluginMenuCommandAllBringFront(WPARAM, LPARAM)
{
- BringAllNotesToFront(NULL);
+ BringAllNotesToFront(nullptr);
return 0;
}
@@ -84,7 +84,7 @@ static INT_PTR PluginMenuCommandViewReminders(WPARAM, LPARAM)
static INT_PTR PluginMenuCommandDeleteReminders(WPARAM, LPARAM)
{
- if (RemindersList && MessageBox(NULL, Translate("Are you sure you want to delete all reminders?"), Translate(SECTIONNAME), MB_OKCANCEL) == IDOK)
+ if (RemindersList && MessageBox(nullptr, Translate("Are you sure you want to delete all reminders?"), Translate(SECTIONNAME), MB_OKCANCEL) == IDOK)
DeleteReminders();
return 0;
}
@@ -129,7 +129,7 @@ static int OnOptInitialise(WPARAM w, LPARAM)
int OnTopToolBarInit(WPARAM, LPARAM)
{
- TTBButton ttb = { 0 };
+ TTBButton ttb = {};
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttb.hIconHandleUp = iconList[14].hIcolib;
@@ -178,7 +178,7 @@ static void InitServices()
static void addMenuItem(CMenuItem &mi)
{
if (g_AddContListMI) {
- HGENMENU save = mi.root; mi.root = NULL;
+ HGENMENU save = mi.root; mi.root = nullptr;
Menu_AddContactMenuItem(&mi);
mi.root = save;
}
@@ -300,7 +300,7 @@ extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- hmiranda = GetModuleHandle(NULL);
+ hmiranda = GetModuleHandle(nullptr);
INITCOMMONCONTROLSEX ctrls = { 0 };
ctrls.dwSize = sizeof(INITCOMMONCONTROLSEX);
@@ -309,7 +309,7 @@ extern "C" __declspec(dllexport) int Load(void)
hRichedDll = LoadLibrary("Msftedit.dll");
if (!hRichedDll) {
- if (MessageBox(0, Translate("Miranda could not load the Notes & Reminders plugin, Msftedit.dll is missing. If you are using WINE, please make sure you have Msftedit.dll installed. Press 'Yes' to continue loading Miranda."), SECTIONNAME, MB_YESNO | MB_ICONINFORMATION) != IDYES)
+ if (MessageBox(nullptr, Translate("Miranda could not load the Notes & Reminders plugin, Msftedit.dll is missing. If you are using WINE, please make sure you have Msftedit.dll installed. Press 'Yes' to continue loading Miranda."), SECTIONNAME, MB_YESNO | MB_ICONINFORMATION) != IDYES)
return 1;
return 0;
}
diff --git a/plugins/NotesAndReminders/src/miscutils.cpp b/plugins/NotesAndReminders/src/miscutils.cpp
index 5add0c6e07..04d08f00ed 100644
--- a/plugins/NotesAndReminders/src/miscutils.cpp
+++ b/plugins/NotesAndReminders/src/miscutils.cpp
@@ -33,7 +33,7 @@ void ReadSettingBlob(MCONTACT hContact, char *ModuleName, char *SettingName, WOR
dbv.type = DBVT_BLOB;
if (db_get(hContact, ModuleName, SettingName, &dbv)) {
*pSize = 0;
- *pbBlob = NULL;
+ *pbBlob = nullptr;
}
else {
*pSize = LOWORD(dbv.cpbVal);
@@ -88,11 +88,11 @@ void TreeAddSorted(TREEELEMENT **root, void *Data, int(*CompareCb)(TREEELEMENT*,
return;
NTE->ptrdata = Data;
- NTE->next = NULL;
+ NTE->next = nullptr;
// insert sorted
- TREEELEMENT *Prev = NULL;
+ TREEELEMENT *Prev = nullptr;
TREEELEMENT *TTE = *root;
while (TTE) {
@@ -119,7 +119,7 @@ void TreeAddSorted(TREEELEMENT **root, void *Data, int(*CompareCb)(TREEELEMENT*,
void TreeDelete(TREEELEMENT **root, void *iItem)
{
- TREEELEMENT *TTE = *root, *Prev = NULL;
+ TREEELEMENT *TTE = *root, *Prev = nullptr;
if (!TTE)
return;
@@ -139,7 +139,7 @@ void TreeDelete(TREEELEMENT **root, void *iItem)
void *TreeGetAt(TREEELEMENT *root, int iItem)
{
if (!root)
- return NULL;
+ return nullptr;
TREEELEMENT *TTE = root;
int i = 0;
@@ -147,7 +147,7 @@ void *TreeGetAt(TREEELEMENT *root, int iItem)
TTE = (TREEELEMENT*)TTE->next;
i++;
}
- return (!TTE) ? NULL : TTE->ptrdata;
+ return (!TTE) ? nullptr : TTE->ptrdata;
}
int TreeGetCount(TREEELEMENT *root)
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp
index bb4dfb0393..2cfde03695 100644
--- a/plugins/NotesAndReminders/src/notes.cpp
+++ b/plugins/NotesAndReminders/src/notes.cpp
@@ -82,7 +82,7 @@ static struct ColorPreset clrPresets[] =
{ LPGEN("White"), RGB(255,255,255) }
};
-TREEELEMENT *g_Stickies = NULL;
+TREEELEMENT *g_Stickies = nullptr;
LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam);
@@ -155,9 +155,9 @@ static void InitStickyNoteLogFont(STICKYNOTEFONT *pCustomFont, LOGFONT *lf)
if (!pCustomFont->size) {
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE);
lf->lfHeight = 10;
- HDC hdc = GetDC(0);
+ HDC hdc = GetDC(nullptr);
lf->lfHeight = -MulDiv(lf->lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
- ReleaseDC(0, hdc);
+ ReleaseDC(nullptr, hdc);
}
else {
lf->lfHeight = pCustomFont->size;
@@ -191,7 +191,7 @@ static BOOL CreateStickyNoteFont(STICKYNOTEFONT *pCustomFont, LOGFONT *plf)
pCustomFont->hFont = CreateFontIndirect(plf);
- return pCustomFont->hFont != NULL;
+ return pCustomFont->hFont != nullptr;
}
@@ -212,14 +212,14 @@ STICKYNOTE* NewNoteEx(int Ax, int Ay, int Aw, int Ah, char *Data, ULARGE_INTEGER
TWC.cbClsExtra = 0;
TWC.cbWndExtra = 0;
TWC.hInstance = hmiranda;
- TWC.hIcon = LoadIcon(0, IDI_APPLICATION);
- TWC.hCursor = LoadCursor(0, IDC_ARROW);
- TWC.hbrBackground = 0;
- TWC.lpszMenuName = 0;
+ TWC.hIcon = LoadIcon(nullptr, IDI_APPLICATION);
+ TWC.hCursor = LoadCursor(nullptr, IDC_ARROW);
+ TWC.hbrBackground = nullptr;
+ TWC.lpszMenuName = nullptr;
TWC.lpszClassName = NOTE_WND_CLASS;
TWC.cbSize = sizeof(WNDCLASSEX);
TWC.lpfnWndProc = StickyNoteWndProc;
- if (!RegisterClassEx(&TWC)) return NULL;
+ if (!RegisterClassEx(&TWC)) return nullptr;
}
if (!TData || Aw < 0 || Ah < 0) {
@@ -257,7 +257,7 @@ STICKYNOTE* NewNoteEx(int Ax, int Ay, int Aw, int Ah, char *Data, ULARGE_INTEGER
TSN->CustomTitle = TRUE;
}
else {
- TSN->title = NULL;
+ TSN->title = nullptr;
InitNoteTitle(TSN);
}
@@ -278,7 +278,7 @@ STICKYNOTE* NewNoteEx(int Ax, int Ay, int Aw, int Ah, char *Data, ULARGE_INTEGER
// NOTE: loaded note positions stem from GetWindowPlacement, which normally have a different coord space than
// CreateWindow/SetWindowPos, BUT since we now use WS_EX_TOOLWINDOW they use the same coord space so
// we don't have to worry about notes "drifting" between sessions
- TSN->SNHwnd = CreateWindowEx(L1, NOTE_WND_CLASS, "StickyNote", L2, Ax, Ay, Aw, Ah, NULL, 0, hmiranda, TSN);
+ TSN->SNHwnd = CreateWindowEx(L1, NOTE_WND_CLASS, "StickyNote", L2, Ax, Ay, Aw, Ah, nullptr, nullptr, hmiranda, TSN);
if (g_Transparency < 255)
SetLayeredWindowAttributes(TSN->SNHwnd, 0, (BYTE)g_Transparency, LWA_ALPHA);
@@ -296,7 +296,7 @@ STICKYNOTE* NewNoteEx(int Ax, int Ay, int Aw, int Ah, char *Data, ULARGE_INTEGER
if (Ay < TWP.rcNormalPosition.top + 50 || Ay > TWP.rcNormalPosition.bottom - 50)
Ay = ((TWP.rcNormalPosition.bottom - TWP.rcNormalPosition.top) / 4) + (rand() & 0x1f);
- SetWindowPos(TSN->SNHwnd, NULL, Ax, Ay, Aw, Ah, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(TSN->SNHwnd, nullptr, Ax, Ay, Aw, Ah, SWP_NOZORDER | SWP_NOACTIVATE);
}
}
@@ -323,16 +323,16 @@ STICKYNOTE* NewNoteEx(int Ax, int Ay, int Aw, int Ah, char *Data, ULARGE_INTEGER
STICKYNOTE* NewNote(int Ax, int Ay, int Aw, int Ah, char *Data, ULARGE_INTEGER *ID, BOOL bVisible, BOOL bOnTop, int scrollV)
{
- return NewNoteEx(Ax, Ay, Aw, Ah, Data, ID, bVisible, bOnTop, scrollV, 0, 0, NULL, NULL, FALSE);
+ return NewNoteEx(Ax, Ay, Aw, Ah, Data, ID, bVisible, bOnTop, scrollV, 0, 0, nullptr, nullptr, FALSE);
}
void LoadNotes(BOOL bIsStartup)
{
WORD Size = 0;
- char *Value = NULL, *TVal = NULL;
+ char *Value = nullptr, *TVal = nullptr;
char ValueName[32];
- g_Stickies = NULL;
+ g_Stickies = nullptr;
int NotesCount = db_get_dw(0, MODULENAME, "NotesData", 0);
@@ -343,7 +343,7 @@ void LoadNotes(BOOL bIsStartup)
if (Value) {
FreeSettingBlob(Size, Value);
- Value = NULL;
+ Value = nullptr;
}
Size = 65535; // does not get used
@@ -356,10 +356,10 @@ void LoadNotes(BOOL bIsStartup)
if (Value[0] == 'X') {
// new eXtended/fleXible data format
- STICKYNOTE note = { 0 };
+ STICKYNOTE note = {};
int i, rect[4];
int scrollV = 0;
- STICKYNOTEFONT *pCustomFont = NULL;
+ STICKYNOTEFONT *pCustomFont = nullptr;
DWORD flags;
DelPos = strchr(Value + 1, 0x1B);
@@ -373,7 +373,7 @@ void LoadNotes(BOOL bIsStartup)
continue;
*TVal++ = 0;
- note.ID.QuadPart = _strtoui64(Value + 1, NULL, 16);
+ note.ID.QuadPart = _strtoui64(Value + 1, nullptr, 16);
for (i = 0; i<4; i++) {
char *sep = strchr(TVal, ':');
@@ -381,12 +381,12 @@ void LoadNotes(BOOL bIsStartup)
goto skip;
*sep++ = 0;
- rect[i] = strtol(TVal, NULL, 10);
+ rect[i] = strtol(TVal, nullptr, 10);
TVal = sep;
}
- flags = strtoul(TVal, NULL, 16);
+ flags = strtoul(TVal, nullptr, 16);
if (flags & 1)
note.bVisible = TRUE;
@@ -410,7 +410,7 @@ void LoadNotes(BOOL bIsStartup)
if (!sep || (DelPos && sep > DelPos))
goto skip;
- tag = strtoul(TVal, NULL, 10);
+ tag = strtoul(TVal, nullptr, 10);
TVal = sep + 1;
switch (tag) {
@@ -419,15 +419,15 @@ void LoadNotes(BOOL bIsStartup)
break;
case DATATAG_SCROLLPOS:
- scrollV = (int)strtoul(TVal, NULL, 10);
+ scrollV = (int)strtoul(TVal, nullptr, 10);
break;
case DATATAG_BGCOL:
- note.BgColor = strtoul(TVal, NULL, 16) | 0xff000000;
+ note.BgColor = strtoul(TVal, nullptr, 16) | 0xff000000;
break;
case DATATAG_FGCOL:
- note.FgColor = strtoul(TVal, NULL, 16) | 0xff000000;
+ note.FgColor = strtoul(TVal, nullptr, 16) | 0xff000000;
break;
case DATATAG_TITLE:
@@ -447,21 +447,21 @@ void LoadNotes(BOOL bIsStartup)
if (!sep || (DelPos && sep > DelPos))
goto skip;
*sep++ = 0;
- fsize = strtol(TVal2, NULL, 10);
+ fsize = strtol(TVal2, nullptr, 10);
TVal2 = sep;
sep = strchr(TVal2, ':');
if (!sep || (DelPos && sep > DelPos))
goto skip;
*sep++ = 0;
- fstyle = strtoul(TVal2, NULL, 10);
+ fstyle = strtoul(TVal2, nullptr, 10);
TVal2 = sep;
sep = strchr(TVal2, ':');
if (!sep || (DelPos && sep > DelPos))
goto skip;
*sep++ = 0;
- fcharset = strtoul(TVal2, NULL, 10);
+ fcharset = strtoul(TVal2, nullptr, 10);
TVal2 = sep;
if (TVal2 >= DelPos)
@@ -472,11 +472,11 @@ void LoadNotes(BOOL bIsStartup)
pCustomFont->style = (BYTE)fstyle;
pCustomFont->charset = (BYTE)fcharset;
mir_strcpy(pCustomFont->szFace, TVal2);
- pCustomFont->hFont = NULL;
+ pCustomFont->hFont = nullptr;
- if (!CreateStickyNoteFont(pCustomFont, NULL)) {
+ if (!CreateStickyNoteFont(pCustomFont, nullptr)) {
free(pCustomFont);
- pCustomFont = NULL;
+ pCustomFont = nullptr;
}
}
break;
@@ -503,46 +503,46 @@ void LoadNotes(BOOL bIsStartup)
OT = 1; TV = 1;
Tx = 100; Ty = 100;
Tw = 179; Th = 35;
- Data = NULL; ID = NULL;
+ Data = nullptr; ID = nullptr;
if (DelPos = strchr(Value, 0x1B)) { // get first delimiter
// int PartLen = DelPos - TVal;
- Data = NULL;
- ID = NULL;
+ Data = nullptr;
+ ID = nullptr;
TVal = Value;
DelPos[0] = 0x0;
- Tx = strtol(TVal, NULL, 10);
+ Tx = strtol(TVal, nullptr, 10);
TVal = DelPos + 1;
DelPos = strchr(TVal, 0x1B);
if (!DelPos) continue; // setting is broken, do not crash
DelPos[0] = 0x0;
- Ty = strtol(TVal, NULL, 10);
+ Ty = strtol(TVal, nullptr, 10);
TVal = DelPos + 1;
DelPos = strchr(TVal, 0x1B);
if (!DelPos) continue; // setting is broken, do not crash
DelPos[0] = 0x0;
- Tw = strtol(TVal, NULL, 10);
+ Tw = strtol(TVal, nullptr, 10);
TVal = DelPos + 1;
DelPos = strchr(TVal, 0x1B);
if (!DelPos) continue; // setting is broken, do not crash
DelPos[0] = 0x0;
- Th = strtol(TVal, NULL, 10);
+ Th = strtol(TVal, nullptr, 10);
TVal = DelPos + 1;
DelPos = strchr(TVal, 0x1B);
if (!DelPos) continue; // setting is broken, do not crash
DelPos[0] = 0x0;
- TV = strtol(TVal, NULL, 10);
+ TV = strtol(TVal, nullptr, 10);
TVal = DelPos + 1;
DelPos = strchr(TVal, 0x1B);
if (!DelPos) continue; // setting is broken, do not crash
DelPos[0] = 0x0;
- OT = strtol(TVal, NULL, 10);
+ OT = strtol(TVal, nullptr, 10);
TVal = DelPos + 1;
DelPos = strchr(TVal, 0x1B);
@@ -562,7 +562,7 @@ void LoadNotes(BOOL bIsStartup)
if (strchr(ID, '-')) {
// validate format (otherwise create new)
if (mir_strlen(ID) < 19 || ID[2] != '-' || ID[5] != '-' || ID[10] != ' ' || ID[13] != ':' || ID[16] != ':') {
- ID = NULL;
+ ID = nullptr;
}
else {
SYSTEMTIME tm;
@@ -570,21 +570,21 @@ void LoadNotes(BOOL bIsStartup)
ID[2] = ID[5] = ID[10] = ID[13] = ID[16] = 0;
memset(&tm, 0, sizeof(tm));
- tm.wDay = (WORD)strtoul(ID, NULL, 10);
- tm.wMonth = (WORD)strtoul(ID + 3, NULL, 10);
- tm.wYear = (WORD)strtoul(ID + 6, NULL, 10);
- tm.wHour = (WORD)strtoul(ID + 11, NULL, 10);
- tm.wMinute = (WORD)strtoul(ID + 14, NULL, 10);
- tm.wSecond = (WORD)strtoul(ID + 17, NULL, 10);
+ tm.wDay = (WORD)strtoul(ID, nullptr, 10);
+ tm.wMonth = (WORD)strtoul(ID + 3, nullptr, 10);
+ tm.wYear = (WORD)strtoul(ID + 6, nullptr, 10);
+ tm.wHour = (WORD)strtoul(ID + 11, nullptr, 10);
+ tm.wMinute = (WORD)strtoul(ID + 14, nullptr, 10);
+ tm.wSecond = (WORD)strtoul(ID + 17, nullptr, 10);
SYSTEMTIMEtoFILETIME(&tm, (FILETIME*)&newid);
}
}
else {
- ID = NULL;
+ ID = nullptr;
}
- NewNoteEx(Tx, Ty, Tw, Th, Data, ID ? &newid : NULL, V, (BOOL)OT, 0, 0, 0, NULL, NULL, TRUE);
+ NewNoteEx(Tx, Ty, Tw, Th, Data, ID ? &newid : nullptr, V, (BOOL)OT, 0, 0, 0, nullptr, nullptr, TRUE);
}
}
skip:;
@@ -618,7 +618,7 @@ static void PurgeNotesTree()
TreeDelete(&g_Stickies, pt);
SAFE_FREE((void**)&pt);
}
- g_Stickies = NULL;
+ g_Stickies = nullptr;
}
void PurgeNotes(void)
@@ -667,7 +667,7 @@ void BringAllNotesToFront(STICKYNOTE *pActive)
}
// pModified optionally points to the modified note that invoked the JustSaveNotesEx call
-static void JustSaveNotesEx(STICKYNOTE *pModified = NULL)
+static void JustSaveNotesEx(STICKYNOTE *pModified = nullptr)
{
int I = 0, NotesCount = TreeGetCount(g_Stickies);
int n, l;
@@ -687,7 +687,7 @@ static void JustSaveNotesEx(STICKYNOTE *pModified = NULL)
STICKYNOTE *pNote = (STICKYNOTE*)TTE->ptrdata;
BOOL bDeleteTData = TRUE;
scrollV = 0;
- tData = NULL;
+ tData = nullptr;
// window pos and size
wp.length = sizeof(WINDOWPLACEMENT);
@@ -924,7 +924,7 @@ static BOOL DoContextMenu(HWND AhWnd, WPARAM, LPARAM lParam)
}
TranslateMenu(FhMenu);
- TrackPopupMenu(FhMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, AhWnd, 0);
+ TrackPopupMenu(FhMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, AhWnd, nullptr);
DestroyMenu(hMenuLoad);
return TRUE;
}
@@ -983,7 +983,7 @@ static BOOL GetClipboardText_Title(char *pOut, int size)
{
BOOL bResult = FALSE;
- if (OpenClipboard(NULL)) {
+ if (OpenClipboard(nullptr)) {
HANDLE hData = GetClipboardData(CF_TEXT);
LPCSTR buffer;
@@ -1067,7 +1067,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
MoveWindow(H, 0, 0, SZ.right, SZ.bottom, TRUE);
KillTimer(hdlg, 1025);
- SetTimer(hdlg, 1025, NOTE_CHANGE_COMMIT_DELAY, 0);
+ SetTimer(hdlg, 1025, NOTE_CHANGE_COMMIT_DELAY, nullptr);
return TRUE;
}
@@ -1083,7 +1083,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
case WM_MOVE:
KillTimer(hdlg, 1025);
- SetTimer(hdlg, 1025, NOTE_CHANGE_COMMIT_DELAY, 0);
+ SetTimer(hdlg, 1025, NOTE_CHANGE_COMMIT_DELAY, nullptr);
return TRUE;
case WM_CREATE:
@@ -1098,7 +1098,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
BringWindowToTop(hdlg);
mystyle = WS_CHILD | WS_VISIBLE | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN;
if (g_ShowScrollbar) mystyle |= WS_VSCROLL;
- HWND H = CreateWindowW(MSFTEDIT_CLASS, 0, mystyle, 0, 0, CS->cx - 3 - 3, CS->cy - 3 - (3 + 14), hdlg, (HMENU)1, hmiranda, 0);
+ HWND H = CreateWindowW(MSFTEDIT_CLASS, nullptr, mystyle, 0, 0, CS->cx - 3 - 3, CS->cy - 3 - (3 + 14), hdlg, (HMENU)1, hmiranda, nullptr);
SN->REHwnd = H;
SendMessage(H, EM_SETTEXTMODE, TM_PLAINTEXT, 0);
SendMessage(H, EM_LIMITTEXT, MAX_NOTE_LEN, 0);
@@ -1196,7 +1196,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
}
if (wParam && wParam != 1)
- SelectClipRgn(hdc, NULL);
+ SelectClipRgn(hdc, nullptr);
ReleaseDC(hdlg, hdc);
}
@@ -1214,7 +1214,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
case WM_NCACTIVATE:
// update window (so that parts that potentially became visible through activation get redrawn immediately)
- RedrawWindow(hdlg, NULL, NULL, RDW_UPDATENOW);
+ RedrawWindow(hdlg, nullptr, nullptr, RDW_UPDATENOW);
return TRUE;
case WM_NOTIFY:
@@ -1325,7 +1325,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
case EN_VSCROLL:
case EN_HSCROLL:
KillTimer(hdlg, 1025);
- SetTimer(hdlg, 1025, NOTE_CHANGE_COMMIT_DELAY, 0);
+ SetTimer(hdlg, 1025, NOTE_CHANGE_COMMIT_DELAY, nullptr);
break;
}
@@ -1336,7 +1336,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
if (id >= IDM_COLORPRESET_BG && id <= IDM_COLORPRESET_BG + _countof(clrPresets)) {
SN->BgColor = clrPresets[id - IDM_COLORPRESET_BG].color | 0xff000000;
SendMessage(H, EM_SETBKGNDCOLOR, 0, SN->BgColor & 0xffffff);
- RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
+ RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
JustSaveNotesEx();
return FALSE;
}
@@ -1347,7 +1347,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
CF.dwMask = CFM_COLOR;
CF.crTextColor = SN->FgColor & 0xffffff;
SendMessage(H, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&CF);
- RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
+ RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
JustSaveNotesEx();
return FALSE;
}
@@ -1371,7 +1371,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
if (ChooseColor(&cc) && cc.rgbResult != orgclr) {
SN->BgColor = cc.rgbResult | 0xff000000;
SendMessage(H, EM_SETBKGNDCOLOR, 0, SN->BgColor & 0xffffff);
- RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
+ RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
JustSaveNotesEx();
}
}
@@ -1394,7 +1394,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
CF.dwMask = CFM_COLOR;
CF.crTextColor = SN->FgColor & 0xffffff;
SendMessage(H, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&CF);
- RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
+ RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
JustSaveNotesEx();
}
}
@@ -1408,7 +1408,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
if (SN->pCustomFont)
InitStickyNoteLogFont(SN->pCustomFont, &lf);
else
- LoadNRFont(NR_FONTID_BODY, &lf, NULL);
+ LoadNRFont(NR_FONTID_BODY, &lf, nullptr);
cf.lStructSize = sizeof(cf);
cf.hwndOwner = SN->SNHwnd;
@@ -1419,7 +1419,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
if (ChooseFont(&cf)) {
if (!SN->pCustomFont) {
SN->pCustomFont = (STICKYNOTEFONT*)malloc(sizeof(STICKYNOTEFONT));
- SN->pCustomFont->hFont = NULL;
+ SN->pCustomFont->hFont = nullptr;
}
SN->pCustomFont->size = (char)lf.lfHeight;
@@ -1430,14 +1430,14 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
if (!CreateStickyNoteFont(SN->pCustomFont, &lf)) {
// failed
free(SN->pCustomFont);
- SN->pCustomFont = NULL;
+ SN->pCustomFont = nullptr;
}
// clear text first to force a reformatting w.r.w scrollbar
SetWindowText(H, "");
SendMessage(H, WM_SETFONT, (WPARAM)(SN->pCustomFont ? SN->pCustomFont->hFont : hBodyFont), FALSE);
SetNoteTextControl(SN);
- RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
+ RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
JustSaveNotesEx();
}
}
@@ -1446,7 +1446,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
case ID_BACKGROUNDCOLOR_RESET:
SN->BgColor = 0;
SendMessage(H, EM_SETBKGNDCOLOR, 0, (LPARAM)BodyColor);
- RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
+ RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
JustSaveNotesEx();
break;
@@ -1458,7 +1458,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
CF.dwMask = CFM_COLOR;
CF.crTextColor = BodyFontColor;
SendMessage(H, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&CF);
- RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
+ RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
}
JustSaveNotesEx();
break;
@@ -1467,13 +1467,13 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
if (SN->pCustomFont) {
DeleteObject(SN->pCustomFont->hFont);
free(SN->pCustomFont);
- SN->pCustomFont = NULL;
+ SN->pCustomFont = nullptr;
// clear text first to force a reformatting w.r.w scrollbar
SetWindowText(H, "");
SendMessage(H, WM_SETFONT, (WPARAM)hBodyFont, FALSE);
SetNoteTextControl(SN);
- RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
+ RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
JustSaveNotesEx();
}
break;
@@ -1486,7 +1486,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
free(SN->title);
SN->title = _strdup(s);
SN->CustomTitle = TRUE;
- RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
+ RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
JustSaveNotesEx();
}
}
@@ -1496,10 +1496,10 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
if (SN->CustomTitle) {
if (SN->title) {
free(SN->title);
- SN->title = NULL;
+ SN->title = nullptr;
}
InitNoteTitle(SN);
- RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
+ RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
JustSaveNotesEx();
}
break;
@@ -1537,7 +1537,7 @@ LRESULT CALLBACK StickyNoteWndProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
case IDM_TOGGLEONTOP:
SN->bOnTop = !SN->bOnTop;
SetWindowPos(hdlg, SN->bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
- RedrawWindow(hdlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
+ RedrawWindow(hdlg, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
JustSaveNotesEx();
break;
@@ -1614,7 +1614,7 @@ char* GetPreviewString(const char *lpsz)
}
if (!s)
- return NULL;
+ return nullptr;
// convert line breaks and tabs to spaces
@@ -1712,7 +1712,7 @@ static BOOL DoListContextMenu(HWND AhWnd, WPARAM wParam, LPARAM lParam, STICKYNO
}
TranslateMenu(FhMenu);
- TrackPopupMenu(FhMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, AhWnd, 0);
+ TrackPopupMenu(FhMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, AhWnd, nullptr);
DestroyMenu(hMenuLoad);
return TRUE;
}
@@ -1723,11 +1723,11 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
switch (Message) {
case WM_SIZE:
OnListResize(Dialog);
- UpdateGeomFromWnd(Dialog, g_notesListGeom, NULL, 0);
+ UpdateGeomFromWnd(Dialog, g_notesListGeom, nullptr, 0);
break;
case WM_MOVE:
- UpdateGeomFromWnd(Dialog, g_notesListGeom, NULL, 0);
+ UpdateGeomFromWnd(Dialog, g_notesListGeom, nullptr, 0);
break;
case WM_GETMINMAXINFO:
@@ -1745,7 +1745,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
case WM_CONTEXTMENU:
{
- STICKYNOTE *pNote = NULL;
+ STICKYNOTE *pNote = nullptr;
HWND H = GetDlgItem(Dialog, IDC_LISTREMINDERS);
if (ListView_GetSelectedCount(H)) {
@@ -1851,7 +1851,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
LPNMHEADER NM = (LPNMHEADER)lParam;
switch (NM->hdr.code) {
case HDN_ENDTRACK:
- UpdateGeomFromWnd(Dialog, NULL, g_notesListColGeom, _countof(g_notesListColGeom));
+ UpdateGeomFromWnd(Dialog, nullptr, g_notesListColGeom, _countof(g_notesListColGeom));
break;
}
}
@@ -1895,7 +1895,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
STICKYNOTE *SN = (STICKYNOTE*)TreeGetAt(g_Stickies, I);
SN->bOnTop = !SN->bOnTop;
SetWindowPos(SN->SNHwnd, SN->bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
- RedrawWindow(SN->SNHwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
+ RedrawWindow(SN->SNHwnd, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
JustSaveNotesEx();
}
}
@@ -1933,7 +1933,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
return TRUE;
case ID_CONTEXTMENUNOTEPOPUP_BRINGALLTOTOP:
- BringAllNotesToFront(NULL);
+ BringAllNotesToFront(nullptr);
return TRUE;
}
}
@@ -1947,7 +1947,7 @@ static INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog, UINT Message, WPARAM wPara
void ListNotes(void)
{
if (!ListNotesVisible) {
- CreateDialog(hinstance, MAKEINTRESOURCE(IDD_LISTREMINDERS), 0, DlgProcViewNotes);
+ CreateDialog(hinstance, MAKEINTRESOURCE(IDD_LISTREMINDERS), nullptr, DlgProcViewNotes);
ListNotesVisible = TRUE;
}
else BringWindowToTop(LV);
diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp
index b1de471297..37773c7b03 100644
--- a/plugins/NotesAndReminders/src/options.cpp
+++ b/plugins/NotesAndReminders/src/options.cpp
@@ -7,19 +7,19 @@ extern HANDLE hkFontChange;
extern HANDLE hkColorChange;
BOOL g_CloseAfterAddReminder, g_UseDefaultPlaySound;
-HICON g_hReminderIcon = NULL;
+HICON g_hReminderIcon = nullptr;
LOGFONT lfBody,lfCaption;
-HFONT hBodyFont = NULL, hCaptionFont = NULL;
+HFONT hBodyFont = nullptr, hCaptionFont = nullptr;
long BodyColor;
long CaptionFontColor,BodyFontColor;
BOOL g_ShowNotesAtStart,g_ShowScrollbar,g_AddContListMI,g_ShowNoteButtons;
int g_NoteTitleDate, g_NoteTitleTime;
int g_NoteWidth,g_NoteHeight;
int g_Transparency;
-char *g_RemindSMS = NULL;
+char *g_RemindSMS = nullptr;
-char *g_lpszAltBrowser = NULL;
+char *g_lpszAltBrowser = nullptr;
int g_reminderListGeom[4] = {0};
int g_reminderListColGeom[2] = { 150, 205 };
@@ -169,9 +169,9 @@ static BYTE MsgDlgGetFontDefaultCharset(const char *szFont)
lf.lfCharSet = MsgDlgGetCPDefaultCharset();
// check if the font supports specified charset
- HDC hdc = GetDC(0);
+ HDC hdc = GetDC(nullptr);
EnumFontFamiliesEx(hdc, &lf, &EnumFontFamExProc, (LPARAM)&found, 0);
- ReleaseDC(0, hdc);
+ ReleaseDC(nullptr, hdc);
if (found)
return lf.lfCharSet;
@@ -234,9 +234,9 @@ void RegisterFontServiceFonts()
strncpy(fontid.dbSettingsGroup, MODULENAME, _countof(fontid.dbSettingsGroup));
fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_SAVEPOINTSIZE;
- HDC hDC = GetDC(NULL);
+ HDC hDC = GetDC(nullptr);
int nFontScale = GetDeviceCaps(hDC, LOGPIXELSY);
- ReleaseDC(NULL, hDC);
+ ReleaseDC(nullptr, hDC);
for (int i = 0; i < _countof(fontOptionsList); i++) {
fontid.order = i;
@@ -397,12 +397,12 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l
TrimString(g_lpszAltBrowser);
if (!*g_lpszAltBrowser) {
mir_free(g_lpszAltBrowser);
- g_lpszAltBrowser = NULL;
+ g_lpszAltBrowser = nullptr;
}
}
else if (g_lpszAltBrowser) {
mir_free(g_lpszAltBrowser);
- g_lpszAltBrowser = NULL;
+ g_lpszAltBrowser = nullptr;
}
SetDlgItemText(hdlg, IDC_EDIT_ALTBROWSER, g_lpszAltBrowser ? g_lpszAltBrowser : "");
if (g_lpszAltBrowser)
@@ -457,7 +457,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l
SetDlgItemText(hdlg, IDC_EDIT_EMAILSMS, "");
if (g_lpszAltBrowser) {
mir_free(g_lpszAltBrowser);
- g_lpszAltBrowser = NULL;
+ g_lpszAltBrowser = nullptr;
}
SetDlgItemText(hdlg, IDC_EDIT_ALTBROWSER, "");
g_ShowNotesAtStart = TRUE;
@@ -515,12 +515,12 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg, UINT message, WPARAM wParam, LPARAM l
void InitSettings(void)
{
- void *P = NULL;
+ void *P = nullptr;
short Sz1 = MAX_PATH;
ReadSettingBlob(0, MODULENAME, "RemindEmail", (WORD*)&Sz1, &P);
if (!(Sz1 && P))
- g_RemindSMS = NULL;
+ g_RemindSMS = nullptr;
else {
g_RemindSMS = (char*)malloc(Sz1 + 1);
memcpy(g_RemindSMS, P, Sz1);
@@ -572,6 +572,6 @@ void TermSettings(void)
if (g_lpszAltBrowser) {
mir_free(g_lpszAltBrowser);
- g_lpszAltBrowser = NULL;
+ g_lpszAltBrowser = nullptr;
}
}
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp
index 3bb2361b9a..1b6b8854cc 100644
--- a/plugins/NotesAndReminders/src/reminders.cpp
+++ b/plugins/NotesAndReminders/src/reminders.cpp
@@ -41,11 +41,11 @@
#define NOTIFY_LIST() if (ListReminderVisible) PostMessage(LV,WM_RELOAD,0,0)
-TREEELEMENT *RemindersList = NULL;
+TREEELEMENT *RemindersList = nullptr;
static UINT QueuedReminderCount = 0;
static BOOL ListReminderVisible = FALSE;
static BOOL NewReminderVisible = FALSE;
-static REMINDERDATA *pEditReminder = NULL;
+static REMINDERDATA *pEditReminder = nullptr;
static HWND LV;
static SOCKET S;
@@ -68,7 +68,7 @@ void UtcToTzLocalFT(const FILETIME *lpUtc, FILETIME *lpLocal)
{
SYSTEMTIME tm, tmLocal;
FILETIMEtoSYSTEMTIME(lpUtc, &tm);
- SystemTimeToTzSpecificLocalTime(NULL, &tm, &tmLocal);
+ SystemTimeToTzSpecificLocalTime(nullptr, &tm, &tmLocal);
SYSTEMTIMEtoFILETIME(&tmLocal, lpLocal);
}
@@ -76,7 +76,7 @@ void TzLocalToUtcFT(const FILETIME *lpLocal, FILETIME *lpUtc)
{
SYSTEMTIME tm, tmUtc;
FILETIMEtoSYSTEMTIME(lpLocal, &tm);
- TzSpecificLocalTimeToSystemTime(NULL, &tm, &tmUtc);
+ TzSpecificLocalTimeToSystemTime(nullptr, &tm, &tmUtc);
SYSTEMTIMEtoFILETIME(&tmUtc, lpUtc);
}
@@ -84,13 +84,13 @@ void FileTimeToTzLocalST(const FILETIME *lpUtc, SYSTEMTIME *tmLocal)
{
SYSTEMTIME tm;
FILETIMEtoSYSTEMTIME(lpUtc, &tm);
- SystemTimeToTzSpecificLocalTime(NULL, &tm, tmLocal);
+ SystemTimeToTzSpecificLocalTime(nullptr, &tm, tmLocal);
}
void TzLocalSTToFileTime(const SYSTEMTIME *tmLocal, FILETIME *lpUtc)
{
SYSTEMTIME tm;
- TzSpecificLocalTimeToSystemTime(NULL, (SYSTEMTIME*)tmLocal, &tm);
+ TzSpecificLocalTimeToSystemTime(nullptr, (SYSTEMTIME*)tmLocal, &tm);
SYSTEMTIMEtoFILETIME(&tm, lpUtc);
}
@@ -122,7 +122,7 @@ try_next:;
static REMINDERDATA* FindReminder(DWORD uid)
{
if (!RemindersList)
- return NULL;
+ return nullptr;
for (TREEELEMENT *TTE = RemindersList; TTE; TTE = (TREEELEMENT *)TTE->next) {
REMINDERDATA *pReminder = (REMINDERDATA*)TTE->ptrdata;
@@ -132,7 +132,7 @@ static REMINDERDATA* FindReminder(DWORD uid)
}
}
- return NULL;
+ return nullptr;
}
@@ -170,7 +170,7 @@ void PurgeReminders(void)
void JustSaveReminders(void)
{
int I = 0, n, l;
- char *tmpReminder = NULL, *Value;
+ char *tmpReminder = nullptr, *Value;
char ValueName[32];
int ReminderCount;
@@ -185,7 +185,7 @@ void JustSaveReminders(void)
if (pReminder->Reminder && mir_strlen(pReminder->Reminder))
tmpReminder = pReminder->Reminder;
else
- tmpReminder = NULL;
+ tmpReminder = nullptr;
if (!tmpReminder)
tmpReminder = "";
@@ -248,19 +248,19 @@ void LoadReminders(void)
char ValueName[32];
BOOL GenerateUids = FALSE;
- RemindersList = NULL;
+ RemindersList = nullptr;
int RemindersCount = db_get_dw(0, MODULENAME, "RemindersData", 0);
for (int I = 0; I < RemindersCount; I++) {
Size = 65535;
- Value = NULL;
+ Value = nullptr;
mir_snprintf(ValueName, "RemindersData%d", I);
ReadSettingBlob(0, MODULENAME, ValueName, &Size, (void**)&Value);
if (Size && Value) // was the blob found
{
- REMINDERDATA rem = { 0 };
+ REMINDERDATA rem = {};
char *TVal;
REMINDERDATA *TempRem;
char *DelPos = strchr(Value, 0x1B);
@@ -281,8 +281,8 @@ void LoadReminders(void)
continue;
*TVal++ = 0;
- rem.uid = strtoul(Value + 1, NULL, 10);
- rem.When.QuadPart = _strtoui64(TVal, NULL, 16) * FILETIME_TICKS_PER_SEC;
+ rem.uid = strtoul(Value + 1, nullptr, 10);
+ rem.When.QuadPart = _strtoui64(TVal, nullptr, 16) * FILETIME_TICKS_PER_SEC;
// optional \033 separated params
while (DelPos) {
@@ -301,7 +301,7 @@ void LoadReminders(void)
if (!sep || (DelPos && sep > DelPos))
goto skip;
- tag = strtoul(TVal, NULL, 10);
+ tag = strtoul(TVal, nullptr, 10);
TVal = sep + 1;
switch (tag) {
@@ -310,11 +310,11 @@ void LoadReminders(void)
break;
case DATATAG_SNDREPEAT:
- rem.RepeatSound = strtoul(TVal, NULL, 10);
+ rem.RepeatSound = strtoul(TVal, nullptr, 10);
break;
case DATATAG_SNDSEL:
- rem.SoundSel = strtol(TVal, NULL, 10);
+ rem.SoundSel = strtol(TVal, nullptr, 10);
if (rem.SoundSel > 2) rem.SoundSel = 2;
break;
}
@@ -338,7 +338,7 @@ void LoadReminders(void)
struct tm *stm;
time_t tt;
- tt = (time_t)strtoul(Value, NULL, 10);
+ tt = (time_t)strtoul(Value, nullptr, 10);
stm = localtime(&tt);
tm.wDayOfWeek = 0;
tm.wSecond = 0;
@@ -417,7 +417,7 @@ static void PurgeReminderTree()
if (pt->handle) DestroyWindow(pt->handle);
DeleteReminder(pt);
}
- RemindersList = NULL;
+ RemindersList = nullptr;
}
void SaveReminders(void)
@@ -446,13 +446,13 @@ void GetTriggerTimeString(const ULARGE_INTEGER *When, char *s, UINT strSize, BOO
else
FILETIMEtoSYSTEMTIME((FILETIME*)When, &tm);
- if (GetDateFormat(lc, DATE_LONGDATE, &tm, NULL, s, strSize)) {
+ if (GetDateFormat(lc, DATE_LONGDATE, &tm, nullptr, s, strSize)) {
// append time
int n = (int)mir_strlen(s);
s[n++] = ' ';
s[n] = 0;
- if (!GetTimeFormat(lc, LOCALE_NOUSEROVERRIDE | TIME_NOSECONDS, &tm, NULL, s + n, strSize - n))
+ if (!GetTimeFormat(lc, LOCALE_NOUSEROVERRIDE | TIME_NOSECONDS, &tm, nullptr, s + n, strSize - n))
mir_snprintf(s + n, strSize - n, "%02d:%02d", tm.wHour, tm.wMinute);
}
else mir_snprintf(s, strSize, "%d-%02d-%02d %02d:%02d", tm.wYear, tm.wMonth, tm.wDay, tm.wHour, tm.wMinute);
@@ -481,7 +481,7 @@ static void Skin_PlaySoundPoly(LPCSTR pszSoundName)
char s[512];
GetShortPathNameA(szFull, szShort, sizeof(szShort));
mir_snprintf(s, "play \"%s\"", szShort);
- mciSendStringA(s, NULL, 0, NULL);
+ mciSendStringA(s, nullptr, 0, nullptr);
}
db_free(&dbv);
@@ -832,12 +832,12 @@ static void PopulateTimeCombo(HWND Dialog, UINT nIDTime, BOOL bRelative, const S
SendDlgItemMessage(Dialog, nIDTime, CB_RESETCONTENT, 0, 0);
// ensure that we start on midnight local time
- SystemTimeToTzSpecificLocalTime(NULL, (SYSTEMTIME*)tmUtc, &tm2);
+ SystemTimeToTzSpecificLocalTime(nullptr, (SYSTEMTIME*)tmUtc, &tm2);
tm2.wHour = 0;
tm2.wMinute = 0;
tm2.wSecond = 0;
tm2.wMilliseconds = 0;
- TzSpecificLocalTimeToSystemTime(NULL, &tm2, &tm2);
+ TzSpecificLocalTimeToSystemTime(nullptr, &tm2, &tm2);
SYSTEMTIMEtoFILETIME(&tm2, (FILETIME*)&li);
// from 00:00 to 23:30 in 30 minute steps
@@ -1016,7 +1016,7 @@ static int ReformatTimeInputEx(HWND Dialog, UINT nIDTime, UINT nIDRefTime, int h
// get reference time (UTC) from hidden control
{
GetDlgItemText(Dialog, nIDRefTime, buf, 30);
- li.QuadPart = ref = _strtoui64(buf, NULL, 16);
+ li.QuadPart = ref = _strtoui64(buf, nullptr, 16);
}
// clamp delta time to 23.5 hours (coule be issues otherwise as relative combo only handles <24)
@@ -1077,7 +1077,7 @@ static int ReformatTimeInputEx(HWND Dialog, UINT nIDTime, UINT nIDRefTime, int h
// get reference time (UTC) from hidden control
{
GetDlgItemText(Dialog, nIDRefTime, buf, 30);
- ref = _strtoui64(buf, NULL, 16);
+ ref = _strtoui64(buf, nullptr, 16);
}
FileTimeToTzLocalST((FILETIME*)&ref, &tmRefLocal);
@@ -1180,7 +1180,7 @@ output_result:
static __inline int ReformatTimeInput(HWND Dialog, UINT nIDTime, UINT nIDRefTime, int h, int m, const SYSTEMTIME *pDateLocal)
{
- return ReformatTimeInputEx(Dialog, nIDTime, nIDRefTime, h, m, pDateLocal, NULL);
+ return ReformatTimeInputEx(Dialog, nIDTime, nIDRefTime, h, m, pDateLocal, nullptr);
}
// in: pDate contains the desired trigger date in LOCAL time
@@ -1194,7 +1194,7 @@ static BOOL GetTriggerTime(HWND Dialog, UINT nIDTime, UINT nIDRefTime, SYSTEMTIM
// get reference (UTC) time from hidden control
{
GetDlgItemText(Dialog, nIDRefTime, buf, 30);
- li.QuadPart = _strtoui64(buf, NULL, 16);
+ li.QuadPart = _strtoui64(buf, nullptr, 16);
}
int n = SendDlgItemMessage(Dialog, nIDTime, CB_GETCURSEL, 0, 0);
@@ -1259,7 +1259,7 @@ preset_value:;
return TRUE;
}
else {
- if (ReformatTimeInputEx(Dialog, nIDTime, nIDRefTime, h, m, pDate, NULL))
+ if (ReformatTimeInputEx(Dialog, nIDTime, nIDRefTime, h, m, pDate, nullptr))
return FALSE;
// check if reformatted value is a preset
@@ -1294,7 +1294,7 @@ static void OnDateChanged(HWND Dialog, UINT nDateID, UINT nTimeID, UINT nRefTime
SendDlgItemMessage(Dialog, nDateID, DTM_GETSYSTEMTIME, 0, (LPARAM)&Date);
- TzSpecificLocalTimeToSystemTime(NULL, &Date, &DateUtc);
+ TzSpecificLocalTimeToSystemTime(nullptr, &Date, &DateUtc);
PopulateTimeCombo(Dialog, nTimeID, FALSE, &DateUtc);
if (h < 0) {
@@ -1553,7 +1553,7 @@ static INT_PTR CALLBACK DlgProcNotifyReminder(HWND Dialog, UINT Message, WPARAM
// update reminder text
{
- char *ReminderText = NULL;
+ char *ReminderText = nullptr;
int SzT = SendDlgItemMessage(Dialog, IDC_REMDATA, WM_GETTEXTLENGTH, 0, 0);
if (SzT) {
if (SzT > MAX_REMINDER_LEN) SzT = MAX_REMINDER_LEN;
@@ -1566,7 +1566,7 @@ static INT_PTR CALLBACK DlgProcNotifyReminder(HWND Dialog, UINT Message, WPARAM
}
pReminder->RemVisible = FALSE;
- pReminder->handle = NULL;
+ pReminder->handle = nullptr;
// re-insert tree item sorted
TreeDelete(&RemindersList, pReminder);
@@ -1589,7 +1589,7 @@ static INT_PTR CALLBACK DlgProcNotifyReminder(HWND Dialog, UINT Message, WPARAM
if (pReminder->handle == Dialog) {
// get up-to-date reminder text
- char *ReminderText = NULL;
+ char *ReminderText = nullptr;
int SzT = SendDlgItemMessage(Dialog, IDC_REMDATA, WM_GETTEXTLENGTH, 0, 0);
if (SzT) {
if (SzT > MAX_REMINDER_LEN) SzT = MAX_REMINDER_LEN;
@@ -1597,7 +1597,7 @@ static INT_PTR CALLBACK DlgProcNotifyReminder(HWND Dialog, UINT Message, WPARAM
GetDlgItemText(Dialog, IDC_REMDATA, ReminderText, SzT + 1);
}
- SetFocus(NewNote(0, 0, -1, -1, ReminderText, 0, TRUE, TRUE, 0)->REHwnd);
+ SetFocus(NewNote(0, 0, -1, -1, ReminderText, nullptr, TRUE, TRUE, 0)->REHwnd);
break;
}
}
@@ -1611,7 +1611,7 @@ static INT_PTR CALLBACK DlgProcNotifyReminder(HWND Dialog, UINT Message, WPARAM
static INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
{
- HICON hIcon = NULL;
+ HICON hIcon = nullptr;
switch (Message) {
case WM_INITDIALOG:
{
@@ -1766,7 +1766,7 @@ static INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog, UINT Message, WPARAM wPa
}
DestroyWindow(Dialog);
NewReminderVisible = FALSE;
- pEditReminder = NULL;
+ pEditReminder = nullptr;
return TRUE;
case WM_NOTIFY:
@@ -1838,7 +1838,7 @@ static INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog, UINT Message, WPARAM wPa
}
DestroyWindow(Dialog);
NewReminderVisible = FALSE;
- pEditReminder = NULL;
+ pEditReminder = nullptr;
return TRUE;
case IDC_VIEWREMINDERS:
@@ -1861,7 +1861,7 @@ static INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog, UINT Message, WPARAM wPa
RepeatSound = 0;
int SzT = SendDlgItemMessage(Dialog, IDC_REMINDER, WM_GETTEXTLENGTH, 0, 0);
- char *ReminderText = NULL;
+ char *ReminderText = nullptr;
if (SzT) {
if (SzT > MAX_REMINDER_LEN) SzT = MAX_REMINDER_LEN;
ReminderText = (char*)malloc(SzT + 1);
@@ -1904,7 +1904,7 @@ static INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog, UINT Message, WPARAM wPa
if (g_CloseAfterAddReminder || NewReminderVisible == 2) {
DestroyWindow(Dialog);
NewReminderVisible = FALSE;
- pEditReminder = NULL;
+ pEditReminder = nullptr;
}
}
}
@@ -1938,7 +1938,7 @@ INT_PTR OpenTriggeredReminder(WPARAM, LPARAM l)
pReminder->RemVisible = TRUE;
- HWND H = CreateDialog(hinstance, MAKEINTRESOURCE(IDD_NOTIFYREMINDER), 0, DlgProcNotifyReminder);
+ HWND H = CreateDialog(hinstance, MAKEINTRESOURCE(IDD_NOTIFYREMINDER), nullptr, DlgProcNotifyReminder);
pReminder->handle = H;
mir_snprintf(S2, "%s! - %s", Translate("Reminder"), S1);
@@ -1957,7 +1957,7 @@ void NewReminder(void)
{
if (!NewReminderVisible) {
NewReminderVisible = TRUE;
- CreateDialog(hinstance, MAKEINTRESOURCE(IDD_ADDREMINDER), 0, DlgProcNewReminder);
+ CreateDialog(hinstance, MAKEINTRESOURCE(IDD_ADDREMINDER), nullptr, DlgProcNewReminder);
}
}
@@ -1971,7 +1971,7 @@ void EditReminder(REMINDERDATA *p)
p->RemVisible = TRUE;
NewReminderVisible = 2;
pEditReminder = p;
- CreateDialog(hinstance, MAKEINTRESOURCE(IDD_ADDREMINDER), 0, DlgProcNewReminder);
+ CreateDialog(hinstance, MAKEINTRESOURCE(IDD_ADDREMINDER), nullptr, DlgProcNewReminder);
}
else {
BringWindowToTop(p->handle);
@@ -2056,7 +2056,7 @@ void OnListResize(HWND Dialog)
clsr.left -= btnw + 2;
MoveWindow(hBtnNew, clsr.left, clsr.top, btnw, btnh, FALSE);
- RedrawWindow(Dialog, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
+ RedrawWindow(Dialog, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
//UpdateWindow(Dialog);
}
@@ -2102,7 +2102,7 @@ static BOOL DoListContextMenu(HWND AhWnd, WPARAM wParam, LPARAM lParam, REMINDER
EnableMenuItem(FhMenu, IDM_DELETEREMINDER, MF_GRAYED | MF_BYCOMMAND);
TranslateMenu(FhMenu);
- TrackPopupMenu(FhMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, AhWnd, 0);
+ TrackPopupMenu(FhMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, LOWORD(lParam), HIWORD(lParam), 0, AhWnd, nullptr);
DestroyMenu(hMenuLoad);
return TRUE;
}
@@ -2114,11 +2114,11 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog, UINT Message, WPARAM w
switch (Message) {
case WM_SIZE:
OnListResize(Dialog);
- UpdateGeomFromWnd(Dialog, g_reminderListGeom, NULL, 0);
+ UpdateGeomFromWnd(Dialog, g_reminderListGeom, nullptr, 0);
break;
case WM_MOVE:
- UpdateGeomFromWnd(Dialog, g_reminderListGeom, NULL, 0);
+ UpdateGeomFromWnd(Dialog, g_reminderListGeom, nullptr, 0);
break;
case WM_GETMINMAXINFO:
@@ -2136,7 +2136,7 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog, UINT Message, WPARAM w
case WM_CONTEXTMENU:
{
- REMINDERDATA *pReminder = NULL;
+ REMINDERDATA *pReminder = nullptr;
HWND H = GetDlgItem(Dialog, IDC_LISTREMINDERS);
if (ListView_GetSelectedCount(H)) {
@@ -2218,7 +2218,7 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog, UINT Message, WPARAM w
LPNMHEADER NM = (LPNMHEADER)lParam;
switch (NM->hdr.code) {
case HDN_ENDTRACK:
- UpdateGeomFromWnd(Dialog, NULL, g_reminderListColGeom, _countof(g_reminderListColGeom));
+ UpdateGeomFromWnd(Dialog, nullptr, g_reminderListColGeom, _countof(g_reminderListColGeom));
break;
}
}
@@ -2284,7 +2284,7 @@ static INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog, UINT Message, WPARAM w
void ListReminders(void)
{
if (!ListReminderVisible) {
- CreateDialog(hinstance, MAKEINTRESOURCE(IDD_LISTREMINDERS), 0, DlgProcViewReminders);
+ CreateDialog(hinstance, MAKEINTRESOURCE(IDD_LISTREMINDERS), nullptr, DlgProcViewReminders);
ListReminderVisible = TRUE;
}
else {
@@ -2318,16 +2318,16 @@ int WS_Send(SOCKET s, char *data, int datalen)
unsigned long WS_ResolveName(char *name, WORD *port, int defaultPort)
{
char *nameCopy = _strdup(name);
- if (port != NULL)
+ if (port != nullptr)
*port = defaultPort;
char *pcolon = strchr(nameCopy, ':');
- if (pcolon != NULL) {
- if (port != NULL) *port = atoi(pcolon + 1);
+ if (pcolon != nullptr) {
+ if (port != nullptr) *port = atoi(pcolon + 1);
*pcolon = 0;
}
if (inet_addr(nameCopy) == INADDR_NONE) {
HOSTENT *lk = gethostbyname(nameCopy);
- if (lk == 0)
+ if (lk == nullptr)
return SOCKET_ERROR;
free(nameCopy);
@@ -2342,7 +2342,7 @@ void Send(char *user, char *host, char *Msg, char *server)
{
SOCKADDR_IN sockaddr;
WORD port;
- char *ch = NULL;
+ char *ch = nullptr;
S = socket(AF_INET, SOCK_STREAM, 0);
if (!server) server = host;
if ((sockaddr.sin_addr.S_un.S_addr = WS_ResolveName(server,