summaryrefslogtreecommitdiff
path: root/plugins/TrafficCounter/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/TrafficCounter/src
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/TrafficCounter/src')
-rw-r--r--plugins/TrafficCounter/src/TrafficCounter.cpp50
-rw-r--r--plugins/TrafficCounter/src/misc.cpp2
-rw-r--r--plugins/TrafficCounter/src/options.cpp98
-rw-r--r--plugins/TrafficCounter/src/opttree.cpp14
-rw-r--r--plugins/TrafficCounter/src/statistics.cpp30
-rw-r--r--plugins/TrafficCounter/src/vars.cpp26
6 files changed, 110 insertions, 110 deletions
diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp
index f4d9c3c188..ef7c33e8ca 100644
--- a/plugins/TrafficCounter/src/TrafficCounter.cpp
+++ b/plugins/TrafficCounter/src/TrafficCounter.cpp
@@ -67,13 +67,13 @@ unsigned short int Traffic_LineHeight;
wchar_t Traffic_CounterFormat[512];
wchar_t Traffic_TooltipFormat[512];
//
-HANDLE Traffic_FrameID = NULL;
+HANDLE Traffic_FrameID = nullptr;
char Traffic_AdditionSpace;
-HFONT Traffic_h_font = NULL;
-HMENU TrafficPopupMenu = NULL;
-HGENMENU hTrafficMainMenuItem = NULL;
+HFONT Traffic_h_font = nullptr;
+HMENU TrafficPopupMenu = nullptr;
+HGENMENU hTrafficMainMenuItem = nullptr;
/*-------------------------------------------------------------------------------------------------------------------*/
//TIME COUNTER
@@ -149,7 +149,7 @@ extern "C" int __declspec(dllexport) Unload(void)
// Удаляем шрифт.
if (Traffic_h_font) {
DeleteObject(Traffic_h_font);
- Traffic_h_font = NULL;
+ Traffic_h_font = nullptr;
}
// Убиваем все рабочие данные.
@@ -167,12 +167,12 @@ int TrafficCounterShutdown(WPARAM, LPARAM)
// Удаляем пункт главного меню.
if (hTrafficMainMenuItem) {
Menu_RemoveItem(hTrafficMainMenuItem);
- hTrafficMainMenuItem = NULL;
+ hTrafficMainMenuItem = nullptr;
}
// Удаляем контекстное меню.
if (TrafficPopupMenu) {
DestroyMenu(TrafficPopupMenu);
- TrafficPopupMenu = NULL;
+ TrafficPopupMenu = nullptr;
}
// Разрегистрируем процедуру отрисовки фрейма.
CallService(MS_SKINENG_REGISTERPAINTSUB, (WPARAM)TrafficHwnd, (LPARAM)NULL);
@@ -180,7 +180,7 @@ int TrafficCounterShutdown(WPARAM, LPARAM)
// Удаляем фрейм.
if ((ServiceExists(MS_CLIST_FRAMES_REMOVEFRAME)) && Traffic_FrameID) {
CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)Traffic_FrameID, 0);
- Traffic_FrameID = NULL;
+ Traffic_FrameID = nullptr;
}
return 0;
}
@@ -378,7 +378,7 @@ int TrafficCounter_Draw(HWND hwnd, HDC hDC)
if (GetParent(hwnd) == pcli->hwndContactList)
return PaintTrafficCounterWindow(hwnd, hDC);
else
- InvalidateRect(hwnd, NULL, FALSE);
+ InvalidateRect(hwnd, nullptr, FALSE);
return 0;
}
@@ -425,7 +425,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC)
RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
RGB32BitsBITMAPINFO.bmiHeader.biCompression = BI_RGB;
- HBITMAP hbmp = CreateDIBSection(NULL, &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, NULL, NULL, 0);
+ HBITMAP hbmp = CreateDIBSection(nullptr, &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, nullptr, nullptr, 0);
HBITMAP oldbmp = (HBITMAP)SelectObject(hdc, hbmp);
HBRUSH b = CreateSolidBrush(Traffic_BkColor);
@@ -791,7 +791,7 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP
p.x = GET_X_LPARAM(lParam);
p.y = GET_Y_LPARAM(lParam);
ClientToScreen(hwnd, &p);
- TrackPopupMenu(TrafficPopupMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL, p.x, p.y, 0, hwnd, NULL);
+ TrackPopupMenu(TrafficPopupMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL, p.x, p.y, 0, hwnd, nullptr);
break;
case WM_COMMAND:
@@ -827,7 +827,7 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP
TooltipShowing = FALSE;
}
KillTimer(TrafficHwnd, TIMER_TOOLTIP);
- SetTimer(TrafficHwnd, TIMER_TOOLTIP, CallService(MS_CLC_GETINFOTIPHOVERTIME, 0, 0), 0);
+ SetTimer(TrafficHwnd, TIMER_TOOLTIP, CallService(MS_CLC_GETINFOTIPHOVERTIME, 0, 0), nullptr);
break;
}
@@ -958,7 +958,7 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP
ti.rcItem.top = TooltipPosition.y - 10;
ti.rcItem.bottom = TooltipPosition.y + 10;
ti.cbSize = sizeof(ti);
- TooltipText = variables_parsedup(Traffic_TooltipFormat, NULL, NULL);
+ TooltipText = variables_parsedup(Traffic_TooltipFormat, nullptr, NULL);
CallService(MS_TIPPER_SHOWTIPW, (WPARAM)TooltipText, (LPARAM)&ti);
@@ -989,17 +989,17 @@ void CreateTrafficWindow(HWND hCluiWnd)
wcx.cbClsExtra = 0;
wcx.cbWndExtra = 0;
wcx.hInstance = hInst;
- wcx.hIcon = NULL;
+ wcx.hIcon = nullptr;
wcx.hCursor = LoadCursor(hInst, IDC_ARROW);
- wcx.hbrBackground = 0;
- wcx.lpszMenuName = NULL;
+ wcx.hbrBackground = nullptr;
+ wcx.lpszMenuName = nullptr;
wcx.lpszClassName = TRAFFIC_COUNTER_WINDOW_CLASS;
- wcx.hIconSm = NULL;
+ wcx.hIconSm = nullptr;
RegisterClassEx(&wcx);
TrafficHwnd = CreateWindowEx(WS_EX_TOOLWINDOW, TRAFFIC_COUNTER_WINDOW_CLASS,
TRAFFIC_COUNTER_WINDOW_CLASS,
WS_CHILDWINDOW | WS_CLIPCHILDREN,
- 0, 0, 0, 0, hCluiWnd, NULL, hInst, NULL);
+ 0, 0, 0, 0, hCluiWnd, nullptr, hInst, nullptr);
if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
// Готовимся создавать фрейм
@@ -1017,14 +1017,14 @@ void CreateTrafficWindow(HWND hCluiWnd)
}
// Создаём таймеры.
- SetTimer(TrafficHwnd, TIMER_REDRAW, 500, NULL);
+ SetTimer(TrafficHwnd, TIMER_REDRAW, 500, nullptr);
UpdateNotifyTimer();
}
INT_PTR MenuCommand_TrafficShowHide(WPARAM, LPARAM)
{
unOptions.FrameIsVisible = !unOptions.FrameIsVisible;
- if (Traffic_FrameID == NULL)
+ if (Traffic_FrameID == nullptr)
ShowWindow(TrafficHwnd, unOptions.FrameIsVisible ? SW_SHOW : SW_HIDE);
else
CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)Traffic_FrameID, 0);
@@ -1038,7 +1038,7 @@ void Traffic_AddMainMenuItem(void)
CMenuItem mi;
SET_UID(mi, 0x7fe75b30, 0x3cf6, 0x4280, 0xb9, 0xd2, 0x88, 0x6b, 0xbb, 0x69, 0xa3, 0x7e);
mi.position = -0x7FFFFFFF;
- mi.hIcolibItem = NULL;
+ mi.hIcolibItem = nullptr;
mi.name.a = LPGEN("Toggle traffic counter");
mi.pszService = "TrafficCounter/ShowHide";
@@ -1051,7 +1051,7 @@ void UpdateNotifyTimer(void)
if (!bPopupExists) return;
if (Traffic_Notify_time_value && unOptions.NotifyByTime)
- SetTimer(TrafficHwnd, TIMER_NOTIFY_TICK, Traffic_Notify_time_value * 1000 * 60, NULL);
+ SetTimer(TrafficHwnd, TIMER_NOTIFY_TICK, Traffic_Notify_time_value * 1000 * 60, nullptr);
else
KillTimer(TrafficHwnd, TIMER_NOTIFY_TICK);
}
@@ -1067,7 +1067,7 @@ void NotifyOnSend(void)
mir_snwprintf(ppd.lptzText, TranslateT("%d kilobytes sent"), notify_send_size = OverallInfo.CurrentSentTraffic >> 10);
ppd.colorBack = Traffic_PopupBkColor;
ppd.colorText = Traffic_PopupFontColor;
- ppd.PluginWindowProc = NULL;
+ ppd.PluginWindowProc = nullptr;
ppd.iSeconds = (Traffic_PopupTimeoutDefault ? 0 : Traffic_PopupTimeoutValue);
PUAddPopupT(&ppd);
}
@@ -1083,7 +1083,7 @@ void NotifyOnRecv(void)
mir_snwprintf(ppd.lptzText, TranslateT("%d kilobytes received"), notify_recv_size = OverallInfo.CurrentRecvTraffic >> 10);
ppd.colorBack = Traffic_PopupBkColor;
ppd.colorText = Traffic_PopupFontColor;
- ppd.PluginWindowProc = NULL;
+ ppd.PluginWindowProc = nullptr;
ppd.iSeconds = (Traffic_PopupTimeoutDefault ? 0 : Traffic_PopupTimeoutValue);
PUAddPopupT(&ppd);
}
@@ -1179,7 +1179,7 @@ int UpdateFonts(WPARAM, LPARAM)
void UpdateTrafficWindowSize(void)
{
- if (Traffic_FrameID != NULL)
+ if (Traffic_FrameID != nullptr)
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, Traffic_FrameID), TrafficWindowHeight());
}
diff --git a/plugins/TrafficCounter/src/misc.cpp b/plugins/TrafficCounter/src/misc.cpp
index 240ba55aa1..f15a045250 100644
--- a/plugins/TrafficCounter/src/misc.cpp
+++ b/plugins/TrafficCounter/src/misc.cpp
@@ -149,7 +149,7 @@ size_t GetFormattedTraffic(DWORD Value, BYTE Unit, wchar_t *Buffer, size_t Size)
}
mir_snwprintf(Str1, L"%d.%d", Value / Divider, Value % Divider);
- size_t l = GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, NULL, 0);
+ size_t l = GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, nullptr, 0);
if (!l) return 0;
l += mir_wstrlen(szUnit) + 1;
Res = (wchar_t*)malloc(l * sizeof(wchar_t));
diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp
index c65d82e203..605f04767a 100644
--- a/plugins/TrafficCounter/src/options.cpp
+++ b/plugins/TrafficCounter/src/options.cpp
@@ -102,15 +102,15 @@ static INT_PTR CALLBACK DlgProcPopupsTraffic(HWND hwndDlg, UINT msg, WPARAM wPar
case 0:
if (((LPNMHDR)lParam)->code == PSN_APPLY ) {
unOptions.NotifyBySize = IsDlgButtonChecked(hwndDlg,IDC_NOTIFYSIZE);
- Traffic_Notify_size_value = GetDlgItemInt(hwndDlg,IDC_ENOTIFYSIZE,NULL,0);
+ Traffic_Notify_size_value = GetDlgItemInt(hwndDlg,IDC_ENOTIFYSIZE,nullptr,0);
unOptions.NotifyByTime = IsDlgButtonChecked(hwndDlg,IDC_NOTIFYTIME);
- Traffic_Notify_time_value = GetDlgItemInt(hwndDlg,IDC_ENOTIFYTIME,NULL,0);
+ Traffic_Notify_time_value = GetDlgItemInt(hwndDlg,IDC_ENOTIFYTIME,nullptr,0);
//
Traffic_PopupBkColor = SendDlgItemMessage(hwndDlg,IDC_COLOR1,CPM_GETCOLOUR,0,0);
Traffic_PopupFontColor = SendDlgItemMessage(hwndDlg,IDC_COLOR2,CPM_GETCOLOUR,0,0);
//
Traffic_PopupTimeoutDefault = IsDlgButtonChecked(hwndDlg,IDC_RADIO_FROMPOPUP);
- if (Traffic_PopupTimeoutDefault == 0) Traffic_PopupTimeoutValue = GetDlgItemInt(hwndDlg,IDC_POPUP_TIMEOUT,NULL,0);
+ if (Traffic_PopupTimeoutDefault == 0) Traffic_PopupTimeoutValue = GetDlgItemInt(hwndDlg,IDC_POPUP_TIMEOUT,nullptr,0);
//
UpdateNotifyTimer();
return TRUE;
@@ -126,51 +126,51 @@ static INT_PTR CALLBACK DlgProcPopupsTraffic(HWND hwndDlg, UINT msg, WPARAM wPar
static OPTTREE_OPTION options[] =
{
- {0, LPGENW("Display") L"/" LPGENW("Icon"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawProtoIcon"},
- {0, LPGENW("Display") L"/" LPGENW("Account name"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawProtoName"},
- {0, LPGENW("Display") L"/" LPGENW("Current traffic"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawCurrentTraffic"},
- {0, LPGENW("Display") L"/" LPGENW("Total traffic"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawTotalTraffic"},
- {0, LPGENW("Display") L"/" LPGENW("Current online"), OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawCurrentTime"},
- {0, LPGENW("Display") L"/" LPGENW("Total online"),OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, "DrawTotalTime"},
- {0, LPGENW("General") L"/" LPGENW("Draw frame as skin element"), OPTTREE_CHECK, 1, NULL, "DrawFrmAsSkin"},
- {0, LPGENW("General") L"/" LPGENW("Show tooltip in traffic window"), OPTTREE_CHECK, 1, NULL, "ShowTooltip"},
- {0, LPGENW("General") L"/" LPGENW("\"Toggle traffic counter\" in main menu"), OPTTREE_CHECK, 1, NULL, "ShowMainMenuItem"},
+ {0, LPGENW("Display") L"/" LPGENW("Icon"), OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, "DrawProtoIcon"},
+ {0, LPGENW("Display") L"/" LPGENW("Account name"), OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, "DrawProtoName"},
+ {0, LPGENW("Display") L"/" LPGENW("Current traffic"), OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, "DrawCurrentTraffic"},
+ {0, LPGENW("Display") L"/" LPGENW("Total traffic"), OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, "DrawTotalTraffic"},
+ {0, LPGENW("Display") L"/" LPGENW("Current online"), OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, "DrawCurrentTime"},
+ {0, LPGENW("Display") L"/" LPGENW("Total online"),OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, "DrawTotalTime"},
+ {0, LPGENW("General") L"/" LPGENW("Draw frame as skin element"), OPTTREE_CHECK, 1, nullptr, "DrawFrmAsSkin"},
+ {0, LPGENW("General") L"/" LPGENW("Show tooltip in traffic window"), OPTTREE_CHECK, 1, nullptr, "ShowTooltip"},
+ {0, LPGENW("General") L"/" LPGENW("\"Toggle traffic counter\" in main menu"), OPTTREE_CHECK, 1, nullptr, "ShowMainMenuItem"},
// Резервируем место под активные и видимые протоколы
// Максимум 16 позиций видимых и 16 активных
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, NULL, OPTTREE_CHECK, OPTTREE_INVISIBLE, NULL, NULL},
- {0, LPGENW("Visible accounts")L"/" LPGENW("Summary traffic for visible accounts"), OPTTREE_CHECK, 1, NULL, "ShowSummary"},
- {0, LPGENW("Visible accounts")L"/" LPGENW("Overall traffic"), OPTTREE_CHECK, 1, NULL, "ShowOverall"},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, nullptr, OPTTREE_CHECK, OPTTREE_INVISIBLE, nullptr, nullptr},
+ {0, LPGENW("Visible accounts")L"/" LPGENW("Summary traffic for visible accounts"), OPTTREE_CHECK, 1, nullptr, "ShowSummary"},
+ {0, LPGENW("Visible accounts")L"/" LPGENW("Overall traffic"), OPTTREE_CHECK, 1, nullptr, "ShowOverall"},
};
static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -210,7 +210,7 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
TranslateDialogDefault(hwndDlg);
SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(15, 0));
- SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, GetDlgItemInt(hwndDlg, IDC_EDIT_SPACE, NULL, FALSE));
+ SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, GetDlgItemInt(hwndDlg, IDC_EDIT_SPACE, nullptr, FALSE));
//show/hide button
SetDlgItemText(hwndDlg,IDC_BSHOWHIDE,(IsWindowVisible(TrafficHwnd) != 0)? TranslateT("Hide now") : TranslateT("Show now"));
@@ -286,7 +286,7 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
unOptions.PeriodForShow = (char)SendDlgItemMessage(hwndDlg,IDC_COMBO_AUTO_CLEAR,CB_GETCURSEL,0,0);
// Интервал между строками
- Traffic_AdditionSpace = GetDlgItemInt(hwndDlg, IDC_EDIT_SPACE, NULL, 0);
+ Traffic_AdditionSpace = GetDlgItemInt(hwndDlg, IDC_EDIT_SPACE, nullptr, 0);
// Настройки Appearance
unOptions.DrawProtoIcon = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "DrawProtoIcon");
unOptions.DrawProtoName = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "DrawProtoName");
@@ -325,7 +325,7 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
if (!unOptions.ShowMainMenuItem && hTrafficMainMenuItem)
{
Menu_RemoveItem(hTrafficMainMenuItem);
- hTrafficMainMenuItem = NULL;
+ hTrafficMainMenuItem = nullptr;
}
// Если включается, то создаём.
if (unOptions.ShowMainMenuItem && !hTrafficMainMenuItem)
diff --git a/plugins/TrafficCounter/src/opttree.cpp b/plugins/TrafficCounter/src/opttree.cpp
index 1fb69b220e..c3d6cfdc7d 100644
--- a/plugins/TrafficCounter/src/opttree.cpp
+++ b/plugins/TrafficCounter/src/opttree.cpp
@@ -47,7 +47,7 @@ void OptTree_Translate(HWND hwndTree)
HTREEITEM hItem = TreeView_GetRoot(hwndTree);
while (hItem)
{
- HTREEITEM hItemTmp = 0;
+ HTREEITEM hItemTmp = nullptr;
OptTree_TranslateItem(hwndTree, hItem);
if (hItemTmp = TreeView_GetChild(hwndTree, hItem))
@@ -98,7 +98,7 @@ HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wcha
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
}
- return NULL;
+ return nullptr;
}
HTREEITEM OptTree_AddItem(HWND hwndTree, wchar_t *name, LPARAM lParam, int iconIndex)
@@ -108,7 +108,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, wchar_t *name, LPARAM lParam, int iconI
wchar_t* sectionName;
int sectionLevel = 0;
- HTREEITEM hSection = NULL, result = NULL;
+ HTREEITEM hSection = nullptr, result = nullptr;
mir_wstrcpy(itemName, name);
sectionName = itemName;
@@ -130,7 +130,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, wchar_t *name, LPARAM lParam, int iconI
{
if (!hItem)
{
- TVINSERTSTRUCT tvis = {0};
+ TVINSERTSTRUCT tvis = {};
tvis.hParent = hSection;
tvis.hInsertAfter = TVI_LAST;//TVI_SORT;
@@ -191,7 +191,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, BOOL*,
wchar_t* sectionName;
int sectionLevel = 0;
- HTREEITEM hSection = NULL;
+ HTREEITEM hSection = nullptr;
if (options[indx].szOptionName)
mir_wstrcpy(itemName, options[indx].szOptionName);
else
@@ -218,7 +218,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, BOOL*,
{
if (!hItem)
{
- TVINSERTSTRUCT tvis = {0};
+ TVINSERTSTRUCT tvis = {};
tvis.hParent = hSection;
tvis.hInsertAfter = TVI_LAST;//TVI_SORT;
@@ -254,7 +254,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, BOOL*,
OptTree_Translate(hwndTree);
ShowWindow(hwndTree, SW_SHOW);
- TreeView_SelectItem(hwndTree, OptTree_FindNamedTreeItemAt(hwndTree, 0, NULL));
+ TreeView_SelectItem(hwndTree, OptTree_FindNamedTreeItemAt(hwndTree, nullptr, nullptr));
break;
}
diff --git a/plugins/TrafficCounter/src/statistics.cpp b/plugins/TrafficCounter/src/statistics.cpp
index 6eaef9b4c3..342b1d8fa2 100644
--- a/plugins/TrafficCounter/src/statistics.cpp
+++ b/plugins/TrafficCounter/src/statistics.cpp
@@ -37,9 +37,9 @@ INT_PTR CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
// Создаём ListBox c перечнем аккаунтов.
hListAccs = CreateWindowEx(WS_EX_CLIENTEDGE,
L"ListBox",
- NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | LBS_NOTIFY,
+ nullptr, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | LBS_NOTIFY,
2, 20, 246, 112,
- hwndDlg, NULL, NULL, NULL);
+ hwndDlg, nullptr, nullptr, nullptr);
SendMessage(hListAccs, WM_SETFONT, (WPARAM)(HFONT)GetStockObject(DEFAULT_GUI_FONT), 0);
for (i = 0; i < NumberOfAccounts; i++) {
// Готовим список аккаунтов
@@ -135,7 +135,7 @@ INT_PTR CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
GetLocalTime(&stNow);
for (i = NumberOfAccounts; i--;)
if (0x01 & (Stat_SelAcc >> i)) {
- SetFilePointer(ProtoList[i].hFile, sizeof(HOURLYSTATS), NULL, FILE_BEGIN);
+ SetFilePointer(ProtoList[i].hFile, sizeof(HOURLYSTATS), nullptr, FILE_BEGIN);
SetEndOfFile(ProtoList[i].hFile); // Усекаем файл до одной записи.
ProtoList[i].NumberOfRecords = 1;
ProtoList[i].AllStatistics = (HOURLYSTATS*)mir_realloc(ProtoList[i].AllStatistics, sizeof(HOURLYSTATS));
@@ -186,30 +186,30 @@ INT_PTR CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
Index = Stat_GetStartIndex(EldestAcc, unOptions.Stat_Tab, pdi->item.iItem, &st);
switch (unOptions.Stat_Tab) {
case 0: // Hourly
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szBufW, 32);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, nullptr, szBufW, 32);
mir_snwprintf(pdi->item.pszText, 32, L"%s %02d:00 - %02d:59",
szBufW,
ProtoList[EldestAcc].AllStatistics[Index].Hour,
ProtoList[EldestAcc].AllStatistics[Index].Hour);
break;
case 1: // Dayly
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, pdi->item.pszText, 32);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, nullptr, pdi->item.pszText, 32);
break;
case 2: // Weekly
// Уходим к первому понедельнику слева.
SystemTimeToVariantTime(&st, &vartime);
vartime -= DayOfWeek(st.wDay, st.wMonth, st.wYear) - 1;
VariantTimeToSystemTime(vartime, &st);
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, pdi->item.pszText, 32);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, nullptr, pdi->item.pszText, 32);
// Теперь к воскресенью.
SystemTimeToVariantTime(&st, &vartime);
vartime += 6;
VariantTimeToSystemTime(vartime, &st);
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szBufW, 32);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, nullptr, szBufW, 32);
mir_snwprintf(pdi->item.pszText, 32, L"%s - %s", pdi->item.pszText, szBufW);
break;
case 3: // Monthly
- GetDateFormat(LOCALE_USER_DEFAULT, DATE_YEARMONTH, &st, NULL, pdi->item.pszText, 32);
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_YEARMONTH, &st, nullptr, pdi->item.pszText, 32);
break;
case 4: // Yearly
mir_snwprintf(pdi->item.pszText, 32, L"%d", st.wYear);
@@ -306,14 +306,14 @@ void Stat_ReadFile(BYTE n)
mir_free(pszPath);
GetLocalTime(&stNow);
ProtoList[n].hFile = CreateFile(FileName, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
GetFileSizeEx(ProtoList[n].hFile, &Size);
if (Size.QuadPart != 0) // Если файл со статистикой существует и имеет ненулевой размер...
{
// ...то читаем статистику из файла
ProtoList[n].NumberOfRecords = DWORD(Size.QuadPart / sizeof(HOURLYSTATS));
ProtoList[n].AllStatistics = (HOURLYSTATS*)mir_alloc(sizeof(HOURLYSTATS)*ProtoList[n].NumberOfRecords);
- ReadFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[0], sizeof(HOURLYSTATS)*ProtoList[n].NumberOfRecords, &BytesRead, NULL);
+ ReadFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[0], sizeof(HOURLYSTATS)*ProtoList[n].NumberOfRecords, &BytesRead, nullptr);
if (!BytesRead) {
MessageBox(TrafficHwnd, TranslateT("Couldn't read statistics file"), TranslateT("Traffic Counter"), MB_OK);
return;
@@ -384,8 +384,8 @@ void Stat_CheckStatistics(BYTE n)
// Если текущее время совпадает со временем последней записи...
if (!d) {
// ...сохраняем запись в файл и уходим.
- SetFilePointer(ProtoList[n].hFile, -LONG(sizeof(HOURLYSTATS)), NULL, FILE_END);
- WriteFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1], sizeof(HOURLYSTATS), &q, NULL);
+ SetFilePointer(ProtoList[n].hFile, -LONG(sizeof(HOURLYSTATS)), nullptr, FILE_END);
+ WriteFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1], sizeof(HOURLYSTATS), &q, nullptr);
return;
}
@@ -412,8 +412,8 @@ void Stat_CheckStatistics(BYTE n)
if (d > 0) {
// Сохраняем.
- SetFilePointer(ProtoList[n].hFile, -LONG(sizeof(HOURLYSTATS)), NULL, FILE_END);
- WriteFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1], sizeof(HOURLYSTATS), &q, NULL);
+ SetFilePointer(ProtoList[n].hFile, -LONG(sizeof(HOURLYSTATS)), nullptr, FILE_END);
+ WriteFile(ProtoList[n].hFile, &ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1], sizeof(HOURLYSTATS), &q, nullptr);
// Последняя запись из статистики понадобится для вычисления новых записей, поэтому копируем её (кроме трафика и времени).
memcpy(&htTmp, &ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1],
@@ -442,7 +442,7 @@ void Stat_CheckStatistics(BYTE n)
stLast.wYear = htTmp.Year;
// Добавляем записи одновременно в ОЗУ и в файл.
- WriteFile(ProtoList[n].hFile, &htTmp, sizeof(HOURLYSTATS), &q, NULL);
+ WriteFile(ProtoList[n].hFile, &htTmp, sizeof(HOURLYSTATS), &q, nullptr);
memcpy(&ProtoList[n].AllStatistics[ProtoList[n].NumberOfRecords - 1], &htTmp, sizeof(HOURLYSTATS));
} while (TimeCompare(stNow, stLast));
diff --git a/plugins/TrafficCounter/src/vars.cpp b/plugins/TrafficCounter/src/vars.cpp
index 989df08b21..b7df5fb1ba 100644
--- a/plugins/TrafficCounter/src/vars.cpp
+++ b/plugins/TrafficCounter/src/vars.cpp
@@ -28,7 +28,7 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai)
DWORD tmp, tmpsn = 0, tmprn = 0, tmpst = 0, tmprt = 0;
BYTE ed;
- if (ai->argc != 5) return NULL;
+ if (ai->argc != 5) return nullptr;
if (!mir_wstrcmp(ai->targv[1], L"overall"))
{
@@ -65,7 +65,7 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai)
}
mir_free(buf);
}
- if (tmp != 0xAA) return NULL;
+ if (tmp != 0xAA) return nullptr;
}
if (!mir_wstrcmp(ai->targv[2], L"now"))
@@ -75,7 +75,7 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai)
if (!mir_wstrcmp(ai->targv[3], L"received")) tmp = tmprn;
else
if (!mir_wstrcmp(ai->targv[3], L"both")) tmp = tmprn + tmpsn;
- else return NULL;
+ else return nullptr;
}
else
if (!mir_wstrcmp(ai->targv[2], L"total"))
@@ -85,9 +85,9 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai)
if (!mir_wstrcmp(ai->targv[3], L"received")) tmp = tmprt;
else
if (!mir_wstrcmp(ai->targv[3], L"both")) tmp = tmprt + tmpst;
- else return NULL;
+ else return nullptr;
}
- else return NULL;
+ else return nullptr;
if (!mir_wstrcmp(ai->targv[4], L"b")) ed = 0;
else
@@ -96,18 +96,18 @@ static wchar_t* GetTraffic(ARGUMENTSINFO *ai)
if (!mir_wstrcmp(ai->targv[4], L"m")) ed = 2;
else
if (!mir_wstrcmp(ai->targv[4], L"d")) ed = 3;
- else return NULL;
+ else return nullptr;
// Получаем форматированную строку и возвращаем указатель на неё.
// Сначала узнаем размер буфера.
- size_t l = GetFormattedTraffic(tmp, ed, NULL, 0);
+ size_t l = GetFormattedTraffic(tmp, ed, nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc(l * sizeof(wchar_t));
- if (!res) return NULL;
+ if (!res) return nullptr;
if (GetFormattedTraffic(tmp, ed, res, l))
return res;
mir_free(res);
- return NULL;
+ return nullptr;
}
static wchar_t* GetTime(ARGUMENTSINFO *ai)
@@ -115,7 +115,7 @@ static wchar_t* GetTime(ARGUMENTSINFO *ai)
BYTE ed, flag;
DWORD Duration;
- if (ai->argc != 4) return NULL;
+ if (ai->argc != 4) return nullptr;
// Ищем индекс протокола, переданного первым аргументом
for (flag = ed = 0; ed < NumberOfAccounts; ed++)
@@ -145,13 +145,13 @@ static wchar_t* GetTime(ARGUMENTSINFO *ai)
else flag = 0;
}
- if (flag != 0xAA) return NULL;
+ if (flag != 0xAA) return nullptr;
// Получаем форматированную строку и возвращаем указатель на неё.
// Сначала узнаем размер буфера.
- size_t l = GetDurationFormatM(Duration, ai->targv[3], NULL, 0);
+ size_t l = GetDurationFormatM(Duration, ai->targv[3], nullptr, 0);
wchar_t *res = (wchar_t*)mir_alloc(l * sizeof(wchar_t));
- if (!res) return NULL;
+ if (!res) return nullptr;
GetDurationFormatM(Duration, ai->targv[3], res, l);
return res;