summaryrefslogtreecommitdiff
path: root/plugins/TooltipNotify
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/TooltipNotify
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/TooltipNotify')
-rw-r--r--plugins/TooltipNotify/src/Tooltip.cpp16
-rw-r--r--plugins/TooltipNotify/src/TooltipNotify.cpp26
-rw-r--r--plugins/TooltipNotify/src/main.cpp16
3 files changed, 29 insertions, 29 deletions
diff --git a/plugins/TooltipNotify/src/Tooltip.cpp b/plugins/TooltipNotify/src/Tooltip.cpp
index 9289c34824..7552ec858d 100644
--- a/plugins/TooltipNotify/src/Tooltip.cpp
+++ b/plugins/TooltipNotify/src/Tooltip.cpp
@@ -14,13 +14,13 @@ CTooltip::CTooltip(CTooltipNotify *pTooltipNotify)
{
m_pTooltipNotify = pTooltipNotify;
m_bLDblClick = DEF_SETTING_LDBLCLICK;
- m_hFont = 0;
- m_hWnd = 0;
- m_szText = 0;
+ m_hFont = nullptr;
+ m_hWnd = nullptr;
+ m_szText = nullptr;
- m_hWnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, s_szTooltipClass, 0,
- WS_POPUP|WS_BORDER, 100, 100, 50, 50, 0, 0,
- g_hInstDLL, NULL);
+ m_hWnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, s_szTooltipClass, nullptr,
+ WS_POPUP|WS_BORDER, 100, 100, 50, 50, nullptr, nullptr,
+ g_hInstDLL, nullptr);
SetWindowLongPtr(m_hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
}
@@ -148,7 +148,7 @@ void CTooltip::Validate()
HDC hDC = GetDC(m_hWnd);
SelectObject(hDC, m_hFont);
GetTextExtentPoint32(hDC, m_szText, (int)mir_wstrlen(m_szText), &Size);
- SetWindowPos(m_hWnd, 0, 0, 0, Size.cx+6, Size.cy+4,
+ SetWindowPos(m_hWnd, nullptr, 0, 0, Size.cx+6, Size.cy+4,
SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOREDRAW);
ReleaseDC(m_hWnd, hDC);
}
@@ -189,7 +189,7 @@ void CTooltip::get_Rect(RECT *Rect) const
void CTooltip::set_Position(INT x, INT y)
{
- SetWindowPos(m_hWnd, 0, x, y, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE);
+ SetWindowPos(m_hWnd, nullptr, x, y, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE);
}
void CTooltip::set_Text(const wchar_t* szText)
diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp
index 9b17cb37e6..d68ba585f6 100644
--- a/plugins/TooltipNotify/src/TooltipNotify.cpp
+++ b/plugins/TooltipNotify/src/TooltipNotify.cpp
@@ -45,7 +45,7 @@ static FontEntry s_fontTable[] =
0, FONTSERV_OTHER, "OtherFont", "OtherBgColor",
};
-CTooltipNotify *CTooltipNotify::s_pInstance = 0;
+CTooltipNotify *CTooltipNotify::s_pInstance = nullptr;
const char *CTooltipNotify::s_szModuleNameOld = "ttntfmod";
//////////////////////////////////////////////////////////////////////
@@ -55,7 +55,7 @@ const char *CTooltipNotify::s_szModuleNameOld = "ttntfmod";
CTooltipNotify::CTooltipNotify() :
m_bNt50(IsNt50())
{
- if (s_pInstance != 0)
+ if (s_pInstance != nullptr)
throw EAlreadyExists();
s_pInstance = this;
@@ -67,7 +67,7 @@ CTooltipNotify::~CTooltipNotify()
{
EndNotifyAll();
CTooltip::Deinitialize();
- s_pInstance = 0;
+ s_pInstance = nullptr;
}
void CTooltipNotify::RegisterFonts()
@@ -105,13 +105,13 @@ void CTooltipNotify::RegisterFonts()
void CTooltipNotify::GetFont(int iStatus, LOGFONT* lf, COLORREF* text, COLORREF* bg)
{
- wchar_t* fontName = 0;
+ wchar_t* fontName = nullptr;
for (int i = 0; i < _countof(s_fontTable); i++) {
if (s_fontTable[i].status == iStatus) {
fontName = s_fontTable[i].name;
}
}
- if (fontName == 0)
+ if (fontName == nullptr)
fontName = s_fontTable[_countof(s_fontTable) - 1].name;
// name and group only
@@ -167,7 +167,7 @@ int CTooltipNotify::ProtoContactIsTyping(WPARAM hContact, LPARAM lParam)
int CTooltipNotify::ProtoAck(WPARAM, LPARAM lParam)
{
ACKDATA *ack = (ACKDATA*)lParam;
- if ((ack == NULL) || (ack->type != ACKTYPE_STATUS)) return 0;
+ if ((ack == nullptr) || (ack->type != ACKTYPE_STATUS)) return 0;
WORD wNewStatus = (WORD)ack->lParam;
WORD wOldStatus = (UINT_PTR)ack->hProcess;
@@ -182,7 +182,7 @@ int CTooltipNotify::ProtoAck(WPARAM, LPARAM lParam)
}
else {
if (wOldStatus < ID_STATUS_ONLINE && wNewStatus > ID_STATUS_OFFLINE) {
- UINT_PTR idTimer = SetTimer(0, 0, m_sOptions.wStartupDelay * 1000, ConnectionTimerProcWrapper);
+ UINT_PTR idTimer = SetTimer(nullptr, 0, m_sOptions.wStartupDelay * 1000, ConnectionTimerProcWrapper);
ProtoData protoData = { _strdup(szProtocol), idTimer };
m_mapTimerIdProto.push_back(protoData);
}
@@ -294,7 +294,7 @@ CTooltip *CTooltipNotify::BeginNotify(STooltipData *pTooltipData)
if (m_sOptions.bAutoPos || Utils_RestoreWindowPosition(pTooltip->GetHandle(), 0, MODULENAME, "toolwindow", RWPF_NOSIZE | RWPF_NOACTIVATE))
pTooltip->set_Position(WorkAreaRect.right - 10 - (TooltipRect.right - TooltipRect.left), WorkAreaRect.bottom - 2 - (TooltipRect.bottom - TooltipRect.top));
- UINT_PTR idTimer = SetTimer(0, 0, pTooltipData->uiTimeout, TooltipTimerProcWrapper);
+ UINT_PTR idTimer = SetTimer(nullptr, 0, pTooltipData->uiTimeout, TooltipTimerProcWrapper);
pTooltipData->idTimer = idTimer;
pTooltipData->pTooltip = pTooltip;
@@ -356,7 +356,7 @@ CTooltipNotify::MapTimerIdProtoIter CTooltipNotify::FindProtoByTimer(UINT idTime
void CTooltipNotify::OnConnectionTimer(HWND, UINT, UINT_PTR idEvent, DWORD)
{
- BOOL bSuccess = KillTimer(0, idEvent);
+ BOOL bSuccess = KillTimer(nullptr, idEvent);
assert(bSuccess);
MapTimerIdProtoIter iter = FindProtoByTimer(idEvent);
@@ -634,7 +634,7 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM)
// enum protocols currently running
int iProtoCount = 0;
- PROTOACCOUNT **ppProtos = 0;
+ PROTOACCOUNT **ppProtos = nullptr;
Proto_EnumAccounts(&iProtoCount, &ppProtos);
// and fill in the list
@@ -673,7 +673,7 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM)
char szMultiByteProto[128];
long lLen = WideCharToMultiByte(CP_ACP, 0, szProto, (int)mir_wstrlen(szProto),
- szMultiByteProto, sizeof(szMultiByteProto), NULL, NULL);
+ szMultiByteProto, sizeof(szMultiByteProto), nullptr, nullptr);
szMultiByteProto[lLen] = '\0';
BYTE bProtoState = db_get_b(NULL, MODULENAME, szMultiByteProto, ProtoUserBit | ProtoIntBit);
@@ -891,7 +891,7 @@ void CTooltipNotify::SuspendTimer(CTooltip *pTooltip)
STooltipData* pTooltipData = *iter;
- BOOL bSuccess = KillTimer(0, pTooltipData->idTimer);
+ BOOL bSuccess = KillTimer(nullptr, pTooltipData->idTimer);
assert(bSuccess);
pTooltipData->idTimer = 0; // denote that the timer is inactive
}
@@ -904,7 +904,7 @@ void CTooltipNotify::ResumeTimer(CTooltip *pTooltip)
STooltipData* pTooltipData = *iter;
- UINT_PTR idTimer = SetTimer(0, 0, pTooltipData->uiTimeout, TooltipTimerProcWrapper);
+ UINT_PTR idTimer = SetTimer(nullptr, 0, pTooltipData->uiTimeout, TooltipTimerProcWrapper);
pTooltipData->idTimer = idTimer;
}
diff --git a/plugins/TooltipNotify/src/main.cpp b/plugins/TooltipNotify/src/main.cpp
index 55f777e104..7151d44a06 100644
--- a/plugins/TooltipNotify/src/main.cpp
+++ b/plugins/TooltipNotify/src/main.cpp
@@ -10,16 +10,16 @@ static int ContactSettingChanged(WPARAM wParam,LPARAM lParam);
static int ProtoAck(WPARAM,LPARAM);
static int ProtoContactIsTyping(WPARAM wParam,LPARAM lParam);
-static HANDLE g_hContactSettingChanged = 0;
-static HANDLE g_hOptionsInitialize = 0;
-static HANDLE g_hModulesLoaded = 0;
-static HANDLE g_hProtoAck = 0;
-static HANDLE g_hProtoContactIsTyping = 0;
+static HANDLE g_hContactSettingChanged = nullptr;
+static HANDLE g_hOptionsInitialize = nullptr;
+static HANDLE g_hModulesLoaded = nullptr;
+static HANDLE g_hProtoAck = nullptr;
+static HANDLE g_hProtoContactIsTyping = nullptr;
-HINSTANCE g_hInstDLL = 0;
+HINSTANCE g_hInstDLL = nullptr;
// Main global object
-static CTooltipNotify *g_pTooltipNotify = 0;
+static CTooltipNotify *g_pTooltipNotify = nullptr;
int hLangpack;
CLIST_INTERFACE *pcli;
@@ -59,7 +59,7 @@ extern "C" int __declspec(dllexport) Load(void)
pcli = Clist_GetInterface();
g_pTooltipNotify = new CTooltipNotify();
- assert(g_pTooltipNotify!=0);
+ assert(g_pTooltipNotify!=nullptr);
g_hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
return 0;