OSDN Git Service

Various refactorings involving NULL, ASSERT, TRUE and FALSE
authorGreyMerlin <greymerlin7@gmail.com>
Tue, 23 Oct 2018 20:10:53 +0000 (13:10 -0700)
committerGreyMerlin <greymerlin7@gmail.com>
Sun, 28 Oct 2018 15:00:29 +0000 (08:00 -0700)
* Many more `NULL` -> `nullptr`
* More `ASSERT (ptr)` -> `ASSERT (ptr!=nullptr`)
* More `if (ptr)` -> `if (ptr != nullptr`)
* Also `if (!ptr)` -> `if (ptr == nullptr)`
* Also, treat `HWND` like `ptr` for these refactorings

* More `TRUE/FALSE` -> `true/false` where `bool` vars already exists
* All `ASSERT(FALSE)` are now `ASSERT(false)`
* Some `if ( i1 & i2 )` -> `if ( (i1 & i2) != 0)`
* Some `b == false` -> `!b`
* Some `b == true` -> `b`

57 files changed:
Externals/crystaledit/editlib/ccrystaleditview.cpp
Externals/crystaledit/editlib/ccrystaltextbuffer.cpp
Externals/crystaledit/editlib/ccrystaltextview.cpp
Externals/crystaledit/editlib/ceditreplacedlg.cpp
Externals/crystaledit/editlib/cfindtextdlg.cpp
Externals/crystaledit/editlib/chcondlg.cpp
Externals/crystaledit/editlib/crystalparser.cpp
Externals/crystaledit/editlib/crystaltextblock.cpp
Externals/crystaledit/editlib/gotodlg.cpp
Externals/crystaledit/editlib/python.cpp
Externals/crystaledit/editlib/registry.cpp
Src/Common/BCMenu.cpp
Src/Common/CMoveConstraint.cpp
Src/Common/LanguageSelect.cpp
Src/Common/MDITabBar.cpp
Src/Common/MessageBoxDialog.cpp
Src/Common/Picture.cpp
Src/Common/PreferencesDlg.cpp
Src/Common/PropertyPageHost.cpp
Src/Common/SplitterWndEx.cpp
Src/Common/SuperComboBox.cpp
Src/Common/memdc.h
Src/Common/sizecbar.cpp
Src/Common/unicoder.cpp
Src/CompareEngines/Wrap_DiffUtils.cpp
Src/DiffFileInfo.cpp
Src/DiffTextBuffer.cpp
Src/DiffThread.cpp
Src/DiffWrapper.cpp
Src/DirActions.h
Src/DirColsDlg.cpp
Src/DirDoc.cpp
Src/DirView.cpp
Src/FileFiltersDlg.cpp
Src/FileTransform.cpp
Src/FilepathEdit.cpp
Src/FilterList.cpp
Src/FolderCmp.cpp
Src/GhostTextBuffer.cpp
Src/HexMergeDoc.cpp
Src/HexMergeView.cpp
Src/ImgMergeFrm.cpp
Src/LocationView.cpp
Src/MainFrm.cpp
Src/MergeDoc.cpp
Src/MergeEditView.cpp
Src/OpenDoc.cpp
Src/OpenView.cpp
Src/PatchDlg.cpp
Src/PatchTool.cpp
Src/Plugins.cpp
Src/ProjectFile.cpp
Src/ProjectFile.h
Src/PropCompareFolder.cpp
Src/PropGeneral.cpp
Src/PropTextColors.cpp
Src/Test.cpp

index 239156b..921031e 100644 (file)
@@ -1363,7 +1363,7 @@ DoDragScroll (const CPoint & point)
 void CCrystalEditView::
 SetAlternateDropTarget (IDropTarget *pDropTarget)
 {
-  ASSERT(m_pDropTarget->m_pAlternateDropTarget == NULL);
+  ASSERT(m_pDropTarget->m_pAlternateDropTarget == nullptr);
   m_pDropTarget->m_pAlternateDropTarget = pDropTarget;
   m_pDropTarget->m_pAlternateDropTarget->AddRef();
 }
@@ -1425,13 +1425,13 @@ OnCreate (LPCREATESTRUCT lpCreateStruct)
   if (CCrystalTextView::OnCreate (lpCreateStruct) == -1)
     return -1;
 
-  ASSERT (m_pDropTarget == NULL);
+  ASSERT (m_pDropTarget == nullptr);
   m_pDropTarget = new CEditDropTargetImpl (this);
   if (!m_pDropTarget->Register (this))
     {
       TRACE0 ("Warning: Unable to register drop target for ccrystaleditview.\n");
       delete m_pDropTarget;
-      m_pDropTarget = NULL;
+      m_pDropTarget = nullptr;
     }
 
   return 0;
@@ -1536,7 +1536,7 @@ OnEditReplace ()
     return;
 
   CWinApp *pApp = AfxGetApp ();
-  ASSERT (pApp != NULL);
+  ASSERT (pApp != nullptr);
 
   CEditReplaceDlg dlg (this);
   LastSearchInfos * lastSearch = dlg.GetLastSearchInfos();
