summaryrefslogtreecommitdiff
path: root/plugins/Ping
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Ping')
-rw-r--r--plugins/Ping/src/icmp.cpp12
-rw-r--r--plugins/Ping/src/log.cpp4
-rw-r--r--plugins/Ping/src/options.cpp4
-rw-r--r--plugins/Ping/src/ping.cpp6
-rw-r--r--plugins/Ping/src/pinggraph.cpp44
-rw-r--r--plugins/Ping/src/pingthread.cpp68
-rw-r--r--plugins/Ping/src/rawping.cpp4
-rw-r--r--plugins/Ping/src/utils.cpp6
8 files changed, 74 insertions, 74 deletions
diff --git a/plugins/Ping/src/icmp.cpp b/plugins/Ping/src/icmp.cpp
index 93bf4febd4..26e7379845 100644
--- a/plugins/Ping/src/icmp.cpp
+++ b/plugins/Ping/src/icmp.cpp
@@ -1,11 +1,11 @@
#include "stdafx.h"
char data[] = "AAAABBBBCCCCDDDDEEEEFFFFGGGGHHH";
-ICMP *ICMP::instance = 0;
+ICMP *ICMP::instance = nullptr;
#define BUFFER_SIZE (16 * (sizeof(ICMP_ECHO_REPLY) + sizeof(data)))
-ICMP::ICMP() : timeout(2000), functions_loaded(false), hIP(0)
+ICMP::ICMP() : timeout(2000), functions_loaded(false), hIP(nullptr)
{
WSAData wsaData;
if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) {
@@ -40,7 +40,7 @@ bool ICMP::ping(char *host, ICMP_ECHO_REPLY &reply)
if (address == INADDR_NONE)
{
rec = gethostbyname(host);
- if (rec != NULL)
+ if (rec != nullptr)
address = *(unsigned long *)(*rec->h_addr_list);
else
return false;
@@ -50,7 +50,7 @@ bool ICMP::ping(char *host, ICMP_ECHO_REPLY &reply)
ipoi.Tos = 0;
ipoi.Flags = 0;
ipoi.OptionsSize = 0;
- ipoi.OptionsData = 0;
+ ipoi.OptionsData = nullptr;
reply.Status = 0;
@@ -58,14 +58,14 @@ bool ICMP::ping(char *host, ICMP_ECHO_REPLY &reply)
if (hIP == INVALID_HANDLE_VALUE)
return false;
- DWORD rep_cnt = IcmpSendEcho2(hIP, 0, 0, 0, address, data, sizeof(data), 0, buff, BUFFER_SIZE, timeout);
+ DWORD rep_cnt = IcmpSendEcho2(hIP, nullptr, nullptr, nullptr, address, data, sizeof(data), nullptr, buff, BUFFER_SIZE, timeout);
if (rep_cnt == 0)
{
DWORD code = GetLastError();
if (code != 11010)
{
char winmsg[512], msg[1024];
- FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, code, 0, winmsg, 512, 0);
+ FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, code, 0, winmsg, 512, nullptr);
mir_snprintf(msg, "Ping error (%d): %s", code, winmsg);
PUShowMessage(msg, SM_NOTIFY);
return false;
diff --git a/plugins/Ping/src/log.cpp b/plugins/Ping/src/log.cpp
index 6d1a2a9767..20782c2c17 100644
--- a/plugins/Ping/src/log.cpp
+++ b/plugins/Ping/src/log.cpp
@@ -10,8 +10,8 @@ INT_PTR Log(WPARAM wParam, LPARAM) {
GetLocalTime(&systime);
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, tbuf, 512);
- GetDateFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, dbuf, 512);
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, &systime, nullptr, tbuf, 512);
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, &systime, nullptr, dbuf, 512);
wchar_t *line = (wchar_t *)wParam;
diff --git a/plugins/Ping/src/options.cpp b/plugins/Ping/src/options.cpp
index 974469725f..f8ee4ec831 100644
--- a/plugins/Ping/src/options.cpp
+++ b/plugins/Ping/src/options.cpp
@@ -91,9 +91,9 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
ofn.lpstrTitle = TranslateT("Open log file");
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
- ofn.lpstrFileTitle = NULL;
+ ofn.lpstrFileTitle = nullptr;
ofn.nMaxFileTitle = 0;
- ofn.lpstrInitialDir = NULL;
+ ofn.lpstrInitialDir = nullptr;
ofn.Flags = OFN_PATHMUSTEXIST;
if (GetOpenFileName(&ofn) == TRUE) {
diff --git a/plugins/Ping/src/ping.cpp b/plugins/Ping/src/ping.cpp
index 7dd24e6a26..c703feba7a 100644
--- a/plugins/Ping/src/ping.cpp
+++ b/plugins/Ping/src/ping.cpp
@@ -4,8 +4,8 @@ CLIST_INTERFACE *pcli;
HINSTANCE hInst;
int hLangpack = 0;
-HNETLIBUSER hNetlibUser = 0;
-HANDLE hFillListEvent = 0;
+HNETLIBUSER hNetlibUser = nullptr;
+HANDLE hFillListEvent = nullptr;
bool use_raw_ping = true;
@@ -131,7 +131,7 @@ extern "C" __declspec(dllexport) int Load(void)
db_set_b(0, PLUG, "UsingRawSockets", (BYTE)use_raw_ping);
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0);
- hWakeEvent = CreateEvent(NULL, FALSE, FALSE, L"Local\\ThreadWaitEvent");
+ hWakeEvent = CreateEvent(nullptr, FALSE, FALSE, L"Local\\ThreadWaitEvent");
// create services before loading options - so we can have the 'getlogfilename' service!
CreatePluginServices();
diff --git a/plugins/Ping/src/pinggraph.cpp b/plugins/Ping/src/pinggraph.cpp
index 1b95e95649..554c740c61 100644
--- a/plugins/Ping/src/pinggraph.cpp
+++ b/plugins/Ping/src/pinggraph.cpp
@@ -37,24 +37,24 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
return TRUE;
}
- InvalidateRect(hwnd, 0, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
}
return TRUE;
case WM_SHOWWINDOW:
if (wParam == TRUE && lParam == 0) {
WindowData *wd = (WindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (wd->hwnd_chk_grid == 0) {
- wd->hwnd_chk_grid = CreateWindow(L"BUTTON", TranslateT("Show grid lines"), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 0, 0, 0, 0, hwnd, 0, hInst, 0);
+ if (wd->hwnd_chk_grid == nullptr) {
+ wd->hwnd_chk_grid = CreateWindow(L"BUTTON", TranslateT("Show grid lines"), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 0, 0, 0, 0, hwnd, nullptr, hInst, nullptr);
SendMessage(wd->hwnd_chk_grid, BM_SETCHECK, wd->show_grid ? BST_CHECKED : BST_UNCHECKED, 0);
}
- if (wd->hwnd_chk_stat == 0) {
- wd->hwnd_chk_stat = CreateWindow(L"BUTTON", TranslateT("Show stats"), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 0, 0, 0, 0, hwnd, 0, hInst, 0);
+ if (wd->hwnd_chk_stat == nullptr) {
+ wd->hwnd_chk_stat = CreateWindow(L"BUTTON", TranslateT("Show stats"), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 0, 0, 0, 0, hwnd, nullptr, hInst, nullptr);
SendMessage(wd->hwnd_chk_stat, BM_SETCHECK, wd->show_stat ? BST_CHECKED : BST_UNCHECKED, 0);
}
KillTimer(hwnd, ID_REPAINT_TIMER);
#ifdef min
- SetTimer(hwnd, ID_REPAINT_TIMER, min(options.ping_period * 1000, 5000), 0);
+ SetTimer(hwnd, ID_REPAINT_TIMER, min(options.ping_period * 1000, 5000), nullptr);
#else
SetTimer(hwnd, ID_REPAINT_TIMER, std::min(options.ping_period * 1000, 5000), 0);
#endif
@@ -71,7 +71,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
else if ((HWND)lParam == wd->hwnd_chk_stat) {
wd->show_stat = (SendMessage(wd->hwnd_chk_stat, BM_GETCHECK, 0, 0) == BST_CHECKED);
}
- InvalidateRect(hwnd, 0, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
}
return TRUE;
case WM_TIMER:
@@ -85,7 +85,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
HDC hdc;
RECT r;
WindowData *wd = (WindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (wd && (hdc = BeginPaint(hwnd, &ps)) != 0)
+ if (wd && (hdc = BeginPaint(hwnd, &ps)) != nullptr)
{
GetClientRect(hwnd, &r);
FillRect(hdc, &r, GetSysColorBrush(COLOR_WINDOW));
@@ -144,7 +144,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
if (time / MARK_PERIOD != last_time / MARK_PERIOD)
{ // new minute
- MoveToEx(hdc, bar.left, r.bottom, 0);
+ MoveToEx(hdc, bar.left, r.bottom, nullptr);
LineTo(hdc, bar.left, r.top);
}
@@ -160,7 +160,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
// draw horizontal lines to mark every 100ms
for (int li = 0; li < graph_height; li += MARK_TIME)
{
- MoveToEx(hdc, r.left, r.bottom - (int)(li * unit_height + 0.5f), 0);
+ MoveToEx(hdc, r.left, r.bottom - (int)(li * unit_height + 0.5f), nullptr);
LineTo(hdc, r.right, r.bottom - (int)(li * unit_height + 0.5f));
}
}
@@ -169,13 +169,13 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
if (wd->show_stat)
{
SelectObject(hdc, hPen2);
- MoveToEx(hdc, r.left, r.bottom - (int)(avg * unit_height + 0.5f), 0);
+ MoveToEx(hdc, r.left, r.bottom - (int)(avg * unit_height + 0.5f), nullptr);
LineTo(hdc, r.right, r.bottom - (int)(avg * unit_height + 0.5f));
if (max_value != avg)
{
- MoveToEx(hdc, r.left, r.bottom - (int)(max_value * unit_height + 0.5f), 0);
+ MoveToEx(hdc, r.left, r.bottom - (int)(max_value * unit_height + 0.5f), nullptr);
LineTo(hdc, r.right, r.bottom - (int)(max_value * unit_height + 0.5f));
- MoveToEx(hdc, r.left, r.bottom - (int)(min_value * unit_height + 0.5f), 0);
+ MoveToEx(hdc, r.left, r.bottom - (int)(min_value * unit_height + 0.5f), nullptr);
LineTo(hdc, r.right, r.bottom - (int)(min_value * unit_height + 0.5f));
}
}
@@ -220,10 +220,10 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
WindowData *wd = (WindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
RECT r;
GetClientRect(hwnd, &r);
- if (wd->hwnd_chk_grid != 0) SetWindowPos(wd->hwnd_chk_grid, 0, r.right - 150, r.top + 10, 120, 20, SWP_NOZORDER | SWP_NOACTIVATE);
- if (wd->hwnd_chk_stat != 0) SetWindowPos(wd->hwnd_chk_stat, 0, r.right - 150, r.top + 30, 120, 20, SWP_NOZORDER | SWP_NOACTIVATE);
+ if (wd->hwnd_chk_grid != nullptr) SetWindowPos(wd->hwnd_chk_grid, nullptr, r.right - 150, r.top + 10, 120, 20, SWP_NOZORDER | SWP_NOACTIVATE);
+ if (wd->hwnd_chk_stat != nullptr) SetWindowPos(wd->hwnd_chk_stat, nullptr, r.right - 150, r.top + 30, 120, 20, SWP_NOZORDER | SWP_NOACTIVATE);
}
- InvalidateRect(hwnd, 0, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
break;
case WM_CLOSE:
{
@@ -269,9 +269,9 @@ INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) {
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInst;
wndclass.hIcon = hIconResponding;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
- wndclass.lpszMenuName = NULL;
+ wndclass.lpszMenuName = nullptr;
wndclass.lpszClassName = _A2W(PLUG) L"GraphWindow";
RegisterClass(&wndclass);
@@ -282,15 +282,15 @@ INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) {
mir_wstrncat(title, (wchar_t *)lParam, _countof(title) - mir_wstrlen(title));
}
- HWND parent = 0;
+ HWND parent = nullptr;
hGraphWnd = CreateWindowEx(0, _A2W(PLUG) L"GraphWindow", title,
(WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN) & ~CS_VREDRAW & ~CS_HREDRAW,
- 0, 0, 800, 600, parent, NULL, hInst, NULL);
+ 0, 0, 800, 600, parent, nullptr, hInst, nullptr);
WindowData *wd = new WindowData;
wd->item_id = (DWORD)wParam; // wParam is destination id
- wd->hwnd_chk_grid = 0;
- wd->hwnd_chk_stat = 0;
+ wd->hwnd_chk_grid = nullptr;
+ wd->hwnd_chk_stat = nullptr;
wd->show_grid = db_get_b(0, PLUG, "ShowGridLines", 0) ? true : false;
wd->show_stat = db_get_b(0, PLUG, "ShowStats", 1) ? true : false;
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp
index 06c5b8963e..1cc8632675 100644
--- a/plugins/Ping/src/pingthread.cpp
+++ b/plugins/Ping/src/pingthread.cpp
@@ -5,23 +5,23 @@ int upCount, total = 0;
size_t list_size = 0;
HANDLE mainThread;
-HANDLE hWakeEvent = 0;
+HANDLE hWakeEvent = nullptr;
// thread protected variables
mir_cs thread_finished_cs, list_changed_cs, data_list_cs;
bool thread_finished = false, list_changed = false;
PINGLIST data_list;
-HANDLE status_update_thread = 0;
+HANDLE status_update_thread = nullptr;
-HWND hpwnd = 0, list_hwnd, hwnd_clist = 0;
+HWND hpwnd = nullptr, list_hwnd, hwnd_clist = nullptr;
int frame_id = -1;
-HBRUSH tbrush = 0;
+HBRUSH tbrush = nullptr;
FontIDW font_id;
ColourIDW bk_col_id;
-HFONT hFont = 0;
+HFONT hFont = nullptr;
COLORREF bk_col = RGB(255, 255, 255);
////////////////
@@ -138,7 +138,7 @@ void __cdecl sttCheckStatusThreadProc(void*)
if (i->item_id == pa.item_id)
i->status = PS_TESTING;
- InvalidateRect(list_hwnd, 0, FALSE);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
}
CallService(PLUG "/Ping", 0, (LPARAM)&pa);
@@ -153,7 +153,7 @@ void __cdecl sttCheckStatusThreadProc(void*)
i->responding = pa.responding;
i->round_trip_time = pa.round_trip_time;
history_entry.first = i->round_trip_time;
- history_entry.second = time(0);
+ history_entry.second = time(nullptr);
history_map[i->item_id].push_back(history_entry);
// maintain history (-1 represents no response)
while (history_map[i->item_id].size() >= MAX_HISTORY)
@@ -214,7 +214,7 @@ void __cdecl sttCheckStatusThreadProc(void*)
}
}
- InvalidateRect(list_hwnd, 0, FALSE);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
}
}
@@ -233,7 +233,7 @@ void start_ping_thread()
{
if (status_update_thread)
CloseHandle(status_update_thread);
- status_update_thread = mir_forkthread(sttCheckStatusThreadProc, 0);
+ status_update_thread = mir_forkthread(sttCheckStatusThreadProc, nullptr);
}
void stop_ping_thread()
@@ -244,7 +244,7 @@ void stop_ping_thread()
WaitForSingleObject(status_update_thread, 2000);
TerminateThread(status_update_thread, 0);
CloseHandle(status_update_thread);
- status_update_thread = 0;
+ status_update_thread = nullptr;
}
bool FrameIsFloating()
@@ -280,7 +280,7 @@ int FillList(WPARAM, LPARAM)
}
SendMessage(list_hwnd, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(list_hwnd, 0, FALSE);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
SetEvent(hWakeEvent);
@@ -341,7 +341,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
case WM_DRAWITEM:
dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->hwndItem == list_hwnd) {
- HBRUSH ttbrush = 0;
+ HBRUSH ttbrush = nullptr;
COLORREF tcol;
if (dis->itemID != -1) {
PINGADDRESS itemData;
@@ -382,7 +382,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
SetBkMode(dis->hDC, TRANSPARENT);
HICON hIcon = (itemData.status != PS_DISABLED ? (itemData.status == PS_TESTING ? hIconTesting : (itemData.status == PS_RESPONDING ? hIconResponding : hIconNotResponding)) : hIconDisabled);
dis->rcItem.left += options.indent;
- DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top + ((options.row_height - 16) >> 1), hIcon, 0, 0, 0, NULL, DI_NORMAL);
+ DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top + ((options.row_height - 16) >> 1), hIcon, 0, 0, 0, nullptr, DI_NORMAL);
GetTextExtentPoint32(dis->hDC, itemData.pszLabel, (int)mir_wstrlen(itemData.pszLabel), &textSize);
TextOut(dis->hDC, dis->rcItem.left + 16 + 4, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, itemData.pszLabel, (int)mir_wstrlen(itemData.pszLabel));
@@ -423,7 +423,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
{
context_point = lParam;
context_point_valid = true;
- InvalidateRect(list_hwnd, 0, FALSE);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1)),
submenu = GetSubMenu(menu, 0);
@@ -461,13 +461,13 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
TranslateMenu(submenu);
GetCursorPos(&pt);
- BOOL ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
+ BOOL ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr);
DestroyMenu(menu);
if (ret)
SendMessage(hwnd, WM_COMMAND, ret, 0);
context_point_valid = false;
- InvalidateRect(list_hwnd, 0, FALSE);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
}
return TRUE;
@@ -480,7 +480,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
list_hwnd = CreateWindow(L"LISTBOX", L"",
//(WS_VISIBLE | WS_CHILD | LBS_NOINTEGRALHEIGHT| LBS_STANDARD | WS_CLIPCHILDREN | LBS_OWNERDRAWVARIABLE | LBS_NOTIFY)
(WS_VISIBLE | WS_CHILD | LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_NOTIFY)
- & ~WS_BORDER, 0, 0, 0, 0, hwnd, NULL, hInst, 0);
+ & ~WS_BORDER, 0, 0, 0, 0, hwnd, nullptr, hInst, nullptr);
if (db_get_b(NULL, "CList", "Transparent", 0)) {
if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
@@ -508,7 +508,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
if ((HWND)wParam != hwnd)
if (db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT))
if (transparentFocus)
- SetTimer(hwnd, TM_AUTOALPHA, 250, NULL);
+ SetTimer(hwnd, TM_AUTOALPHA, 250, nullptr);
}
else {
if (db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT)) {
@@ -528,7 +528,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT), LWA_ALPHA);
#endif
transparentFocus = 1;
- SetTimer(hwnd, TM_AUTOALPHA, 250, NULL);
+ SetTimer(hwnd, TM_AUTOALPHA, 250, nullptr);
}
}
return DefWindowProc(hwnd, msg, wParam, lParam);
@@ -648,7 +648,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
WORD x = LOWORD(context_point), y = HIWORD(context_point);
GetWindowRect(list_hwnd, &r);
DWORD item = SendMessage(list_hwnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(x - r.left, y - r.top));
- PINGADDRESS *temp = 0;
+ PINGADDRESS *temp = nullptr;
if (HIWORD(item) == 0) {
int count = LOWORD(item);
{
@@ -698,7 +698,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
DWORD item_id = pItemData->item_id;
int wake = CallService(PLUG "/DblClick", (WPARAM)item_id, 0);
- InvalidateRect(list_hwnd, 0, FALSE);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
if (wake) SetEvent(hWakeEvent);
if (options.logging) {
@@ -728,10 +728,10 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
#else
height = std::min(winheight - winheight % itemheight, itemheight * count);
#endif
- SetWindowPos(list_hwnd, 0, rect.left, rect.top, rect.right - rect.left, height, SWP_NOZORDER);
- InvalidateRect(list_hwnd, 0, FALSE);
+ SetWindowPos(list_hwnd, nullptr, rect.left, rect.top, rect.right - rect.left, height, SWP_NOZORDER);
+ InvalidateRect(list_hwnd, nullptr, FALSE);
}
- InvalidateRect(hwnd, 0, TRUE);
+ InvalidateRect(hwnd, nullptr, TRUE);
return DefWindowProc(hwnd, msg, wParam, lParam);
case WM_DESTROY:
@@ -779,8 +779,8 @@ int ReloadFont(WPARAM, LPARAM)
int RefreshWindow(WPARAM, LPARAM)
{
- InvalidateRect(list_hwnd, 0, TRUE);
- InvalidateRect(hpwnd, 0, TRUE);
+ InvalidateRect(list_hwnd, nullptr, TRUE);
+ InvalidateRect(hpwnd, nullptr, TRUE);
return 0;
}
@@ -802,7 +802,7 @@ void UpdateFrame()
height += (r_frame.bottom - r_frame.top) - (r_frame_client.bottom - r_frame_client.top);
}
- SetWindowPos(hpwnd, 0, r_clist.left, r_clist.top - height, (r_clist.right - r_clist.left), height, SWP_NOZORDER | SWP_NOACTIVATE);
+ SetWindowPos(hpwnd, nullptr, r_clist.left, r_clist.top - height, (r_clist.right - r_clist.left), height, SWP_NOZORDER | SWP_NOACTIVATE);
}
// Subclass procedure
@@ -816,7 +816,7 @@ LRESULT APIENTRY ClistSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
|| GetWindowLongPtr(hwnd_clist, GWL_STYLE) != GetWindowLongPtr(hpwnd, GWL_STYLE)) {
SetWindowLongPtr(hpwnd, GWL_STYLE, GetWindowLongPtr(hwnd_clist, GWL_STYLE));
SetWindowLongPtr(hpwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd_clist, GWL_EXSTYLE));
- SetWindowPos(hpwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
+ SetWindowPos(hpwnd, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
}
}
@@ -833,7 +833,7 @@ void AttachToClist(bool attach)
if (attach) {
SetWindowLongPtr(hpwnd, GWL_STYLE, GetWindowLongPtr(hwnd_clist, GWL_STYLE));
SetWindowLongPtr(hpwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd_clist, GWL_EXSTYLE));
- SetWindowPos(hpwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
+ SetWindowPos(hpwnd, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
// subclass clist to trap move/size
mir_subclassWindow(hwnd_clist, ClistSubclassProc);
@@ -842,7 +842,7 @@ void AttachToClist(bool attach)
else {
SetWindowLongPtr(hpwnd, GWL_STYLE, (WS_POPUPWINDOW | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_VISIBLE | WS_CLIPCHILDREN));
SetWindowLongPtr(hpwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
- SetWindowPos(hpwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
+ SetWindowPos(hpwnd, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
}
}
@@ -858,14 +858,14 @@ void InitList()
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInst;
wndclass.hIcon = hIconResponding;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
- wndclass.lpszMenuName = NULL;
+ wndclass.lpszMenuName = nullptr;
wndclass.lpszClassName = _A2W(PLUG) L"WindowClass";
RegisterClass(&wndclass);
if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
- hpwnd = CreateWindow(_A2W(PLUG) L"WindowClass", L"Ping", (WS_BORDER | WS_CHILD | WS_CLIPCHILDREN), 0, 0, 0, 0, hwnd_clist, NULL, hInst, NULL);
+ hpwnd = CreateWindow(_A2W(PLUG) L"WindowClass", L"Ping", (WS_BORDER | WS_CHILD | WS_CLIPCHILDREN), 0, 0, 0, 0, hwnd_clist, nullptr, hInst, nullptr);
CLISTFrame frame = { 0 };
frame.name = PLUG;
@@ -881,7 +881,7 @@ void InitList()
else {
hpwnd = CreateWindowEx(WS_EX_TOOLWINDOW, _A2W(PLUG) L"WindowClass", L"Ping",
(WS_POPUPWINDOW | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_CLIPCHILDREN),
- 0, 0, 400, 300, hwnd_clist, NULL, hInst, NULL);
+ 0, 0, 400, 300, hwnd_clist, nullptr, hInst, nullptr);
Utils_RestoreWindowPosition(hpwnd, 0, PLUG, "main_window");
diff --git a/plugins/Ping/src/rawping.cpp b/plugins/Ping/src/rawping.cpp
index bc7de84224..c5b2c0c2e8 100644
--- a/plugins/Ping/src/rawping.cpp
+++ b/plugins/Ping/src/rawping.cpp
@@ -87,7 +87,7 @@ extern int raw_ping(char *host, int timeout)
else {
// Not in dotted quad form, so try and look it up
hostent* hp = gethostbyname(host);
- if (hp != 0) {
+ if (hp != nullptr) {
// Found an address for that host, so save it
memcpy(&(dest.sin_addr), hp->h_addr, hp->h_length);
//dest.sin_family = hp->h_addrtype;
@@ -198,7 +198,7 @@ extern int raw_ping(char *host, int timeout)
if (reply->type == PT_ICMP_SOURCE_QUENCH) {
char buff[1024];
mir_snprintf(buff, Translate("Host %s requests that you reduce the amount of traffic you are sending."), host);
- MessageBoxA(0, buff, Translate(PLUG " Warning"), MB_OK | MB_ICONWARNING);
+ MessageBoxA(nullptr, buff, Translate(PLUG " Warning"), MB_OK | MB_ICONWARNING);
}
if (use_hi_res) {
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp
index 8bdaa385a2..cf900a3ffa 100644
--- a/plugins/Ping/src/utils.cpp
+++ b/plugins/Ping/src/utils.cpp
@@ -46,12 +46,12 @@ void __stdcall ShowPopup(wchar_t *line1, wchar_t *line2, int flags)
ppd->iSeconds = 10;
ppd->PluginWindowProc = NullWindowProc;
- ppd->PluginData = NULL;
+ ppd->PluginData = nullptr;
QueueUserAPC(sttMainThreadCallback, mainThread, (ULONG_PTR)ppd);
}
else{
- MessageBox(NULL, line2, _A2W(PLUG) L" Message", MB_OK | MB_ICONINFORMATION);
+ MessageBox(nullptr, line2, _A2W(PLUG) L" Message", MB_OK | MB_ICONINFORMATION);
return;
}
}
@@ -206,7 +206,7 @@ INT_PTR DblClick(WPARAM wParam, LPARAM) {
for (pinglist_it i = pl.begin(); i != pl.end(); ++i) {
if (i->item_id == (DWORD)wParam) {
if (mir_wstrlen(i->pszCommand)) {
- ShellExecute(0, L"open", i->pszCommand, i->pszParams, 0, SW_SHOW);
+ ShellExecute(nullptr, L"open", i->pszCommand, i->pszParams, nullptr, SW_SHOW);
}
else {
return CallService(PLUG "/ToggleEnabled", wParam, 0);