diff options
author | Underground78 <underground78@users.sourceforge.net> | 2013-05-07 23:51:09 +0400 |
---|---|---|
committer | Underground78 <underground78@users.sourceforge.net> | 2013-05-09 16:57:30 +0400 |
commit | 2acb3c5749326e59f6f2c6f48692a32dc7e705f5 (patch) | |
tree | 4b6985d401ea648b1562c3b4a6bb868e61c5105d /src/CmdUI/CmdUI.cpp | |
parent | ae3db48090dc9837fbb439503075521e356dcfa7 (diff) |
Use nullptr instead of NULL whenever possible.
Microsoft recommends to avoid using NULL or zero (0) as a null pointer constant since nullptr is less vulnerable to misuse and works better in most situations.
Also fix some cases where NULL was used instead of 0 or FALSE.
Diffstat (limited to 'src/CmdUI/CmdUI.cpp')
-rw-r--r-- | src/CmdUI/CmdUI.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/CmdUI/CmdUI.cpp b/src/CmdUI/CmdUI.cpp index fac48f70f..a09e0c65c 100644 --- a/src/CmdUI/CmdUI.cpp +++ b/src/CmdUI/CmdUI.cpp @@ -1,6 +1,6 @@ /*
* (C) 2003-2006 Gabest
- * (C) 2006-2012 see Authors.txt
+ * (C) 2006-2013 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -34,7 +34,7 @@ CCmdUIDialog::CCmdUIDialog() {
}
-CCmdUIDialog::CCmdUIDialog(UINT nIDTemplate, CWnd* pParent /*=NULL*/)
+CCmdUIDialog::CCmdUIDialog(UINT nIDTemplate, CWnd* pParent /*=nullptr*/)
: CDialog(nIDTemplate, pParent)
{
}
@@ -78,24 +78,24 @@ void CCmdUIDialog::OnKickIdle() void CCmdUIDialog::OnInitMenuPopup(CMenu* pPopupMenu, UINT /*nIndex*/, BOOL /*bSysMenu*/)
{
- ASSERT(pPopupMenu != NULL);
+ ASSERT(pPopupMenu != nullptr);
// Check the enabled state of various menu items.
CCmdUI state;
state.m_pMenu = pPopupMenu;
- ASSERT(state.m_pOther == NULL);
- ASSERT(state.m_pParentMenu == NULL);
+ ASSERT(state.m_pOther == nullptr);
+ ASSERT(state.m_pParentMenu == nullptr);
// Determine if menu is popup in top-level menu and set m_pOther to
- // it if so (m_pParentMenu == NULL indicates that it is secondary popup).
+ // it if so (m_pParentMenu == nullptr) indicates that it is secondary popup.
HMENU hParentMenu;
if (AfxGetThreadState()->m_hTrackingMenu == pPopupMenu->m_hMenu) {
state.m_pParentMenu = pPopupMenu; // Parent == child for tracking popup.
- } else if ((hParentMenu = ::GetMenu(m_hWnd)) != NULL) {
+ } else if ((hParentMenu = ::GetMenu(m_hWnd)) != nullptr) {
CWnd* pParent = this;
// Child windows don't have menus--need to go to the top!
- if (pParent != NULL &&
- (hParentMenu = ::GetMenu(pParent->m_hWnd)) != NULL) {
+ if (pParent != nullptr &&
+ (hParentMenu = ::GetMenu(pParent->m_hWnd)) != nullptr) {
int nIndexMax = ::GetMenuItemCount(hParentMenu);
for (int nIndex = 0; nIndex < nIndexMax; nIndex++) {
if (::GetSubMenu(hParentMenu, nIndex) == pPopupMenu->m_hMenu) {
@@ -115,12 +115,12 @@ void CCmdUIDialog::OnInitMenuPopup(CMenu* pPopupMenu, UINT /*nIndex*/, BOOL /*bS continue; // Menu separator or invalid cmd - ignore it.
}
- ASSERT(state.m_pOther == NULL);
- ASSERT(state.m_pMenu != NULL);
+ ASSERT(state.m_pOther == nullptr);
+ ASSERT(state.m_pMenu != nullptr);
if (state.m_nID == (UINT) - 1) {
// Possibly a popup menu, route to first item of that popup.
state.m_pSubMenu = pPopupMenu->GetSubMenu(state.m_nIndex);
- if (state.m_pSubMenu == NULL ||
+ if (state.m_pSubMenu == nullptr ||
(state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
state.m_nID == (UINT) - 1) {
continue; // First item of popup can't be routed to.
@@ -130,7 +130,7 @@ void CCmdUIDialog::OnInitMenuPopup(CMenu* pPopupMenu, UINT /*nIndex*/, BOOL /*bS // Normal menu item.
// Auto enable/disable if frame window has m_bAutoMenuEnable
// set and command is _not_ a system command.
- state.m_pSubMenu = NULL;
+ state.m_pSubMenu = nullptr;
state.DoUpdate(this, FALSE);
}
|