OSDN Git Service

Various refactorings involving NULL, ASSERT, TRUE and FALSE (5)
authorGreyMerlin <greymerlin7@gmail.com>
Fri, 26 Oct 2018 18:52:16 +0000 (11:52 -0700)
committerGreyMerlin <greymerlin7@gmail.com>
Sun, 28 Oct 2018 15:00:29 +0000 (08:00 -0700)
More of the same...

18 files changed:
Externals/crystaledit/editlib/ccrystaltextview2.cpp
Src/Common/ColorButton.cpp
Src/Common/sizecbar.cpp
Src/DiffItem.cpp
Src/DiffWrapper.cpp
Src/DirDoc.cpp
Src/DirView.cpp
Src/EditorFilepathBar.cpp
Src/FileTransform.cpp
Src/FilepathEdit.cpp
Src/FolderCmp.cpp
Src/HexMergeDoc.cpp
Src/ImgMergeFrm.cpp
Src/MainFrm.cpp
Src/Merge.cpp
Src/Merge7zFormatMergePluginImpl.cpp
Src/MergeDoc.cpp
Src/MergeEditView.cpp

index a495fea..beb4871 100644 (file)
@@ -798,9 +798,9 @@ OnMouseMove (UINT nFlags, CPoint point)
     {
       m_bPreparingToDrag = false;
       HGLOBAL hData = PrepareDragData ();
-      if (hData != NULL)
+      if (hData != nullptr)
         {
-          if (m_pTextBuffer != NULL)
+          if (m_pTextBuffer != nullptr)
             m_pTextBuffer->BeginUndoGroup ();
 
           COleDataSource ds;
@@ -812,7 +812,7 @@ OnMouseMove (UINT nFlags, CPoint point)
             OnDropSource (de);
           m_bDraggingText = false;
 
-          if (m_pTextBuffer != NULL)
+          if (m_pTextBuffer != nullptr)
             m_pTextBuffer->FlushUndoGroup (this);
         }
     }
@@ -1105,7 +1105,12 @@ OnRButtonDown (UINT nFlags, CPoint point)
 bool CCrystalTextView::
 IsSelection ()
 {
+#if _MSC_VER < 1910            // VS2015 (and earlier?) generates a "performance" warning
+  // NOTE:  Comparing two `CPoint` values yields a BOOL result; therefore this funny code
+  return (m_ptSelStart != m_ptSelEnd) ? true : false;
+#else
   return (m_ptSelStart != m_ptSelEnd);
+#endif
 }
 
 void CCrystalTextView::
@@ -1144,7 +1149,7 @@ PutToClipboard (LPCTSTR pszText, int cchText, bool bColumnSelection)
       EmptyClipboard ();
       SIZE_T cbData = (cchText + 1) * sizeof(TCHAR);
       HGLOBAL hData = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, cbData);
-      if (hData != NULL)
+      if (hData != nullptr)
         {
           SIZE_T dwSize = GlobalSize(hData);
           LPTSTR pszData = (LPTSTR)::GlobalLock (hData);
@@ -1155,13 +1160,13 @@ PutToClipboard (LPCTSTR pszText, int cchText, bool bColumnSelection)
                   memset(reinterpret_cast<char *>(pszData) + cbData, 0, dwSize - cbData);
               GlobalUnlock (hData);
               CLIPFORMAT fmt = GetClipTcharTextFormat();
-              bOK = SetClipboardData (fmt, hData) != NULL;
+              bOK = SetClipboardData (fmt, hData) != nullptr;
               if (bOK)
                 {
                   if (bColumnSelection)
-                    SetClipboardData (RegisterClipboardFormat (_T("MSDEVColumnSelect")), NULL);
+                    SetClipboardData (RegisterClipboardFormat (_T("MSDEVColumnSelect")), nullptr);
                   if (dwSize == cbData)
-                    SetClipboardData (RegisterClipboardFormat (_T("WinMergeClipboard")), NULL);
+                    SetClipboardData (RegisterClipboardFormat (_T("WinMergeClipboard")), nullptr);
                 }
             }
         }