@@ -1638,7 +1638,7 @@ ReplaceSelection (LPCTSTR pszNewText, size_t cchNewText, DWORD dwFlags)
 {
   if (!cchNewText)
     return DeleteCurrentSelection();
-  ASSERT(pszNewText);
+  ASSERT(pszNewText != nullptr);
 
   m_pTextBuffer->BeginUndoGroup();
 
@@ -2828,7 +2828,7 @@ OnToolsCharCoding ()
       LPTSTR pszNew;
       if (!iconvert_new (sText, &pszNew, dlg.m_nSource, dlg.m_nDest, dlg.m_bAlpha != false))
         {
-          ASSERT (pszNew);
+          ASSERT (pszNew != nullptr);
           m_pTextBuffer->BeginUndoGroup ();
 
           m_pTextBuffer->DeleteText (this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_RECODE);
index 8421e2e..30513c3 100644 (file)
@@ -1600,7 +1600,7 @@ InsertText (CCrystalTextView * pSource, int nLine, int nPos, LPCTSTR pszText,
   if (nPos != 0 || nEndChar != 0)
     m_aLines[nEndLine].m_dwRevisionNumber = m_dwCurrentRevisionNumber;
 
-  if (bHistory == false)
+  if (!bHistory)
   {
     delete paSavedRevisionNumbers;
     return true;
@@ -1728,7 +1728,7 @@ DeleteText2 (CCrystalTextView * pSource, int nStartLine, int nStartChar,
   m_dwCurrentRevisionNumber++;
   m_aLines[nStartLine].m_dwRevisionNumber = m_dwCurrentRevisionNumber;
 
-  if (bHistory == false)
+  if (!bHistory)
   {
     delete paSavedRevisionNumbers;
     return true;
index 74bc10b..4bde1ba 100644 (file)
@@ -514,11 +514,11 @@ SaveSettings ()
 
 CCrystalTextView::CCrystalTextView ()
 : m_nScreenChars(-1)
-, m_pFindTextDlg(NULL)
+, m_pFindTextDlg(nullptr)
 {
   memset(((CView*)this)+1, 0, sizeof(*this) - sizeof(class CView)); // AFX_ZERO_INIT_OBJECT (CView)
-  m_rxnode = NULL;
-  m_pszMatched = NULL;
+  m_rxnode = nullptr;
+  m_pszMatched = nullptr;
   m_bSelMargin = true;
   m_bViewLineNumbers = false;
   m_bWordWrap = false;
@@ -530,15 +530,15 @@ CCrystalTextView::CCrystalTextView ()
   //BEGIN SW
   m_panSubLines = new CArray<int, int>();
   m_panSubLineIndexCache = new CArray<int, int>();
-  ASSERT( m_panSubLines );
-  ASSERT( m_panSubLineIndexCache );
+  ASSERT( m_panSubLines != nullptr );
+  ASSERT( m_panSubLineIndexCache != nullptr );
   m_panSubLines->SetSize( 0, 4096 );
   m_panSubLineIndexCache->SetSize( 0, 4096 );
 
   m_pstrIncrementalSearchString = new CString;
-  ASSERT( m_pstrIncrementalSearchString );
+  ASSERT( m_pstrIncrementalSearchString != nullptr );
   m_pstrIncrementalSearchStringOld = new CString;
-  ASSERT( m_pstrIncrementalSearchStringOld );
+  ASSERT( m_pstrIncrementalSearchStringOld != nullptr );
   //END SW
   m_ParseCookies = new vector<DWORD>;
   m_pnActualLineLength = new vector<int>;
@@ -547,33 +547,33 @@ CCrystalTextView::CCrystalTextView ()
   m_bSingle = false; // needed to be set in descendat classes
   m_bRememberLastPos = false;
 
-  m_pColors = NULL;
+  m_pColors = nullptr;
 
   m_nLastLineIndexCalculatedSubLineIndex = -1;
 }
 
 CCrystalTextView::~CCrystalTextView ()
 {
-  ASSERT (m_hAccel == NULL);
-  ASSERT (m_pCacheBitmap == NULL);
-  ASSERT (m_pTextBuffer == NULL);   //  Must be correctly detached
+  ASSERT (m_hAccel == nullptr);
+  ASSERT (m_pCacheBitmap == nullptr);
+  ASSERT (m_pTextBuffer == nullptr);   //  Must be correctly detached
 
   delete m_pFindTextDlg;
 
-  if (m_pszLastFindWhat != NULL)
+  if (m_pszLastFindWhat != nullptr)
     {
       free (m_pszLastFindWhat);
-      m_pszLastFindWhat=NULL;
+      m_pszLastFindWhat=nullptr;
     }
   if (m_rxnode)
     {
       RxFree (m_rxnode);
-      m_rxnode = NULL;
+      m_rxnode = nullptr;
     }
   if (m_pszMatched)
     {
       free(m_pszMatched); // Allocated by _tcsdup()
-      m_pszMatched = NULL;
+      m_pszMatched = nullptr;
     }
   //BEGIN SW
   if( m_panSubLines )
@@ -597,10 +597,10 @@ CCrystalTextView::~CCrystalTextView ()
       m_pstrIncrementalSearchStringOld = NULL;
     }
   //END SW
-  ASSERT(m_ParseCookies);
+  ASSERT(m_ParseCookies != nullptr);
   delete m_ParseCookies;
   m_ParseCookies = NULL;
-  ASSERT(m_pnActualLineLength);
+  ASSERT(m_pnActualLineLength != nullptr);
   delete m_pnActualLineLength;
   m_pnActualLineLength = NULL;
   delete m_pIcons;
@@ -2998,7 +2998,7 @@ RecalcPageLayouts (CDC * pdc, CPrintInfo * pInfo)
   m_rcPrintArea = m_ptPageArea;
   CSize szTopLeft, szBottomRight;
   CWinApp *pApp = AfxGetApp ();
-  ASSERT (pApp != NULL);
+  ASSERT (pApp != nullptr);
   GetPrintMargins (szTopLeft.cx, szTopLeft.cy, szBottomRight.cx, szBottomRight.cy);
   pdc->HIMETRICtoLP (&szTopLeft);
   pdc->HIMETRICtoLP (&szBottomRight);
@@ -3020,7 +3020,7 @@ RecalcPageLayouts (CDC * pdc, CPrintInfo * pInfo)
 void CCrystalTextView::
 OnBeginPrinting (CDC * pdc, CPrintInfo * pInfo)
 {
-  ASSERT (m_pPrintFont == NULL);
+  ASSERT (m_pPrintFont == nullptr);
   CFont *pDisplayFont = GetFont ();
 
   LOGFONT lf;
@@ -3533,7 +3533,7 @@ OnUpdateSibling (CCrystalTextView * pUpdateSource, bool bHorz)
 {
   if (pUpdateSource != this)
     {
-      ASSERT (pUpdateSource != NULL);
+      ASSERT (pUpdateSource != nullptr);
       ASSERT_KINDOF (CCrystalTextView, pUpdateSource);
       if (bHorz)
         {
@@ -4468,12 +4468,12 @@ OnCreate (LPCREATESTRUCT lpCreateStruct)
   if (CView::OnCreate (lpCreateStruct) == -1)
     return -1;
 
-  ASSERT (m_hAccel == NULL);
+  ASSERT (m_hAccel == nullptr);
              // vvv GetResourceHandle () ???
   HINSTANCE hInst = AfxFindResourceHandle (MAKEINTRESOURCE(IDR_DEFAULT_ACCEL), RT_ACCELERATOR);
-  ASSERT (hInst);
+  ASSERT (hInst != nullptr);
   m_hAccel =::LoadAccelerators (hInst, MAKEINTRESOURCE (IDR_DEFAULT_ACCEL));
-  ASSERT (m_hAccel != NULL);
+  ASSERT (m_hAccel != nullptr);
   return 0;
 }
 
@@ -4790,8 +4790,8 @@ FindStringHelper (LPCTSTR pszLineBegin, LPCTSTR pszFindWhere, LPCTSTR pszFindWha
     }
   else
     {
-      ASSERT (pszFindWhere != NULL);
-      ASSERT (pszFindWhat != NULL);
+      ASSERT (pszFindWhere != nullptr);
+      ASSERT (pszFindWhat != nullptr);
       int nCur = 0;
       int nLength = (int) _tcslen (pszFindWhat);
       LPCTSTR pszFindWhereOrig = pszFindWhere;
@@ -4921,7 +4921,7 @@ FindTextInBlock (LPCTSTR pszText, const CPoint & ptStartPosition,
 {
   CPoint ptCurrentPos = ptStartPosition;
 
-  ASSERT (pszText != NULL && _tcslen (pszText) > 0);
+  ASSERT (pszText != nullptr && _tcslen (pszText) > 0);
   ASSERT_VALIDTEXTPOS (ptCurrentPos);
   ASSERT_VALIDTEXTPOS (ptBlockBegin);
   ASSERT_VALIDTEXTPOS (ptBlockEnd);
@@ -5212,7 +5212,7 @@ void CCrystalTextView::
 OnEditFind ()
 {
   CWinApp *pApp = AfxGetApp ();
-  ASSERT (pApp != NULL);
+  ASSERT (pApp != nullptr);
 
   if (!m_pFindTextDlg)
     m_pFindTextDlg = new CFindTextDlg (this);
@@ -5370,7 +5370,7 @@ void CCrystalTextView::
 OnFilePageSetup ()
 {
   CWinApp *pApp = AfxGetApp ();
-  ASSERT (pApp != NULL);
+  ASSERT (pApp != nullptr);
 
   CPageSetupDialog dlg;
   PRINTDLG pd;
@@ -5922,7 +5922,7 @@ OnToggleSourceHeader ()
   if (m_CurSourceDef->type == SRC_C)
     {
       CDocument *pDoc = GetDocument ();
-      ASSERT (pDoc);
+      ASSERT (pDoc != nullptr);
       CString sFilePath = pDoc->GetPathName (), sOriginalPath = sFilePath;
       if (!_tcsicmp (sFilePath.Right (2), _T (".c")))
         {
@@ -5998,7 +5998,7 @@ OnUpdateSelMargin (CCmdUI * pCmdUI)
 void CCrystalTextView::
 OnSelMargin ()
 {
-  ASSERT (m_CurSourceDef);
+  ASSERT (m_CurSourceDef != nullptr);
   if (m_bSelMargin)
     {
       m_CurSourceDef->flags &= ~SRCOPT_SELMARGIN;
@@ -6020,7 +6020,7 @@ OnUpdateWordWrap (CCmdUI * pCmdUI)
 void CCrystalTextView::
 OnWordWrap ()
 {
-  ASSERT (m_CurSourceDef);
+  ASSERT (m_CurSourceDef != nullptr);
   if (m_bWordWrap)
     {
       m_CurSourceDef->flags &= ~SRCOPT_WORDWRAP;
@@ -6319,7 +6319,7 @@ void CCrystalTextView::OnUpdateStatusMessage( CStatusBar *pStatusBar )
 {
   static bool  bUpdatedAtLastCall = false;
 
-  ASSERT( pStatusBar && IsWindow( pStatusBar->m_hWnd ) );
+  ASSERT( pStatusBar != nullptr && IsWindow( pStatusBar->m_hWnd ) );
   if( !pStatusBar || !IsWindow( pStatusBar->m_hWnd ) )
     return;
 
index f2e34d2..bcec66e 100644 (file)
@@ -61,7 +61,7 @@ CEditReplaceDlg::CEditReplaceDlg (CCrystalEditView * pBuddy)
 , m_bFound(false)
 , lastSearch({0})
 {
-  ASSERT (pBuddy != NULL);
+  ASSERT (pBuddy != nullptr);
 }
 
 void CEditReplaceDlg::
@@ -181,7 +181,7 @@ GetLastSearchInfos()
 bool CEditReplaceDlg::
 DoHighlightText ( bool bNotifyIfNotFound )
 {
-  ASSERT (m_pBuddy != NULL);
+  ASSERT (m_pBuddy != nullptr);
   DWORD dwSearchFlags = 0;
   if (m_bMatchCase)
     dwSearchFlags |= FIND_MATCH_CASE;
@@ -229,7 +229,7 @@ DoHighlightText ( bool bNotifyIfNotFound )
 bool CEditReplaceDlg::
 DoReplaceText (LPCTSTR /*pszNewText*/, DWORD dwSearchFlags)
 {
-  ASSERT (m_pBuddy != NULL);
+  ASSERT (m_pBuddy != nullptr);
   // m_pBuddy->m_nLastFindWhatLen
 
   bool bFound;
index 1f07876..c288e40 100644 (file)
@@ -37,7 +37,7 @@
 // CFindTextDlg dialog
 
 CFindTextDlg::CFindTextDlg (CCrystalTextView * pBuddy)
-: CDialog (CFindTextDlg::IDD, NULL)
+: CDialog (CFindTextDlg::IDD, nullptr)
 , m_pBuddy(pBuddy)
 , m_nDirection(1)
 , m_bMatchCase(false)
@@ -47,7 +47,7 @@ CFindTextDlg::CFindTextDlg (CCrystalTextView * pBuddy)
 , m_bNoClose(false)
 , lastSearch({0})
 {
-  ASSERT (pBuddy != NULL);
+  ASSERT (pBuddy != nullptr);
   Create(CFindTextDlg::IDD,pBuddy);
 }
 
@@ -96,7 +96,7 @@ FindText (int nDirection)
       m_nDirection = nDirection;
       UpdateLastSearch ();
 
-      ASSERT (m_pBuddy != NULL);
+      ASSERT (m_pBuddy != nullptr);
 
       if (!m_pBuddy->FindText(GetLastSearchInfos()))
         {
index c47bd96..52f61f0 100644 (file)
@@ -46,7 +46,7 @@ EDITPADC_CLASS int nCodeNames = sizeof (pszCodeNames) / sizeof (pszCodeNames[0])
 EDITPADC_CLASS void FillComboBox (CComboBox &Control, LPCTSTR *pszItems)
 {
   Control.ResetContent();
-  ASSERT (pszItems);
+  ASSERT (pszItems != nullptr);
   while (*pszItems)
     Control.AddString(*pszItems++);
 }
index 8410f3e..707a2a7 100644 (file)
@@ -50,7 +50,7 @@ static LPTSTR NTAPI EnsureCharNext(LPCTSTR current)
 void CCrystalParser::WrapLine( int nLineIndex, int nMaxLineWidth, int *anBreaks, int &nBreaks )
 {
        // The parser must be attached to a view!
-       ASSERT( m_pTextView );
+       ASSERT( m_pTextView != nullptr );
 
        int                     nLineLength = m_pTextView->GetLineLength( nLineIndex );
        int                     nTabWidth = m_pTextView->GetTabSize();
index 0c03125..87da305 100644 (file)
@@ -23,7 +23,7 @@
 CCrystalTextBlock::CCrystalTextBlock( TEXTBLOCK *pTextBlock, int &rnActualItems )
 : m_rnActualItems( rnActualItems )
 {
-       ASSERT( pTextBlock );
+       ASSERT( pTextBlock != nullptr );
        m_pTextBlock = pTextBlock;
 }
 
index 957b5a2..6c1c86e 100644 (file)
@@ -55,7 +55,7 @@ END_MESSAGE_MAP ()
 void CGotoDlg::OnOK ()
 {
   CDialog::OnOK ();
-  ASSERT (m_pBuddy != NULL);
+  ASSERT (m_pBuddy != nullptr);
   m_pBuddy->GoToLine (_ttoi (m_sNumber), _tcschr (_T ("+-"), *(LPCTSTR)m_sNumber) != NULL);
 }
 
index ec26da1..89957fd 100644 (file)
@@ -210,7 +210,7 @@ IsPythonNumber (LPCTSTR pszChars, int nLength)
 
 #define DEFINE_BLOCK(pos, colorindex)   \
 ASSERT((pos) >= 0 && (pos) <= nLength);\
-if (pBuf != NULL)\
+if (pBuf != nullptr)\
   {\
     if (nActualItems == 0 || pBuf[nActualItems - 1].m_nCharPos <= (pos)){\
         if (nActualItems > 0 && pBuf[nActualItems - 1].m_nCharPos == (pos)) nActualItems--;\
index 0e8a045..36f0c7b 100644 (file)
@@ -32,7 +32,7 @@
 void
 RegValInit (RegVal *pValData)
 {
-  ASSERT (pValData);
+  ASSERT (pValData != nullptr);
   pValData->dwType = REG_NONE;
 }
 
@@ -40,7 +40,7 @@ RegValInit (RegVal *pValData)
 void
 RegValFree (RegVal *pValData)
 {
-  ASSERT (pValData);
+  ASSERT (pValData != nullptr);
   if (pValData->dwType == REG_SZ || pValData->dwType == REG_EXPAND_SZ
         || pValData->dwType == REG_LINK || pValData->dwType == REG_MULTI_SZ
         || pValData->dwType == REG_BINARY)
@@ -54,7 +54,7 @@ RegValFree (RegVal *pValData)
 bool
 RegValGetNumber (const RegVal *pValData, DWORD *pdwNumber)
 {
-  ASSERT (pValData &&pdwNumber);
+  ASSERT (pValData != nullptr && pdwNumber != nullptr);
   if (pValData->dwType == REG_DWORD)
     {
       *pdwNumber = pValData->dwNumber;
@@ -67,7 +67,7 @@ RegValGetNumber (const RegVal *pValData, DWORD *pdwNumber)
 bool
 RegValGetBinary (const RegVal *pValData, LPBYTE pbyteData, DWORD dwSize)
 {
-  ASSERT (pValData &&pbyteData);
+  ASSERT (pValData != nullptr && pbyteData != nullptr);
   if (pValData->dwType == REG_BINARY &&dwSize >= pValData->dwSize)
     {
       memcpy (pbyteData, pValData->pbyteData, pValData->dwSize);
@@ -80,11 +80,11 @@ RegValGetBinary (const RegVal *pValData, LPBYTE pbyteData, DWORD dwSize)
 bool
 RegValGetNewBinary (const RegVal *pValData, LPBYTE *pbyteData, DWORD *pdwSize)
 {
-  ASSERT (pValData &&pbyteData);
+  ASSERT (pValData != nullptr && pbyteData != nullptr);
   if (pValData->dwType == REG_BINARY)
     {
       LPBYTE pbyteNewData = (LPBYTE) malloc (pValData->dwSize);
-      if (pbyteNewData)
+      if (pbyteNewData != nullptr)
         {
           *pbyteData = pbyteNewData;
           *pdwSize = pValData->dwSize;
@@ -99,15 +99,15 @@ RegValGetNewBinary (const RegVal *pValData, LPBYTE *pbyteData, DWORD *pdwSize)
 bool
 RegValGetNewString (const RegVal *pValData, LPTSTR *pszString, DWORD *pdwLength)
 {
-  ASSERT (pValData &&pszString);
+  ASSERT (pValData != nullptr && pszString != nullptr);
   if (pValData->dwType == REG_SZ || pValData->dwType == REG_EXPAND_SZ
         || pValData->dwType == REG_LINK || pValData->dwType == REG_MULTI_SZ)
     {
       LPTSTR pszNewString = (LPTSTR) malloc (pValData->dwLength + 1);
-      if (pszNewString)
+      if (pszNewString != nullptr)
         {
           *pszString = pszNewString;
-          if (pdwLength)
+          if (pdwLength != nullptr)
             {
               *pdwLength = pValData->dwLength;
             }
@@ -123,7 +123,7 @@ RegValGetNewString (const RegVal *pValData, LPTSTR *pszString, DWORD *pdwLength)
 bool
 RegValGetString (const RegVal *pValData, LPTSTR pszString, DWORD dwLength)
 {
-  ASSERT (pValData &&pszString);
+  ASSERT (pValData != nullptr && pszString != nullptr);
   if ((pValData->dwType == REG_SZ || pValData->dwType == REG_EXPAND_SZ
          || pValData->dwType == REG_LINK || pValData->dwType == REG_MULTI_SZ)
         && dwLength >= pValData->dwLength)
@@ -139,7 +139,7 @@ RegValGetString (const RegVal *pValData, LPTSTR pszString, DWORD dwLength)
 bool
 RegValGetStringArr (const RegVal *pValData, LPTSTR pszStrings[], DWORD dwCount)
 {
-  ASSERT (pValData);
+  ASSERT (pValData != nullptr);
   if (pValData->dwType == REG_MULTI_SZ)
     {
       LPCTSTR pszString0;
@@ -183,7 +183,7 @@ RegValGetStringArr (const RegVal *pValData, LPTSTR pszStrings[], DWORD dwCount)
 bool
 RegValGetNewStringArr (const RegVal *pValData, LPTSTR **pszStrings, DWORD *pdwCount)
 {
-  ASSERT (pValData);
+  ASSERT (pValData != nullptr);
   if (pValData->dwType == REG_MULTI_SZ)
     {
       LPTSTR pszString;
@@ -231,7 +231,7 @@ RegValGetNewStringArr (const RegVal *pValData, LPTSTR **pszStrings, DWORD *pdwCo
 bool
 RegValGetString (const RegVal *pValData, CString &sString)
 {
-  ASSERT (pValData);
+  ASSERT (pValData != nullptr);
   if (pValData->dwType == REG_SZ || pValData->dwType == REG_EXPAND_SZ
         || pValData->dwType == REG_LINK || pValData->dwType == REG_MULTI_SZ)
     {
@@ -247,7 +247,7 @@ RegValGetString (const RegVal *pValData, CString &sString)
 bool
 RegValGetStringArr (const RegVal *pValData, CStringArray &arrString)
 {
-  ASSERT (pValData);
+  ASSERT (pValData != nullptr);
   if (pValData->dwType == REG_MULTI_SZ)
     {
       arrString.RemoveAll ();
@@ -266,7 +266,7 @@ RegValGetStringArr (const RegVal *pValData, CStringArray &arrString)
 void
 RegValSetNumber (RegVal *pValData, DWORD dwNumber)
 {
-  ASSERT (pValData);
+  ASSERT (pValData != nullptr);
   pValData->dwType = REG_DWORD;
   pValData->dwNumber = dwNumber;
 }
@@ -275,9 +275,9 @@ RegValSetNumber (RegVal *pValData, DWORD dwNumber)
 bool
 RegValSetBinary (RegVal *pValData, const LPBYTE pbyteData, DWORD dwSize)
 {
-  ASSERT (pValData &&pbyteData);
+  ASSERT (pValData != nullptr && pbyteData != nullptr);
   pValData->pbyteData = (LPBYTE) malloc (dwSize);
-  if (pValData->pbyteData)
+  if (pValData->pbyteData != nullptr)
     {
       pValData->dwSize = dwSize;
       pValData->dwType = REG_BINARY;
@@ -292,10 +292,10 @@ RegValSetBinary (RegVal *pValData, const LPBYTE pbyteData, DWORD dwSize)
 bool
 RegValSetString (RegVal *pValData, LPCTSTR pszString)
 {
-  ASSERT (pValData &&pszString);
+  ASSERT (pValData != nullptr && pszString != nullptr);
   DWORD dwLength = (DWORD) _tcslen (pszString) + 1;
   pValData->pszString = (LPTSTR) malloc (dwLength);
-  if (pValData->pszString)
+  if (pValData->pszString != nullptr)
     {
       pValData->dwLength = dwLength;
       pValData->dwType = REG_SZ;
@@ -309,9 +309,9 @@ RegValSetString (RegVal *pValData, LPCTSTR pszString)
 bool
 RegValSetStringArr (RegVal *pValData, const LPCTSTR pszStrings[], DWORD dwCount)
 {
-  ASSERT (pValData &&pszStrings);
+  ASSERT (pValData != nullptr && pszStrings != nullptr);
   DWORD i, dwSize = 1;
-  if (dwCount)
+  if (dwCount != 0)
     {
       for (i = 0; i < dwCount; i++)
         {
@@ -323,12 +323,12 @@ RegValSetStringArr (RegVal *pValData, const LPCTSTR pszStrings[], DWORD dwCount)
       dwSize++;
     }
   pValData->pbyteData = (LPBYTE) malloc (dwSize);
-  if (pValData->pbyteData)
+  if (pValData->pbyteData != nullptr)
     {
       pValData->dwSize = dwSize;
       pValData->dwType = REG_MULTI_SZ;
       LPBYTE pbyteData = pValData->pbyteData;
-      if (dwCount)
+      if (dwCount != 0)
         {
           for (i = 0; i < dwCount; i++)
             {
@@ -356,9 +356,9 @@ RegValSetStringArr (RegVal *pValData, const LPCTSTR pszStrings[], DWORD dwCount)
 bool
 RegValSetStringArr (RegVal *pValData, const CStringArray &arrString)
 {
-  ASSERT (pValData);
+  ASSERT (pValData != nullptr);
   DWORD i, dwSize = 1, dwCount = (DWORD) arrString.GetSize ();
-  if (dwCount)
+  if (dwCount != 0)
     {
       for (i = 0; i < dwCount; i++)
         {
@@ -370,12 +370,12 @@ RegValSetStringArr (RegVal *pValData, const CStringArray &arrString)
       dwSize++;
     }
   pValData->pbyteData = (LPBYTE) malloc (dwSize);
-  if (pValData->pbyteData)
+  if (pValData->pbyteData != nullptr)
     {
       pValData->dwSize = dwSize;
       pValData->dwType = REG_MULTI_SZ;
       LPBYTE pbyteData = pValData->pbyteData;
-      if (dwCount)
+      if (dwCount != 0)
         {
           for (i = 0; i < dwCount; i++)
             {
@@ -449,9 +449,9 @@ RegClose (HKEY hKey)
 bool
 RegLoadVal (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, RegVal *pValData)
 {
-  ASSERT (pValData);
+  ASSERT (pValData != nullptr);
   HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ) : hKey;
-  if (hSubKey)
+  if (hSubKey != nullptr)
     {
       DWORD dwType, dwSize;
       if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwSize) == ERROR_SUCCESS)
@@ -475,7 +475,7 @@ RegLoadVal (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, RegVal *pValData)
                 || dwType == REG_MULTI_SZ || dwType == REG_BINARY)
             {
               LPBYTE pbyteData = (LPBYTE) malloc (dwSize);
-              if (pbyteData)
+              if (pbyteData != nullptr)
                 {
                   if (RegQueryValueEx (hSubKey, pszValName, 0, NULL, pbyteData, &dwSize) == ERROR_SUCCESS)
                     {
@@ -501,9 +501,9 @@ RegLoadVal (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, RegVal *pValData)
 bool
 RegLoadNumber (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, DWORD *pdwNumber)
 {
-  ASSERT (pdwNumber);
+  ASSERT (pdwNumber != nullptr);
   HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ) : hKey;
-  if (hSubKey)
+  if (hSubKey != nullptr)
     {
       DWORD dwType, dwSize;
       if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwSize) == ERROR_SUCCESS)
@@ -530,9 +530,9 @@ RegLoadNumber (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, DWORD *pdwNumbe
 bool
 RegLoadBinary (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, LPBYTE pbyteData, DWORD dwSize)
 {
-  ASSERT (pbyteData);
+  ASSERT (pbyteData != nullptr);
   HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ) : hKey;
-  if (hSubKey)
+  if (hSubKey != nullptr)
     {
       DWORD dwType, dwRealSize;
       if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwRealSize) == ERROR_SUCCESS)
@@ -557,9 +557,9 @@ RegLoadBinary (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, LPBYTE pbyteDat
 bool
 RegLoadNewBinary (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, LPBYTE *pbyteData, DWORD *pdwSize)
 {
-  ASSERT (pbyteData);
+  ASSERT (pbyteData != nullptr);
   HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ) : hKey;
-  if (hSubKey)
+  if (hSubKey != nullptr)
     {
       DWORD dwType, dwRealSize;
       if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwRealSize) == ERROR_SUCCESS)
@@ -591,9 +591,9 @@ RegLoadNewBinary (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, LPBYTE *pbyt
 bool
 RegLoadString (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, LPTSTR pszString, DWORD dwLength)
 {
-  ASSERT (pszString);
+  ASSERT (pszString != nullptr);
   HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ) : hKey;
-  if (hSubKey)
+  if (hSubKey != nullptr)
     {
       DWORD dwType, dwRealLength;
       if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwRealLength) == ERROR_SUCCESS)
@@ -619,9 +619,9 @@ RegLoadString (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, LPTSTR pszStrin
 bool
 RegLoadNewString (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, LPTSTR *pszString, DWORD *pdwLength)
 {
-  ASSERT (pszString);
+  ASSERT (pszString != nullptr);
   HKEY hSubKey = pszSubKey ? RegOpen (hKey, pszSubKey, KEY_READ) : hKey;
-  if (hSubKey)
+  if (hSubKey != nullptr)
     {
       DWORD dwType, dwRealLength;
       if (RegQueryValueEx (hSubKey, pszValName, 0, &dwType, NULL, &dwRealLength) == ERROR_SUCCESS)
@@ -742,9 +742,9 @@ RegLoadStringArr (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, CStringArray
 bool
 RegSaveVal (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, const RegVal *pValData)
 {
-  ASSERT (pValData);
+  ASSERT (pValData != nullptr);
   HKEY hSubKey = pszSubKey ? RegCreate (hKey, pszSubKey, KEY_WRITE) : hKey;
-  if (hSubKey)
+  if (hSubKey != nullptr)
     {
       LONG lResult;
       if (pValData->dwType == REG_DWORD)
index e40cc5f..55d6029 100644 (file)
@@ -214,9 +214,9 @@ bool BCMenu::IsMenu(HMENU submenu)
        for(m=0;m<=numSubMenus;++m){
                if(submenu==m_AllSubMenus[m] || 
                  static_cast<UINT>(reinterpret_cast<uintptr_t>(submenu)) == static_cast<UINT>(reinterpret_cast<uintptr_t>(m_AllSubMenus[m])))
-                       return(TRUE);
+                       return(true);
        }
-       return(FALSE);
+       return(false);
 }
 
 BOOL BCMenu::DestroyMenu()
@@ -261,7 +261,7 @@ void BCMenu::DrawItem(LPDRAWITEMSTRUCT)
 
 void BCMenu::DrawItem (LPDRAWITEMSTRUCT lpDIS)
 {
-       ASSERT(lpDIS != NULL);
+       ASSERT(lpDIS != nullptr);
        CDC* pDC = CDC::FromHandle(lpDIS->hDC);
        if(pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE)DrawItem_Win9xNT2000(lpDIS);
        else{
@@ -274,7 +274,7 @@ void BCMenu::DrawItem (LPDRAWITEMSTRUCT lpDIS)
 
 void BCMenu::DrawItem_Win9xNT2000 (LPDRAWITEMSTRUCT lpDIS)
 {
-       ASSERT(lpDIS != NULL);
+       ASSERT(lpDIS != nullptr);
        CDC* pDC = CDC::FromHandle(lpDIS->hDC);
        CRect rect;
        UINT state0 = reinterpret_cast<BCMenuData*>(lpDIS->itemData)->nFlags;
@@ -510,7 +510,7 @@ inline COLORREF BCMenu::LightenColor(COLORREF col,double factor)
 
 void BCMenu::DrawItem_Theme(LPDRAWITEMSTRUCT lpDIS)
 {
-       ASSERT(lpDIS != NULL);
+       ASSERT(lpDIS != nullptr);
        CDC* pDC = CDC::FromHandle(lpDIS->hDC);
        HDC hDC = lpDIS->hDC;
        CRect rect(&lpDIS->rcItem);
@@ -921,7 +921,7 @@ BOOL BCMenu::ModifyODMenuW(wchar_t *lpstrText,UINT_PTR nID,int nIconNormal)
                        m_MenuList.Add(mdata);
                }
                
-               ASSERT(mdata);
+               ASSERT(mdata != nullptr);
                if(lpstrText)
                        mdata->SetWideString(lpstrText);  //SK: modified for dynamic allocation
                mdata->menuIconNormal = -1;
@@ -1470,7 +1470,7 @@ BOOL BCMenu::GetMenuText(UINT id, CString& string, UINT nFlags/*= MF_BYPOSITION*
        else{
                UINT uiLoc;
                BCMenu* pMenu = FindMenuOption(id,uiLoc);
-               if(NULL!=pMenu) returnflag = pMenu->GetMenuText(uiLoc,string);
+               if(pMenu != nullptr) returnflag = pMenu->GetMenuText(uiLoc,string);
        }
        return(returnflag);
 }
@@ -1906,7 +1906,7 @@ BOOL BCMenu::RemoveMenu(UINT uiId,UINT nFlags)
                }
                else{
                        BCMenu* pSubMenu = static_cast<BCMenu*>(GetSubMenu(uiId));
-                       if(NULL==pSubMenu){
+                       if(pSubMenu == nullptr){
                                UINT uiCommandId = GetMenuItemID(uiId);
                                for(int i=0;i<m_MenuList.GetSize(); i++){
                                        if(m_MenuList[i]->nID==uiCommandId){
@@ -1970,7 +1970,7 @@ BOOL BCMenu::DeleteMenu(UINT uiId,UINT nFlags)
                }
                else{
                        BCMenu* pSubMenu = static_cast<BCMenu*>(GetSubMenu(uiId));
-                       if(NULL==pSubMenu){
+                       if(pSubMenu == nullptr){
                                UINT uiCommandId = GetMenuItemID(uiId);
                                for(int i=0;i<m_MenuList.GetSize(); i++){
                                        if(m_MenuList[i]->nID==uiCommandId){
@@ -2220,7 +2220,7 @@ BOOL BCMenu::SetMenuText(UINT id, CString string, UINT nFlags/*= MF_BYPOSITION*/
        else{
                UINT uiLoc;
                BCMenu* pMenu = FindMenuOption(id,uiLoc);
-               if(NULL!=pMenu) returnflag = pMenu->SetMenuText(uiLoc,string);
+               if(pMenu != nullptr) returnflag = pMenu->SetMenuText(uiLoc,string);
        }
        return(returnflag);
 }
index c6428cc..5e6ff63 100644 (file)
@@ -131,7 +131,7 @@ CMoveConstraint::InitializeSpecificSize(HWND /*hwndDlg*/, int nWidth, int nHeigh
 bool
 CMoveConstraint::InitializeOriginalSize(HWND hwndDlg)
 {
-       ASSERT(hwndDlg && !m_hwndDlg);
+       ASSERT(hwndDlg != nullptr && m_hwndDlg == nullptr);
        m_hwndDlg = hwndDlg;
 
        return m_nOrigX != 0; // if 0, we didn't get WM_SIZE so we don't know the original size
@@ -140,7 +140,7 @@ CMoveConstraint::InitializeOriginalSize(HWND hwndDlg)
 bool
 CMoveConstraint::InitializeOriginalSize(CWnd * pParent)
 {
-       ASSERT(pParent);
+       ASSERT(pParent != nullptr);
        return InitializeOriginalSize(pParent->m_hWnd);
 }
 
@@ -148,14 +148,14 @@ CMoveConstraint::InitializeOriginalSize(CWnd * pParent)
 void
 CMoveConstraint::InitializeSpecificSize(CWnd * pDlg, int nWidth, int nHeight)
 {
-       ASSERT(pDlg);
+       ASSERT(pDlg != nullptr);
        InitializeSpecificSize(pDlg->m_hWnd, nWidth, nHeight);
 }
 
 bool
 CMoveConstraint::InitializeCurrentSize(CWnd * pDlg)
 {
-       ASSERT(pDlg);
+       ASSERT(pDlg != nullptr);
        return InitializeCurrentSize(pDlg->m_hWnd);
 }
 
@@ -316,7 +316,7 @@ void
 CMoveConstraint::
 Constrain(CWnd * pWnd, double fLeftX, double fExpandX, double fAboveY, double fExpandY)
 {
-       ASSERT(pWnd);
+       ASSERT(pWnd != nullptr);
        DoConstrain(pWnd, pWnd->m_hWnd, fLeftX, fExpandX, fAboveY, fExpandY);
 }
 
@@ -385,7 +385,7 @@ CMoveConstraint::CheckDeferredChildren()
                Constraint & constraint = constraintList.GetAt(pos);
                if (constraint.m_hwndChild)
                        continue;
-               ASSERT(constraint.m_pWnd);
+               ASSERT(constraint.m_pWnd != nullptr);
                if (constraint.m_pWnd->m_hWnd)
                {
                        constraint.m_hwndChild = constraint.m_pWnd->m_hWnd;
index 83c0ad8..e5c8979 100644 (file)
@@ -624,7 +624,7 @@ bool CLanguageSelect::LoadLanguageFile(LANGID wLangId, bool bShowError /*= false
                size_t len = eol - data;
                if (len >= sizeof buf)
                {
-                       ASSERT(FALSE);
+                       ASSERT(false);
                        break;
                }
                memcpy(buf, data, len);
index 9e485f1..34fd526 100644 (file)
@@ -290,7 +290,7 @@ void CMDITabBar::UpdateTabs()
                int dummy;
                tci.mask = TCIF_PARAM;
                GetItem(item, &tci);
-               if (MDIFrameList.Lookup((HWND)tci.lParam, dummy) == FALSE)
+               if (!MDIFrameList.Lookup((HWND)tci.lParam, dummy))
                {
                        DeleteItem(item);
                        if (GetItemCount() == 0)
index d4783d9..743af96 100644 (file)
@@ -250,7 +250,7 @@ inline const String &CMessageBoxDialog::GetTitle ( )
  */
 inline void CMessageBoxDialog::SetMessageIcon ( HICON hIcon )
 {
-       ASSERT(hIcon != NULL);
+       ASSERT(hIcon != nullptr);
 
        // Save the icon.
        m_hIcon = hIcon;
@@ -264,7 +264,7 @@ inline void CMessageBoxDialog::SetMessageIcon ( UINT nIconID )
        // Try to load the given icon.
        m_hIcon = AfxGetApp()->LoadIcon(nIconID);
 
-       ASSERT(m_hIcon != NULL);
+       ASSERT(m_hIcon != nullptr);
 }
 
 /*
@@ -328,10 +328,10 @@ void CMessageBoxDialog::ResetMessageBoxes ( )
        // Try to retrieve a handle to the application object.
        CWinApp* pApplication = AfxGetApp();
 
-       ASSERT(pApplication);
+       ASSERT(pApplication != nullptr);
 
        // Check whether a handle was retrieved.
-       if ( pApplication != NULL )
+       if ( pApplication != nullptr )
        {
                // Create the registry key for this application.
                CString strKey = _T("Software\\");
@@ -567,10 +567,10 @@ BOOL CMessageBoxDialog::OnInitDialog ( )
                                // Try to retrieve a handle for the button.
                 CWnd* pButtonWnd = GetDlgItem(iter->nID);
 
-                               ASSERT(pButtonWnd);
+                               ASSERT(pButtonWnd != nullptr);
 
                                // Check whether the handle was retrieved.
-                               if ( pButtonWnd != NULL )
+                               if ( pButtonWnd != nullptr )
                                {
                                        // Disable the button.
                                        pButtonWnd->EnableWindow(FALSE);
@@ -750,10 +750,10 @@ void CMessageBoxDialog::OnTimer ( UINT_PTR nIDEvent )
                                        // Try to retrieve a handle to access the button.
                                        CWnd* pButtonWnd = GetDlgItem(iter->nID);
 
-                                       ASSERT(pButtonWnd);
+                                       ASSERT(pButtonWnd != nullptr);
 
                                        // Check whether a handle was retrieved.
-                                       if ( pButtonWnd != NULL )
+                                       if ( pButtonWnd != nullptr )
                                        {
                                                // Enable the button again.
                                                pButtonWnd->EnableWindow(TRUE);
@@ -1536,10 +1536,10 @@ void CMessageBoxDialog::DefineLayout ( )
                // Try to determine the control element for the checkbox.
                CWnd* pCheckboxWnd = GetDlgItem(IDCHECKBOX);
 
-               ASSERT(pCheckboxWnd);
+               ASSERT(pCheckboxWnd != nullptr);
 
                // Check whether the control was retrieved.
-               if ( pCheckboxWnd != NULL )
+               if ( pCheckboxWnd != nullptr )
                {
                        // Move the checkbox window.
                        pCheckboxWnd->MoveWindow(nXPosition, nYPosition, m_sCheckbox.cx,
@@ -1582,10 +1582,10 @@ void CMessageBoxDialog::DefineLayout ( )
                // Try to retrieve the handle to access the button.
                CWnd* pButton = GetDlgItem(iter->nID);
 
-               ASSERT(pButton);
+               ASSERT(pButton != nullptr);
 
                // Check whether the handle was retrieved successfully.
-               if ( pButton != NULL )
+               if ( pButton != nullptr )
                {
                        // Move the button.
                        pButton->MoveWindow(nXButtonPosition, nYButtonPosition, 
index 1776d7c..c6dcfb1 100644 (file)
@@ -94,7 +94,7 @@ bool CPicture::Load(IStream* pstm)
        Free();
        HRESULT hr = OleLoadPicture(pstm, 0, FALSE,
                IID_IPicture, (void**)&m_spIPicture);
-       ASSERT(SUCCEEDED(hr) && m_spIPicture);  
+       ASSERT(SUCCEEDED(hr) && m_spIPicture != nullptr);       
        return true;
 }
 
@@ -103,7 +103,7 @@ bool CPicture::Load(IStream* pstm)
 //
 bool CPicture::Render(CDC* pDC, CRect rc, LPCRECT prcMFBounds) const
 {
-       ASSERT(pDC);
+       ASSERT(pDC != nullptr);
 
        if (rc.IsRectNull()) {
                CSize sz = GetImageSize(pDC);
index f50f681..f04f037 100644 (file)
@@ -207,9 +207,9 @@ void CPreferencesDlg::OnSelchangedPages(NMHDR* pNMHDR, LRESULT* pResult)
                htiSel = m_tcPages.GetChildItem(htiSel);
 
        CPropertyPage* pPage = (CPropertyPage*)m_tcPages.GetItemData(htiSel);
-       ASSERT (pPage);
+       ASSERT (pPage != nullptr);
 
-       if (pPage)
+       if (pPage != nullptr)
        {
                m_pphost.SetActivePage(pPage, FALSE);
 
index 375ada4..a45d35f 100644 (file)
@@ -154,9 +154,9 @@ bool CPropertyPageHost::SetActivePage(int nIndex, bool bAndFocus /*= true*/)
        if (m_nSelIndex != -1)
        {
                CPropertyPage* pPage1 = GetActivePage();
-               ASSERT (pPage1);
+               ASSERT (pPage1 != nullptr);
 
-               if (pPage1)
+               if (pPage1 != nullptr)
                {
                        pPage1->ShowWindow(SW_HIDE);
                        pPage1->OnKillActive();
@@ -289,9 +289,9 @@ void CPropertyPageHost::OnSize(UINT nType, int cx, int cy)
        if (m_nSelIndex != -1)
        {
                CPropertyPage* pPage = GetActivePage();
-               ASSERT (pPage);
+               ASSERT (pPage != nullptr);
 
-               if (pPage)
+               if (pPage != nullptr)
                        pPage->MoveWindow(0, 0, cx, cy, TRUE);
        }
 }
index e751dd4..e0b257d 100644 (file)
@@ -82,7 +82,7 @@ void CSplitterWndEx::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
                return;
 
        // enhance with proportional horizontal scroll synchronization
-       ASSERT(pScrollBar != NULL);
+       ASSERT(pScrollBar != nullptr);
        int curCol = ::GetDlgCtrlID(pScrollBar->m_hWnd) - AFX_IDW_HSCROLL_FIRST;
        ASSERT(curCol >= 0 && curCol < m_nMaxCols);
 
@@ -133,7 +133,7 @@ void CSplitterWndEx::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
        CSplitterWnd::OnVScroll(nSBCode, nPos, pScrollBar);
 
        // enhance with proportional vertical scroll synchronization
-       ASSERT(pScrollBar != NULL);
+       ASSERT(pScrollBar != nullptr);
        int curRow = ::GetDlgCtrlID(pScrollBar->m_hWnd) - AFX_IDW_VSCROLL_FIRST;
        ASSERT(curRow >= 0 && curRow < m_nMaxRows);
 
index 1233b04..3503873 100644 (file)
@@ -410,7 +410,7 @@ void CSuperComboBox::SetAutoComplete(INT nSource)
 
                        // ComboBox's edit control is alway 1001.
                        CWnd *pWnd = m_bComboBoxEx ? this->GetEditCtrl() : GetDlgItem(1001);
-                       ASSERT(NULL != pWnd);
+                       ASSERT(pWnd != nullptr);
                        SHAutoComplete(pWnd->m_hWnd, SHACF_FILESYSTEM);
                        break;
                }
index 255c401..45a5406 100644 (file)
@@ -34,17 +34,17 @@ private:
        bool            m_bMemDC;               // `true` if CDC really is a Memory DC.
 public:
        
-       CMyMemDC(CDC* pDC, const CRect* pRect = NULL) : CDC()
+       CMyMemDC(CDC* pDC, const CRect* pRect = nullptr) : CDC()
        {
-               ASSERT(pDC != NULL); 
+               ASSERT(pDC != nullptr); 
 
                // Some initialization
                m_pDC = pDC;
-               m_oldBitmap = NULL;
+               m_oldBitmap = nullptr;
                m_bMemDC = !pDC->IsPrinting();
 
                // Get the rectangle to draw
-               if (pRect == NULL) {
+               if (pRect == nullptr) {
                        pDC->GetClipBox(&m_rect);
                } else {
                        m_rect = *pRect;
index 38e5810..a38368e 100644 (file)
@@ -351,10 +351,10 @@ void CSizingControlBar::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
 //
 void CSizingControlBar::OnLButtonDown(UINT nFlags, CPoint point)
 {
-    if (m_pDockBar != NULL)
+    if (m_pDockBar != nullptr)
     {
         // start the drag
-        ASSERT(m_pDockContext != NULL);
+        ASSERT(m_pDockContext != nullptr);
         ClientToScreen(&point);
         m_pDockContext->StartDrag(point);
     }
@@ -364,10 +364,10 @@ void CSizingControlBar::OnLButtonDown(UINT nFlags, CPoint point)
 
 void CSizingControlBar::OnLButtonDblClk(UINT nFlags, CPoint point)
 {
-    if (m_pDockBar != NULL)
+    if (m_pDockBar != nullptr)
     {
         // toggle docking
-        ASSERT(m_pDockContext != NULL);
+        ASSERT(m_pDockContext != nullptr);
         m_pDockContext->ToggleDocking();
     }
     else
@@ -592,10 +592,10 @@ void CSizingControlBar::OnSize(UINT nType, int cx, int cy)
     {
         // automatic child resizing - only one child is allowed
         CWnd* pWnd = GetWindow(GW_CHILD);
-        if (pWnd != NULL)
+        if (pWnd != nullptr)
         {
             pWnd->MoveWindow(0, 0, cx, cy);
-            ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL);
+            ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == nullptr);
         }
     }
 }
@@ -840,9 +840,9 @@ bool CSizingControlBar::GetEdgeRect(CRect rcWnd, UINT nHitTest,
         rcEdge.DeflateRect(bHorz ? 0 : m_cxEdge, 0);
         break;
     default:
-        ASSERT(FALSE); // invalid hit test code
+        ASSERT(false); // invalid hit test code
     }
-    return TRUE;
+    return true;
 }
 
 UINT CSizingControlBar::GetEdgeHTCode(int nEdge)
@@ -851,7 +851,7 @@ UINT CSizingControlBar::GetEdgeHTCode(int nEdge)
     if (nEdge == 1) return HTTOP;
     if (nEdge == 2) return HTRIGHT;
     if (nEdge == 3) return HTBOTTOM;
-    ASSERT(FALSE); // invalid edge code
+    ASSERT(false); // invalid edge code
     return HTNOWHERE;
 }
 
@@ -1144,7 +1144,7 @@ void CSizingControlBar::SaveState(LPCTSTR lpszProfileName)
     // place your SaveState or GlobalSaveState call in
     // CMainFrame's OnClose() or DestroyWindow(), not in OnDestroy()
     ASSERT_VALID(this);
-    ASSERT(GetSafeHwnd());
+    ASSERT(GetSafeHwnd() != nullptr);
 
     CWinApp* pApp = AfxGetApp();
 
@@ -1166,11 +1166,11 @@ void CSizingControlBar::GlobalLoadState(CFrameWnd* pFrame,
                                         LPCTSTR lpszProfileName)
 {
     POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
-    while (pos != NULL)
+    while (pos != nullptr)
     {
         CSizingControlBar* pBar = 
             static_cast<CSizingControlBar*>(pFrame->m_listControlBars.GetNext(pos));
-        ASSERT(pBar != NULL);
+        ASSERT(pBar != nullptr);
         if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
             pBar->LoadState(lpszProfileName);
     }
@@ -1180,11 +1180,11 @@ void CSizingControlBar::GlobalSaveState(CFrameWnd* pFrame,
                                         LPCTSTR lpszProfileName)
 {
     POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
-    while (pos != NULL)
+    while (pos != nullptr)
     {
         CSizingControlBar* pBar =
             static_cast<CSizingControlBar*>(pFrame->m_listControlBars.GetNext(pos));
-        ASSERT(pBar != NULL);
+        ASSERT(pBar != nullptr);
         if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
             pBar->SaveState(lpszProfileName);
     }
index 3b28de0..170bce0 100644 (file)
@@ -501,7 +501,7 @@ bool maketstring(String & str, const char* lpd, size_t len, int codepage, bool *
                        // good idea to ASSERT that the assumption holds.
                        if (wbuff[n-1] == 0 && lpd[len-1] != 0)
                        {
-                               //assert(FALSE);
+                               //assert(false);
                                *lossy = true;
                                --n;
                        }
@@ -530,7 +530,7 @@ bool maketstring(String & str, const char* lpd, size_t len, int codepage, bool *
                                        */
                                        if (wbuff[n-1] == 0 && lpd[len-1] != 0)
                                        {
-                                               //assert(FALSE);
+                                               //assert(false);
                                                *lossy = true;
                                                --n;
                                        }
index b4b1a57..791e6af 100644 (file)
@@ -281,7 +281,7 @@ bool DiffUtils::RegExpFilter(int StartPos, int EndPos, int FileNo) const
        bool linesMatch = true; // set to false when non-matching line is found.
        int line = StartPos;
 
-       while (line <= EndPos && linesMatch == true)
+       while (line <= EndPos && linesMatch)
        {
                size_t len = files[FileNo].linbuf[line + 1] - files[FileNo].linbuf[line];
                const char *string = files[FileNo].linbuf[line];
index 24e3c46..dbc798e 100644 (file)
@@ -37,5 +37,5 @@ void DiffFileInfo::ClearPartial()
  */
 bool DiffFileInfo::IsEditableEncoding() const
 {
-       return encoding.m_bom == false;
+       return !encoding.m_bom;
 }
index 44150c7..7e272db 100644 (file)
@@ -606,7 +606,7 @@ int CDiffTextBuffer::SaveToFile (const String& pszFileName,
        {
                // If we are saving user files
                // we need an unpacker/packer, at least a "do nothing" one
-               ASSERT(infoUnpacker != NULL);
+               ASSERT(infoUnpacker != nullptr);
                // repack the file here, overwrite the temporary file we did save in
                String csTempFileName = sIntermediateFilename;
                infoUnpacker->subcode = m_unpackerSubcode;
index c875234..63f5879 100644 (file)
@@ -113,7 +113,7 @@ unsigned CDiffThread::CompareDirectories()
 
        m_pDiffParm->context->m_pCompareStats->SetCompareState(CompareStats::STATE_START);
 
-       if (m_bOnlyRequested == false)
+       if (!m_bOnlyRequested)
                m_threads[0].start(DiffThreadCollect, m_pDiffParm.get());
        else
        {
@@ -158,7 +158,7 @@ static void DiffThreadCollect(void *pParam)
        PathContext paths;
        DiffFuncStruct *myStruct = static_cast<DiffFuncStruct *>(pParam);
 
-       assert(myStruct->bOnlyRequested == false);
+       assert(!myStruct->bOnlyRequested);
 
        // Stash abortable interface into context
        myStruct->context->SetAbortable(myStruct->m_pAbortgate);
index 808ed40..dd01775 100644 (file)
@@ -727,7 +727,7 @@ bool CDiffWrapper::RunFileDiff()
 
                        // We use the same plugin for both files, so it must be defined before
                        // second file
-                       assert(m_infoPrediffer->bToBeScanned == false);
+                       assert(!m_infoPrediffer->bToBeScanned);
                }
        }
 
@@ -1143,7 +1143,7 @@ bool CDiffWrapper::RegExpFilter(int StartPos, int EndPos, int FileNo) const
        bool linesMatch = true; // set to false when non-matching line is found.
        int line = StartPos;
 
-       while (line <= EndPos && linesMatch == true)
+       while (line <= EndPos && linesMatch)
        {
                size_t len = files[FileNo].linbuf[line + 1] - files[FileNo].linbuf[line];
                const char *string = files[FileNo].linbuf[line];
index 8152c75..74561b4 100644 (file)
@@ -705,7 +705,7 @@ std::pair<int, int> CountPredifferYesNo(const InputIterator& begin, const InputI
                        PackingInfo * unpacker;
                        PrediffingInfo * prediffer;
                        const_cast<CDiffContext&>(ctxt).FetchPluginInfos(filteredFilenames, &unpacker, &prediffer);
-                       if (prediffer->bToBeScanned == 1 || prediffer->pluginName.empty() == false)
+                       if (prediffer->bToBeScanned == 1 || !prediffer->pluginName.empty())
                                nPredifferYes ++;
                        else
                                nPredifferNo ++;
index 8d75260..c8f2fa4 100644 (file)
@@ -194,7 +194,7 @@ void CDirColsDlg::MoveSelectedItems(bool bUp)
  */
 void CDirColsDlg::OnUp()
 {
-       MoveSelectedItems(TRUE);
+       MoveSelectedItems(true);
 }
 
 /**
@@ -202,7 +202,7 @@ void CDirColsDlg::OnUp()
  */
 void CDirColsDlg::OnDown() 
 {
-       MoveSelectedItems(FALSE);
+       MoveSelectedItems(false);
 }
 
 /**
index 7707f32..101a6fc 100644 (file)
@@ -186,7 +186,7 @@ void CDirDoc::InitCompare(const PathContext & paths, bool bRecursive, CTempPathC
  */
 void CDirDoc::LoadLineFilterList()
 {
-       ASSERT(m_pCtxt);
+       ASSERT(m_pCtxt != nullptr);
        
        bool bFilters = GetOptionsMgr()->GetBool(OPT_LINEFILTER_ENABLED);
        String filters = theApp.m_pLineFilters->GetAsString();
@@ -379,7 +379,7 @@ void CDirDoc::SetDirView(CDirView * newView)
  */
 void CDirDoc::AddMergeDoc(IMergeDoc * pMergeDoc)
 {
-       ASSERT(pMergeDoc);
+       ASSERT(pMergeDoc != nullptr);
        m_MergeDocs.AddTail(pMergeDoc);
 }
 
@@ -388,11 +388,11 @@ void CDirDoc::AddMergeDoc(IMergeDoc * pMergeDoc)
  */
 void CDirDoc::MergeDocClosing(IMergeDoc * pMergeDoc)
 {
-       ASSERT(pMergeDoc);
+       ASSERT(pMergeDoc != nullptr);
        if (POSITION pos = m_MergeDocs.CPtrList::Find(pMergeDoc))
                m_MergeDocs.RemoveAt(pos);
        else
-               ASSERT(FALSE);
+               ASSERT(false);
 
        // If dir compare is empty (no compare results) and we are not closing
        // because of reuse close also dir compare
@@ -524,7 +524,7 @@ const bool *CDirDoc::GetReadOnly(void) const
 void CDirDoc::UpdateHeaderPath(int nIndex)
 {
        CDirFrame *pf = m_pDirView->GetParentFrame();
-       ASSERT(pf);
+       ASSERT(pf != nullptr);
        String sText;
 
        if (!m_strDesc[nIndex].empty())
index ece89c2..4e55ce3 100644 (file)
@@ -674,7 +674,7 @@ void CDirView::ListContextMenu(CPoint point, int /*i*/)
 
        // 1st submenu of IDR_POPUP_DIRVIEW is for item popup
        BCMenu *pPopup = static_cast<BCMenu*>(menu.GetSubMenu(0));
-       ASSERT(pPopup != NULL);
+       ASSERT(pPopup != nullptr);
 
        if (pDoc->m_nDirs < 3)
        {
@@ -721,7 +721,7 @@ void CDirView::ListContextMenu(CPoint point, int /*i*/)
        pPopup->AppendMenu(MF_POPUP, static_cast<int>(reinterpret_cast<uintptr_t>(menuPluginsHolder.m_hMenu)), s.c_str());
 
        CFrameWnd *pFrame = GetTopLevelFrame();
-       ASSERT(pFrame != NULL);
+       ASSERT(pFrame != nullptr);
        pFrame->m_bAutoMenuEnable = FALSE;
        // invoke context menu
        // this will invoke all the OnUpdate methods to enable/disable the individual items
@@ -742,7 +742,7 @@ void CDirView::HeaderContextMenu(CPoint point, int /*i*/)
        theApp.TranslateMenu(menu.m_hMenu);
        // 2nd submenu of IDR_POPUP_DIRVIEW is for header popup
        BCMenu* pPopup = static_cast<BCMenu *>(menu.GetSubMenu(1));
-       ASSERT(pPopup != NULL);
+       ASSERT(pPopup != nullptr);
 
        // invoke context menu
        // this will invoke all the OnUpdate methods to enable/disable the individual items
@@ -1015,7 +1015,7 @@ void CDirView::UpdateAfterFileScript(FileActionScript & actionList)
        
        // Make sure selection is at sensible place if all selected items
        // were removed.
-       if (bItemsRemoved == true)
+       if (bItemsRemoved)
        {
                UINT selected = GetSelectedCount();
                if (selected == 0)
@@ -1476,7 +1476,7 @@ void CDirView::OpenSelectionHex()
 
        if (pos1 == SPECIAL_ITEM_POS)
        {
-               ASSERT(FALSE);
+               ASSERT(false);
                return;
        }
 
@@ -2014,7 +2014,7 @@ void CDirView::OnCurdiff()
        if (i == -1)
                i = count;
 
-       while (i < count && found == false)
+       while (i < count && !found)
        {
                UINT selected = m_pList->GetItemState(i, LVIS_SELECTED);
                UINT focused = m_pList->GetItemState(i, LVIS_FOCUSED);
@@ -2110,7 +2110,7 @@ BOOL CDirView::PreTranslateMessage(MSG* pMsg)
        // Handle special shortcuts here
        if (pMsg->message == WM_KEYDOWN)
        {
-               if (false == IsLabelEdit())
+               if (!IsLabelEdit())
                {
                        // Check if we got 'ESC pressed' -message
                        if (pMsg->wParam == VK_ESCAPE)
@@ -2194,7 +2194,7 @@ BOOL CDirView::PreTranslateMessage(MSG* pMsg)
                        // ESC doesn't close window when user is renaming an item.
                        if (pMsg->wParam == VK_ESCAPE)
                        {
-                               m_bUserCancelEdit = TRUE;
+                               m_bUserCancelEdit = true;
 
                                // The edit control send LVN_ENDLABELEDIT when it loses focus,
                                // so we use it to cancel the rename action.
@@ -2780,7 +2780,7 @@ void CDirView::ShowShellContextMenu(SIDE_TYPE stype)
                GetCursorPos(&point);
                HWND hWnd = GetSafeHwnd();
                CFrameWnd *pFrame = GetTopLevelFrame();
-               ASSERT(pFrame != NULL);
+               ASSERT(pFrame != nullptr);
                BOOL bAutoMenuEnableOld = pFrame->m_bAutoMenuEnable;
                pFrame->m_bAutoMenuEnable = FALSE;
                BOOL nCmd = TrackPopupMenu(pContextMenu->GetHMENU(), TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, point.x, point.y, 0, hWnd, NULL);
@@ -2804,7 +2804,7 @@ void CDirView::OnSelectAll()
 {
        // While the user is renaming an item, select all the edited text.
        CEdit *pEdit = m_pList->GetEditControl();
-       if (NULL != pEdit)
+       if (pEdit != nullptr)
        {
                pEdit->SetSel(pEdit->GetWindowTextLength());
        }
@@ -3051,10 +3051,10 @@ afx_msg void CDirView::OnBeginLabelEdit(NMHDR* pNMHDR, LRESULT* pResult)
        *pResult = (SelBegin() == SelEnd());
 
        // If label edit is allowed.
-       if (FALSE == *pResult)
+       if (*pResult == FALSE)
        {
                const NMLVDISPINFO *pdi = (NMLVDISPINFO*)pNMHDR;
-               ASSERT(pdi != NULL);
+               ASSERT(pdi != nullptr);
 
                // Locate the edit box on the right column in case the user changed the
                // column order.
@@ -3074,10 +3074,10 @@ afx_msg void CDirView::OnBeginLabelEdit(NMHDR* pNMHDR, LRESULT* pResult)
 
                // Set the edit control with the updated text.
                CEdit *pEdit = m_pList->GetEditControl();
-               ASSERT(NULL != pEdit);
+               ASSERT(pEdit != nullptr);
                pEdit->SetWindowText(sText);
 
-               m_bUserCancelEdit = FALSE;
+               m_bUserCancelEdit = false;
        }
 }
 
@@ -3094,10 +3094,10 @@ afx_msg void CDirView::OnEndLabelEdit(NMHDR* pNMHDR, LRESULT* pResult)
        // "file.txt|FILE.txt"). The edit text was changed to "file.txt" and
        // if the user accept it as the new file name, pszText is NULL.
 
-       if (TRUE != m_bUserCancelEdit)
+       if (!m_bUserCancelEdit)
        {
                CEdit *pEdit = m_pList->GetEditControl();
-               ASSERT(NULL != pEdit);
+               ASSERT(pEdit != nullptr);
 
                CString sText;
                pEdit->GetWindowText(sText);
@@ -3526,7 +3526,7 @@ void CDirView::OnHelp()
  */
 bool CDirView::IsLabelEdit() const
 {
-       return (NULL != m_pList->GetEditControl());
+       return (m_pList->GetEditControl() != nullptr);
 }
 
 /**
@@ -3535,7 +3535,7 @@ bool CDirView::IsLabelEdit() const
 void CDirView::OnEditCopy()
 {
        CEdit *pEdit = m_pList->GetEditControl();
-       if (NULL != pEdit)
+       if (pEdit != nullptr)
        {
                pEdit->Copy();
        }
@@ -3547,7 +3547,7 @@ void CDirView::OnEditCopy()
 void CDirView::OnEditCut()
 {
        CEdit *pEdit = m_pList->GetEditControl();
-       if (NULL != pEdit)
+       if (pEdit != nullptr)
        {
                pEdit->Cut();
        }
@@ -3559,7 +3559,7 @@ void CDirView::OnEditCut()
 void CDirView::OnEditPaste()
 {
        CEdit *pEdit = m_pList->GetEditControl();
-       if (NULL != pEdit)
+       if (pEdit != nullptr)
        {
                pEdit->Paste();
        }
@@ -3571,7 +3571,7 @@ void CDirView::OnEditPaste()
 void CDirView::OnEditUndo()
 {
        CEdit *pEdit = m_pList->GetEditControl();
-       if (NULL != pEdit)
+       if (pEdit != nullptr)
        {
                pEdit->Undo();
        }
index 1dcffab..29b7ff9 100644 (file)
@@ -313,7 +313,7 @@ void FileFiltersDlg::OnInfoTip(NMHDR * pNMHDR, LRESULT * pResult)
 {
        LVHITTESTINFO lvhti = {0};
        NMLVGETINFOTIP * pInfoTip = reinterpret_cast<NMLVGETINFOTIP*>(pNMHDR);
-       ASSERT(pInfoTip);
+       ASSERT(pInfoTip != nullptr);
 
        // Get subitem under mouse cursor
        lvhti.pt = m_ptLastMousePos;
index 6ee9d4f..627705d 100644 (file)
@@ -89,7 +89,7 @@ bool Packing(String & filepath, PackingInfo handler)
        }
 
        // if this packer does not work, that is an error
-       if (bHandled == false)
+       if (!bHandled)
                return false;
 
        // if the buffer changed, write it before leaving
@@ -149,7 +149,7 @@ bool Unpacking(String & filepath, const PackingInfo * handler, int * handlerSubc
        }
 
        // if this unpacker does not work, that is an error
-       if (bHandled == false)
+       if (!bHandled)
                return false;
 
        // valid the subcode
@@ -223,7 +223,7 @@ bool Unpacking(String & filepath, const String& filteredText, PackingInfo * hand
                }
        }
 
-       if (bHandled == false)
+       if (!bHandled)
        {
                // we didn't find any unpacker, just hope it is normal Ansi/Unicode
                handler->pluginName = _T("");
@@ -305,7 +305,7 @@ bool Prediffing(String & filepath, PrediffingInfo handler, bool bMayOverwrite)
        }
 
        // if this unpacker does not work, that is an error
-       if (bHandled == false)
+       if (!bHandled)
                return false;
 
        // if the buffer changed, write it before leaving
@@ -364,7 +364,7 @@ bool Prediffing(String & filepath, const String& filteredText, PrediffingInfo *
                }
        }
 
-       if (bHandled == false)
+       if (!bHandled)
        {
                // we didn't find any prediffer, that is OK anyway
                handler->pluginName = _T("");
index 9fc867a..4ff015a 100644 (file)
@@ -250,7 +250,7 @@ void CFilepathEdit::OnContextMenu(CWnd*, CPoint point)
                theApp.TranslateMenu(menu.m_hMenu);
 
                BCMenu* pPopup = static_cast<BCMenu *>(menu.GetSubMenu(0));
-               ASSERT(pPopup != NULL);
+               ASSERT(pPopup != nullptr);
 
                DWORD sel = GetSel();
                if (HIWORD(sel) == LOWORD(sel))
index da4f66a..7e42f0e 100644 (file)
@@ -85,7 +85,7 @@ bool FilterList::Match(const std::string& string, int codepage/*=CP_UTF8*/)
                                        string.length(), ucr::UTF8, ucr::CP_UTF_8, &buf);
 
        unsigned i = 0;
-       while (i < count && retval == false)
+       while (i < count && !retval)
        {
                const filter_item_ptr& item = m_list[i];
                int result = 0;
index 69b5153..acd2009 100644 (file)
@@ -117,7 +117,7 @@ int FolderCmp::prepAndCompareFiles(CDiffContext * pCtxt, DIFFITEM &di)
                                        goto exitPrepAndCompare;
 
                                // we use the same plugins for both files, so they must be defined before second file
-                               assert(infoUnpacker->bToBeScanned == false);
+                               assert(!infoUnpacker->bToBeScanned);
                        }
 
                        // As we keep handles open on unpacked files, Transform() may not delete them.
index f14843d..f7139a3 100644 (file)
@@ -104,7 +104,7 @@ bool CGhostTextBuffer::InternalDeleteGhostLine (CCrystalTextView * pSource,
 
        for (int i = nLine ; i < nLine + nCount; i++)
        {
-               ASSERT (GetLineFlags(i) & LF_GHOST);
+               ASSERT ( (GetLineFlags(i) & LF_GHOST) != 0 );
                m_aLines[i].Clear();
        }
 
index 241298f..12a0b8e 100644 (file)
@@ -435,7 +435,7 @@ void CHexMergeDoc::OnUpdateStatusNum(CCmdUI* pCmdUI)
  */
 void CHexMergeDoc::SetDirDoc(CDirDoc * pDirDoc)
 {
-       ASSERT(pDirDoc && !m_pDirDoc);
+       ASSERT(pDirDoc != nullptr && m_pDirDoc == nullptr);
        m_pDirDoc = pDirDoc;
 }
 
@@ -503,7 +503,7 @@ HRESULT CHexMergeDoc::LoadOneFile(int index, LPCTSTR filename, bool readOnly, co
 bool CHexMergeDoc::OpenDocs(int nFiles, const FileLocation fileloc[], const bool bRO[], const String strDesc[], int nPane)
 {
        CHexMergeFrame *pf = GetParentFrame();
-       ASSERT(pf);
+       ASSERT(pf != nullptr);
        bool bSucceeded = true;
        int nBuffer;
        for (nBuffer = 0; nBuffer < nFiles; nBuffer++)
@@ -556,7 +556,7 @@ void CHexMergeDoc::CheckFileChanged(void)
 void CHexMergeDoc::UpdateHeaderPath(int pane)
 {
        CHexMergeFrame *pf = GetParentFrame();
-       ASSERT(pf);
+       ASSERT(pf != nullptr);
        String sText;
 
        if (m_nBufferType[pane] == BUFFER_UNNAMED ||
@@ -663,7 +663,7 @@ void CHexMergeDoc::SetMergeViews(CHexMergeView *pView[])
 {
        for (int nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
        {
-               ASSERT(pView[nBuffer] && !m_pView[nBuffer]);
+               ASSERT(pView[nBuffer] != nullptr && m_pView[nBuffer] == nullptr);
                m_pView[nBuffer] = pView[nBuffer];
                m_pView[nBuffer]->m_nThisPane = nBuffer;
        }
index 7571e02..82c6a84 100644 (file)
@@ -46,7 +46,7 @@ static HRESULT NTAPI SE(BOOL f)
        if (f)
                return S_OK;
        HRESULT hr = (HRESULT)::GetLastError();
-       ASSERT(hr);
+       ASSERT(hr != 0);
        if (hr == 0)
                hr = E_UNEXPECTED;
        return hr;
@@ -113,7 +113,7 @@ CHexMergeView::CHexMergeView()
  */
 void CHexMergeView::OnDraw(CDC *)
 {
-       ASSERT(FALSE);
+       ASSERT(false);
 }
 
 /**
index 17ef488..37b382b 100644 (file)
@@ -296,7 +296,7 @@ void CImgMergeFrame::DoAutoMerge(int dstPane)
  */
 void CImgMergeFrame::SetDirDoc(CDirDoc * pDirDoc)
 {
-       ASSERT(pDirDoc && !m_pDirDoc);
+       ASSERT(pDirDoc != nullptr && m_pDirDoc == nullptr);
        m_pDirDoc = pDirDoc;
 }
 
index ae5b00a..1ad2697 100644 (file)
@@ -761,7 +761,7 @@ void CLocationView::OnContextMenu(CWnd* pWnd, CPoint point)
        theApp.TranslateMenu(menu.m_hMenu);
 
        BCMenu* pPopup = static_cast<BCMenu *>(menu.GetSubMenu(0));
-       ASSERT(pPopup != NULL);
+       ASSERT(pPopup != nullptr);
 
        CCmdUI cmdUI;
        cmdUI.m_pMenu = pPopup;
@@ -820,15 +820,15 @@ void CLocationView::OnContextMenu(CWnd* pWnd, CPoint point)
                break;
        case ID_DISPLAY_MOVED_NONE:
                SetConnectMovedBlocks(DISPLAY_MOVED_NONE);
-               pDoc->SetDetectMovedBlocks(FALSE);
+               pDoc->SetDetectMovedBlocks(false);
                break;
        case ID_DISPLAY_MOVED_ALL:
                SetConnectMovedBlocks(DISPLAY_MOVED_ALL);
-               pDoc->SetDetectMovedBlocks(TRUE);
+               pDoc->SetDetectMovedBlocks(true);
                break;
        case ID_DISPLAY_MOVED_FOLLOW_DIFF:
                SetConnectMovedBlocks(DISPLAY_MOVED_FOLLOW_DIFF);
-               pDoc->SetDetectMovedBlocks(TRUE);
+               pDoc->SetDetectMovedBlocks(true);
                break;
        }
 }
index bf91e1c..f9df628 100644 (file)
@@ -443,7 +443,7 @@ HMENU CMainFrame::NewMenu(int view, int ID)
 
        if (!m_pMenus[view]->LoadMenu(ID))
        {
-               ASSERT(FALSE);
+               ASSERT(false);
                return NULL;
        }
 
@@ -1611,7 +1611,7 @@ void CMainFrame::OnToolsFilters()
                else
                {
                        theApp.m_pGlobalFileFilter->SetFileFilterPath(path);
-                       theApp.m_pGlobalFileFilter->UseMask(FALSE);
+                       theApp.m_pGlobalFileFilter->UseMask(false);
                        String sFilter = theApp.m_pGlobalFileFilter->GetFilterNameOrMask();
                        GetOptionsMgr()->SaveOption(OPT_FILEFILTER_CURRENT, sFilter);
                }
@@ -1866,9 +1866,9 @@ void CMainFrame::OnUpdateWindowCloseAll(CCmdUI* pCmdUI)
 CMainFrame * GetMainFrame()
 {
        CWnd * mainwnd = AfxGetMainWnd();
-       ASSERT(mainwnd);
+       ASSERT(mainwnd != nullptr);
        CMainFrame *pMainframe = dynamic_cast<CMainFrame*>(mainwnd);
-       ASSERT(pMainframe);
+       ASSERT(pMainframe != nullptr);
        return pMainframe;
 }
 
@@ -2314,7 +2314,7 @@ void CMainFrame::OnDiffOptionsDropDown(NMHDR* pNMHDR, LRESULT* pResult)
        VERIFY(menu.LoadMenu(IDR_POPUP_DIFF_OPTIONS));
        theApp.TranslateMenu(menu.m_hMenu);
        CMenu* pPopup = menu.GetSubMenu(0);
-       if (NULL != pPopup)
+       if (pPopup != nullptr)
        {
                pPopup->TrackPopupMenu(TPM_RIGHTALIGN | TPM_RIGHTBUTTON, 
                        pToolBar->rcButton.right, pToolBar->rcButton.bottom, this);
@@ -2513,17 +2513,17 @@ void CMainFrame::UpdateDocTitle()
 {
        CDocManager* pDocManager = AfxGetApp()->m_pDocManager;
        POSITION posTemplate = pDocManager->GetFirstDocTemplatePosition();
-       ASSERT(posTemplate != NULL);
+       ASSERT(posTemplate != nullptr);
 
-       while (posTemplate != NULL)
+       while (posTemplate != nullptr)
        {
                CDocTemplate* pTemplate = pDocManager->GetNextDocTemplate(posTemplate);
 
-               ASSERT(pTemplate != NULL);
+               ASSERT(pTemplate != nullptr);
 
                for (auto pDoc : GetDocList(static_cast<CMultiDocTemplate *>(pTemplate)))
                {
-                       static_cast<CDocument *>(const_cast<void *>(pDoc))->SetTitle(NULL);
+                       static_cast<CDocument *>(const_cast<void *>(pDoc))->SetTitle(nullptr);
                        ((CFrameWnd*)AfxGetApp()->m_pMainWnd)->OnUpdateFrameTitle(TRUE);
                }
        }
index 7dc05fb..b4feb45 100644 (file)
@@ -1618,7 +1618,7 @@ void CMergeDoc::FlushAndRescan(bool bForced /* =false */)
        });
 
        // Refresh display
-       UpdateAllViews(NULL);
+       UpdateAllViews(nullptr);
 
        // Show possible error after updating screen
        if (nRescanResult != RESCAN_SUPPRESSED)
@@ -2323,7 +2323,7 @@ void CMergeDoc::RemoveMergeViews(int nGroup)
  */
 void CMergeDoc::SetDirDoc(CDirDoc * pDirDoc)
 {
-       ASSERT(pDirDoc && !m_pDirDoc);
+       ASSERT(pDirDoc != nullptr && m_pDirDoc == nullptr);
        m_pDirDoc = pDirDoc;
 }
 
@@ -2814,7 +2814,7 @@ void CMergeDoc::RefreshOptions()
 void CMergeDoc::UpdateHeaderPath(int pane)
 {
        CChildFrame *pf = GetParentFrame();
-       ASSERT(pf);
+       ASSERT(pf != nullptr);
        String sText;
        bool bChanges = false;
 
@@ -2826,7 +2826,7 @@ void CMergeDoc::UpdateHeaderPath(int pane)
        else
        {
                sText = m_filePaths[pane];
-               if (m_pDirDoc)
+               if (m_pDirDoc != nullptr)
                {
                        m_pDirDoc->ApplyDisplayRoot(pane, sText);
                }
@@ -2847,7 +2847,7 @@ void CMergeDoc::UpdateHeaderPath(int pane)
 void CMergeDoc::UpdateHeaderActivity(int pane, bool bActivate)
 {
        CChildFrame *pf = GetParentFrame();
-       ASSERT(pf);
+       ASSERT(pf != nullptr);
        pf->GetHeaderInterface()->SetActive(pane, bActivate);
 }
 
@@ -2978,7 +2978,7 @@ void CMergeDoc::SwapFiles()
        GetParentFrame()->UpdateSplitter();
        ForEachView([](auto& pView) { pView->UpdateStatusbar(); });
 
-       UpdateAllViews(NULL);
+       UpdateAllViews(nullptr);
 }
 
 /**
index 9554c01..6b87a6d 100644 (file)
@@ -708,7 +708,7 @@ void CMergeEditView::OnUpdateSibling (CCrystalTextView * pUpdateSource, bool bHo
 {
        if (pUpdateSource != this)
        {
-               ASSERT (pUpdateSource != NULL);
+               ASSERT (pUpdateSource != nullptr);
                ASSERT_KINDOF (CCrystalTextView, pUpdateSource);
                CMergeEditView *pSrcView = static_cast<CMergeEditView*>(pUpdateSource);
                if (!bHorz)  // changed this so bHorz works right
@@ -2181,7 +2181,7 @@ void CMergeEditView::OnUpdateFileSaveRight(CCmdUI* pCmdUI)
 void CMergeEditView::OnRefresh()
 {
        CMergeDoc *pd = GetDocument();
-       ASSERT(pd);
+       ASSERT(pd != nullptr);
        pd->FlushAndRescan(true);
 }
 
@@ -2362,7 +2362,7 @@ void CMergeEditView::OnUpdateRightReadOnly(CCmdUI* pCmdUI)
 /// Store interface we use to display status line info
 void CMergeEditView::SetStatusInterface(IMergeEditStatus * piMergeEditStatus)
 {
-       ASSERT(!m_piMergeEditStatus);
+       ASSERT(m_piMergeEditStatus == nullptr);
        m_piMergeEditStatus = piMergeEditStatus;
 }
 
@@ -2531,7 +2531,7 @@ HMENU CMergeEditView::createPrediffersSubmenu(HMENU hMenu)
                DeleteMenu(hMenu, 0, MF_BYPOSITION);
 
        CMergeDoc *pd = GetDocument();
-       ASSERT(pd);
+       ASSERT(pd != nullptr);
 
        // title
        AppendMenu(hMenu, MF_STRING, ID_NO_PREDIFFER, _("No prediffer (normal)").c_str());
@@ -2643,7 +2643,7 @@ void CMergeEditView::OnContextMenu(CWnd* pWnd, CPoint point)
        theApp.TranslateMenu(menu.m_hMenu);
 
        BCMenu *pSub = static_cast<BCMenu *>(menu.GetSubMenu(0));
-       ASSERT(pSub != NULL);
+       ASSERT(pSub != nullptr);
 
        // Context menu opened using keyboard has no coordinates
        if (point.x == -1 && point.y == -1)
@@ -2697,7 +2697,7 @@ void CMergeEditView::OnConvertEolTo(UINT nID )
        if (m_pTextBuffer->applyEOLMode())
        {
                CMergeDoc *pd = GetDocument();
-               ASSERT(pd);
+               ASSERT(pd != nullptr);
                pd->UpdateHeaderPath(m_nThisPane);
                pd->FlushAndRescan(true);
        }
@@ -2929,7 +2929,7 @@ void CMergeEditView::OnUpdatePrediffer(CCmdUI* pCmdUI)
        pCmdUI->Enable(true);
 
        CMergeDoc *pd = GetDocument();
-       ASSERT(pd);
+       ASSERT(pd != nullptr);
        PrediffingInfo prediffer;
        pd->GetPrediffer(&prediffer);
 
@@ -2966,7 +2966,7 @@ void CMergeEditView::OnNoPrediffer()
 void CMergeEditView::OnPrediffer(UINT nID )
 {
        CMergeDoc *pd = GetDocument();
-       ASSERT(pd);
+       ASSERT(pd != nullptr);
 
        SetPredifferByMenu(nID);
        pd->FlushAndRescan(true);
@@ -2980,7 +2980,7 @@ void CMergeEditView::OnPrediffer(UINT nID )
 void CMergeEditView::SetPredifferByMenu(UINT nID )
 {
        CMergeDoc *pd = GetDocument();
-       ASSERT(pd);
+       ASSERT(pd != nullptr);
 
        if (nID == ID_NO_PREDIFFER)
        {
@@ -3248,7 +3248,7 @@ void CMergeEditView::OnUpdateEditCopyLinenumbers(CCmdUI* pCmdUI)
 void CMergeEditView::OnOpenFile()
 {
        CMergeDoc * pDoc = GetDocument();
-       ASSERT(pDoc != NULL);
+       ASSERT(pDoc != nullptr);
 
        String sFileName = pDoc->m_filePaths[m_nThisPane];
        if (sFileName.empty())
@@ -3268,7 +3268,7 @@ void CMergeEditView::OnOpenFile()
 void CMergeEditView::OnOpenFileWith()
 {
        CMergeDoc * pDoc = GetDocument();
-       ASSERT(pDoc != NULL);
+       ASSERT(pDoc != nullptr);
 
        String sFileName = pDoc->m_filePaths[m_nThisPane];
        if (sFileName.empty())
@@ -3289,7 +3289,7 @@ void CMergeEditView::OnOpenFileWith()
 void CMergeEditView::OnOpenFileWithEditor()
 {
        CMergeDoc * pDoc = GetDocument();
-       ASSERT(pDoc != NULL);
+       ASSERT(pDoc != nullptr);
 
        String sFileName = pDoc->m_filePaths[m_nThisPane];
        if (sFileName.empty())
@@ -3561,7 +3561,7 @@ int CMergeEditView::GetEmptySubLines( int nLineIndex )
 void CMergeEditView::InvalidateSubLineIndexCache( int nLineIndex )
 {
        CMergeDoc * pDoc = GetDocument();
-       ASSERT(pDoc != NULL);
+       ASSERT(pDoc != nullptr);
 
     // We have to invalidate sub line index cache on both panes.
        for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++) 
@@ -3761,21 +3761,21 @@ void CMergeEditView::OnUpdateViewChangeScheme(CCmdUI *pCmdUI)
 void CMergeEditView::OnChangeScheme(UINT nID)
 {
        CMergeDoc *pDoc = GetDocument();
-       ASSERT(pDoc != NULL);
+       ASSERT(pDoc != nullptr);
 
        for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++) 
        {
                CMergeEditView *pView = GetGroupView(nPane);
-               ASSERT(pView != NULL);
+               ASSERT(pView != nullptr);
 
-               if (pView != NULL)
+               if (pView != nullptr)
                {
                        pView->SetTextType(CCrystalTextView::TextType(nID - ID_COLORSCHEME_FIRST));
                        pView->SetDisableBSAtSOL(false);
                }
        }
 
-       pDoc->UpdateAllViews(NULL);
+       pDoc->UpdateAllViews(nullptr);
 }
 
 /**
@@ -3852,16 +3852,16 @@ void CMergeEditView::ZoomText(short amount)
        lf.lfHeight = -MulDiv(nPointSize, nLogPixelsY, 72);
 
        CMergeDoc *pDoc = GetDocument();
-       ASSERT(pDoc != NULL);
+       ASSERT(pDoc != nullptr);
 
-       if (pDoc != NULL )
+       if (pDoc != nullptr)
        {
                for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++) 
                {
                        CMergeEditView *pView = GetGroupView(nPane);
-                       ASSERT(pView != NULL);
+                       ASSERT(pView != nullptr);
                        
-                       if (pView != NULL)
+                       if (pView != nullptr)
                        {
                                pView->SetFont(lf);
                        }
index bca62c9..4f5131a 100644 (file)
@@ -32,7 +32,7 @@ COpenDoc::~COpenDoc()
 void COpenDoc::RefreshOptions()
 {
        m_bRecurse = GetOptionsMgr()->GetBool(OPT_CMP_INCLUDE_SUBDIRS);
-       UpdateAllViews(NULL);
+       UpdateAllViews(nullptr);
 }
 
 /**
index 41c4f53..93f3ffc 100644 (file)
@@ -115,9 +115,9 @@ END_MESSAGE_MAP()
 
 COpenView::COpenView()
        : CFormView(COpenView::IDD)
-       , m_pUpdateButtonStatusThread(NULL)
-       , m_bRecurse(FALSE)
-       , m_pDropHandler(NULL)
+       , m_pUpdateButtonStatusThread(nullptr)
+       , m_bRecurse(false)
+       , m_pDropHandler(nullptr)
        , m_dwFlags()
        , m_bAutoCompleteReady()
        , m_bReadOnly {false, false, false}
@@ -675,7 +675,7 @@ void COpenView::OnDropDownSaveProject(NMHDR *pNMHDR, LRESULT *pResult)
        VERIFY(menu.LoadMenu(IDR_POPUP_PROJECT));
        theApp.TranslateMenu(menu.m_hMenu);
        CMenu* pPopup = menu.GetSubMenu(0);
-       if (NULL != pPopup)
+       if (pPopup != nullptr)
        {
                pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, 
                        rcButton.left, rcButton.bottom, GetMainFrame());
index 0cfd021..6db2df1 100644 (file)
@@ -43,13 +43,13 @@ using std::swap;
  */
 CPatchDlg::CPatchDlg(CWnd* pParent /*=NULL*/)
        : CTrDialog(CPatchDlg::IDD, pParent)
-       , m_caseSensitive(FALSE)
-       , m_ignoreBlanks(0)
-       , m_ignoreEOLDifference(FALSE)
+       , m_caseSensitive(false)
+       , m_ignoreBlanks(false)
+       , m_ignoreEOLDifference(false)
        , m_whitespaceCompare(0)
-       , m_appendFile(FALSE)
-       , m_openToEditor(FALSE)
-       , m_includeCmdLine(FALSE)
+       , m_appendFile(false)
+       , m_openToEditor(false)
+       , m_includeCmdLine(false)
        , m_outputStyle(OUTPUT_NORMAL)
        , m_contextLines(0)
 {
@@ -463,12 +463,12 @@ void CPatchDlg::OnDefaultSettings()
 {
        m_outputStyle = (enum output_style) DIFF_OUTPUT_NORMAL;
        m_contextLines = 0;
-       m_caseSensitive = TRUE;
-       m_ignoreEOLDifference = FALSE;
-       m_ignoreBlanks = FALSE;
+       m_caseSensitive = true;
+       m_ignoreEOLDifference = false;
+       m_ignoreBlanks = false;
        m_whitespaceCompare = WHITESPACE_COMPARE_ALL;
-       m_openToEditor = FALSE;
-       m_includeCmdLine = FALSE;
+       m_openToEditor = false;
+       m_includeCmdLine = false;
 
        UpdateSettings();
 }
index 258d755..32a2e7b 100644 (file)
@@ -212,7 +212,7 @@ bool CPatchTool::ShowDialog(CPatchDlg *pDlgPatch)
                // patch file EOLs correctly
                diffOptions.bIgnoreEol = pDlgPatch->m_ignoreEOLDifference;
                
-               diffOptions.bIgnoreCase = pDlgPatch->m_caseSensitive == false;
+               diffOptions.bIgnoreCase = !pDlgPatch->m_caseSensitive;
                m_diffWrapper.SetOptions(&diffOptions);
        }
        else
index 85db51e..49e6ad9 100644 (file)
@@ -814,9 +814,9 @@ PluginInfo *CScriptsOfThread::GetAutomaticPluginByFilter(const wchar_t *transfor
        for (size_t step = 0 ; step < piFileScriptArray->size() ; step ++)
        {
                const PluginInfoPtr & plugin = piFileScriptArray->at(step);
-               if (plugin->m_bAutomatic == false || plugin->m_disabled)
+               if (!plugin->m_bAutomatic || plugin->m_disabled)
                        continue;
-               if (plugin->TestAgainstRegList(filteredText) == false)
+               if (!plugin->TestAgainstRegList(filteredText))
                        continue;
                return plugin.get();
        }
@@ -926,7 +926,7 @@ CAssureScriptsForThread::~CAssureScriptsForThread()
        CScriptsOfThread * scripts = CAllThreadsScripts::GetActiveSetNoAssert();
        if (scripts == NULL)
                return;
-       if (scripts->Unlock() == true)
+       if (scripts->Unlock())
        {
                CAllThreadsScripts::Remove(scripts);
                delete scripts;
index 3c2a7ea..5fd9277 100755 (executable)
@@ -388,9 +388,9 @@ int ProjectFile::GetSubfolders() const
  * @brief set subfolder.
  * @param [in] iSubfolder New value for subfolder inclusion.
  */
-void ProjectFile::SetSubfolders(int iSubfolder)
+void ProjectFile::SetSubfolders(bool bSubfolder)
 {
-       m_subfolders = iSubfolder ? 1 : 0;
+       m_subfolders = bSubfolder ? 1 : 0;
 }
 
 /** 
index 5813a6d..3c69161 100755 (executable)
@@ -59,7 +59,7 @@ public:
        void SetMiddle(const String& sMiddle, const bool * pReadOnly = NULL);
        void SetRight(const String& sRight, const bool * pReadOnly = NULL);
        void SetFilter(const String& sFilter);
-       void SetSubfolders(int iSubfolder);
+       void SetSubfolders(bool bSubfolder);
 
        void GetPaths(PathContext& files, bool & bSubFolders) const;
        void SetPaths(const PathContext& files, bool bSubFolders = false);
index 5da5410..faa69a7 100644 (file)
@@ -23,12 +23,12 @@ static const int Mega = 1024 * 1024;
 PropCompareFolder::PropCompareFolder(COptionsMgr *optionsMgr) 
  : OptionsPanel(optionsMgr, PropCompareFolder::IDD)
  , m_compareMethod(-1)
- , m_bStopAfterFirst(FALSE)
- , m_bIgnoreSmallTimeDiff(FALSE)
- , m_bIncludeUniqFolders(FALSE)
- , m_bIncludeSubdirs(FALSE)
- , m_bExpandSubdirs(FALSE)
- , m_bIgnoreReparsePoints(FALSE)
+ , m_bStopAfterFirst(false)
+ , m_bIgnoreSmallTimeDiff(false)
+ , m_bIncludeUniqFolders(false)
+ , m_bIncludeSubdirs(false)
+ , m_bExpandSubdirs(false)
+ , m_bIgnoreReparsePoints(false)
  , m_nQuickCompareLimit(4 * Mega)
  , m_nCompareThreads(-1)
 {
index 981c3e3..c2fd772 100644 (file)
@@ -64,7 +64,7 @@ BOOL PropGeneral::OnInitDialog()
        OptionsPanel::OnInitDialog();
 
        CComboBox *pWnd = (CComboBox*)GetDlgItem(IDC_AUTO_COMPLETE_SOURCE);
-       ASSERT(NULL != pWnd);
+       ASSERT(pWnd != nullptr);
 
        pWnd->AddString(_("Disabled").c_str());
        pWnd->AddString(_("From file system").c_str());
index 22fc9e0..5d19e12 100644 (file)
@@ -74,7 +74,7 @@ void PropTextColors::ReadOptions()
  */
 void PropTextColors::WriteOptions()
 {
-       GetOptionsMgr()->SaveOption(OPT_CLR_DEFAULT_TEXT_COLORING, m_bCustomColors == false);
+       GetOptionsMgr()->SaveOption(OPT_CLR_DEFAULT_TEXT_COLORING, !m_bCustomColors);
        // User can only change colors via BrowseColorAndSave,
        // which writes to m_pTempColors
        // so user's latest choices are in m_pTempColors
index fff48e5..1876852 100644 (file)
@@ -57,7 +57,7 @@ TEST(CodepageTest, UTF8)
        CFrameWnd *pFrame = GetMainFrame()->GetActiveFrame();\r
        CMergeDoc *pDoc = dynamic_cast<CMergeDoc *>(pFrame->GetActiveDocument());\r
        EXPECT_NE(nullptr, pDoc);\r
-       if (nullptr == pDoc)\r
+       if (pDoc == nullptr)\r
                return;\r
        EXPECT_EQ(ucr::UTF8, pDoc->m_ptBuf[0]->getEncoding().m_unicoding);\r
        EXPECT_TRUE(pDoc->m_ptBuf[0]->getEncoding().m_bom);\r
@@ -79,7 +79,7 @@ TEST(SyntaxHighlight, Verilog)
        CFrameWnd *pFrame = GetMainFrame()->GetActiveFrame();\r
        CMergeDoc *pDoc = dynamic_cast<CMergeDoc *>(pFrame->GetActiveDocument());\r
        EXPECT_NE(nullptr, pDoc);\r
-       if (nullptr == pDoc)\r
+       if (pDoc == nullptr)\r
                return;\r
 \r
        std::vector<CCrystalTextView::TEXTBLOCK> blocks;\r
@@ -123,7 +123,7 @@ TEST(FolderCompare, IgnoreEOL)
                CFrameWnd *pFrame = GetMainFrame()->GetActiveFrame();\r
                CDirDoc *pDoc = dynamic_cast<CDirDoc *>(pFrame->GetActiveDocument());\r
                EXPECT_NE(nullptr, pDoc);\r
-               if (nullptr == pDoc)\r
+               if (pDoc != nullptr)\r
                {\r
                        pFrame->PostMessage(WM_CLOSE);\r
                        continue;\r