summaryrefslogtreecommitdiff
path: root/plugins/WebView/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/WebView/src
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/WebView/src')
-rw-r--r--plugins/WebView/src/main.cpp14
-rw-r--r--plugins/WebView/src/webview.cpp20
-rw-r--r--plugins/WebView/src/webview_alerts.cpp42
-rw-r--r--plugins/WebView/src/webview_cleanup.cpp52
-rw-r--r--plugins/WebView/src/webview_datawnd.cpp16
-rw-r--r--plugins/WebView/src/webview_getdata.cpp14
-rw-r--r--plugins/WebView/src/webview_opts.cpp92
-rw-r--r--plugins/WebView/src/webview_services.cpp40
8 files changed, 145 insertions, 145 deletions
diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp
index fd897fb380..421e92fdd2 100644
--- a/plugins/WebView/src/main.cpp
+++ b/plugins/WebView/src/main.cpp
@@ -29,7 +29,7 @@ HANDLE hHookDisplayDataAlert, hHookAlertPopup, hHookAlertWPopup, hHookErrorPopup
int hLangpack = 0;
CLIST_INTERFACE *pcli;
-static HMODULE hRichEd = NULL;
+static HMODULE hRichEd = nullptr;
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
@@ -95,8 +95,8 @@ extern "C" int __declspec(dllexport) Unload(void)
{
ChangeContactStatus(0);
- KillTimer(NULL, timerId);
- KillTimer(NULL, Countdown);
+ KillTimer(nullptr, timerId);
+ KillTimer(nullptr, Countdown);
db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 0);
SavewinSettings();
@@ -105,7 +105,7 @@ extern "C" int __declspec(dllexport) Unload(void)
if (hNetlibUser) {
Netlib_CloseHandle(hNetlibUser);
- hNetlibUser = NULL;
+ hNetlibUser = nullptr;
}
if (hHookDisplayDataAlert)
@@ -115,7 +115,7 @@ extern "C" int __declspec(dllexport) Unload(void)
if (hHookAlertWPopup)
DestroyHookableEvent(hHookAlertWPopup);
- if (h_font != NULL)
+ if (h_font != nullptr)
DeleteObject(h_font);
if (hMenu)
DestroyMenu(hMenu);
@@ -136,9 +136,9 @@ extern "C" int __declspec(dllexport) Load()
/*TIMERS*/
if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME) != 0)) {
- timerId = SetTimer(NULL, 0, ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME)) * MINUTE), timerfunc);
+ timerId = SetTimer(nullptr, 0, ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME)) * MINUTE), timerfunc);
db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0);
- Countdown = SetTimer(NULL, 0, MINUTE, Countdownfunc);
+ Countdown = SetTimer(nullptr, 0, MINUTE, Countdownfunc);
}
InitialiseGlobals();
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp
index 592a4a734d..9c77b5e6af 100644
--- a/plugins/WebView/src/webview.cpp
+++ b/plugins/WebView/src/webview.cpp
@@ -97,7 +97,7 @@ void TxtclrLoop()
for (MCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) {
HWND hwndDlg = WindowList_Find(hWindowList, hContact);
SetDlgItemText(hwndDlg, IDC_DATA, L"");
- InvalidateRect(hwndDlg, NULL, 1);
+ InvalidateRect(hwndDlg, nullptr, 1);
}
}
@@ -108,7 +108,7 @@ void BGclrLoop()
HWND hwndDlg = (WindowList_Find(hWindowList, hContact));
SetDlgItemText(hwndDlg, IDC_DATA, L"");
SendDlgItemMessage(hwndDlg, IDC_DATA, EM_SETBKGNDCOLOR, 0, BackgoundClr);
- InvalidateRect(hwndDlg, NULL, 1);
+ InvalidateRect(hwndDlg, nullptr, 1);
}
}
@@ -185,7 +185,7 @@ int Doubleclick(WPARAM wParam, LPARAM)
SetFocus(hwndDlg);
}
else {
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, (LPARAM)hContact);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
@@ -269,7 +269,7 @@ void CALLBACK timerfunc(HWND, UINT, UINT_PTR, DWORD)
if (!(db_get_b(NULL, MODULENAME, OFFLINE_STATUS, 1)))
if (!(db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0)))
- mir_forkthread(ContactLoop, NULL);
+ mir_forkthread(ContactLoop, nullptr);
db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0);
}
@@ -352,7 +352,7 @@ int ModulesLoaded(WPARAM, LPARAM)
// get data on startup
if (db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0))
- mir_forkthread(StartUpdate, NULL);
+ mir_forkthread(StartUpdate, nullptr);
return 0;
}
@@ -362,13 +362,13 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM)
{
MCONTACT hContact = wParam;
HWND hwndDlg = WindowList_Find(hWindowList, hContact);
- if (hwndDlg != NULL) {
+ if (hwndDlg != nullptr) {
DestroyWindow(hwndDlg);
return 0;
}
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, (LPARAM)hContact);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, (LPARAM)hContact);
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
@@ -396,7 +396,7 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM)
/*****************************************************************************/
INT_PTR UpdateAllMenuCommand(WPARAM, LPARAM)
{
- mir_forkthread(ContactLoop, NULL);
+ mir_forkthread(ContactLoop, nullptr);
return 0;
}
@@ -474,7 +474,7 @@ INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM)
return 0;
}
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACT_OPT), NULL, DlgProcContactOpt, (LPARAM)wParam);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACT_OPT), nullptr, DlgProcContactOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
@@ -489,7 +489,7 @@ INT_PTR CntAlertMenuCommand(WPARAM wParam, LPARAM)
return 0;
}
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ALRT_OPT), NULL, DlgProcAlertOpt, (LPARAM)wParam);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ALRT_OPT), nullptr, DlgProcAlertOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp
index bdd4551410..78d217a383 100644
--- a/plugins/WebView/src/webview_alerts.cpp
+++ b/plugins/WebView/src/webview_alerts.cpp
@@ -113,7 +113,7 @@ int PopupAlert(WPARAM wParam, LPARAM lParam)
{
POPUPDATAT ppd = { 0 };
- if( ((HANDLE)wParam) != NULL) {
+ if( ((HANDLE)wParam) != nullptr) {
DBVARIANT dbv;
db_get_ws(wParam, MODULENAME, PRESERVE_NAME_KEY, &dbv);
mir_wstrncpy(ppd.lptzContactName, dbv.ptszVal, _countof(ppd.lptzContactName));
@@ -143,7 +143,7 @@ int PopupAlert(WPARAM wParam, LPARAM lParam)
ppd.colorText = TextClr;
}
- ppd.PluginWindowProc = NULL;
+ ppd.PluginWindowProc = nullptr;
ppd.iSeconds = db_get_dw(NULL, MODULENAME, POP_DELAY_KEY, 0);
if (ServiceExists(MS_POPUP_ADDPOPUPT))
@@ -196,7 +196,7 @@ int ErrorMsgs(WPARAM wParam, LPARAM lParam)
CallService("OSD/Announce", (WPARAM)newdisplaytext, 0);
}
- Clist_TrayNotifyW(NULL, ptszContactName, TranslateW(displaytext), NIIF_ERROR, 15000);
+ Clist_TrayNotifyW(nullptr, ptszContactName, TranslateW(displaytext), NIIF_ERROR, 15000);
return 0;
}
@@ -220,13 +220,13 @@ void SaveToFile(MCONTACT hContact, char *truncated)
return;
FILE *pfile = fopen(dbv.pszVal, mode);
- if (pfile == NULL)
+ if (pfile == nullptr)
WErrorPopup(hContact, TranslateT("Cannot write to file"));
else {
char timestring[128], timeprefix[32];
char temptime1[32], temptime2[32];
- time_t ftime = time(NULL);
+ time_t ftime = time(nullptr);
struct tm *nTime = localtime(&ftime);
mir_snprintf(timeprefix, " %s ", Translate("Last updated on"));
@@ -332,7 +332,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Start/end strings not found or strings not set."));
}
- else MessageBox(NULL, TranslateT("Start/end strings not found or strings not set."), _A2W(MODULENAME), MB_OK);
+ else MessageBox(nullptr, TranslateT("Start/end strings not found or strings not set."), _A2W(MODULENAME), MB_OK);
}
if (eventIndex == 0) { // string present
@@ -340,7 +340,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
strncpy_s(alertstring, _countof(alertstring), tdbv.pszVal, _TRUNCATE);
db_free(&tdbv);
- if ((strstr(tempraw, alertstring)) != 0) { // // ENDALERT EVENT:CHECK FOR STRING
+ if ((strstr(tempraw, alertstring)) != nullptr) { // // ENDALERT EVENT:CHECK FOR STRING
// there was an alert
wasAlert = 1;
@@ -405,7 +405,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
HWND hwndDlg = WindowList_Find(hWindowList, hContact);
SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Download successful; about to process data..."));
}
- else MessageBox(NULL, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK);
+ else MessageBox(nullptr, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK);
}
}
}
@@ -419,11 +419,11 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
*cacheend = '\0';
mir_snwprintf(cachedirectorypath, L"%s%S%S", cachepath, MODULENAME, "cache\\");
- CreateDirectory(cachedirectorypath, NULL);
+ CreateDirectory(cachedirectorypath, nullptr);
mir_snwprintf(newcachepath, L"%s%S%S%S%S", cachepath, MODULENAME, "cache\\", contactname, ".txt");
// file exists?
if ( _waccess(newcachepath, 0) != -1) {
- if ((pcachefile = _wfopen(newcachepath, L"r")) == NULL)
+ if ((pcachefile = _wfopen(newcachepath, L"r")) == nullptr)
WErrorPopup((UINT_PTR)contactname, TranslateT("Cannot read from file"));
else {
memset(&cachecompare, 0, sizeof(cachecompare));
@@ -432,7 +432,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
}
}
// write to cache
- if ((pcachefile = _wfopen(newcachepath, L"w")) == NULL)
+ if ((pcachefile = _wfopen(newcachepath, L"w")) == nullptr)
WErrorPopup((UINT_PTR)contactname, TranslateT("Cannot write to file 1"));
else {
fwrite(tempraw, mir_strlen(tempraw), 1, pcachefile); //smaller cache
@@ -500,7 +500,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0))
db_set_s(hContact, "CList", "MyHandle", tstr);
}
- else MessageBox(NULL, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK);
+ else MessageBox(nullptr, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK);
}
}
}
@@ -517,7 +517,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
}
// putting data into string
- if (((strstr(tempraw, Alerttempstring)) != 0) && ((strstr(tempraw, Alerttempstring2)) != 0)) {
+ if (((strstr(tempraw, Alerttempstring)) != nullptr) && ((strstr(tempraw, Alerttempstring2)) != nullptr)) {
//start string
alertpos = strstr(tempraw, Alerttempstring);
statalertpos = alertpos - tempraw;
@@ -616,13 +616,13 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
HWND hwndDlg = (WindowList_Find(hWindowList, hContact));
SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Alert start/end strings not found or strings not set."));
}
- else MessageBox(NULL, TranslateT("Alert start/end strings not found or strings not set."), _A2W(MODULENAME), MB_OK);
+ else MessageBox(nullptr, TranslateT("Alert start/end strings not found or strings not set."), _A2W(MODULENAME), MB_OK);
db_set_w(hContact, MODULENAME, "Status", ID_STATUS_AWAY);
}
///////////////
- if (((strstr(tempraw, Alerttempstring)) != 0) && ((strstr(tempraw, Alerttempstring2)) != 0)) {
+ if (((strstr(tempraw, Alerttempstring)) != nullptr) && ((strstr(tempraw, Alerttempstring2)) != nullptr)) {
// TEST GET NAME FOR CACHE
wchar_t cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
GetModuleFileName(hInst, cachepath, _countof(cachepath));
@@ -631,11 +631,11 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
*cacheend = '\0';
mir_snwprintf(cachedirectorypath, L"%s%S%S", cachepath, MODULENAME, "cache\\");
- CreateDirectory(cachedirectorypath, NULL);
+ CreateDirectory(cachedirectorypath, nullptr);
mir_snwprintf(newcachepath, L"%s%S%S%S%S", cachepath, MODULENAME, "cache\\", contactname, ".txt");
// file exists?
if ( _waccess(newcachepath, 0) != -1) {
- if ((pcachefile = _wfopen(newcachepath, L"r")) == NULL)
+ if ((pcachefile = _wfopen(newcachepath, L"r")) == nullptr)
WErrorPopup((UINT_PTR)contactname, TranslateT("Cannot read from file"));
else {
memset(&cachecompare, 0, sizeof(cachecompare));
@@ -644,7 +644,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
}
}
// write to cache
- if ((pcachefile = _wfopen(newcachepath, L"w")) == NULL)
+ if ((pcachefile = _wfopen(newcachepath, L"w")) == nullptr)
WErrorPopup((UINT_PTR)contactname, TranslateT("Cannot write to file 2"));
else {
fwrite(raw, mir_strlen(raw), 1, pcachefile); //smaller cache
@@ -710,7 +710,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
if ( db_get_b(hContact, MODULENAME, APND_DATE_NAME_KEY, 0))
db_set_s(hContact, "CList", "MyHandle", tstr);
}
- else MessageBox(NULL, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK);
+ else MessageBox(nullptr, TranslateT("Unknown alert type."), _A2W(MODULENAME), MB_OK);
}
}
}
@@ -763,7 +763,7 @@ int DataWndAlertCommand(WPARAM wParam, LPARAM)
if ( WindowList_Find(hWindowList, hContact))
return 0;
- HWND hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, hContact);
+ HWND hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), nullptr, DlgProcDisplayData, hContact);
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) ((HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
if ( db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
@@ -802,7 +802,7 @@ void ReadFromFile(void *param)
return;
FILE *pfile;
- if ((pfile = fopen(dbv.pszVal, "r")) == NULL) {
+ if ((pfile = fopen(dbv.pszVal, "r")) == nullptr) {
SendToRichEdit(hwndDlg, Translate("Cannot read from cache file"), TextClr, BackgoundClr);
fileexists = 0;
}
diff --git a/plugins/WebView/src/webview_cleanup.cpp b/plugins/WebView/src/webview_cleanup.cpp
index 11c7558f9c..31d081e15c 100644
--- a/plugins/WebView/src/webview_cleanup.cpp
+++ b/plugins/WebView/src/webview_cleanup.cpp
@@ -374,8 +374,8 @@ void CodetoSymbol(char *truncated)
while (true) { // loop forever
Sleep(1); // avoid 100% CPU
- if ( strstr(truncated, CharacterCodes[n]) != 0) { // does character code exist?
- if (strstr(truncated, CharacterCodes[n]) != 0)
+ if ( strstr(truncated, CharacterCodes[n]) != nullptr) { // does character code exist?
+ if (strstr(truncated, CharacterCodes[n]) != nullptr)
stringfrompos = strstr(truncated, CharacterCodes[n]);
position = stringfrompos - truncated;
@@ -415,25 +415,25 @@ void EraseBlock(char *truncated)
Sleep(1); // avoid 100% CPU
// /get start and end of block
- if (strstr(tempraw, "<!--") != 0) // does tag exist?
+ if (strstr(tempraw, "<!--") != nullptr) // does tag exist?
{
stringfrompos = strstr(tempraw, "<!--");
positionStart = stringfrompos - tempraw;
}
- if (strstr(tempraw, "-->") != 0) // does tag exist?
+ if (strstr(tempraw, "-->") != nullptr) // does tag exist?
{
stringfrompos = strstr(tempraw, "-->");
positionEnd = stringfrompos - tempraw;
}
BlockLength = (positionEnd - positionStart) + 3;
- if ((strstr(tempraw, "<!--") == 0) || (strstr(tempraw, "-->") == 0))
+ if ((strstr(tempraw, "<!--") == nullptr) || (strstr(tempraw, "-->") == nullptr))
break;
/////////////////////////////////////////
- if (strstr(tempraw, "<!--") != 0)
+ if (strstr(tempraw, "<!--") != nullptr)
for (counter = 0; counter < BlockLength; counter++)
tempraw[positionStart + counter] = ' ';
@@ -455,9 +455,9 @@ void EraseBlock(char *truncated)
Sleep(1); // avoid 100% CPU
// /get start and end of block
- if (((strstr(tempraw, "<script")) != 0) || (strstr(tempraw, "<SCRIPT") != 0)) // does
+ if (((strstr(tempraw, "<script")) != nullptr) || (strstr(tempraw, "<SCRIPT") != nullptr)) // does
{
- if (strstr(tempraw, "<script") != 0)
+ if (strstr(tempraw, "<script") != nullptr)
stringfrompos = strstr(tempraw, "<script");
else
stringfrompos = strstr(tempraw, "<SCRIPT");
@@ -465,9 +465,9 @@ void EraseBlock(char *truncated)
positionStart = stringfrompos - tempraw;
}
- if (((strstr(tempraw, "</script")) != 0) || (strstr(tempraw, "</SCRIPT") != 0)) // does
+ if (((strstr(tempraw, "</script")) != nullptr) || (strstr(tempraw, "</SCRIPT") != nullptr)) // does
{
- if (strstr(tempraw, "<script") != 0)
+ if (strstr(tempraw, "<script") != nullptr)
stringfrompos = strstr(tempraw, "</script");
else
stringfrompos = strstr(tempraw, "</SCRIPT");
@@ -476,15 +476,15 @@ void EraseBlock(char *truncated)
}
BlockLength = (positionEnd - positionStart) + 9;
- if ((strstr(tempraw, "<script") != 0) && (strstr(tempraw, "</script") == 0))
+ if ((strstr(tempraw, "<script") != nullptr) && (strstr(tempraw, "</script") == nullptr))
break;
- if ((strstr(tempraw, "<SCRIPT") != 0) && (strstr(tempraw, "</SCRIPT") == 0))
+ if ((strstr(tempraw, "<SCRIPT") != nullptr) && (strstr(tempraw, "</SCRIPT") == nullptr))
break;
///////////////////////////////////////
- if (((strstr(tempraw, "<script")) != 0) || ((strstr(tempraw, "<SCRIPT")) != 0))
+ if (((strstr(tempraw, "<script")) != nullptr) || ((strstr(tempraw, "<SCRIPT")) != nullptr))
for (counter = 0; counter < BlockLength; counter++)
tempraw[positionStart + counter] = ' ';
@@ -504,9 +504,9 @@ void EraseBlock(char *truncated)
Sleep(1); // avoid 100% CPU
// /get start and end of block
- if (((strstr(tempraw, "<style")) != 0) || (strstr(tempraw, "<STYLE") != 0)) // does
+ if (((strstr(tempraw, "<style")) != nullptr) || (strstr(tempraw, "<STYLE") != nullptr)) // does
{
- if (strstr(tempraw, "<style") != 0)
+ if (strstr(tempraw, "<style") != nullptr)
stringfrompos = strstr(tempraw, "<style");
else
stringfrompos = strstr(tempraw, "<STYLE");
@@ -514,9 +514,9 @@ void EraseBlock(char *truncated)
positionStart = stringfrompos - tempraw;
}
- if (((strstr(tempraw, "</style")) != 0) || (strstr(tempraw, "</STYLE") != 0)) // does
+ if (((strstr(tempraw, "</style")) != nullptr) || (strstr(tempraw, "</STYLE") != nullptr)) // does
{
- if (strstr(tempraw, "<style") != 0)
+ if (strstr(tempraw, "<style") != nullptr)
stringfrompos = strstr(tempraw, "</style");
else
stringfrompos = strstr(tempraw, "</STYLE");
@@ -525,14 +525,14 @@ void EraseBlock(char *truncated)
}
BlockLength = (positionEnd - positionStart) + 8;
- if ((strstr(tempraw, "<style") != 0) && (strstr(tempraw, "</style") == 0))
+ if ((strstr(tempraw, "<style") != nullptr) && (strstr(tempraw, "</style") == nullptr))
break;
- if ((strstr(tempraw, "<STYLE") != 0) && (strstr(tempraw, "</STYLE") == 0))
+ if ((strstr(tempraw, "<STYLE") != nullptr) && (strstr(tempraw, "</STYLE") == nullptr))
break;
///////////////////////////////////////
- if (((strstr(tempraw, "<style")) != 0) || ((strstr(tempraw, "<STYLE")) != 0))
+ if (((strstr(tempraw, "<style")) != nullptr) || ((strstr(tempraw, "<STYLE")) != nullptr))
for (counter = 0; counter < BlockLength; counter++)
tempraw[positionStart + counter] = ' ';
@@ -550,24 +550,24 @@ void EraseBlock(char *truncated)
while (true) {
Sleep(1); // avoid 100% CPU
// /get start and end of block
- if (strstr(tempraw, "{") != 0) // does tag exist?
+ if (strstr(tempraw, "{") != nullptr) // does tag exist?
{
stringfrompos = strstr(tempraw, "{");
positionStart = stringfrompos - tempraw;
}
- if (strstr(tempraw, "}") != 0) // does tag exist?
+ if (strstr(tempraw, "}") != nullptr) // does tag exist?
{
stringfrompos = strstr(tempraw, "}");
positionEnd = stringfrompos - tempraw;
}
BlockLength = (positionEnd - positionStart) + 1;
- if ((strstr(tempraw, "}") == 0) || (strstr(tempraw, "{") == 0))
+ if ((strstr(tempraw, "}") == nullptr) || (strstr(tempraw, "{") == nullptr))
break;
/////////////////////////////////////////
- if (strstr(tempraw, "{") != 0)
+ if (strstr(tempraw, "{") != nullptr)
for (counter = 0; counter < BlockLength; counter++)
tempraw[positionStart + counter] = ' ';
@@ -605,7 +605,7 @@ void EraseSymbols(char *truncated)
/**/
counter = 0;
- if ((strstr(tempraw, "&#")) != 0) {
+ if ((strstr(tempraw, "&#")) != nullptr) {
stringfrompos = strstr(tempraw, "&#");
position = stringfrompos - tempraw;
@@ -647,7 +647,7 @@ void NumSymbols(char *truncated)
counter = 0;
- if ((strstr(tempraw, "&#")) != 0) {
+ if ((strstr(tempraw, "&#")) != nullptr) {
stringfrompos = strstr(tempraw, "&#");
position = stringfrompos - tempraw;
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp
index dd66e38fbd..bbbed64265 100644
--- a/plugins/WebView/src/webview_datawnd.cpp
+++ b/plugins/WebView/src/webview_datawnd.cpp
@@ -69,7 +69,7 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
OLDstartposition = startposition;
- if ((strstr(Searchstr, NewSearchstr)) != 0)
+ if ((strstr(Searchstr, NewSearchstr)) != nullptr)
startposition = loc + (int)mir_strlen(Searchstr);
else {
oldloc = 0;
@@ -135,7 +135,7 @@ static MCONTACT FindContactByUrl(HWND hwndDlg)
if (!mir_wstrcmp(urltext, db1) && !mir_wstrcmp(titlebartxt, db2)) {
contactcount++;
if (contactcount > 1) {
- MessageBox(NULL, TranslateT("ERROR: You have two or more Webview contacts with the same URL and contact name."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("ERROR: You have two or more Webview contacts with the same URL and contact name."), _A2W(MODULENAME), MB_OK);
return NULL;
}
res = hContact;
@@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SetDlgItemText(hwndDlg, IDC_DATA, L"");
- InvalidateRect(hwndDlg, NULL, 1);
+ InvalidateRect(hwndDlg, nullptr, 1);
SendDlgItemMessage(hwndDlg, IDC_DATA, EM_AUTOURLDETECT, 1, 0);
int mask = (int)SendDlgItemMessage(hwndDlg, IDC_DATA, EM_GETEVENTMASK, 0, 0);
@@ -270,7 +270,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
pt.x = (short) LOWORD(((ENLINK *) lParam)->lParam);
pt.y = (short) HIWORD(((ENLINK *) lParam)->lParam);
ClientToScreen(((NMHDR *) lParam)->hwndFrom, &pt);
- switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr)) {
case IDM_COPY:
SendMessage(((NMHDR *) lParam)->hwndFrom, WM_COPY, 0, 0);
break;
@@ -320,7 +320,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
tr.lpstrText = (char*)malloc(tr.chrg.cpMax - tr.chrg.cpMin + 8);
SendDlgItemMessage(hwndDlg, IDC_DATA, EM_GETTEXTRANGE, 0, (LPARAM) & tr);
- if (strchr(tr.lpstrText, '@') != NULL && strchr(tr.lpstrText, ':') == NULL && strchr(tr.lpstrText, '/') == NULL) {
+ if (strchr(tr.lpstrText, '@') != nullptr && strchr(tr.lpstrText, ':') == nullptr && strchr(tr.lpstrText, '/') == nullptr) {
memmove(tr.lpstrText + 7, tr.lpstrText, tr.chrg.cpMax - tr.chrg.cpMin + 1);
memcpy(tr.lpstrText, "mailto:", 7);
}
@@ -404,7 +404,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case IDOK:
case IDCANCEL:
- if (hwndDlg != NULL)
+ if (hwndDlg != nullptr)
DestroyWindow(hwndDlg);
return TRUE;
}
@@ -422,7 +422,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (hContact = FindContactByUrl(hwndDlg))
Utils_SaveWindowPosition(hwndDlg, hContact, MODULENAME, "WV");
- if (hwndDlg != NULL)
+ if (hwndDlg != nullptr)
DestroyWindow(hwndDlg);
return 0;
@@ -432,7 +432,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case WM_SIZE:
Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_DISPLAY_DATA), DataDialogResize);
- InvalidateRect(hwndDlg, NULL, TRUE);
+ InvalidateRect(hwndDlg, nullptr, TRUE);
// global
GetWindowRect(hwndDlg, &rc);
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp
index 3e0c656a0a..ef9ba7fa7e 100644
--- a/plugins/WebView/src/webview_getdata.cpp
+++ b/plugins/WebView/src/webview_getdata.cpp
@@ -115,7 +115,7 @@ void GetData(void *param)
headers[0].szValue = NETLIB_USER_AGENT;
headers[1].szName = "Content-Length";
- headers[1].szValue = NULL;
+ headers[1].szValue = nullptr;
nlhr.headers = headers;
@@ -181,7 +181,7 @@ void GetData(void *param)
mir_strncpy(truncated, truncated2, MAXSIZE1);
else { // use start and end string
// putting data into string
- if (((strstr(truncated2, tempstring)) != 0) && ((strstr(truncated2, tempstring2)) != 0)) {
+ if (((strstr(truncated2, tempstring)) != nullptr) && ((strstr(truncated2, tempstring2)) != nullptr)) {
// start string
pos = strstr(truncated2, tempstring);
statpos = pos - truncated2;
@@ -270,7 +270,7 @@ void GetData(void *param)
if (!db_get_s(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) {
memset(&temptime, 0, sizeof(temptime));
memset(&tstr, 0, sizeof(tstr));
- ftime = time(NULL);
+ ftime = time(nullptr);
nTime = localtime(&ftime);
// 12 hour
if (db_get_b(hContact, MODULENAME, USE_24_HOUR_KEY, 0) == 0)
@@ -289,7 +289,7 @@ void GetData(void *param)
db_get_ws(hContact, "CList", "MyHandle", &dbv);
memset(&temptime, 0, sizeof(temptime));
memset(&tstr, 0, sizeof(tstr));
- ftime = time(NULL);
+ ftime = time(nullptr);
nTime = localtime(&ftime);
// 12 hour
if (db_get_b(hContact, MODULENAME, USE_24_HOUR_KEY, 0) == 0)
@@ -306,7 +306,7 @@ void GetData(void *param)
db_free(&dbv);
}
- ftime = time(NULL);
+ ftime = time(nullptr);
nTime = localtime(&ftime);
strncpy_s(timeprefix, _countof(timeprefix), Translate("Last updated on"), _TRUNCATE);
@@ -340,14 +340,14 @@ void GetData(void *param)
}
// putting data into string
- if (((strstr(buff, Alerttempstring)) != 0) && ((strstr(buff, Alerttempstring2)) != 0)) {
+ if (((strstr(buff, Alerttempstring)) != nullptr) && ((strstr(buff, Alerttempstring2)) != nullptr)) {
location = (strstr(buff, Alerttempstring)) - buff;
location2 = (strstr(buff, Alerttempstring2)) - buff;
}
}
}
- if ((((strstr(truncated2, tempstring)) != 0) && ((strstr(truncated2, tempstring2)) != 0) && (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 0)) || (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 1)) {
+ if ((((strstr(truncated2, tempstring)) != nullptr) && ((strstr(truncated2, tempstring2)) != nullptr) && (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 0)) || (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 1)) {
RemoveTabs(truncated);
if ( db_get_b(hContact, MODULENAME, CLEAR_DISPLAY_KEY, 0)) {
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp
index 66970dc59d..4ad9519b4a 100644
--- a/plugins/WebView/src/webview_opts.cpp
+++ b/plugins/WebView/src/webview_opts.cpp
@@ -43,9 +43,9 @@ wchar_t* FixButtonText(wchar_t *url, size_t len)
wcsncpy_s(buttontext, url, _TRUNCATE);
wcsncpy_s(newbuttontext, url, _TRUNCATE);
- if (wcschr(newbuttontext, '&') != 0) {
+ if (wcschr(newbuttontext, '&') != nullptr) {
while (true) {
- if (wcschr(newbuttontext, '&') == 0)
+ if (wcschr(newbuttontext, '&') == nullptr)
break;
wcsncpy_s(buttontext, newbuttontext, _TRUNCATE);
@@ -62,12 +62,12 @@ wchar_t* FixButtonText(wchar_t *url, size_t len)
}
while (true) {
- if (wcschr(newbuttontext, '!') != 0) {
+ if (wcschr(newbuttontext, '!') != nullptr) {
wchar_t *stringafter = wcschr(newbuttontext, '!');
int pos = (stringafter - newbuttontext);
newbuttontext[pos] = '&';
}
- if (wcschr(newbuttontext, '!') == 0)
+ if (wcschr(newbuttontext, '!') == nullptr)
break;
}
}
@@ -211,7 +211,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
mir_wstrcpy(ppd.lptzText, TranslateT("This is a preview popup."));
ppd.colorBack = BGColour;
ppd.colorText = TextColour;
- ppd.PluginWindowProc = NULL;
+ ppd.PluginWindowProc = nullptr;
ppd.iSeconds = _wtol(str3);
// display popups
PUAddPopupT(&ppd);
@@ -445,7 +445,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndDlg;
- ofn.hInstance = NULL;
+ ofn.hInstance = nullptr;
ofn.lpstrFilter = L"TEXT Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0";
ofn.lpstrFile = szFileName;
ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
@@ -715,18 +715,18 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
if (eventIndex == 0) // string present
if (!(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ALERT_STRING))))
if (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)) {
- MessageBox(NULL, TranslateT("You need to supply a search string."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a search string."), _A2W(MODULENAME), MB_OK);
break;
}
if (eventIndex == 2) // part of web page changed
if (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)) {
if (!(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_START2)))) {
- MessageBox(NULL, TranslateT("You need to supply a start string."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a start string."), _A2W(MODULENAME), MB_OK);
break;
}
if (!(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_END2)))) {
- MessageBox(NULL, TranslateT("You need to supply an end string."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply an end string."), _A2W(MODULENAME), MB_OK);
break;
}
}
@@ -734,14 +734,14 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
if (alertIndex == 1) // log to file
if (!(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_FILENAME))))
if (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)) {
- MessageBox(NULL, TranslateT("You need to supply a file name and path."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a file name and path."), _A2W(MODULENAME), MB_OK);
break;
}
if (IsDlgButtonChecked(hwndDlg, IDC_ALWAYS_LOG))
if (!(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_FILENAME))))
if (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)) {
- MessageBox(NULL, TranslateT("You need to supply a file name and path."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a file name and path."), _A2W(MODULENAME), MB_OK);
break;
}
@@ -780,7 +780,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
WindowList_Remove(hWindowList, hwndDlg);
if (hwndDlg) {
DestroyWindow(hwndDlg);
- hwndDlg = NULL;
+ hwndDlg = nullptr;
}
break;
@@ -887,7 +887,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case IDCANCEL:
if (hwndDlg) {
DestroyWindow(hwndDlg);
- hwndDlg = NULL;
+ hwndDlg = nullptr;
}
return TRUE;
@@ -952,61 +952,61 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
{
wchar_t str[128], contactname[128];
if (!GetWindowTextLength(GetDlgItem(hwndDlg, IDC_URL))) {
- MessageBox(NULL, TranslateT("You need to supply a URL."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a URL."), _A2W(MODULENAME), MB_OK);
break;
}
if (!GetWindowTextLength(GetDlgItem(hwndDlg, IDC_START))) {
if (IsDlgButtonChecked(hwndDlg, IDC_U_SE_STRINGS)) {
- MessageBox(NULL, TranslateT("You need to supply a start string."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a start string."), _A2W(MODULENAME), MB_OK);
break;
}
}
if (!GetWindowTextLength(GetDlgItem(hwndDlg, IDC_END))) {
if (IsDlgButtonChecked(hwndDlg, IDC_U_SE_STRINGS)) {
- MessageBox(NULL, TranslateT("You need to supply an end string."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply an end string."), _A2W(MODULENAME), MB_OK);
break;
}
}
if (!GetWindowTextLength(GetDlgItem(hwndDlg, IDC_SITE_NAME))) {
- MessageBox(NULL, TranslateT("You need to supply a name for the contact."), _A2W(MODULENAME), MB_OK);
+ MessageBox(nullptr, TranslateT("You need to supply a name for the contact."), _A2W(MODULENAME), MB_OK);
break;
}
GetDlgItemText(hwndDlg, IDC_SITE_NAME, contactname, _countof(contactname));
- if (wcschr(contactname, '\\') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '\\') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '/') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '/') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, ':') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, ':') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '*') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '*') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '?') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '?') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '\"') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '\"') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '<') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '<') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '>') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '>') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
- if (wcschr(contactname, '|') != NULL) {
- MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
+ if (wcschr(contactname, '|') != nullptr) {
+ MessageBox(nullptr, TranslateT("Invalid symbol present in contact name."), _A2W(MODULENAME), MB_OK);
break;
}
@@ -1041,7 +1041,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
EnableWindow(GetDlgItem(ParentHwnd, IDC_ALERT_BUTTON), 1);
if (hwndDlg) {
DestroyWindow(hwndDlg);
- hwndDlg = NULL;
+ hwndDlg = nullptr;
}
}
}
@@ -1053,7 +1053,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
WindowList_Remove(hWindowList, hwndDlg);
if (hwndDlg) {
DestroyWindow(hwndDlg);
- hwndDlg = NULL;
+ hwndDlg = nullptr;
}
}
break;
@@ -1271,31 +1271,31 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
GetDlgItemText(hwndDlg, IDC_TYPEFACE, str, _countof(str));
db_set_ws(NULL, MODULENAME, FONT_FACE_KEY, str);
- db_set_b(NULL, MODULENAME, FONT_SIZE_KEY, (GetDlgItemInt(hwndDlg, IDC_FONTSIZE, NULL, FALSE)));
+ db_set_b(NULL, MODULENAME, FONT_SIZE_KEY, (GetDlgItemInt(hwndDlg, IDC_FONTSIZE, nullptr, FALSE)));
db_set_b(NULL, MODULENAME, FONT_SCRIPT_KEY, ((BYTE)SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCURSEL, 0, 0), 0)));
db_set_b(NULL, MODULENAME, ERROR_POPUP_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ERROR_POPUP));
- timerval = GetDlgItemInt(hwndDlg, IDC_TIME, NULL, FALSE);
+ timerval = GetDlgItemInt(hwndDlg, IDC_TIME, nullptr, FALSE);
db_set_dw(NULL, MODULENAME, REFRESH_KEY, timerval);
db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, timerval);
- delaytime = GetDlgItemInt(hwndDlg, IDC_START_DELAY, NULL, FALSE);
+ delaytime = GetDlgItemInt(hwndDlg, IDC_START_DELAY, nullptr, FALSE);
db_set_dw(NULL, MODULENAME, START_DELAY_KEY, delaytime);
BackgoundClr = (SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0));
TextClr = (SendDlgItemMessage(hwndDlg, IDC_TXTCOLOR, CPM_GETCOLOUR, 0, 0));
if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) != 0)) {
- KillTimer(NULL, timerId);
- KillTimer(NULL, Countdown);
- timerId = SetTimer(NULL, 0, ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0)) * MINUTE), timerfunc);
- Countdown = SetTimer(NULL, 0, MINUTE, Countdownfunc);
+ KillTimer(nullptr, timerId);
+ KillTimer(nullptr, Countdown);
+ timerId = SetTimer(nullptr, 0, ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0)) * MINUTE), timerfunc);
+ Countdown = SetTimer(nullptr, 0, MINUTE, Countdownfunc);
}
if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) == 0)) {
- KillTimer(NULL, timerId);
- KillTimer(NULL, Countdown);
+ KillTimer(nullptr, timerId);
+ KillTimer(nullptr, Countdown);
}
test = 0;
}
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp
index 3fe04a9629..91ae497ba7 100644
--- a/plugins/WebView/src/webview_services.cpp
+++ b/plugins/WebView/src/webview_services.cpp
@@ -41,7 +41,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam)
int invalidpresent = 0;
char *szProto = GetContactProto(hContact);
- if (szProto == NULL || strcmp(szProto, MODULENAME))
+ if (szProto == nullptr || strcmp(szProto, MODULENAME))
return 0;
// A contact is renamed
@@ -59,7 +59,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam)
for (int i=0; i < _countof(szInvalidChars); i++ ) {
wchar_t *p = wcschr(nick, szInvalidChars[i]);
- if (p != NULL) {
+ if (p != nullptr) {
WErrorPopup((UINT_PTR)"ERROR", TranslateT("Invalid symbol present in contact name."));
*p = '_';
invalidpresent =1;
@@ -67,13 +67,13 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam)
}
if (invalidpresent) {
- srand((unsigned)time(NULL));
+ srand((unsigned)time(nullptr));
wchar_t ranStr[7];
_itow((int)10000 *rand() / (RAND_MAX + 1.0), ranStr, 10);
mir_wstrcat(nick, ranStr);
}
- if ( wcschr(nick, '(') == 0) {
+ if ( wcschr(nick, '(') == nullptr) {
db_set_ws(hContact, MODULENAME, PRESERVE_NAME_KEY, nick);
db_set_ws(hContact, MODULENAME, "Nick", nick);
db_set_ws(hContact, "CList", "MyHandle", nick);
@@ -86,7 +86,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam)
cacheend++;
*cacheend = '\0';
mir_snwprintf(cachedirectorypath, L"%s" _A2W(MODULENAME) L"cache\\", cachepath);
- CreateDirectory(cachedirectorypath, NULL);
+ CreateDirectory(cachedirectorypath, nullptr);
wchar_t newcachepath[MAX_PATH + 50], renamedcachepath[MAX_PATH + 50];
mir_snwprintf(newcachepath, L"%s" _A2W(MODULENAME) L"cache\\%s.txt", cachepath, oldName);
@@ -95,7 +95,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam)
// file exists?
if ( _waccess(newcachepath, 0) != -1) {
FILE *pcachefile = _wfopen(newcachepath, L"r");
- if (pcachefile != NULL) {
+ if (pcachefile != nullptr) {
fclose(pcachefile);
if (mir_wstrcmp(newcachepath, renamedcachepath)) {
MoveFile(newcachepath, renamedcachepath);
@@ -125,12 +125,12 @@ int SiteDeleted(WPARAM wParam, LPARAM)
*cacheend = '\0';
mir_snwprintf(cachedirectorypath, L"%s" _A2W(MODULENAME) L"cache\\", cachepath);
- CreateDirectory(cachedirectorypath, NULL);
+ CreateDirectory(cachedirectorypath, nullptr);
mir_snwprintf(newcachepath, L"%s" _A2W(MODULENAME) L"cache\\%s.txt", cachepath, contactName);
// file exists?
if ( _waccess(newcachepath, 0) != -1) {
FILE *pcachefile = _wfopen(newcachepath, L"r");
- if (pcachefile != NULL) {
+ if (pcachefile != nullptr) {
fclose(pcachefile);
DeleteFile(newcachepath);
db_set_s(hContact, MODULENAME, CACHE_FILE_KEY, "");
@@ -154,7 +154,7 @@ INT_PTR OpenCacheDir(WPARAM, LPARAM)
if( _waccess(cachedirectorypath, 0) != 0)
WErrorPopup((UINT_PTR)"ERROR", TranslateT("Cache folder does not exist."));
else
- ShellExecute(NULL, L"open", cachedirectorypath, NULL, NULL, SW_SHOWNORMAL);
+ ShellExecute(nullptr, L"open", cachedirectorypath, nullptr, nullptr, SW_SHOWNORMAL);
return 0;
}
@@ -162,7 +162,7 @@ INT_PTR OpenCacheDir(WPARAM, LPARAM)
INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM)
{
FILE *pfile = fopen("psite.bat", "r");
- if (pfile == NULL) {
+ if (pfile == nullptr) {
WErrorPopup((UINT_PTR)"ERROR", TranslateT("Missing \"psite.bat\" file."));
return 0;
}
@@ -173,7 +173,7 @@ INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM)
wchar_t Cnick[200], *Oldnick;
wcsncpy(Cnick, url, _countof(Cnick));
- if ((Oldnick = wcsstr(Cnick, L"://")) != 0)
+ if ((Oldnick = wcsstr(Cnick, L"://")) != nullptr)
Oldnick += 3;
else
Oldnick = Cnick;
@@ -181,7 +181,7 @@ INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM)
wchar_t *Nend = wcschr(Oldnick, '/');
if (Nend) *Nend = '\0';
- ShellExecute(NULL, L"open", L"psite.bat", Oldnick, NULL, SW_HIDE);
+ ShellExecute(nullptr, L"open", L"psite.bat", Oldnick, nullptr, SW_HIDE);
return 0;
}
@@ -341,9 +341,9 @@ INT_PTR AddToList(WPARAM, LPARAM lParam)
int sameurl = 0;
int samename = 0;
- if (psr == NULL)
+ if (psr == nullptr)
return 0;
- if (psr->nick.w == NULL) {
+ if (psr->nick.w == nullptr) {
WErrorPopup((UINT_PTR)"ERROR", TranslateT("Please select site in Find/Add contacts..."));
return 0;
}
@@ -379,23 +379,23 @@ INT_PTR AddToList(WPARAM, LPARAM lParam)
//Convert url into a name for contact
wchar_t Cnick[255];
- if (psr->nick.w != NULL)
+ if (psr->nick.w != nullptr)
wcsncpy(Cnick, psr->nick.w, _countof(Cnick));
else
Cnick[0] = 0;
wchar_t *Oldnick = wcsstr(Cnick, L"://");
- if (Oldnick != 0)
+ if (Oldnick != nullptr)
Oldnick += 3;
else
Oldnick = Cnick;
wchar_t *Newnick = wcsstr(Oldnick, L"www.");
- if (Newnick != 0)
+ if (Newnick != nullptr)
Newnick += 4;
else {
Newnick = wcsstr(Oldnick, L"WWW.");
- if (Newnick != 0)
+ if (Newnick != nullptr)
Newnick += 4;
else
Newnick = Oldnick;
@@ -423,7 +423,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam)
if ((sameurl > 0) || (samename > 0)) // contact has the same url or name as another contact, add rand num to name
{
- srand((unsigned) time(NULL));
+ srand((unsigned) time(nullptr));
wchar_t ranStr[10];
_itow((int) 10000 *rand() / (RAND_MAX + 1.0), ranStr, 10);
@@ -455,7 +455,7 @@ INT_PTR AddToList(WPARAM, LPARAM lParam)
/*****************************************************************************/
INT_PTR GetInfo(WPARAM, LPARAM)
{
- mir_forkthread(AckFunc, NULL);
+ mir_forkthread(AckFunc, nullptr);
return 1;
}