@@ -1179,10 +1184,10 @@ GetFromClipboard (CString & text, bool & bColumnSelection)
     {
       CLIPFORMAT fmt = GetClipTcharTextFormat();
       HGLOBAL hData = GetClipboardData (fmt);
-      if (hData != NULL)
+      if (hData != nullptr)
         {
           LPTSTR pszData = (LPTSTR) GlobalLock (hData);
-          if (pszData != NULL)
+          if (pszData != nullptr)
             {
               UINT cbData = (UINT) GlobalSize (hData);
               // in case we get an odd length for unicodes
index a468a91..1de7599 100644 (file)
@@ -45,6 +45,6 @@ void CColorButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
 void CColorButton::SetColor(COLORREF clrFill, bool bInvalidate /* = true*/)
 {
        m_clrFill = clrFill;
-       if (bInvalidate && m_hWnd)
+       if (bInvalidate && m_hWnd != nullptr)
                Invalidate();
 }
index 3e11479..4e2c409 100644 (file)
@@ -156,11 +156,11 @@ void CSizingControlBar::EnableDocking(DWORD dwDockStyle)
     ASSERT((m_dwStyle & CBRS_SIZE_DYNAMIC) != 0);
 
     m_dwDockStyle = dwDockStyle;
-    if (m_pDockContext == NULL)
+    if (m_pDockContext == nullptr)
         m_pDockContext = new CSCBDockContext(this);
 
     // permanently wire the bar's owner to its current parent
-    if (m_hWndOwner == NULL)
+    if (m_hWndOwner == nullptr)
         m_hWndOwner = ::GetParent(m_hWnd);
 }
 #endif
@@ -1104,7 +1104,7 @@ void CSizingControlBar::LoadState(LPCTSTR lpszProfileName)
     for (int i = 0; i < state.m_arrBarInfo.GetSize(); i++)
     {
         CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
-        ASSERT(pInfo != NULL);
+        ASSERT(pInfo != nullptr);
         if (!pInfo->m_bFloating)
             continue;
         
index 99c82bd..694fb91 100644 (file)
@@ -30,7 +30,7 @@ int DIFFITEM::GetDepth() const
 {
        const DIFFITEM *cur;
        int depth;
-       for (depth = 0, cur = parent; cur; depth++, cur = cur->parent)
+       for (depth = 0, cur = parent; cur != nullptr; depth++, cur = cur->parent)
                ;
        return depth;
 }
@@ -41,7 +41,7 @@ int DIFFITEM::GetDepth() const
 bool DIFFITEM::IsAncestor(const DIFFITEM *pdi) const
 {
        const DIFFITEM *cur;
-       for (cur = this; cur; cur = cur->parent)
+       for (cur = this; cur != nullptr; cur = cur->parent)
        {
                if (cur->parent == pdi)
                        return true;
@@ -53,7 +53,7 @@ bool DIFFITEM::IsAncestor(const DIFFITEM *pdi) const
 bool DIFFITEM::HasChildren() const
 {
        DIFFITEM *p = static_cast<DIFFITEM *>(children.IsSibling(children.Flink));
-       return p ? true : false;
+       return (p != nullptr) ? true : false;
 }
 
 void DIFFITEM::RemoveChildren()
@@ -72,7 +72,7 @@ void DIFFITEM::Swap(int idx1, int idx2)
        diffcode.swap(idx1, idx2);
        if (HasChildren())
        {
-               for (ListEntry *p = children.IsSibling(children.Flink); p; p = children.IsSibling(p->Flink))
+               for (ListEntry *p = children.IsSibling(children.Flink); p != nullptr; p = children.IsSibling(p->Flink))
                        static_cast<DIFFITEM *>(p)->Swap(idx1, idx2);
        }
 }
index a255cd3..b5ed1d8 100644 (file)
@@ -133,16 +133,16 @@ void CDiffWrapper::SetCreatePatchFile(const String &filename)
 /**
  * @brief Enables/disabled DiffList creation ands sets DiffList.
  * This function enables or disables DiffList creation. When
- * @p diffList is NULL difflist is not created. When valid DiffList
- * pointer is given, compare results are stored into it.
+ * @p diffList is `nullptr`, a difflist was not created. When valid 
+ * DiffList pointer is given, compare results are stored into it.
  * @param [in] diffList Pointer to DiffList getting compare results.
  */
 void CDiffWrapper::SetCreateDiffList(DiffList *diffList)
 {
-       if (diffList == NULL)
+       if (diffList == nullptr)
        {
                m_bUseDiffList = false;
-               m_pDiffList = NULL;
+               m_pDiffList = nullptr;
        }
        else
        {
@@ -190,7 +190,7 @@ void CDiffWrapper::SetPrediffer(const PrediffingInfo * prediffer /*= nullptr*/)
        // all flags are set correctly during the construction
        m_infoPrediffer.reset(new PrediffingInfo);
 
-       if (prediffer)
+       if (prediffer != nullptr)
                *m_infoPrediffer = *prediffer;
 }
 void CDiffWrapper::GetPrediffer(PrediffingInfo * prediffer) const
@@ -284,7 +284,7 @@ bool CDiffWrapper::IsTrivialLine(const std::string &Line,
                                   const FilterCommentsSet& filtercommentsset) const
 {
        //Do easy test first
-       if ((!StartOfComment || !EndOfComment) && !InLineComment)
+       if ((StartOfComment == nullptr || EndOfComment == nullptr) && InLineComment == nullptr)
                return false;//In no Start and End pair, and no single in-line set, then it's not trivial
 
        if (StartOfComment == Line.c_str() &&
@@ -293,7 +293,7 @@ bool CDiffWrapper::IsTrivialLine(const std::string &Line,
                return true;
        }
 
-       if (InLineComment && InLineComment < StartOfComment)
+       if (InLineComment != nullptr && InLineComment < StartOfComment)
        {
                if (InLineComment == Line.c_str())
                        return true;//If line starts with InLineComment marker, then entire line is trivial
@@ -303,8 +303,8 @@ bool CDiffWrapper::IsTrivialLine(const std::string &Line,
        }
 
        //Done with easy test, so now do more complex test
-       if (StartOfComment && 
-               EndOfComment && 
+       if (StartOfComment != nullptr && 
+               EndOfComment != nullptr && 
                StartOfComment < EndOfComment &&
                IsTrivialBytes(Line.c_str(), StartOfComment, filtercommentsset) &&
                IsTrivialBytes(EndOfComment + filtercommentsset.EndMarker.size(),
@@ -438,9 +438,9 @@ bool CDiffWrapper::PostFilter(int StartPos, int EndPos, int Direction,
                                return false;
                        }
 
-                       if (EndOfComment && 
-                               (!StartOfComment || StartOfComment > EndOfComment) && 
-                               (!InLineComment || InLineComment > EndOfComment) )
+                       if (EndOfComment != nullptr && 
+                               (StartOfComment == nullptr || StartOfComment > EndOfComment) && 
+                               (InLineComment == nullptr || InLineComment > EndOfComment) )
                        {
                                if (!IsTrivialBytes(EndOfComment+filtercommentsset.EndMarker.size(), LineData.c_str()+LineData.size(), filtercommentsset))
                                {
@@ -552,7 +552,7 @@ void CDiffWrapper::PostFilter(int LineNumberLeft, int QtyLinesLeft, int LineNumb
                        EndLineRight = files[1].linbuf[LineNumberRight + i + 1];
                }
                        
-               if (EndLineLeft && EndLineRight)
+               if (EndLineLeft != nullptr && EndLineRight != nullptr)
                {       
                        std::string LineDataLeft(LineStrLeft, EndLineLeft);
                        std::string LineDataRight(LineStrRight, EndLineRight);
@@ -572,28 +572,28 @@ void CDiffWrapper::PostFilter(int LineNumberLeft, int QtyLinesLeft, int LineNumb
                                        CommentStrRightStart = FindCommentMarker(LineDataRight.c_str(), filtercommentsset.StartMarker.c_str());
                                        CommentStrRightEnd = FindCommentMarker(LineDataRight.c_str(), filtercommentsset.EndMarker.c_str());
                                        
-                                       if (CommentStrLeftStart != NULL && CommentStrLeftEnd != NULL && CommentStrLeftStart < CommentStrLeftEnd)
+                                       if (CommentStrLeftStart != nullptr && CommentStrLeftEnd != nullptr && CommentStrLeftStart < CommentStrLeftEnd)
                                                LineDataLeft.erase(CommentStrLeftStart - LineDataLeft.c_str(), CommentStrLeftEnd + filtercommentsset.EndMarker.size() - CommentStrLeftStart);
-                                       else if (CommentStrLeftEnd != NULL)
+                                       else if (CommentStrLeftEnd != nullptr)
                                                LineDataLeft.erase(0, CommentStrLeftEnd + filtercommentsset.EndMarker.size() - LineDataLeft.c_str());
-                                       else if (CommentStrLeftStart != NULL)
+                                       else if (CommentStrLeftStart != nullptr)
                                                LineDataLeft.erase(CommentStrLeftStart - LineDataLeft.c_str());
                                        else if(LeftOp == OP_TRIVIAL && bFirstLoop)
                                                LineDataLeft.erase(0);  //This line is all in block comments
 
-                                       if (CommentStrRightStart != NULL && CommentStrRightEnd != NULL && CommentStrRightStart < CommentStrRightEnd)
+                                       if (CommentStrRightStart != nullptr && CommentStrRightEnd != nullptr && CommentStrRightStart < CommentStrRightEnd)
                                                LineDataRight.erase(CommentStrRightStart - LineDataRight.c_str(), CommentStrRightEnd + filtercommentsset.EndMarker.size() - CommentStrRightStart);
-                                       else if (CommentStrRightEnd != NULL)
+                                       else if (CommentStrRightEnd != nullptr)
                                                LineDataRight.erase(0, CommentStrRightEnd + filtercommentsset.EndMarker.size() - LineDataRight.c_str());
-                                       else if (CommentStrRightStart != NULL)
+                                       else if (CommentStrRightStart != nullptr)
                                                LineDataRight.erase(CommentStrRightStart - LineDataRight.c_str());
                                        else if(RightOp == OP_TRIVIAL && bFirstLoop)
                                                LineDataRight.erase(0);  //This line is all in block comments
 
                                        bFirstLoop = false;
 
-                               } while (CommentStrLeftStart != NULL || CommentStrLeftEnd != NULL
-                                       || CommentStrRightStart != NULL || CommentStrRightEnd != NULL); //Loops until all blockcomments are lost
+                               } while (CommentStrLeftStart != nullptr || CommentStrLeftEnd != nullptr
+                                       || CommentStrRightStart != nullptr || CommentStrRightEnd != nullptr); //Loops until all blockcomments are lost
                        }
 
                        if (!filtercommentsset.InlineMarker.empty())
@@ -602,9 +602,9 @@ void CDiffWrapper::PostFilter(int LineNumberLeft, int QtyLinesLeft, int LineNumb
                                const char * CommentStrLeft = FindCommentMarker(LineDataLeft.c_str(), filtercommentsset.InlineMarker.c_str());
                                const char * CommentStrRight = FindCommentMarker(LineDataRight.c_str(), filtercommentsset.InlineMarker.c_str());
 
-                               if (CommentStrLeft != NULL)
+                               if (CommentStrLeft != nullptr)
                                        LineDataLeft.erase(CommentStrLeft - LineDataLeft.c_str());
-                               if (CommentStrRight != NULL)
+                               if (CommentStrRight != nullptr)
                                        LineDataRight.erase(CommentStrRight - LineDataRight.c_str());
                        }
 
@@ -1134,10 +1134,10 @@ CDiffWrapper::FreeDiffUtilsScript(struct change * & script)
  */
 bool CDiffWrapper::RegExpFilter(int StartPos, int EndPos, int FileNo) const
 {
-       if (m_pFilterList == NULL)
+       if (m_pFilterList == nullptr)
        {       
                throw "CDiffWrapper::RegExpFilter() called when "
-                       "filterlist doesn't exist (=NULL)";
+                       "filterlist doesn't exist (=nullptr)";
        }
 
        bool linesMatch = true; // set to false when non-matching line is found.
@@ -1249,7 +1249,7 @@ CDiffWrapper::LoadWinMergeDiffsFromDiffUtilsScript(struct change * script, const
                                        PostFilter(thisob->line0, QtyLinesLeft, thisob->line1, QtyLinesRight, op, asLwrCaseExt);
                                }
 
-                               if (m_pFilterList && m_pFilterList->HasRegExps())
+                               if (m_pFilterList != nullptr && m_pFilterList->HasRegExps())
                                {
                                         //Determine quantity of lines in this block for both sides
                                        int QtyLinesLeft = (trans_b0 - trans_a0);
@@ -1626,7 +1626,7 @@ void CDiffWrapper::SetFilterList(const String& filterStr)
        }
 
        // Adding new filter without previous filter
-       if (m_pFilterList == NULL)
+       if (m_pFilterList == nullptr)
        {
                m_pFilterList.reset(new FilterList);
        }
index b3c5498..e8260db 100644 (file)
@@ -155,16 +155,16 @@ void CDirDoc::InitCompare(const PathContext & paths, bool bRecursive, CTempPathC
 
        m_pDirView->DeleteAllDisplayItems();
        // Anything that can go wrong here will yield an exception.
-       // Default implementation of operator new() never returns NULL.
+       // Default implementation of operator new() never returns `nullptr`.
        
-       if (m_pCompareStats == NULL)
+       if (m_pCompareStats == nullptr)
                m_pCompareStats.reset(new CompareStats(m_nDirs));
 
        m_pCtxt.reset(new CDiffContext(paths,
                        GetOptionsMgr()->GetInt(OPT_CMP_METHOD)));
        m_pCtxt->m_bRecursive = bRecursive;
 
-       if (pTempPathContext)
+       if (pTempPathContext != nullptr)
        {
                int nIndex;
                for (nIndex = 0; nIndex < m_nDirs; nIndex++)
@@ -176,7 +176,7 @@ void CDirDoc::InitCompare(const PathContext & paths, bool bRecursive, CTempPathC
        }
        
        // All plugin management is done by our plugin manager
-       m_pCtxt->m_piPluginInfos = GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED) ? &m_pluginman : NULL;
+       m_pCtxt->m_piPluginInfos = GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED) ? &m_pluginman : nullptr;
 }
 
 
@@ -219,7 +219,7 @@ void CDirDoc::DiffThreadCallback(int& state)
  */
 void CDirDoc::Rescan()
 {
-       if (!m_pCtxt)
+       if (m_pCtxt == nullptr)
                return;
 
        CDirFrame *pf = m_pDirView->GetParentFrame();
@@ -300,7 +300,7 @@ void CDirDoc::Rescan()
  */
 void CDirDoc::Redisplay()
 {
-       if (!m_pDirView)
+       if (m_pDirView == nullptr)
                return;
 
        // Do not redisplay an empty CDirView
@@ -314,7 +314,7 @@ void CDirDoc::Redisplay()
 
 CDirView * CDirDoc::GetMainView() const
 {
-       CDirView *pView = NULL;
+       CDirView *pView = nullptr;
        if (POSITION pos = GetFirstViewPosition())
        {
                pView = static_cast<CDirView*>(GetNextView(pos));
@@ -354,7 +354,7 @@ void CDirDoc::InitStatusStrings()
  */
 void CDirDoc::UpdateResources()
 {
-       if (m_pDirView)
+       if (m_pDirView != nullptr)
                m_pDirView->UpdateResources();
 
        SetTitle(nullptr);
@@ -396,9 +396,9 @@ void CDirDoc::MergeDocClosing(IMergeDoc * pMergeDoc)
 
        // If dir compare is empty (no compare results) and we are not closing
        // because of reuse close also dir compare
-       if (m_pDirView)
+       if (m_pDirView != nullptr)
        {
-               if (m_pCtxt == NULL)
+               if (m_pCtxt == nullptr)
                        m_pDirView->PostMessage(WM_COMMAND, ID_FILE_CLOSE);
        }
        else if (m_MergeDocs.GetCount() == 0)
@@ -487,9 +487,9 @@ void CDirDoc::CompareReady()
  */
 void CDirDoc::RefreshOptions()
 {
-       if (m_pCtxt)
+       if (m_pCtxt != nullptr)
                m_pCtxt->m_bRecursive = GetOptionsMgr()->GetBool(OPT_CMP_INCLUDE_SUBDIRS);
-       if (m_pDirView)
+       if (m_pDirView != nullptr)
                m_pDirView->RefreshOptions();
 }
 
@@ -597,7 +597,7 @@ bool CDirDoc::IsCurrentScanAbortable() const
  */
 void CDirDoc::SetDescriptions(const String strDesc[])
 {
-       if (strDesc)
+       if (strDesc != nullptr)
                std::copy_n(strDesc, m_nDirs, m_strDesc);
 }
 
@@ -611,7 +611,7 @@ void CDirDoc::SetDescriptions(const String strDesc[])
  */
 void CDirDoc::ApplyDisplayRoot(int nIndex, String &sText)
 {
-       if (m_pTempPathContext)
+       if (m_pTempPathContext != nullptr)
        {
                sText.erase(0, m_pTempPathContext->m_strRoot[nIndex].length());
                sText.insert(0, m_pTempPathContext->m_strDisplayRoot[nIndex]);
@@ -624,18 +624,18 @@ void CDirDoc::ApplyDisplayRoot(int nIndex, String &sText)
  * Formats and sets caption for directory compare window. Caption
  * has left- and right-side paths separated with '-'.
  *
- * @param [in] lpszTitle New title for window if. If this parameter
- * is not NULL we use this string, otherwise format caption from
+ * @param [in] lpszTitle New title for window. If this parameter
+ * is not `nullptr` we use this string, otherwise format caption from
  * actual paths.
  */
 void CDirDoc::SetTitle(LPCTSTR lpszTitle)
 {
-       if (!m_pDirView)
+       if (m_pDirView == nullptr)
                return;
 
-       if (lpszTitle)
+       if (lpszTitle != nullptr)
                CDocument::SetTitle(lpszTitle);
-       else if (!m_pCtxt || m_pCtxt->GetLeftPath().empty() ||
+       else if (m_pCtxt == nullptr || m_pCtxt->GetLeftPath().empty() ||
                m_pCtxt->GetRightPath().empty() || 
                (m_nDirs > 2 && m_pCtxt->GetMiddlePath().empty()))
        {
@@ -667,7 +667,7 @@ void CDirDoc::SetTitle(LPCTSTR lpszTitle)
  */
 bool CDirDoc::IsArchiveFolders() const
 {
-       if (m_pTempPathContext)
+       if (m_pTempPathContext != nullptr)
                return true;
        else
                return false;
@@ -677,7 +677,7 @@ void CDirDoc::Swap(int idx1, int idx2)
 {
        std::swap(m_bRO[idx1], m_bRO[idx2]);
        std::swap(m_strDesc[idx1], m_strDesc[idx2]);
-       if (m_pTempPathContext)
+       if (m_pTempPathContext != nullptr)
                m_pTempPathContext->Swap(idx1, idx2);
        m_pCtxt->Swap(idx1, idx2);
        m_pCompareStats->Swap(idx1, idx2);
@@ -688,7 +688,7 @@ void CDirDoc::Swap(int idx1, int idx2)
 
 bool CDirDoc::MoveableToNextDiff()
 {
-       if (!m_pDirView)
+       if (m_pDirView == nullptr)
                return false;
        CMessageBoxDialog dlg(nullptr, _("Do you want to move to the next file?").c_str());
        const int nFormerResult = dlg.GetFormerResult();
@@ -699,7 +699,7 @@ bool CDirDoc::MoveableToNextDiff()
 
 bool CDirDoc::MoveableToPrevDiff()
 {
-       if (!m_pDirView)
+       if (m_pDirView == nullptr)
                return false;
        CMessageBoxDialog dlg(nullptr, _("Do you want to move to the previous file?").c_str());
        const int nFormerResult = dlg.GetFormerResult();
@@ -710,7 +710,7 @@ bool CDirDoc::MoveableToPrevDiff()
 
 void CDirDoc::MoveToNextDiff(IMergeDoc *pMergeDoc)
 {
-       if (!m_pDirView)
+       if (m_pDirView == nullptr)
                return;
        if (AfxMessageBox(_("Do you want to move to the next file?").c_str(), MB_YESNO | MB_DONT_ASK_AGAIN) == IDYES)
        {
@@ -722,7 +722,7 @@ void CDirDoc::MoveToNextDiff(IMergeDoc *pMergeDoc)
 
 void CDirDoc::MoveToPrevDiff(IMergeDoc *pMergeDoc)
 {
-       if (!m_pDirView)
+       if (m_pDirView == nullptr)
                return;
        if (AfxMessageBox(_("Do you want to move to the previous file?").c_str(), MB_YESNO | MB_DONT_ASK_AGAIN) == IDYES)
        {
index 1ffac4b..df11042 100644 (file)
@@ -2225,7 +2225,7 @@ LRESULT CDirView::OnUpdateUIMessage(WPARAM wParam, LPARAM lParam)
        UNREFERENCED_PARAMETER(lParam);
 
        CDirDoc * pDoc = GetDocument();
-       ASSERT(pDoc);
+       ASSERT(pDoc != nullptr);
 
        if (wParam == CDiffThread::EVENT_COMPARE_COMPLETED)
        {
index 13b06c1..dc1b2fe 100644 (file)
@@ -99,7 +99,7 @@ void CEditorFilePathBar::SetPaneCount(int nPanes)
  */
 void CEditorFilePathBar::Resize()
 {
-       if (m_hWnd == NULL)
+       if (m_hWnd == nullptr)
                return;
 
        WINDOWPLACEMENT infoBar;
@@ -128,7 +128,7 @@ void CEditorFilePathBar::SetOnSetFocusCallback(const std::function<void(int)> ca
  */
 void CEditorFilePathBar::Resize(int widths[])
 {
-       if (m_hWnd == NULL)
+       if (m_hWnd == nullptr)
                return;
 
        // resize left filename
@@ -156,7 +156,7 @@ void CEditorFilePathBar::Resize(int widths[])
  */
 BOOL CEditorFilePathBar::OnToolTipNotify(UINT id, NMHDR * pTTTStruct, LRESULT * pResult)
 {
-       if (m_hWnd == NULL)
+       if (m_hWnd == nullptr)
                return FALSE;
 
        TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pTTTStruct;
@@ -214,7 +214,7 @@ String CEditorFilePathBar::GetText(int pane) const
        ASSERT (pane >= 0 && pane < countof(m_Edit));
 
        // Check for NULL since window may be closing..
-       if (m_hWnd == NULL)
+       if (m_hWnd == nullptr)
                return _T("");
 
        CString str;
@@ -233,7 +233,7 @@ void CEditorFilePathBar::SetText(int pane, const String& sString)
        ASSERT (pane >= 0 && pane < countof(m_Edit));
 
        // Check for NULL since window may be closing..
-       if (m_hWnd == NULL)
+       if (m_hWnd == nullptr)
                return;
 
        m_Edit[pane].SetOriginalText(sString);
index 8c6749a..97719fc 100644 (file)
@@ -406,7 +406,7 @@ bool AnyCodepageToUTF8(int codepage, String & filepath, bool bMayOverwrite)
        // TODO : is it better with the BOM or without (just change the last argument)
        int nFileChanged = 0;
        bool bSuccess = ::AnyCodepageToUTF8(codepage, filepath, tempFilepath, nFileChanged, false); 
-       if (bSuccess && nFileChanged)
+       if (bSuccess && nFileChanged!=0)
        {
                // we do not overwrite so we delete the old file
                if (bMayOverwrite)
index 4ff015a..83e0f5e 100644 (file)
@@ -354,7 +354,7 @@ void CFilepathEdit::SetActive(bool bActive)
 {
        m_bActive = bActive;
 
-       if (m_hWnd == NULL)
+       if (m_hWnd == nullptr)
                return;
 
        CRect rcWnd;
index eea253e..ee5a75b 100644 (file)
@@ -76,10 +76,9 @@ int FolderCmp::prepAndCompareFiles(CDiffContext * pCtxt, DIFFITEM &di)
 
                PathContext tFiles;
                GetComparePaths(pCtxt, di, tFiles);
-               struct change *script = NULL;
-               struct change *script10 = NULL;
-               struct change *script12 = NULL;
-               struct change *script02 = NULL;
+               struct change *script10 = nullptr;
+               struct change *script12 = nullptr;
+               struct change *script02 = nullptr;
                FolderCmp diffdata10, diffdata12, diffdata02;
                String filepathUnpacked[3];
                String filepathTransformed[3];
@@ -183,14 +182,14 @@ int FolderCmp::prepAndCompareFiles(CDiffContext * pCtxt, DIFFITEM &di)
                {
                        if (tFiles.GetSize() == 2)
                        {
-                               if (m_pDiffUtilsEngine == NULL)
+                               if (m_pDiffUtilsEngine == nullptr)
                                        m_pDiffUtilsEngine.reset(new CompareEngines::DiffUtils());
                                m_pDiffUtilsEngine->SetCodepage(codepage);
                                bool success = m_pDiffUtilsEngine->SetCompareOptions(
                                                *pCtxt->GetCompareOptions(CMP_CONTENT));
                                if (success)
                                {
-                                       if (pCtxt->m_pFilterList != NULL)
+                                       if (pCtxt->m_pFilterList != nullptr)
                                                m_pDiffUtilsEngine->SetFilterList(pCtxt->m_pFilterList.get());
                                        else
                                                m_pDiffUtilsEngine->ClearFilterList();
@@ -214,14 +213,14 @@ int FolderCmp::prepAndCompareFiles(CDiffContext * pCtxt, DIFFITEM &di)
                        }
                        else
                        {
-                               if (m_pDiffUtilsEngine == NULL)
+                               if (m_pDiffUtilsEngine == nullptr)
                                        m_pDiffUtilsEngine.reset(new CompareEngines::DiffUtils());
                                m_pDiffUtilsEngine->SetCodepage(codepage);
                                bool success = m_pDiffUtilsEngine->SetCompareOptions(
                                                *pCtxt->GetCompareOptions(CMP_CONTENT));
                                if (success)
                                {
-                                       if (pCtxt->m_pFilterList != NULL)
+                                       if (pCtxt->m_pFilterList != nullptr)
                                                m_pDiffUtilsEngine->SetFilterList(pCtxt->m_pFilterList.get());
                                        else
                                                m_pDiffUtilsEngine->ClearFilterList();
@@ -231,17 +230,17 @@ int FolderCmp::prepAndCompareFiles(CDiffContext * pCtxt, DIFFITEM &di)
                                        int bin_flag10 = 0, bin_flag12 = 0, bin_flag02 = 0;
 
                                        m_pDiffUtilsEngine->SetFileData(2, diffdata10.m_diffFileData.m_inf);
-                                       bRet = m_pDiffUtilsEngine->Diff2Files(&script10, 0, &bin_flag10, false, NULL);
+                                       bRet = m_pDiffUtilsEngine->Diff2Files(&script10, 0, &bin_flag10, false, nullptr);
                                        m_pDiffUtilsEngine->GetTextStats(0, &m_diffFileData.m_textStats[1]);
                                        m_pDiffUtilsEngine->GetTextStats(1, &m_diffFileData.m_textStats[0]);
 
                                        m_pDiffUtilsEngine->SetFileData(2, diffdata12.m_diffFileData.m_inf);
-                                       bRet = m_pDiffUtilsEngine->Diff2Files(&script12, 0, &bin_flag12, false, NULL);
+                                       bRet = m_pDiffUtilsEngine->Diff2Files(&script12, 0, &bin_flag12, false, nullptr);
                                        m_pDiffUtilsEngine->GetTextStats(0, &m_diffFileData.m_textStats[1]);
                                        m_pDiffUtilsEngine->GetTextStats(1, &m_diffFileData.m_textStats[2]);
 
                                        m_pDiffUtilsEngine->SetFileData(2, diffdata02.m_diffFileData.m_inf);
-                                       bRet = m_pDiffUtilsEngine->Diff2Files(&script02, 0, &bin_flag02, false, NULL);
+                                       bRet = m_pDiffUtilsEngine->Diff2Files(&script02, 0, &bin_flag02, false, nullptr);
                                        m_pDiffUtilsEngine->GetTextStats(0, &m_diffFileData.m_textStats[0]);
                                        m_pDiffUtilsEngine->GetTextStats(1, &m_diffFileData.m_textStats[2]);
 
@@ -272,11 +271,11 @@ int FolderCmp::prepAndCompareFiles(CDiffContext * pCtxt, DIFFITEM &di)
                                        {
                                                if ((code & DIFFCODE::TEXTFLAGS) == DIFFCODE::TEXT)
                                                {
-                                                       if (!script12)
+                                                       if (script12 == nullptr)
                                                                code |= DIFFCODE::DIFF1STONLY;
-                                                       else if (!script02)
+                                                       else if (script02 == nullptr)
                                                                code |= DIFFCODE::DIFF2NDONLY;
-                                                       else if (!script10)
+                                                       else if (script10 == nullptr)
                                                                code |= DIFFCODE::DIFF3RDONLY;
                                                }
                                                else
@@ -441,7 +440,7 @@ exitPrepAndCompare:
        }
        else if (nCompMethod == CMP_BINARY_CONTENT)
        {
-               if (m_pBinaryCompare == NULL)
+               if (m_pBinaryCompare == nullptr)
                        m_pBinaryCompare.reset(new BinaryCompare());
 
                PathContext tFiles;
@@ -450,7 +449,7 @@ exitPrepAndCompare:
        }
        else if (nCompMethod == CMP_DATE || nCompMethod == CMP_DATE_SIZE || nCompMethod == CMP_SIZE)
        {
-               if (m_pTimeSizeCompare == NULL)
+               if (m_pTimeSizeCompare == nullptr)
                        m_pTimeSizeCompare.reset(new TimeSizeCompare());
 
                m_pTimeSizeCompare->SetAdditionalOptions(pCtxt->m_bIgnoreSmallTimeDiff);
index f9869f0..e5b4490 100644 (file)
@@ -138,7 +138,7 @@ CHexMergeDoc::CHexMergeDoc()
  */
 CHexMergeDoc::~CHexMergeDoc()
 {      
-       if (m_pDirDoc)
+       if (m_pDirDoc != nullptr)
                m_pDirDoc->MergeDocClosing(this);
 }
 
@@ -160,7 +160,7 @@ CHexMergeView * CHexMergeDoc::GetActiveMergeView() const
 int CHexMergeDoc::UpdateDiffItem(CDirDoc *pDirDoc)
 {
        // If directory compare has results
-       if (pDirDoc && pDirDoc->HasDiffs())
+       if (pDirDoc != nullptr && pDirDoc->HasDiffs())
        {
                CDiffContext &ctxt = pDirDoc->GetDiffContext();
                if (UINT_PTR pos = FindItemFromPaths(ctxt, m_filePaths))
@@ -567,7 +567,7 @@ void CHexMergeDoc::UpdateHeaderPath(int pane)
        else
        {
                sText = m_filePaths.GetPath(pane);
-               if (m_pDirDoc)
+               if (m_pDirDoc != nullptr)
                        m_pDirDoc->ApplyDisplayRoot(pane, sText);
        }
        if (m_pView[pane]->GetModified())
@@ -641,7 +641,7 @@ void CHexMergeDoc::SetTitle(LPCTSTR lpszTitle)
        String sTitle;
        String sFileName[3];
 
-       if (lpszTitle)
+       if (lpszTitle != nullptr)
                sTitle = lpszTitle;
        else
        {
index 95ad389..569e1c8 100644 (file)
@@ -170,31 +170,31 @@ CImgMergeFrame::CImgMergeFrame()
 
 CImgMergeFrame::~CImgMergeFrame()
 {
-       if (m_pDirDoc)
+       if (m_pDirDoc != nullptr)
        {
                m_pDirDoc->MergeDocClosing(this);
-               m_pDirDoc = NULL;
+               m_pDirDoc = nullptr;
        }
 
        HMODULE hModule = GetModuleHandleW(L"WinIMergeLib.dll");
-       if (hModule)
+       if (hModule != nullptr)
        {
                bool (*WinIMerge_DestroyWindow)(IImgMergeWindow *) = 
                        (bool (*)(IImgMergeWindow *))GetProcAddress(hModule, "WinIMerge_DestroyWindow");
                bool (*WinIMerge_DestroyToolWindow)(IImgToolWindow *) = 
                        (bool (*)(IImgToolWindow *))GetProcAddress(hModule, "WinIMerge_DestroyToolWindow");
-               if (WinIMerge_DestroyWindow && WinIMerge_DestroyToolWindow)
+               if (WinIMerge_DestroyWindow != nullptr && WinIMerge_DestroyToolWindow != nullptr)
                {
-                       if (m_pImgMergeWindow)
+                       if (m_pImgMergeWindow != nullptr)
                        {
                                for (int pane = 0; pane < m_pImgMergeWindow->GetPaneCount(); ++pane)
                                        RevokeDragDrop(m_pImgMergeWindow->GetPaneHWND(pane));
                                WinIMerge_DestroyWindow(m_pImgMergeWindow);
                        }
-                       if (m_pImgToolWindow)
+                       if (m_pImgToolWindow != nullptr)
                                WinIMerge_DestroyToolWindow(m_pImgToolWindow);
-                       m_pImgMergeWindow = NULL;
-                       m_pImgToolWindow = NULL;
+                       m_pImgMergeWindow = nullptr;
+                       m_pImgToolWindow = nullptr;
                }
        }
 }
@@ -394,10 +394,10 @@ void CImgMergeFrame::OnChildPaneEvent(const IImgMergeWindow::Event& evt)
 bool CImgMergeFrame::IsLoadable()
 {
        static HMODULE hModule;
-       if (!hModule)
+       if (hModule == nullptr)
        {
                hModule = LoadLibraryW(L"WinIMerge\\WinIMergeLib.dll");
-               if (!hModule)
+               if (hModule == nullptr)
                        return false;
        }
        return true;
@@ -413,13 +413,13 @@ BOOL CImgMergeFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
                return FALSE;
 
        HMODULE hModule = GetModuleHandleW(L"WinIMergeLib.dll");
-       if (!hModule)
+       if (hModule == nullptr)
                return FALSE;
 
        IImgMergeWindow * (*WinIMerge_CreateWindow)(HINSTANCE hInstance, HWND hWndParent, int nID) = 
                        (IImgMergeWindow * (*)(HINSTANCE hInstance, HWND hWndParent, int nID))GetProcAddress(hModule, "WinIMerge_CreateWindow");
-       if (!WinIMerge_CreateWindow || 
-               (m_pImgMergeWindow = WinIMerge_CreateWindow(hModule, m_hWnd, AFX_IDW_PANE_FIRST)) == NULL)
+       if (WinIMerge_CreateWindow == nullptr || 
+               (m_pImgMergeWindow = WinIMerge_CreateWindow(hModule, m_hWnd, AFX_IDW_PANE_FIRST)) == nullptr)
        {
                FreeLibrary(hModule);
                return FALSE;
@@ -458,8 +458,8 @@ BOOL CImgMergeFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
 
        IImgToolWindow * (*WinIMerge_CreateToolWindow)(HINSTANCE hInstance, HWND hWndParent, IImgMergeWindow *) = 
                        (IImgToolWindow * (*)(HINSTANCE hInstance, HWND hWndParent, IImgMergeWindow *pImgMergeWindow))GetProcAddress(hModule, "WinIMerge_CreateToolWindow");
-       if (!WinIMerge_CreateToolWindow ||
-               (m_pImgToolWindow = WinIMerge_CreateToolWindow(hModule, m_wndLocationBar.m_hWnd, m_pImgMergeWindow)) == NULL)
+       if (WinIMerge_CreateToolWindow == nullptr ||
+               (m_pImgToolWindow = WinIMerge_CreateToolWindow(hModule, m_wndLocationBar.m_hWnd, m_pImgMergeWindow)) == nullptr)
        {
                return FALSE;
        }
@@ -529,7 +529,7 @@ bool CImgMergeFrame::EnsureValidDockState(CDockState& state)
        {
                bool barIsCorrect = true;
                CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
-               if (!pInfo)
+               if (pInfo == nullptr)
                        barIsCorrect = false;
                else
                {
@@ -917,13 +917,13 @@ void CImgMergeFrame::UpdateHeaderPath(int pane)
 
        m_wndFilePathBar.SetText(pane, sText.c_str());
 
-       SetTitle(NULL);
+       SetTitle(nullptr);
 }
 
 /// update splitting position for panels 1/2 and headerbar and statusbar 
 void CImgMergeFrame::UpdateHeaderSizes()
 {
-       if (IsWindowVisible() && m_pImgMergeWindow)
+       if (IsWindowVisible() && m_pImgMergeWindow != nullptr)
        {
                int w[3];
                CRect rc, rcMergeWindow;
@@ -974,7 +974,7 @@ void CImgMergeFrame::SetTitle(LPCTSTR lpszTitle)
        String sTitle;
        String sFileName[3];
 
-       if (lpszTitle)
+       if (lpszTitle != nullptr)
                sTitle = lpszTitle;
        else
        {
@@ -986,7 +986,7 @@ void CImgMergeFrame::SetTitle(LPCTSTR lpszTitle)
                        {
                                String file;
                                String ext;
-                               paths::SplitFilename(m_filePaths[nBuffer], NULL, &file, &ext);
+                               paths::SplitFilename(m_filePaths[nBuffer], nullptr, &file, &ext);
                                sFileName[nBuffer] += file;
                                if (!ext.empty())
                                {
@@ -1002,7 +1002,7 @@ void CImgMergeFrame::SetTitle(LPCTSTR lpszTitle)
                        sTitle = strutils::join(&sFileName[0], &sFileName[0] + nBuffers, _T(" - "));
        }
        CMDIChildWnd::SetTitle(sTitle.c_str());
-       if (m_hWnd)
+       if (m_hWnd != nullptr)
                SetWindowText(sTitle.c_str());
 }
 
@@ -1526,7 +1526,7 @@ void CImgMergeFrame::OnNextdiff()
                        UpdateLastCompareResult();
                }
        }
-       else if (m_pDirDoc)
+       else if (m_pDirDoc != nullptr)
                m_pDirDoc->MoveToNextDiff(this);
 }
 
@@ -1540,7 +1540,7 @@ void CImgMergeFrame::OnUpdateNextdiff(CCmdUI* pCmdUI)
                m_pImgMergeWindow->GetNextDiffIndex() >= 0 ||
                (m_pImgMergeWindow->GetDiffCount() > 0 && m_pImgMergeWindow->GetCurrentDiffIndex() == -1);
 
-       if (!enabled && m_pDirDoc)
+       if (!enabled && m_pDirDoc != nullptr)
                enabled = m_pDirDoc->MoveableToNextDiff();
 
        pCmdUI->Enable(enabled);
@@ -1563,7 +1563,7 @@ void CImgMergeFrame::OnPrevdiff()
                        UpdateLastCompareResult();
                }
        }
-       else if (m_pDirDoc)
+       else if (m_pDirDoc != nullptr)
                m_pDirDoc->MoveToPrevDiff(this);
 }
 
@@ -1577,7 +1577,7 @@ void CImgMergeFrame::OnUpdatePrevdiff(CCmdUI* pCmdUI)
                m_pImgMergeWindow->GetPrevDiffIndex() >= 0 ||
                (m_pImgMergeWindow->GetDiffCount() > 0 && m_pImgMergeWindow->GetCurrentDiffIndex() == -1);
 
-       if (!enabled && m_pDirDoc)
+       if (!enabled && m_pDirDoc != nullptr)
                enabled = m_pDirDoc->MoveableToPrevDiff();
 
        pCmdUI->Enable(enabled);
index 1fb05a6..9567318 100644 (file)
@@ -653,7 +653,7 @@ bool CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc,
        const DWORD dwFlags[], const String strDesc[], const String& sReportFile /*= _T("")*/,
        const PackingInfo * infoUnpacker /*= nullptr*/)
 {
-       if (!m_pMenus[MENU_MERGEVIEW])
+       if (m_pMenus[MENU_MERGEVIEW] == nullptr)
                theApp.m_pDiffTemplate->m_hMenuShared = NewMergeViewMenu();
        CMergeDoc * pMergeDoc = GetMergeDocForDiff<CMergeDoc>(theApp.m_pDiffTemplate, pDirDoc, nFiles);
 
@@ -661,8 +661,8 @@ bool CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc,
        FileLocation fileloc[3];
        std::copy_n(ifileloc, nFiles, fileloc);
 
-       ASSERT(pMergeDoc);              // must ASSERT to get an answer to the question below ;-)
-       if (!pMergeDoc)
+       ASSERT(pMergeDoc != nullptr);           // must ASSERT to get an answer to the question below ;-)
+       if (pMergeDoc == nullptr)
                return false; // when does this happen ?
 
        // if an unpacker is selected, it must be used during LoadFromFile
@@ -739,7 +739,7 @@ bool CMainFrame::ShowHexMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocati
        const DWORD dwFlags[], const String strDesc[], const String& sReportFile /*= _T("")*/,
        const PackingInfo * infoUnpacker /*= nullptr*/)
 {
-       if (!m_pMenus[MENU_HEXMERGEVIEW])
+       if (m_pMenus[MENU_HEXMERGEVIEW] == nullptr)
                theApp.m_pHexMergeTemplate->m_hMenuShared = NewHexMergeViewMenu();
        CHexMergeDoc *pHexMergeDoc = GetMergeDocForDiff<CHexMergeDoc>(theApp.m_pHexMergeTemplate, pDirDoc, nFiles);
        if (!pHexMergeDoc)
@@ -886,7 +886,7 @@ bool CMainFrame::DoFileOpen(const PathContext * pFiles /*= nullptr*/,
        const DWORD dwFlags[] /*= nullptr*/, const String strDesc[] /*= nullptr*/, const String& sReportFile /*= T("")*/, bool bRecurse /*= false*/, CDirDoc *pDirDoc/*= nullptr*/,
        String prediffer /*= _T("")*/, const PackingInfo *infoUnpacker /*= nullptr*/)
 {
-       if (pDirDoc && !pDirDoc->CloseMergeDocs())
+       if (pDirDoc != nullptr && !pDirDoc->CloseMergeDocs())
                return false;
 
        FileTransform::g_UnpackerMode = static_cast<PLUGIN_MODE>(theApp.GetProfileInt(_T("Settings"), _T("UnpackerMode"), PLUGIN_MANUAL));
@@ -895,7 +895,7 @@ bool CMainFrame::DoFileOpen(const PathContext * pFiles /*= nullptr*/,
        Merge7zFormatMergePluginScope scope(infoUnpacker);
 
        PathContext tFiles;
-       if (pFiles)
+       if (pFiles != nullptr)
                tFiles = *pFiles;
        bool bRO[3] = {0};
        if (dwFlags)
@@ -909,7 +909,7 @@ bool CMainFrame::DoFileOpen(const PathContext * pFiles /*= nullptr*/,
        paths::PATH_EXISTENCE pathsType = paths::GetPairComparability(tFiles, IsArchiveFile);
        if (pathsType == paths::DOES_NOT_EXIST)
        {
-               if (!m_pMenus[MENU_OPENVIEW])
+               if (m_pMenus[MENU_OPENVIEW] == nullptr)
                        theApp.m_pOpenTemplate->m_hMenuShared = NewOpenViewMenu();
                COpenDoc *pOpenDoc = static_cast<COpenDoc *>(theApp.m_pOpenTemplate->CreateNewDocument());
                if (dwFlags)
@@ -965,12 +965,12 @@ bool CMainFrame::DoFileOpen(const PathContext * pFiles /*= nullptr*/,
 
        // Determine if we want a new dirview open, now that we know if it was
        // an archive. Don't open a new dirview if we are comparing files.
-       if (!pDirDoc)
+       if (pDirDoc == nullptr)
        {
                if (pathsType == paths::IS_EXISTING_DIR)
                {
                        CDirDoc::m_nDirsTemp = tFiles.GetSize();
-                       if (!m_pMenus[MENU_DIRVIEW])
+                       if (m_pMenus[MENU_DIRVIEW] == nullptr)
                                theApp.m_pDirTemplate->m_hMenuShared = NewDirViewMenu();
                        pDirDoc = static_cast<CDirDoc*>(theApp.m_pDirTemplate->OpenDocumentFile(NULL));
                }
@@ -983,7 +983,7 @@ bool CMainFrame::DoFileOpen(const PathContext * pFiles /*= nullptr*/,
        // open the diff
        if (pathsType == paths::IS_EXISTING_DIR)
        {
-               if (pDirDoc)
+               if (pDirDoc != nullptr)
                {
                        // Anything that can go wrong inside InitCompare() will yield an
                        // exception. There is no point in checking return value.
@@ -1030,10 +1030,10 @@ void CMainFrame::UpdateFont(FRAMETYPE frame)
        {
                for (auto pDoc : GetAllDirDocs())
                {
-                       if (pDoc)
+                       if (pDoc != nullptr)
                        {
                                CDirView *pView = pDoc->GetMainView();
-                               if (pView)
+                               if (pView != nullptr)
                                        pView->SetFont(m_lfDir);
                        }
                }
@@ -1306,7 +1306,7 @@ DocClass * GetMergeDocForDiff(CMultiDocTemplate *pTemplate, CDirDoc *pDirDoc, in
        // Create a new merge doc
        DocClass::m_nBuffersTemp = nFiles;
        DocClass *pMergeDoc = static_cast<DocClass*>(pTemplate->OpenDocumentFile(NULL));
-       if (pMergeDoc)
+       if (pMergeDoc != nullptr)
        {
                pDirDoc->AddMergeDoc(pMergeDoc);
                pMergeDoc->SetDirDoc(pDirDoc);
@@ -1434,7 +1434,7 @@ void CMainFrame::OnReloadPlugins()
 
        // update the editor scripts submenu
        HMENU scriptsSubmenu = GetScriptsSubmenu(m_hMenuDefault);
-       if (scriptsSubmenu != NULL)
+       if (scriptsSubmenu != nullptr)
                CMergeEditView::createScriptsSubmenu(scriptsSubmenu);
        UpdatePrediffersMenu();
 }
@@ -1450,7 +1450,7 @@ CMergeEditView * CMainFrame::GetActiveMergeEditView()
        // and we can get a MergeEditView from it, if it is a CChildFrame
        // (DirViews use a different frame type)
        CChildFrame * pFrame = dynamic_cast<CChildFrame *>(GetActiveFrame());
-       if (!pFrame) return 0;
+       if (pFrame == nullptr) return nullptr;
        // Try to get the active MergeEditView (ie, left or right)
        if (pFrame->GetActiveView() != nullptr && pFrame->GetActiveView()->IsKindOf(RUNTIME_CLASS(CMergeEditView)))
        {
@@ -1462,17 +1462,17 @@ CMergeEditView * CMainFrame::GetActiveMergeEditView()
 void CMainFrame::UpdatePrediffersMenu()
 {
        CMenu* menu = GetMenu();
-       if (menu == NULL)
+       if (menu == nullptr)
        {
                return;
        }
 
        HMENU hMainMenu = menu->m_hMenu;
        HMENU prediffersSubmenu = GetPrediffersSubmenu(hMainMenu);
-       if (prediffersSubmenu != NULL)
+       if (prediffersSubmenu != nullptr)
        {
                CMergeEditView * pEditView = GetActiveMergeEditView();
-               if (pEditView)
+               if (pEditView != nullptr)
                        pEditView->createPrediffersSubmenu(prediffersSubmenu);
                else
                {
@@ -1802,12 +1802,12 @@ LRESULT CMainFrame::OnCopyData(WPARAM wParam, LPARAM lParam)
 LRESULT CMainFrame::OnUser1(WPARAM wParam, LPARAM lParam)
 {
        CFrameWnd * pFrame = GetActiveFrame();
-       if (pFrame)
+       if (pFrame != nullptr)
        {
                IMergeDoc *pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame->GetActiveDocument());
-               if (!pMergeDoc)
+               if (pMergeDoc == nullptr)
                        pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame);
-               if (pMergeDoc)
+               if (pMergeDoc != nullptr)
                        pMergeDoc->CheckFileChanged();
        }
        return 0;
@@ -1824,7 +1824,7 @@ void CMainFrame::OnWindowCloseAll()
        while (pChild)
        {
                CDocument* pDoc;
-               if ((pDoc = pChild->GetActiveDocument()) != NULL)
+               if ((pDoc = pChild->GetActiveDocument()) != nullptr)
                {
                        if (!pDoc->SaveModified())
                                return;
@@ -1879,7 +1879,7 @@ CMainFrame * GetMainFrame()
  */
 void CMainFrame::OnSaveProject()
 {
-       if (!m_pMenus[MENU_OPENVIEW])
+       if (m_pMenus[MENU_OPENVIEW] == nullptr)
                theApp.m_pOpenTemplate->m_hMenuShared = NewOpenViewMenu();
        COpenDoc *pOpenDoc = static_cast<COpenDoc *>(theApp.m_pOpenTemplate->CreateNewDocument());
 
@@ -1939,12 +1939,12 @@ void CMainFrame::OnActivateApp(BOOL bActive, HTASK hTask)
 #endif
 
        CFrameWnd * pFrame = GetActiveFrame();
-       if (pFrame)
+       if (pFrame != nullptr)
        {
                IMergeDoc *pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame->GetActiveDocument());
-               if (!pMergeDoc)
+               if (pMergeDoc == nullptr)
                        pMergeDoc = dynamic_cast<IMergeDoc *>(pFrame);
-               if (pMergeDoc)
+               if (pMergeDoc != nullptr)
                        PostMessage(WM_USER+1);
        }
 }
@@ -2055,7 +2055,7 @@ void CMainFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
 {
        CFrameWnd::OnUpdateFrameTitle(bAddToTitle);
        
-       if (m_wndTabBar.m_hWnd)
+       if (m_wndTabBar.m_hWnd != nullptr)
                m_wndTabBar.UpdateTabs();
 }
 
@@ -2399,7 +2399,7 @@ void CMainFrame::OnUpdateNoMRUs(CCmdUI* pCmdUI)
 {
        // append the MRU submenu
        HMENU hMenu = GetSubmenu(AfxGetMainWnd()->GetMenu()->m_hMenu, ID_FILE_NEW, false);
-       if (hMenu == NULL)
+       if (hMenu == nullptr)
                return;
        
        // empty the menu
@@ -2471,7 +2471,7 @@ void CMainFrame::ReloadMenu()
                }
 
                CFrameWnd *pActiveFrame = pMainFrame->GetActiveFrame();
-               if (pActiveFrame)
+               if (pActiveFrame != nullptr)
                {
                        if (pActiveFrame->IsKindOf(RUNTIME_CLASS(CChildFrame)))
                                pMainFrame->MDISetMenu(pNewMergeMenu, NULL);
@@ -2490,11 +2490,11 @@ void CMainFrame::ReloadMenu()
                // Don't delete the old menu
                // There is a bug in BCMenu or in Windows98 : the new menu does not
                // appear correctly if we destroy the old one
-               //                      if (pOldDefaultMenu)
+               //                      if (pOldDefaultMenu != nullptr)
                //                              pOldDefaultMenu->DestroyMenu();
-               //                      if (pOldMergeMenu)
+               //                      if (pOldMergeMenu != nullptr)
                //                              pOldMergeMenu->DestroyMenu();
-               //                      if (pOldDirMenu)
+               //                      if (pOldDirMenu = nullptr)
                //                              pOldDirMenu->DestroyMenu();
 
                // m_hMenuDefault is used to redraw the main menu when we close a child frame
index ece5859..cb61599 100644 (file)
@@ -153,10 +153,10 @@ BOOL CMergeApp::InitInstance()
        // Prevents DLL hijacking
        HMODULE hLibrary = GetModuleHandle(_T("kernel32.dll"));
        BOOL (WINAPI *pfnSetSearchPathMode)(DWORD) = (BOOL (WINAPI *)(DWORD))GetProcAddress(hLibrary, "SetSearchPathMode");
-       if (pfnSetSearchPathMode)
+       if (pfnSetSearchPathMode != nullptr)
                pfnSetSearchPathMode(0x00000001L /*BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE*/ | 0x00008000L /*BASE_SEARCH_PATH_PERMANENT*/);
        BOOL (WINAPI *pfnSetDllDirectoryA)(LPCSTR) = (BOOL (WINAPI *)(LPCSTR))GetProcAddress(hLibrary, "SetDllDirectoryA");
-       if (pfnSetDllDirectoryA)
+       if (pfnSetDllDirectoryA != nullptr)
                pfnSetDllDirectoryA("");
 
        JumpList::SetCurrentProcessExplicitAppUserModelID(L"Thingamahoochie.WinMerge");
@@ -243,13 +243,13 @@ BOOL CMergeApp::InitInstance()
        // UNICODE build, so will be the mutex name.
        wsprintf(szMutexName, _T("%s-%s"), CMainFrame::szClassName, szDesktopName);
        HANDLE hMutex = CreateMutex(NULL, FALSE, szMutexName);
-       if (hMutex)
+       if (hMutex != nullptr)
                WaitForSingleObject(hMutex, INFINITE);
        if (bSingleInstance && GetLastError() == ERROR_ALREADY_EXISTS)
        {
                // Activate previous instance and send commandline to it
                HWND hWnd = FindWindow(CMainFrame::szClassName, NULL);
-               if (hWnd)
+               if (hWnd != nullptr)
                {
                        if (IsIconic(hWnd))
                                ShowWindow(hWnd, SW_RESTORE);
@@ -296,13 +296,13 @@ BOOL CMergeApp::InitInstance()
                m_fontGUI.CreateFontIndirect(&ncm.lfMenuFont);
        }
 
-       if (m_pSyntaxColors)
+       if (m_pSyntaxColors != nullptr)
                Options::SyntaxColors::Load(GetOptionsMgr(), m_pSyntaxColors.get());
 
-       if (m_pMarkers)
+       if (m_pMarkers != nullptr)
                m_pMarkers->LoadFromRegistry();
 
-       if (m_pLineFilters)
+       if (m_pLineFilters != nullptr)
                m_pLineFilters->Initialize(GetOptionsMgr());
 
        // If there are no filters loaded, and there is filter string in previous
@@ -387,7 +387,7 @@ BOOL CMergeApp::InitInstance()
        CMainFrame* pMainFrame = new CMainFrame;
        if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
        {
-               if (hMutex)
+               if (hMutex != nullptr)
                {
                        ReleaseMutex(hMutex);
                        CloseHandle(hMutex);
@@ -402,7 +402,7 @@ BOOL CMergeApp::InitInstance()
        // Set the menu
        // Note : for Windows98 compatibility, use FromHandle and not Attach/Detach
        CMenu * pNewMenu = CMenu::FromHandle(pMainFrame->m_hMenuDefault);
-       pMainFrame->MDISetMenu(pNewMenu, NULL);
+       pMainFrame->MDISetMenu(pNewMenu, nullptr);
 
        // The main window has been initialized, so activate and update it.
        pMainFrame->ActivateFrame(cmdInfo.m_nCmdShow);
@@ -414,7 +414,7 @@ BOOL CMergeApp::InitInstance()
        if (!ParseArgsAndDoOpen(cmdInfo, pMainFrame) && bCommandLineInvoke)
                bContinue = false;
 
-       if (hMutex)
+       if (hMutex != nullptr)
                ReleaseMutex(hMutex);
 
        // If user wants to cancel the compare, close WinMerge
@@ -482,11 +482,11 @@ int CMergeApp::DoMessageBox( LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt )
        CWnd* pParentWnd = CWnd::GetActiveWindow();
        
        // Check whether an active window was retrieved successfully.
-       if ( pParentWnd == NULL )
+       if ( pParentWnd == nullptr )
        {
                // Try to retrieve a handle to the last active popup.
                CWnd * mainwnd = GetMainWnd();
-               if (mainwnd)
+               if (mainwnd != nullptr)
                        pParentWnd = mainwnd->GetLastActivePopup();
        }
 
@@ -812,7 +812,7 @@ void CMergeApp::ShowHelp(LPCTSTR helpLocation /*= NULL*/)
        String sPath = env::GetProgPath();
        LANGID LangId = GetLangId();
        sPath = paths::ConcatPath(sPath, DocsPath);
-       if (helpLocation == NULL)
+       if (helpLocation == nullptr)
        {
                if (paths::DoesPathExist(sPath) == paths::IS_EXISTING_FILE)
                        ::HtmlHelp(NULL, sPath.c_str(), HH_DISPLAY_TOC, NULL);
index 18af35c..32f01f7 100644 (file)
@@ -17,7 +17,7 @@ static Poco::FastMutex g_mutex;
 
 static Merge7zFormatMergePluginImpl *GetInstance()
 {
-       if (!g_pluginformat)
+       if (g_pluginformat == nullptr)
        {
                g_pluginformat = new Merge7zFormatMergePluginImpl();
                Poco::FastMutex::ScopedLock lock(g_mutex);
@@ -29,22 +29,22 @@ static Merge7zFormatMergePluginImpl *GetInstance()
 Merge7z::Format *Merge7zFormatMergePluginImpl::GuessFormat(const String& path)
 {
        Merge7zFormatMergePluginImpl *format = GetInstance();
-       PluginInfo *plugin = NULL;
+       PluginInfo *plugin = nullptr;
        if (format->m_infoUnpacker.m_PluginOrPredifferMode != PLUGIN_MANUAL)
                plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"FILE_FOLDER_PACK_UNPACK", path);
        else if (!format->m_infoUnpacker.m_PluginName.empty())
                plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"FILE_FOLDER_PACK_UNPACK", format->m_infoUnpacker.m_PluginName);
-       if (!plugin)
-               return NULL;
+       if (plugin == nullptr)
+               return nullptr;
        if (!plugin::InvokeIsFolder(path, plugin->m_lpDispatch))
-               return NULL;
+               return nullptr;
        format->m_plugin = plugin;
        return format;
 }
 
 HRESULT Merge7zFormatMergePluginImpl::DeCompressArchive(HWND, LPCTSTR path, LPCTSTR folder)
 {
-       if (!m_plugin)
+       if (m_plugin == nullptr)
                return E_FAIL;
        paths::CreateIfNeeded(path);
        int nChanged = 0;
@@ -56,13 +56,13 @@ HRESULT Merge7zFormatMergePluginImpl::CompressArchive(HWND, LPCTSTR path, Merge7
        return E_FAIL;
 }
 
-Merge7z::Format::Inspector *Merge7zFormatMergePluginImpl::Open(HWND, LPCTSTR) { return NULL; }
-Merge7z::Format::Updater *Merge7zFormatMergePluginImpl::Update(HWND, LPCTSTR) { return NULL; }
+Merge7z::Format::Inspector *Merge7zFormatMergePluginImpl::Open(HWND, LPCTSTR) { return nullptr; }
+Merge7z::Format::Updater *Merge7zFormatMergePluginImpl::Update(HWND, LPCTSTR) { return nullptr; }
 HRESULT Merge7zFormatMergePluginImpl::GetHandlerProperty(HWND, PROPID, PROPVARIANT *, VARTYPE) { return E_FAIL; }
-BSTR Merge7zFormatMergePluginImpl::GetHandlerName(HWND) { return NULL; }
-BSTR Merge7zFormatMergePluginImpl::GetHandlerClassID(HWND) { return NULL; }
-BSTR Merge7zFormatMergePluginImpl::GetHandlerExtension(HWND) { return NULL; }
-BSTR Merge7zFormatMergePluginImpl::GetHandlerAddExtension(HWND) { return NULL; }
+BSTR Merge7zFormatMergePluginImpl::GetHandlerName(HWND) { return nullptr; }
+BSTR Merge7zFormatMergePluginImpl::GetHandlerClassID(HWND) { return nullptr; }
+BSTR Merge7zFormatMergePluginImpl::GetHandlerExtension(HWND) { return nullptr; }
+BSTR Merge7zFormatMergePluginImpl::GetHandlerAddExtension(HWND) { return nullptr; }
 VARIANT_BOOL Merge7zFormatMergePluginImpl::GetHandlerUpdate(HWND) { return VARIANT_FALSE; }
 VARIANT_BOOL Merge7zFormatMergePluginImpl::GetHandlerKeepName(HWND) { return VARIANT_FALSE; }
 
index 4ba1ade..5875492 100644 (file)
@@ -136,7 +136,7 @@ CMergeDoc::CMergeDoc()
 , m_bHasSyncPoints(false)
 , m_bAutoMerged(false)
 , m_nGroups(0)
-, m_pView{0}
+, m_pView{nullptr}
 {
        DIFFOPTIONS options = {0};
 
@@ -162,7 +162,7 @@ CMergeDoc::CMergeDoc()
        Options::DiffOptions::Load(GetOptionsMgr(), options);
 
        m_diffWrapper.SetOptions(&options);
-       m_diffWrapper.SetPrediffer(NULL);
+       m_diffWrapper.SetPrediffer(nullptr);
 }
 
 /**
@@ -172,10 +172,10 @@ CMergeDoc::CMergeDoc()
  */
 CMergeDoc::~CMergeDoc()
 {      
-       if (m_pDirDoc)
+       if (m_pDirDoc != nullptr)
        {
                m_pDirDoc->MergeDocClosing(this);
-               m_pDirDoc = NULL;
+               m_pDirDoc = nullptr;
        }
 }
 
@@ -1654,7 +1654,7 @@ void CMergeDoc::OnFileSave()
        if (bChangedOriginal)
        {
                // If DirDoc contains diffs
-               if (m_pDirDoc && m_pDirDoc->HasDiffs())
+               if (m_pDirDoc != nullptr && m_pDirDoc->HasDiffs())
                {
                        for (int nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
                        {
@@ -1688,7 +1688,7 @@ void CMergeDoc::DoFileSave(int nBuffer)
        if (bModified && bSaveSuccess)
        {
                // If DirDoc contains compare results
-               if (m_pDirDoc && m_pDirDoc->HasDiffs())
+               if (m_pDirDoc != nullptr && m_pDirDoc->HasDiffs())
                {
                        for (int nBuffer1 = 0; nBuffer1 < m_nBuffers; nBuffer1++)
                        {
@@ -2267,7 +2267,7 @@ bool CMergeDoc::PromptAndSaveIfNeeded(bool bAllowCancel)
                 (bRModified && bRSaveSuccess))
        {
                // If directory compare has results
-               if (m_pDirDoc && m_pDirDoc->HasDiffs())
+               if (m_pDirDoc != nullptr && m_pDirDoc->HasDiffs())
                {
                        if (m_bEditAfterRescan[0] || m_bEditAfterRescan[1] || (m_nBuffers == 3 && m_bEditAfterRescan[2]))
                                FlushAndRescan(false);
@@ -2341,7 +2341,7 @@ CChildFrame * CMergeDoc::GetParentFrame()
 void CMergeDoc::DirDocClosing(CDirDoc * pDirDoc)
 {
        ASSERT(m_pDirDoc == pDirDoc);
-       m_pDirDoc = 0;
+       m_pDirDoc = nullptr;
        // TODO (Perry 2003-03-30): perhaps merge doc should close now ?
 }
 
@@ -2553,7 +2553,7 @@ bool CMergeDoc::OpenDocs(int nFiles, const FileLocation ifileloc[],
        if (std::find_if(nSuccess, nSuccess + m_nBuffers, [](DWORD d){return !FileLoadResult::IsOk(d);} ) != nSuccess + m_nBuffers)
        {
                CChildFrame *pFrame = GetParentFrame();
-               if (pFrame)
+               if (pFrame != nullptr)
                {
                        // Use verify macro to trap possible error in debug.
                        VERIFY(pFrame->DestroyWindow());
@@ -2630,7 +2630,7 @@ bool CMergeDoc::OpenDocs(int nFiles, const FileLocation ifileloc[],
        // Define the prediffer
        PackingInfo * infoUnpacker = nullptr;
        PrediffingInfo * infoPrediffer = nullptr;
-       if (bFiltersEnabled && m_pDirDoc)
+       if (bFiltersEnabled && m_pDirDoc != nullptr)
        {
                m_pDirDoc->GetPluginManager().FetchPluginInfos(m_strBothFilenames, &infoUnpacker, &infoPrediffer);
                m_diffWrapper.SetPrediffer(infoPrediffer);
@@ -2757,7 +2757,7 @@ bool CMergeDoc::OpenDocs(int nFiles, const FileLocation ifileloc[],
 
        // Force repaint of location pane to update it in case we had some warning
        // dialog visible and it got painted before files were loaded
-       if (m_pView[0][0])
+       if (m_pView[0][0] != nullptr)
                m_pView[0][0]->RepaintLocationPane();
 
        return true;
@@ -2888,7 +2888,7 @@ void CMergeDoc::SetTitle(LPCTSTR lpszTitle)
        String sTitle;
        String sFileName[3];
 
-       if (lpszTitle)
+       if (lpszTitle != nullptr)
                sTitle = lpszTitle;
        else
        {
@@ -3159,7 +3159,7 @@ bool CMergeDoc::GenerateReport(const String& sFileName) const
        // If archive, use archive path + folder + filename inside archive
        // If desc text given, use it
        PathContext paths = m_filePaths;
-       if (m_pDirDoc && m_pDirDoc->IsArchiveFolders())
+       if (m_pDirDoc != nullptr && m_pDirDoc->IsArchiveFolders())
        {
                for (int i = 0; i < paths.GetSize(); i++)
                        m_pDirDoc->ApplyDisplayRoot(i, paths[i]);
@@ -3216,13 +3216,13 @@ bool CMergeDoc::GenerateReport(const String& sFileName) const
                                String tdtag = _T("<td class=\"ln\">");
                                DWORD dwFlags = m_ptBuf[nBuffer]->GetLineFlags(idx[nBuffer]);
                                if (nBuffer == 0 && 
-                                    (dwFlags & (LF_DIFF | LF_GHOST)) && (idx[nBuffer] == 0 || 
-                                   !(m_ptBuf[nBuffer]->GetLineFlags(idx[nBuffer] - 1) & (LF_DIFF | LF_GHOST))))
+                                    (dwFlags & (LF_DIFF | LF_GHOST))!=0 && (idx[nBuffer] == 0 || 
+                                   (m_ptBuf[nBuffer]->GetLineFlags(idx[nBuffer] - 1) & (LF_DIFF | LF_GHOST))==0 ))
                                {
                                        ++nDiff;
                                        tdtag += strutils::format(_T("<a name=\"d%d\" href=\"#d%d\">.</a>"), nDiff, nDiff);
                                }
-                               if (!(dwFlags & LF_GHOST) && m_pView[0][nBuffer]->GetViewLineNumbers())
+                               if ((dwFlags & LF_GHOST)==0 && m_pView[0][nBuffer]->GetViewLineNumbers())
                                        tdtag += strutils::format(_T("%d</td>"), m_ptBuf[nBuffer]->ComputeRealLine(idx[nBuffer]) + 1);
                                else
                                        tdtag += _T("</td>");
index e3936a9..59d13c7 100644 (file)
@@ -660,7 +660,7 @@ void CMergeEditView::GetLineColors2(int nLineIndex, DWORD ignoreFlags, COLORREF
 void CMergeEditView::UpdateSiblingScrollPos (bool bHorz)
 {
        CSplitterWnd *pSplitterWnd = GetParentSplitter (this, false);
-       if (pSplitterWnd != NULL)
+       if (pSplitterWnd != nullptr)
        {
                //  See CSplitterWnd::IdFromRowCol() implementation for details
                int nCurrentRow = (GetDlgCtrlID () - AFX_IDW_PANE_FIRST) / 16;
@@ -678,7 +678,7 @@ void CMergeEditView::UpdateSiblingScrollPos (bool bHorz)
 //                     for (int nCol = 0; nCol < nCols; nCol++)
 //                     {
 //                             CMergeEditView *pSiblingView = static_cast<CMergeEditView*>(GetSiblingView (nRow, nCol));
-//                             if (pSiblingView != NULL)
+//                             if (pSiblingView != nullptr)
 //                                     if (pSiblingView->GetSubLineCount() <= newTopSubLine)
 //                                             newTopSubLine = pSiblingView->GetSubLineCount()-1;
 //                     }
@@ -693,7 +693,7 @@ void CMergeEditView::UpdateSiblingScrollPos (bool bHorz)
                                if (!(nRow == nCurrentRow && nCol == nCurrentCol))  //  We don't need to update ourselves
                                {
                                        CMergeEditView *pSiblingView = static_cast<CMergeEditView*>(GetSiblingView (nRow, nCol));
-                                       if (pSiblingView != NULL && pSiblingView->m_nThisGroup == m_nThisGroup)
+                                       if (pSiblingView != nullptr && pSiblingView->m_nThisGroup == m_nThisGroup)
                                                pSiblingView->OnUpdateSibling (this, bHorz);
                                }
                        }
@@ -773,7 +773,7 @@ void CMergeEditView::OnDisplayDiff(int nDiff /*=0*/)
        CSplitterWnd *pSplitterWnd = GetParentSplitter(this, false);
 
        // pSplitterWnd is NULL if WinMerge started minimized.
-       if (pSplitterWnd != NULL)
+       if (pSplitterWnd != nullptr)
        {
                int nRows = pSplitterWnd->GetRowCount ();
                int nCols = pSplitterWnd->GetColumnCount ();
@@ -782,7 +782,7 @@ void CMergeEditView::OnDisplayDiff(int nDiff /*=0*/)
                        for (int nCol = 0; nCol < nCols; nCol++)
                        {
                                CMergeEditView *pSiblingView = static_cast<CMergeEditView*>(GetSiblingView (nRow, nCol));
-                               if (pSiblingView != NULL)
+                               if (pSiblingView != nullptr)
                                        pSiblingView->OnDisplayDiff(nDiff);
                        }
                }
@@ -1153,7 +1153,7 @@ void CMergeEditView::OnUpdateNextdiff(CCmdUI* pCmdUI)
        const DIFFRANGE * dfi = pd->m_diffList.LastSignificantDiffRange();
        bool enabled;
 
-       if (!dfi)
+       if (dfi == nullptr)
        {
                // There aren't any significant differences
                enabled = false;
@@ -1244,7 +1244,7 @@ void CMergeEditView::OnUpdatePrevdiff(CCmdUI* pCmdUI)
        const DIFFRANGE * dfi = pd->m_diffList.FirstSignificantDiffRange();
        bool enabled;
 
-       if (!dfi)
+       if (dfi == nullptr)
        {
                // There aren't any significant differences
                enabled = false;
@@ -1355,7 +1355,7 @@ void CMergeEditView::OnUpdateNext3wayDiff(CCmdUI* pCmdUI, int nDiffType)
 
        const DIFFRANGE * dfi = pd->m_diffList.LastSignificant3wayDiffRange(nDiffType);
 
-       if (!dfi)
+       if (dfi == nullptr)
        {
                // There aren't any significant differences
                pCmdUI->Enable(false);
@@ -1437,7 +1437,7 @@ void CMergeEditView::OnUpdatePrev3wayDiff(CCmdUI* pCmdUI, int nDiffType)
 
        const DIFFRANGE * dfi = pd->m_diffList.FirstSignificant3wayDiffRange(nDiffType);
 
-       if (!dfi)
+       if (dfi == nullptr)
        {
                // There aren't any significant differences
                pCmdUI->Enable(false);
@@ -1973,7 +1973,7 @@ void CMergeEditView::OnEditOperation(int nAction, LPCTSTR pszText, size_t cchTex
                                if (nPane == m_nThisPane)
                                        continue;
                                CCrystalEditView *pView = GetGroupView(nPane);
-                               if (pView)
+                               if (pView != nullptr)
                                        pView->Invalidate();
                        }
                }
@@ -3081,8 +3081,8 @@ void CMergeEditView::GotoLine(UINT nLine, bool bRealLine, int pane)
 {
        CMergeDoc *pDoc = GetDocument();
        CSplitterWnd *pSplitterWnd = GetParentSplitter(this, false);
-       CMergeEditView *pCurrentView = NULL;
-       if (pSplitterWnd)
+       CMergeEditView *pCurrentView = nullptr;
+       if (pSplitterWnd != nullptr)
                pCurrentView = static_cast<CMergeEditView*>
                        (pSplitterWnd->GetActivePane());
 
@@ -3145,7 +3145,7 @@ void CMergeEditView::GotoLine(UINT nLine, bool bRealLine, int pane)
  */
 void CMergeEditView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
 {
-       if (pScrollBar == NULL)
+       if (pScrollBar == nullptr)
        {
                // Scroll did not come frome a scroll bar
                // Find the appropriate scroll bar
@@ -3166,7 +3166,7 @@ void CMergeEditView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
  */
 void CMergeEditView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
 {
-       if (pScrollBar == NULL)
+       if (pScrollBar == nullptr)
        {
                // Scroll did not come frome a scroll bar
                // Find the appropriate scroll bar
@@ -3306,7 +3306,7 @@ void CMergeEditView::RepaintLocationPane()
 {
        // Must force recalculation due to caching of data in location pane.
        CLocationView *pLocationView = GetDocument()->GetLocationView();
-       if (pLocationView)
+       if (pLocationView != nullptr)
                pLocationView->ForceRecalculate();
 }
 
@@ -3396,7 +3396,7 @@ void CMergeEditView::OnSize(UINT nType, int cx, int cy)
                for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++) 
                {
                        CMergeEditView *pView = GetGroupView(nPane);
-                       if (pView)
+                       if (pView != nullptr)
                                pView->InvalidateScreenRect(false);
                }
        }
@@ -3405,7 +3405,7 @@ void CMergeEditView::OnSize(UINT nType, int cx, int cy)
                for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++) 
                {
                        CMergeEditView *pView = GetGroupView(nPane);
-                       if (pView)
+                       if (pView != nullptr)
                                pView->Invalidate();
                }
        }
@@ -3539,7 +3539,7 @@ int CMergeEditView::GetEmptySubLines( int nLineIndex )
        for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++) 
        {
                CMergeEditView *pView = GetGroupView(nPane);
-               if (pView)
+               if (pView != nullptr)
                {
                        if (nLineIndex >= pView->GetLineCount())
                                return 0;
@@ -3567,7 +3567,7 @@ void CMergeEditView::InvalidateSubLineIndexCache( int nLineIndex )
        for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++) 
        {
                CMergeEditView *pView = GetGroupView(nPane);
-               if (pView)
+               if (pView != nullptr)
                        pView->CCrystalTextView::InvalidateSubLineIndexCache( nLineIndex );
        }
 }
@@ -3692,12 +3692,12 @@ void CMergeEditView::UpdateLocationViewPosition(int nTopLine /*=-1*/,
                int nBottomLine /*= -1*/)
 {
        CMergeDoc *pDoc = GetDocument();
-       if (pDoc == NULL)
+       if (pDoc == nullptr)
                return;
 
        CLocationView *pLocationView = pDoc->GetLocationView();
 
-       if (pLocationView != NULL && IsWindow(pLocationView->GetSafeHwnd()))
+       if (pLocationView != nullptr && IsWindow(pLocationView->GetSafeHwnd()))
        {
                pLocationView->UpdateVisiblePos(nTopLine, nBottomLine);
        }