OSDN Git Service

Various refactorings involving NULL, ASSERT, TRUE and FALSE (4)
authorGreyMerlin <greymerlin7@gmail.com>
Thu, 25 Oct 2018 00:07:58 +0000 (17:07 -0700)
committerGreyMerlin <greymerlin7@gmail.com>
Sun, 28 Oct 2018 15:00:29 +0000 (08:00 -0700)
More of the same...

52 files changed:
Externals/crystaledit/editlib/ccrystaltextbuffer.cpp
Externals/crystaledit/editlib/ccrystaltextbuffer.h
Externals/crystaledit/editlib/ccrystaltextview.cpp
Externals/crystaledit/editlib/ccrystaltextview.h
Externals/crystaledit/editlib/crystaleditviewex.cpp
Externals/crystaledit/editlib/crystaleditviewex.h
Externals/crystaledit/editlib/crystalparser.h
Externals/crystaledit/editlib/registry.cpp
Externals/crystaledit/editlib/registry.h
Src/Common/Picture.cpp
Src/Common/Picture.h
Src/Common/PreferencesDlg.cpp
Src/Common/PreferencesDlg.h
Src/Common/PropertyPageHost.cpp
Src/Common/PropertyPageHost.h
Src/Common/ShellContextMenu.h
Src/Common/ShellFileOperations.cpp
Src/Common/ShellFileOperations.h
Src/Common/VersionInfo.cpp
Src/Common/VersionInfo.h
Src/Common/memdc.h
Src/Common/multiformatText.h
Src/CompareStatisticsDlg.cpp
Src/CompareStatisticsDlg.h
Src/ConfirmFolderCopyDlg.cpp
Src/ConfirmFolderCopyDlg.h
Src/DiffList.cpp
Src/DiffList.h
Src/DiffTextBuffer.cpp
Src/DiffTextBuffer.h
Src/DiffViewBar.cpp
Src/DiffViewBar.h
Src/DirActions.h
Src/DirCmpReportDlg.cpp
Src/DirCmpReportDlg.h
Src/DirColsDlg.cpp
Src/DirColsDlg.h
Src/DirDoc.h
Src/DirView.cpp
Src/DirView.h
Src/Environment.cpp
Src/Environment.h
Src/Exceptions.h
Src/FileOrFolderSelect.cpp
Src/FileOrFolderSelect.h
Src/FileTransform.cpp
Src/FileTransform.h
Src/GhostTextBuffer.cpp
Src/GhostTextBuffer.h
Src/GhostTextView.cpp
Src/GhostTextView.h
Src/IListCtrlImpl.h

index 30513c3..f239ae8 100644 (file)
@@ -868,7 +868,7 @@ GetTextWithoutEmptys(int nStartLine, int nStartChar,
 
 void CCrystalTextBuffer::
 GetText (int nStartLine, int nStartChar, int nEndLine, int nEndChar,
-               CString & text, LPCTSTR pszCRLF /*= NULL*/, bool bExcludeInvisibleLines/*= true*/) const
+               CString & text, LPCTSTR pszCRLF /*= nullptr*/, bool bExcludeInvisibleLines/*= true*/) const
 {
   ASSERT (m_bInit);             //  Text buffer not yet initialized.
   //  You must call InitNew() or LoadFromFile() first!
@@ -1258,7 +1258,7 @@ CanRedo () const
 }
 
 POSITION CCrystalTextBuffer::
-GetUndoActionCode (int & nAction, POSITION pos /*= NULL*/ ) const
+GetUndoActionCode (int & nAction, POSITION pos /*= nullptr*/ ) const
 {
   ASSERT (CanUndo ());          //  Please call CanUndo() first
 
@@ -1295,7 +1295,7 @@ GetUndoActionCode (int & nAction, POSITION pos /*= NULL*/ ) const
 }
 
 POSITION CCrystalTextBuffer::
-GetRedoActionCode (int & nAction, POSITION pos /*= NULL*/ ) const
+GetRedoActionCode (int & nAction, POSITION pos /*= nullptr*/ ) const
 {
   ASSERT (CanRedo ());          //  Please call CanRedo() before!
 
@@ -1303,7 +1303,7 @@ GetRedoActionCode (int & nAction, POSITION pos /*= NULL*/ ) const
   ASSERT ((m_aUndoBuf[m_nUndoPosition].m_dwFlags & UNDO_BEGINGROUP) != 0);
 
   intptr_t nPosition;
-  if (pos == NULL)
+  if (pos == nullptr)
     {
       //  Start from beginning
       nPosition = m_nUndoPosition;
@@ -1336,7 +1336,7 @@ GetRedoActionCode (int & nAction, POSITION pos /*= NULL*/ ) const
 }
 
 POSITION CCrystalTextBuffer::
-GetUndoDescription (CString & desc, POSITION pos /*= NULL*/ ) const
+GetUndoDescription (CString & desc, POSITION pos /*= nullptr*/ ) const
 {
   int nAction;
   POSITION retValue = GetUndoActionCode(nAction, pos);
@@ -1349,7 +1349,7 @@ GetUndoDescription (CString & desc, POSITION pos /*= NULL*/ ) const
 }
 
 POSITION CCrystalTextBuffer::
-GetRedoDescription (CString & desc, POSITION pos /*= NULL*/ ) const
+GetRedoDescription (CString & desc, POSITION pos /*= nullptr*/ ) const
 {
   int nAction;
   POSITION retValue = GetRedoActionCode(nAction, pos);
@@ -1491,8 +1491,8 @@ Redo (CCrystalTextView * pSource, CPoint & ptCursorPos)
 
 void CCrystalTextBuffer::                      /* virtual base */
 AddUndoRecord (bool bInsert, const CPoint & ptStartPos,
-    const CPoint & ptEndPos, LPCTSTR pszText, size_t cchText, int nActionType,
-    CDWordArray *paSavedRevisionNumbers)
+    const CPoint & ptEndPos, LPCTSTR pszText, size_t cchText, int nActionType /*= CE_ACTION_UNKNOWN*/,
+    CDWordArray *paSavedRevisionNumbers /*= nullptr*/)
 {
   //  Forgot to call BeginUndoGroup()?
   ASSERT (m_bUndoGroup);
index 65d7322..a997057 100644 (file)
@@ -179,7 +179,7 @@ public :
 
     //  [JRT] Support For Descriptions On Undo/Redo Actions
     virtual void AddUndoRecord (bool bInsert, const CPoint & ptStartPos, const CPoint & ptEndPos,
-                                LPCTSTR pszText, size_t cchText, int nActionType = CE_ACTION_UNKNOWN, CDWordArray *paSavedRevisionNumbers = NULL);
+                                LPCTSTR pszText, size_t cchText, int nActionType = CE_ACTION_UNKNOWN, CDWordArray *paSavedRevisionNumbers = nullptr);
     virtual UndoRecord GetUndoRecord (int nUndoPos) const;
 
     virtual CDWordArray *CopyRevisionNumbers(int nStartLine, int nEndLine) const;
@@ -231,7 +231,7 @@ public :
     void SetLineFlag (int nLine, DWORD dwFlag, bool bSet,
             bool bRemoveFromPreviousLine = true, bool bUpdate=true);
     void GetText (int nStartLine, int nStartChar, int nEndLine, int nEndChar,
-            CString & text, LPCTSTR pszCRLF = NULL, bool bExcludeInvisibleLines = true) const;
+            CString & text, LPCTSTR pszCRLF = nullptr, bool bExcludeInvisibleLines = true) const;
     virtual void GetTextWithoutEmptys (int nStartLine, int nStartChar,
             int nEndLine, int nEndChar, CString &text,
             CRLFSTYLE nCrlfStyle = CRLF_STYLE_AUTOMATIC, bool bExcludeInvisibleLines = true) const;
@@ -275,10 +275,10 @@ public :
 
 
     //  Browse undo sequence
-    POSITION GetUndoActionCode (int & nAction, POSITION pos = NULL) const;
-    POSITION GetRedoActionCode (int & nAction, POSITION pos = NULL) const;
-    POSITION GetUndoDescription (CString & desc, POSITION pos = NULL) const;
-    POSITION GetRedoDescription (CString & desc, POSITION pos = NULL) const;
+    POSITION GetUndoActionCode (int & nAction, POSITION pos = nullptr) const;
+    POSITION GetRedoActionCode (int & nAction, POSITION pos = nullptr) const;
+    POSITION GetUndoDescription (CString & desc, POSITION pos = nullptr) const;
+    POSITION GetRedoDescription (CString & desc, POSITION pos = nullptr) const;
 
     //  Notify all connected views about changes in name of file
     CCrystalTextView::TextDefinition *RetypeViews (LPCTSTR lpszFileName);
index 20b94c8..0a131ba 100644 (file)
@@ -2900,11 +2900,11 @@ OnInitialUpdate ()
 // CCrystalTextView printing
 
 void CCrystalTextView::
-OnPrepareDC (CDC * pDC, CPrintInfo * pInfo)
+OnPrepareDC (CDC * pDC, CPrintInfo * pInfo /*= nullptr*/)
 {
   CView::OnPrepareDC (pDC, pInfo);
 
-  if (pInfo != NULL)
+  if (pInfo != nullptr)
     {
       pInfo->m_bContinuePrinting = true;
       if (m_nPrintPages != 0 && (int) pInfo->m_nCurPage > m_nPrintPages)
@@ -3297,8 +3297,8 @@ GetViewableLineLength (int nLineIndex) const
 LPCTSTR CCrystalTextView::
 GetLineChars (int nLineIndex) const
 {
-  if (m_pTextBuffer == NULL)
-    return NULL;
+  if (m_pTextBuffer == nullptr)
+    return nullptr;
   return m_pTextBuffer->GetLineChars (nLineIndex);
 }
 
@@ -3309,24 +3309,24 @@ GetLineChars (int nLineIndex) const
  * no need to reset the editor options (m_bOvrMode, m_bLastReplace)
  */
 void CCrystalTextView::
-ReAttachToBuffer (CCrystalTextBuffer * pBuf /*= NULL*/ )
+ReAttachToBuffer (CCrystalTextBuffer * pBuf /*= nullptr*/ )
 {
-  if (m_pTextBuffer != NULL)
+  if (m_pTextBuffer != nullptr)
     m_pTextBuffer->RemoveView (this);
-  if (pBuf == NULL)
+  if (pBuf == nullptr)
     {
       pBuf = LocateTextBuffer ();
       //  ...
     }
   m_pTextBuffer = pBuf;
-  if (m_pTextBuffer != NULL)
+  if (m_pTextBuffer != nullptr)
     m_pTextBuffer->AddView (this);
   // don't reset CCrystalEditView options
   CCrystalTextView::ResetView ();
 
   //  Init scrollbars arrows
   CScrollBar *pVertScrollBarCtrl = GetScrollBarCtrl (SB_VERT);
-  if (pVertScrollBarCtrl != NULL)
+  if (pVertScrollBarCtrl != nullptr)
     pVertScrollBarCtrl->EnableScrollBar (GetScreenLines () >= GetLineCount ()?
                                          ESB_DISABLE_BOTH : ESB_ENABLE_BOTH);
   //  Update vertical scrollbar only
@@ -3338,27 +3338,27 @@ ReAttachToBuffer (CCrystalTextBuffer * pBuf /*= NULL*/ )
  * initialize the view and initialize both scrollbars
  */
 void CCrystalTextView::
-AttachToBuffer (CCrystalTextBuffer * pBuf /*= NULL*/ )
+AttachToBuffer (CCrystalTextBuffer * pBuf /*= nullptr*/ )
 {
-  if (m_pTextBuffer != NULL)
+  if (m_pTextBuffer != nullptr)
     m_pTextBuffer->RemoveView (this);
-  if (pBuf == NULL)
+  if (pBuf == nullptr)
     {
       pBuf = LocateTextBuffer ();
       //  ...
     }
   m_pTextBuffer = pBuf;
-  if (m_pTextBuffer != NULL)
+  if (m_pTextBuffer != nullptr)
     m_pTextBuffer->AddView (this);
   ResetView ();
 
   //  Init scrollbars
   CScrollBar *pVertScrollBarCtrl = GetScrollBarCtrl (SB_VERT);
-  if (pVertScrollBarCtrl != NULL)
+  if (pVertScrollBarCtrl != nullptr)
     pVertScrollBarCtrl->EnableScrollBar (GetScreenLines () >= GetLineCount ()?
                                          ESB_DISABLE_BOTH : ESB_ENABLE_BOTH);
   CScrollBar *pHorzScrollBarCtrl = GetScrollBarCtrl (SB_HORZ);
-  if (pHorzScrollBarCtrl != NULL)
+  if (pHorzScrollBarCtrl != nullptr)
     pHorzScrollBarCtrl->EnableScrollBar (GetScreenChars () >= GetMaxLineLength (m_nTopLine, GetScreenLines())?
                                          ESB_DISABLE_BOTH : ESB_ENABLE_BOTH);
 
@@ -5582,7 +5582,7 @@ GetViewLineNumbers () const
  * @return Margin area width in pixels.
  */
 int CCrystalTextView::
-GetMarginWidth (CDC *pdc)
+GetMarginWidth (CDC *pdc /*= nullptr*/)
 {
   int nMarginWidth = 0;
 
@@ -5600,12 +5600,12 @@ GetMarginWidth (CDC *pdc)
 
   if (m_bSelMargin)
     {
-      if (pdc == NULL || !pdc->IsPrinting ())
+      if (pdc == nullptr || !pdc->IsPrinting ())
         nMarginWidth += MARGIN_ICON_WIDTH  + 7;  // Width for icon markers and some margin
     }
   else
     {
-      if (pdc == NULL || !pdc->IsPrinting ())
+      if (pdc == nullptr || !pdc->IsPrinting ())
         nMarginWidth += MARGIN_REV_WIDTH; // Space for revision marks
     }
 
index 8c0981e..25bfeb6 100644 (file)
@@ -227,7 +227,7 @@ protected :
     CPoint m_ptDraggedTextBegin, m_ptDraggedTextEnd;
     void UpdateCaret ();
     void SetAnchor (const CPoint & ptNewAnchor);
-    int GetMarginWidth (CDC *pdc = NULL);
+    int GetMarginWidth (CDC *pdc = nullptr);
     bool IsValidTextPos (const CPoint &point);
     bool IsValidTextPosX (const CPoint &point);
     bool IsValidTextPosY (const CPoint &point);
@@ -522,7 +522,7 @@ protected:
        not exceed (except whitespaces)
 
        @param anBreaks An array of integers. Put the positions where to wrap the line
-       in that array (its allready allocated). If this pointer is NULL, the function
+       in that array (its allready allocated). If this pointer is `nullptr`, the function
        has only to compute the number of breaks (the parameter nBreaks).
 
        @param nBreaks The number of breaks this line has (number of sublines - 1). When
@@ -540,7 +540,7 @@ protected:
        method). This function uses an internal cache which contains the number
        of sublines for each line, so it has only to call WrapLine(), if the
        cache for the given line is invalid or if the caller wants to get the
-       wrap postions (anBreaks != NULL).
+       wrap postions (anBreaks != nullptr).
 
        This functions also tests m_bWordWrap -- you can call it even if
        word wrapping is disabled and you will retrieve a valid value.
@@ -551,7 +551,7 @@ protected:
        not exceed (except whitespaces)
 
        @param anBreaks An array of integers. Put the positions where to wrap the line
-       in that array (its allready allocated). If this pointer is NULL, the function
+       in that array (its allready allocated). If this pointer is `nullptr`, the function
        has only to compute the number of breaks (the parameter nBreaks).
 
        @param nBreaks The number of breaks this line has (number of sublines - 1). When
@@ -730,9 +730,9 @@ public :
        /**
        Sets the Parser to use to parse the file.
 
-       @param pParser Pointer to parser to use. Set to NULL to use no parser.
+       @param pParser Pointer to parser to use. Set to `nullptr` to use no parser.
 
-       @return Pointer to parser used before or NULL, if no parser has been used before.
+       @return Pointer to parser used before or `nullptr`, if no parser has been used before.
        */
        CCrystalParser *SetParser( CCrystalParser *pParser );
        //END SW
@@ -836,8 +836,8 @@ public :
 
     // Operations
 public :
-    virtual void ReAttachToBuffer (CCrystalTextBuffer * pBuf = NULL);
-    virtual void AttachToBuffer (CCrystalTextBuffer * pBuf = NULL);
+    virtual void ReAttachToBuffer (CCrystalTextBuffer * pBuf = nullptr);
+    virtual void AttachToBuffer (CCrystalTextBuffer * pBuf = nullptr);
     virtual void DetachFromBuffer ();
 
     //  Buffer-view interaction, multiple views
@@ -879,7 +879,7 @@ public :
 
     virtual BOOL PreCreateWindow (CREATESTRUCT & cs);
     virtual BOOL PreTranslateMessage (MSG * pMsg);
-    virtual void OnPrepareDC (CDC * pDC, CPrintInfo * pInfo = NULL);
+    virtual void OnPrepareDC (CDC * pDC, CPrintInfo * pInfo = nullptr);
     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO *pHandlerInfo);
 protected :
     virtual void OnInitialUpdate ();  // called first time after construct
index 1d5085e..45f7515 100644 (file)
@@ -16,7 +16,7 @@ IMPLEMENT_DYNCREATE(CCrystalEditViewEx,CCrystalEditView)
 CCrystalEditViewEx::CCrystalEditViewEx()
 : CCrystalEditView()
 {
-       m_pSyntaxParser = NULL;
+       m_pSyntaxParser = nullptr;
 }
 
 
@@ -34,7 +34,7 @@ HINSTANCE CCrystalEditViewEx::GetResourceHandle()
 DWORD CCrystalEditViewEx::ParseLine( DWORD dwCookie, int nLineIndex, 
                                                                                                                                                TEXTBLOCK *pBuf, int &nActualItems )
 {
-       if( m_pSyntaxParser )
+       if( m_pSyntaxParser != nullptr )
        {
                CCrystalTextBlock       *pTextBlock = 
                        pBuf? new CCrystalTextBlock( (CCrystalTextBlock::TEXTBLOCK*)pBuf, nActualItems ) : NULL;
@@ -56,7 +56,7 @@ CCrystalParser *CCrystalEditViewEx::SetSyntaxParser( CCrystalParser *pParser )
 
        m_pSyntaxParser = pParser;
 
-       if( pParser )
+       if( pParser != nullptr )
   //BEGIN FP
     pParser->m_pTextView = this;
                /*ORIGINAL
index 1e335cc..c0eb8c0 100644 (file)
@@ -30,7 +30,7 @@ public:
 \r
        @return\r
                The syntax parser that was used until the call to this function or\r
-               NULL if no one was attached to this view.\r
+               `nullptr` if no one was attached to this view.\r
        */\r
        CCrystalParser *SetSyntaxParser( CCrystalParser *pParser );\r
 \r
@@ -66,7 +66,7 @@ protected:
                color. You have to specifie each one of this blocks in this Buffer.\r
                You can define a new Block with the macro DEFINE_BLOCK( pos, colorindex ).\r
 \r
-               When the function ist called with this parameter set zu NULL, you only\r
+               When the function is called with this parameter set to `nullptr`, you only\r
                have to calculate the cookies.\r
        @param nActualItems\r
                Used by the macro DEFINE_BLOCK.\r
@@ -81,7 +81,7 @@ protected:
 protected:\r
        /**\r
        @description\r
-               The parser used to parse the Text or NULL if no parser is used.\r
+               The parser used to parse the Text or `nullptr` if no parser is used.\r
        */\r
        CCrystalParser *m_pSyntaxParser;\r
 };\r
index 7d1635f..ae2b5e5 100644 (file)
@@ -60,7 +60,7 @@ public:
                this block array, using CTextBlock::Add(). You do not have to care about
                the sort to add the elements.
 
-               When the function ist called with this parameter set zu NULL, you only
+               When the function is called with this parameter set to `nullptr`, you only
                have to calculate the cookies which can be (hoply) done much more faster.
 
        @return The calculated flags for this line (see dwCookie).
@@ -83,7 +83,7 @@ public:
        not exceed
 
        @param anBreaks An array of integers. Put the positions where to wrap the line
-       in that array (its allready allocated). If this pointer is NULL, the function
+       in that array (its allready allocated). If this pointer is `nullptr`, the function
        has only to compute the number of breaks (the parameter nBreaks).
 
        @param nBreaks The number of breaks this line has (number of sublines - 1). When
index 36f0c7b..83ed148 100644 (file)
@@ -1176,7 +1176,7 @@ HKEY CReg::Connect (HKEY hNewKey, LPCTSTR pszRemote)
 }
 
 /* connect to registry key */
-HKEY CReg::Open (HKEY hNewKey /*= NULL*/)
+HKEY CReg::Open (HKEY hNewKey /*= nullptr*/)
 {
   return hKey = hNewKey;
 }
@@ -1190,12 +1190,12 @@ HKEY CReg::Open (HKEY hNewKey, LPCTSTR pszSubKey, DWORD dwRights)
 /* close computer registry */
 void CReg::Close ()
 {
-  if (hKey != NULL) // MAB 8 Nov 1999 - added NULL test
+  if (hKey != nullptr) // MAB 8 Nov 1999 - added NULL test
     {
       RegClose (hKey);
       //*** MIPO 07-12-1999 - After Closing the Key, hKey must by NULL ****
       // RegClose - dont do that - it must be done manualy
-      hKey = NULL;
+      hKey = nullptr;
     }
 }
 
index 5873f42..7aa14a0 100644 (file)
@@ -261,7 +261,7 @@ struct EDITPADC_CLASS CReg
     HKEY Connect (HKEY hNewKey, LPCTSTR pszRemote);
     
     /* connect to registry key */
-    HKEY Open (HKEY hNewKey = NULL);
+    HKEY Open (HKEY hNewKey = nullptr);
     
     /* open computer registry */
     HKEY Open (HKEY hNewKey, LPCTSTR pszSubKey, DWORD dwRights);
index 7ce38ae..1eb84b1 100644 (file)
@@ -101,7 +101,7 @@ bool CPicture::Load(IStream* pstm)
 //////////////////
 // Render to device context. Covert to HIMETRIC for IPicture.
 //
-bool CPicture::Render(CDC* pDC, CRect rc, LPCRECT prcMFBounds) const
+bool CPicture::Render(CDC* pDC, CRect rc /*= CRect(0,0,0,0)*/, LPCRECT prcMFBounds /*= nullptr*/) const
 {
        ASSERT(pDC != nullptr);
 
@@ -121,16 +121,16 @@ bool CPicture::Render(CDC* pDC, CRect rc, LPCRECT prcMFBounds) const
 //////////////////
 // Get image size in pixels. Converts from HIMETRIC to device coords.
 //
-CSize CPicture::GetImageSize(CDC* pDC) const
+CSize CPicture::GetImageSize(CDC* pDC /*= nullptr*/) const
 {
-       if (!m_spIPicture)
+       if (m_spIPicture == nullptr)
                return CSize(0,0);
        
        LONG hmWidth, hmHeight; // HIMETRIC units
        if (FAILED(m_spIPicture->get_Width(&hmWidth)) || FAILED(m_spIPicture->get_Height(&hmHeight)))
                return CSize(0, 0);
        CSize sz(hmWidth,hmHeight);
-       if (pDC==NULL) {
+       if (pDC==nullptr) {
                CWindowDC dc(nullptr);
                dc.HIMETRICtoDP(&sz); // convert to pixels
        } else {
index 015d5cb..9387a70 100644 (file)
@@ -25,9 +25,9 @@ public:
 
        // render to device context
        bool Render(CDC* pDC, CRect rc=CRect(0,0,0,0),
-               LPCRECT prcMFBounds=NULL) const;
+               LPCRECT prcMFBounds=nullptr) const;
 
-       CSize GetImageSize(CDC* pDC=NULL) const;
+       CSize GetImageSize(CDC* pDC=nullptr) const;
 
        operator IPicture*() {
                return m_spIPicture;
index 88a7464..c8ef461 100644 (file)
@@ -35,7 +35,7 @@ static TCHAR OptionsHelpLocation[] = _T("::/htmlhelp/Configuration.html");
 const TCHAR PATHDELIM = '>';
 
 CPreferencesDlg::CPreferencesDlg(COptionsMgr *regOptions, SyntaxColors *colors,
-               UINT nMenuID, CWnd* pParent)   // standard constructor
+               UINT nMenuID /*= 0*/, CWnd* pParent /*= nullptr*/)   // standard constructor
 : CTrDialog(IDD_PREFERENCES, pParent)
 , m_pOptionsMgr(regOptions)
 , m_pageGeneral(regOptions)
index b5b7d5d..e6a571b 100644 (file)
@@ -38,9 +38,9 @@ class CPreferencesDlg : public CTrDialog
 {
 // Construction
 public:
-       //CPreferencesDlg(UINT nMenuID = 0, CWnd* pParent = NULL);   // standard constructor
+       //CPreferencesDlg(UINT nMenuID = 0, CWnd* pParent = nullptr);   // standard constructor
        CPreferencesDlg(COptionsMgr *optionsMgr, SyntaxColors *colors,
-               UINT nMenuID = 0, CWnd* pParent = NULL);   // standard constructor
+               UINT nMenuID = 0, CWnd* pParent = nullptr);   // standard constructor
        virtual ~CPreferencesDlg();
 
        void SetSyntaxColors(SyntaxColors *pColors);
index 82bdf2c..4c3cd98 100644 (file)
@@ -186,7 +186,7 @@ bool CPropertyPageHost::SetActivePage(CPropertyPage* pPage, bool bAndFocus /*= t
        return SetActivePage(FindPage(pPage));
 }
 
-bool CPropertyPageHost::AddPage(CPropertyPage* pPage, LPCTSTR szTitle, DWORD dwItemData)
+bool CPropertyPageHost::AddPage(CPropertyPage* pPage, LPCTSTR szTitle /*= nullptr*/, DWORD dwItemData /*= 0*/)
 {
        if (!pPage || !pPage->IsKindOf(RUNTIME_CLASS(CPropertyPage)))
                return FALSE;
index 23da419..20c26ee 100644 (file)
@@ -16,7 +16,7 @@
 
 struct PAGEITEM
 {
-       PAGEITEM(CPropertyPage* _pPage = NULL, LPCTSTR szTitle = NULL, DWORD dwData = 0) : 
+       PAGEITEM(CPropertyPage* _pPage = nullptr, LPCTSTR szTitle = nullptr, DWORD dwData = 0) : 
                        pPage(_pPage), sTitle(szTitle), dwItemData(dwData) {}
 
        CPropertyPage* pPage;
@@ -37,7 +37,7 @@ public:
        
        int GetActiveIndex();
        CPropertyPage* GetActivePage();
-       bool AddPage(CPropertyPage* pPage, LPCTSTR szTitle = NULL, DWORD dwItemData = 0);
+       bool AddPage(CPropertyPage* pPage, LPCTSTR szTitle = nullptr, DWORD dwItemData = 0);
        bool SetActivePage(int nIndex, bool bAndFocus = true);
        bool SetActivePage(CPropertyPage* pPage, bool bAndFocus = true);
        int GetPageCount() { return (int) m_aPages.GetSize(); }
index 254963a..8f479fb 100644 (file)
@@ -128,7 +128,7 @@ public:
         *                      Menu is created in constructor and does not normally change when requesting context menu via RequeryShellContextMenu()
         *                      It may though change if destroyed by someone. In this case it should be recreated in RequeryShellContextMenu()
         *
-        * @retval      NULL    If handle is destroyed by parent menu, but not yet recreated by RequeryShellContextMenu()
+        * @retval      nullptr If handle is destroyed by parent menu, but not yet recreated by RequeryShellContextMenu()
         */
        HMENU GetHMENU() const;
 
index 29980fc..03da88b 100644 (file)
@@ -149,7 +149,7 @@ size_t ShellFileOperations::CountStringSize(bool source) const
  * @param [in] parentWindow Window getting notifications.
  */
 void ShellFileOperations::SetOperation(UINT operation, FILEOP_FLAGS flags,
-               HWND parentWindow /*= NULL*/)
+               HWND parentWindow /*= nullptr*/)
 {
        m_function = operation;
        m_flags = flags;
index ecc94ec..78782c9 100644 (file)
@@ -39,7 +39,7 @@ public:
        void AddSourceAndDestination(const String &source, const String &destination);
        void AddSource(const String &source);
        void SetDestination(const String &destination);
-       void SetOperation(UINT operation, FILEOP_FLAGS flags, HWND parentWindow = NULL);
+       void SetOperation(UINT operation, FILEOP_FLAGS flags, HWND parentWindow = nullptr);
        bool Run();
        bool IsCanceled() const;
        void Reset();
index c840dff..f15e11e 100644 (file)
@@ -65,7 +65,7 @@ CVersionInfo::CVersionInfo(LPCTSTR szFileToVersion,
 , m_bVersionOnly(false)
 , m_bDllVersion(bDllVersion)
 {
-       if (szFileToVersion != NULL)
+       if (szFileToVersion != nullptr)
                m_strFileName = szFileToVersion;
        GetVersionInfo();
 }
@@ -76,18 +76,18 @@ CVersionInfo::CVersionInfo(LPCTSTR szFileToVersion,
  * @param [in] szLanguage Language for version.
  * @param [in] szCodePage Codepage for version.
  */
-CVersionInfo::CVersionInfo(LPCTSTR szFileToVersion /* = NULL*/, 
-                                                  LPCTSTR szLanguage /* = NULL*/,
-                                                  LPCTSTR szCodepage /* = NULL*/)
+CVersionInfo::CVersionInfo(LPCTSTR szFileToVersion /* = nullptr*/, 
+                                                  LPCTSTR szLanguage /* = nullptr*/,
+                                                  LPCTSTR szCodepage /* = nullptr*/)
 : m_wLanguage(0)
 , m_bVersionOnly(false)
 , m_bDllVersion(false)
 {
-       if (szFileToVersion != NULL)
+       if (szFileToVersion != nullptr)
                m_strFileName = szFileToVersion;
-       if (szLanguage != NULL)
+       if (szLanguage != nullptr)
                m_strLanguage = szLanguage;
-       if (szCodepage != NULL)
+       if (szCodepage != nullptr)
                m_strCodepage = szCodepage;
        GetVersionInfo();
 }
index 59e403e..e62b395 100644 (file)
@@ -47,9 +47,9 @@ public:
        explicit CVersionInfo(WORD wLanguage);
        CVersionInfo(LPCTSTR szFileToVersion,
                                   bool bDllVersion);
-       CVersionInfo(LPCTSTR szFileToVersion = NULL,
-                                  LPCTSTR szLanguage = NULL,
-                                  LPCTSTR szCodepage = NULL);
+       CVersionInfo(LPCTSTR szFileToVersion = nullptr,
+                                  LPCTSTR szLanguage = nullptr,
+                                  LPCTSTR szCodepage = nullptr);
        explicit CVersionInfo(HINSTANCE hModule);
        String GetFileVersion() const;
        String GetCompanyName() const;
index 45a5406..5f33cbd 100644 (file)
@@ -89,7 +89,7 @@ public:
                        // All we need to do is replace the DC with an illegal value,
                        // this keeps us from accidently deleting the handles associated with
                        // the CDC that was passed to the constructor.                  
-                       m_hDC = m_hAttribDC = NULL;
+                       m_hDC = m_hAttribDC = nullptr;
                }       
        }
        
index bb1725f..f597794 100644 (file)
@@ -80,7 +80,7 @@ public:
                        newFilename = GetDataFileUnicode();
                else
                        newFilename = GetDataFileAnsi();
-               if (newFilename == NULL)
+               if (newFilename == nullptr)
                {
                        GetLastValidFile(filename);
                        return false;
index a204ba3..7efc150 100644 (file)
@@ -33,7 +33,7 @@
 
 IMPLEMENT_DYNAMIC(CompareStatisticsDlg, CTrDialog)
 
-CompareStatisticsDlg::CompareStatisticsDlg(const CompareStats* pStats, CWnd* pParent /*=NULL*/) :
+CompareStatisticsDlg::CompareStatisticsDlg(const CompareStats* pStats, CWnd* pParent /*= nullptr*/) :
        m_pCompareStats(pStats),
        CTrDialog(pStats->GetCompareDirs() < 3 ? IDD_COMPARE_STATISTICS : IDD_COMPARE_STATISTICS3, pParent)
 {
index 8eeba22..22f4e89 100644 (file)
@@ -35,7 +35,7 @@ class CompareStatisticsDlg : public CTrDialog
        DECLARE_DYNAMIC(CompareStatisticsDlg)
 
 public:
-       CompareStatisticsDlg(const CompareStats * pStats, CWnd* pParent = NULL);   // standard constructor
+       CompareStatisticsDlg(const CompareStats * pStats, CWnd* pParent = nullptr);   // standard constructor
 
 // Dialog Data
        //{{AFX_DATA(CompareStatisticsDlg)
index 5f71203..ee39cb5 100644 (file)
@@ -31,7 +31,7 @@
 // ConfirmFolderCopyDlg dialog
 
 IMPLEMENT_DYNAMIC(ConfirmFolderCopyDlg, CTrDialog)
-ConfirmFolderCopyDlg::ConfirmFolderCopyDlg(CWnd* pParent /*=NULL*/)
+ConfirmFolderCopyDlg::ConfirmFolderCopyDlg(CWnd* pParent /*= nullptr*/)
        : CTrDialog(ConfirmFolderCopyDlg::IDD, pParent)
 {
 }
index e03ede6..65a1aec 100644 (file)
@@ -33,7 +33,7 @@ class ConfirmFolderCopyDlg : public CTrDialog
        DECLARE_DYNAMIC(ConfirmFolderCopyDlg)
 
 public:
-       explicit ConfirmFolderCopyDlg(CWnd* pParent = NULL);   // standard constructor
+       explicit ConfirmFolderCopyDlg(CWnd* pParent = nullptr);   // standard constructor
        virtual ~ConfirmFolderCopyDlg();
 
 // Dialog Data
index ec86bf5..46fb7e5 100644 (file)
@@ -922,22 +922,22 @@ void DiffList::GetExtraLinesCounts(int nFiles, int extras[3])
        }
 }
 
-void DiffList::AppendDiffList(const DiffList& list, int offset[], int doffset)
+void DiffList::AppendDiffList(const DiffList& list, int offset[] /*= nullptr*/, int doffset /*= 0*/)
 {
        for (std::vector<DiffRangeInfo>::const_iterator it = list.m_diffs.begin(); it != list.m_diffs.end(); ++it)
        {
                DIFFRANGE dr = *it;
                for (int file = 0; file < 3; ++file)
                {
-                       if (offset)
+                       if (offset != nullptr)
                        {
                                dr.begin[file] += offset[file];
                                dr.end[file] += offset[file];
                        }
-                       if (doffset)
+                       if (doffset != 0)
                                dr.blank[file] += doffset;
                }
-               if (doffset)
+               if (doffset != 0)
                {
                        dr.dbegin += doffset;
                        dr.dend += doffset;
index a8a7d63..913a63b 100644 (file)
@@ -170,7 +170,7 @@ public:
 
        std::vector<DiffRangeInfo>& GetDiffRangeInfoVector() { return m_diffs; }
 
-       void AppendDiffList(const DiffList& list, int offset[] = NULL, int doffset = 0);
+       void AppendDiffList(const DiffList& list, int offset[] = nullptr, int doffset = 0);
 
 private:
        std::vector<DiffRangeInfo> m_diffs; /**< Difference list. */
index 78911d3..8d6ec48 100644 (file)
@@ -194,7 +194,7 @@ void CDiffTextBuffer::                      /* virtual override */
 AddUndoRecord(bool bInsert, const CPoint & ptStartPos,
                const CPoint & ptEndPos, LPCTSTR pszText, size_t cchText,
                int nActionType /*= CE_ACTION_UNKNOWN*/,
-               CDWordArray *paSavedRevisionNumbers)
+               CDWordArray *paSavedRevisionNumbers /*= nullptr*/)
 {
        CGhostTextBuffer::AddUndoRecord(bInsert, ptStartPos, ptEndPos, pszText,
                cchText, nActionType, paSavedRevisionNumbers);
index 39167b3..ad8ff78 100644 (file)
@@ -45,7 +45,7 @@ public :
        virtual void AddUndoRecord (bool bInsert, const CPoint & ptStartPos,
                const CPoint & ptEndPos, LPCTSTR pszText, size_t cchText,
                int nActionType = CE_ACTION_UNKNOWN,
-               CDWordArray *paSavedRevisionNumbers = NULL) override;
+               CDWordArray *paSavedRevisionNumbers = nullptr) override;
        bool curUndoGroup();
        void ReplaceFullLines(CDiffTextBuffer& dbuf, CDiffTextBuffer& sbuf, CCrystalTextView * pSource, int nLineBegin, int nLineEnd, int nAction =CE_ACTION_UNKNOWN);
 
index 857394a..8e813f8 100644 (file)
@@ -49,9 +49,9 @@ END_MESSAGE_MAP()
 */
 BOOL CDiffViewBar::Create(
        CWnd* pParentWnd,
-       LPCTSTR lpszWindowName,
-       DWORD dwStyle,
-       UINT nID)
+       LPCTSTR lpszWindowName /*= nullptr*/,
+       DWORD dwStyle /*= WS_CHILD | WS_VISIBLE | CBRS_TOP*/,
+       UINT nID /*= AFX_IDW_PANE_FIRST*/)
 {
        return TViewBarBase::Create(
                lpszWindowName,
index 268933d..0095a42 100644 (file)
@@ -20,7 +20,7 @@ public:
        virtual ~CDiffViewBar();
        virtual BOOL Create(
                CWnd* pParentWnd,                       // mandatory
-               LPCTSTR lpszWindowName = NULL,
+               LPCTSTR lpszWindowName = nullptr,
                DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP,
                UINT nID = AFX_IDW_PANE_FIRST);
 
index 93384a6..5d81f3b 100644 (file)
@@ -217,7 +217,7 @@ struct DirActions
        typedef bool (DirActions::*method_type2)(const DIFFITEM& di) const;
        typedef FileActionScript *(DirActions::*method_type)(FileActionScript *, const std::pair<int, const DIFFITEM *>& it) const;
 
-       DirActions(const CDiffContext& ctxt, const bool RO[], method_type func = NULL, method_type2 func2 = NULL) : 
+       DirActions(const CDiffContext& ctxt, const bool RO[], method_type func = nullptr, method_type2 func2 = nullptr) : 
                m_ctxt(ctxt), m_RO(RO), m_cur_method(func), m_cur_method2(func2) {}
 
        template <SIDE_TYPE src, SIDE_TYPE dst>
index cc43fea..2847de0 100644 (file)
@@ -19,7 +19,7 @@ IMPLEMENT_DYNAMIC(DirCmpReportDlg, CTrDialog)
 /**
  * @brief Constructor.
  */
-DirCmpReportDlg::DirCmpReportDlg(CWnd* pParent /*=NULL*/)
+DirCmpReportDlg::DirCmpReportDlg(CWnd* pParent /*= nullptr*/)
        : CTrDialog(DirCmpReportDlg::IDD, pParent)
        , m_bCopyToClipboard(false)
        , m_bIncludeFileCmpReport(false)
index 4287ea1..cddf365 100644 (file)
@@ -21,7 +21,7 @@ class DirCmpReportDlg : public CTrDialog
        DECLARE_DYNAMIC(DirCmpReportDlg)
 
 public:
-       explicit DirCmpReportDlg(CWnd* pParent = NULL);   // standard constructor
+       explicit DirCmpReportDlg(CWnd* pParent = nullptr);   // standard constructor
 
 // Dialog Data
        enum { IDD = IDD_DIRCMP_REPORT };
index c8f2fa4..04e884c 100644 (file)
@@ -22,7 +22,7 @@
  * @brief Default dialog constructor.
  * @param [in] pParent Dialog's parent component (window).
  */
-CDirColsDlg::CDirColsDlg(CWnd* pParent /*=NULL*/)
+CDirColsDlg::CDirColsDlg(CWnd* pParent /*= nullptr*/)
        : CTrDialog(CDirColsDlg::IDD, pParent)
        , m_bReset(false)
 {
index 1d5bb81..79917d7 100644 (file)
@@ -44,7 +44,7 @@ public:
 
 // Construction
 public:
-       explicit CDirColsDlg(CWnd* pParent = NULL);   // standard constructor
+       explicit CDirColsDlg(CWnd* pParent = nullptr);   // standard constructor
        void AddColumn(const String & name, const String & desc, int log, int phy=-1)
                { column c(name, desc, log, phy); m_cols.push_back(c); }
        void AddDefColumn(const String & name, int log, int phy=-1)
index 9da0f9d..c7a9cb1 100644 (file)
@@ -87,7 +87,7 @@ public:
        void SetReportFile(const String& sReportFile) { m_sReportFile = sReportFile; }
        bool GetGeneratingReport() const { return m_bGeneratingReport; }
        void SetGeneratingReport(bool bGeneratingReport) { m_bGeneratingReport = bGeneratingReport; }
-       bool HasDirView() const { return m_pDirView != NULL; }
+       bool HasDirView() const { return m_pDirView != nullptr; }
        void RefreshOptions();
        void CompareReady();
        void UpdateChangedItem(PathContext & paths,
@@ -109,7 +109,7 @@ public:
        void SetDescriptions(const String strDesc[]);
        void ApplyDisplayRoot(int nIndex, String &);
 
-       bool HasDiffs() const { return m_pCtxt != NULL; }
+       bool HasDiffs() const { return m_pCtxt != nullptr; }
        const CDiffContext & GetDiffContext() const { return *m_pCtxt; }
        CDiffContext& GetDiffContext() { return *m_pCtxt.get(); }
        void SetMarkedRescan() {m_bMarkedRescan = true; }
index bb20686..1ffac4b 100644 (file)
@@ -2315,31 +2315,31 @@ BOOL CDirView::OnChildNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* p
 /**
  * @brief User is starting to drag a column header
  */
-BOOL CDirView::OnHeaderBeginDrag(LPNMHEADER hdr, LRESULT* pResult)
+bool CDirView::OnHeaderBeginDrag(LPNMHEADER hdr, LRESULT* pResult)
 {
        // save column widths before user reorders them
        // so we can reload them on the end drag
        String secname = GetDocument()->m_nDirs < 3 ? _T("DirView") : _T("DirView3");
        theApp.WriteProfileString(secname.c_str(), _T("ColumnWidths"),
                m_pColItems->SaveColumnWidths(std::bind(&CListCtrl::GetColumnWidth, m_pList, _1)).c_str());
-       return TRUE;
+       return true;
 }
 
 /**
  * @brief User just finished dragging a column header
  */
-BOOL CDirView::OnHeaderEndDrag(LPNMHEADER hdr, LRESULT* pResult)
+bool CDirView::OnHeaderEndDrag(LPNMHEADER hdr, LRESULT* pResult)
 {
        int src = hdr->iItem;
        int dest = hdr->pitem->iOrder;
-       bool allowDrop = TRUE;
-       *pResult = !allowDrop;
+       bool allowDrop = true;
+       *pResult = allowDrop ? FALSE : TRUE;
        if (allowDrop && src != dest && dest != -1)
        {
                m_pColItems->MoveColumn(src, dest);
                InitiateSort();
        }
-       return TRUE;
+       return true;
 }
 
 /**
index b0efc5d..df1eb60 100644 (file)
@@ -383,8 +383,8 @@ protected:
        afx_msg void OnBnClickedComparisonContinue();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
-       BOOL OnHeaderBeginDrag(LPNMHEADER hdr, LRESULT* pResult);
-       BOOL OnHeaderEndDrag(LPNMHEADER hdr, LRESULT* pResult);
+       bool OnHeaderBeginDrag(LPNMHEADER hdr, LRESULT* pResult);
+       bool OnHeaderEndDrag(LPNMHEADER hdr, LRESULT* pResult);
 
 private:
        void OpenSelection(SELECTIONTYPE selectionType = SELECTIONTYPE_NORMAL, PackingInfo * infoUnpacker = nullptr);
index c3d2897..1f2cd7b 100644 (file)
@@ -63,7 +63,7 @@ String GetTemporaryPath()
  * @param [out] pnerr Error code if error happened.
  * @return Full path for temporary file or empty string if error happened.
  */
-String GetTemporaryFileName(const String& lpPathName, const String& lpPrefixString, int * pnerr)
+String GetTemporaryFileName(const String& lpPathName, const String& lpPrefixString, int * pnerr /*= nullptr*/)
 {
        TCHAR buffer[MAX_PATH] = {0};
        if (lpPathName.length() > MAX_PATH-14)
index 84c38a2..c8d4371 100644 (file)
@@ -13,7 +13,7 @@ namespace env
 void SetTemporaryPath(const String& path);
 String GetTemporaryPath();
 String GetTemporaryFileName(const String& lpPathName, const String& lpPrefixString,
-               int * pnerr = NULL);
+               int * pnerr = nullptr);
 String GetTempChildPath();
 void SetProgPath(const String& path);
 String GetProgPath();
index 308fa89..befb29b 100644 (file)
@@ -87,13 +87,13 @@ public:
                // don't localize this as we do not localize the known exceptions
                return _T("Unknown structured exception");
        }
-       virtual bool GetErrorMessage( TCHAR *lpszError, unsigned nMaxError, unsigned *pnHelpContext = NULL )
+       virtual bool GetErrorMessage( TCHAR *lpszError, unsigned nMaxError, unsigned *pnHelpContext = nullptr )
        {
                StringCchPrintf(lpszError, nMaxError, _T("Exception %s (0x%.8x)"), getSeMessage(), static_cast<unsigned>(getSeNumber()));
                return true;
        }
 #else
-       virtual bool GetErrorMessage( TCHAR *lpszError, unsigned nMaxError, unsigned *pnHelpContext = NULL )
+       virtual bool GetErrorMessage( TCHAR *lpszError, unsigned nMaxError, unsigned *pnHelpContext = nullptr )
        {
                return true;
        }
index 96bec53..3cb35cb 100644 (file)
@@ -48,7 +48,7 @@ static String LastSelectedFolder;
  * file or folder to open or file to save. The last parameter @p is_open selects
  * between open or save modes. Biggest difference is that in save-mode Windows
  * asks if user wants to override existing file.
- * @param [in] parent Handle to parent window. Can be a NULL, but then
+ * @param [in] parent Handle to parent window. Can be `nullptr`, but then
  *     CMainFrame is used which can cause modality problems.
  * @param [out] path Selected path is returned in this string
  * @param [in] initialPath Initial path (and file) shown when dialog is opened
@@ -56,13 +56,13 @@ static String LastSelectedFolder;
  * @param [in] filterid 0 or STRING ID for filter string
  *     - 0 means "All files (*.*)". Note the string formatting!
  * @param [in] is_open Selects Open/Save -dialog (mode).
- * @note Be careful when setting @p parent to NULL as there are potential
+ * @note Be careful when setting @p parent to `nullptr` as there are potential
  * modality problems with this. Dialog can be lost behind other windows!
  * @param [in] defaultExtension Extension to append if user doesn't provide one
  */
 bool SelectFile(HWND parent, String& path, bool is_open /*= true*/,
-               LPCTSTR initialPath /*=NULL*/, const String& stitle /*=_T("")*/,
-               const String& sfilter /*=_T("")*/, LPCTSTR defaultExtension /*=NULL*/)
+               LPCTSTR initialPath /*= nullptr*/, const String& stitle /*=_T("")*/,
+               const String& sfilter /*=_T("")*/, LPCTSTR defaultExtension /*= nullptr*/)
 {
        path.clear(); // Clear output param
 
@@ -100,13 +100,13 @@ bool SelectFile(HWND parent, String& path, bool is_open /*= true*/,
        OPENFILENAME_NT4 ofn = { sizeof OPENFILENAME_NT4 };
        ofn.hwndOwner = parent;
        ofn.lpstrFilter = filtersStr;
-       ofn.lpstrCustomFilter = NULL;
+       ofn.lpstrCustomFilter = nullptr;
        ofn.nFilterIndex = 1;
        ofn.lpstrFile = sSelectedFile;
        ofn.nMaxFile = MAX_PATH_FULL;
        ofn.lpstrInitialDir = initialPath;
        ofn.lpstrTitle = title.c_str();
-       ofn.lpstrFileTitle = NULL;
+       ofn.lpstrFileTitle = nullptr;
        if (defaultExtension)
                ofn.lpstrDefExt = defaultExtension;
        ofn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR;
@@ -132,22 +132,22 @@ bool SelectFile(HWND parent, String& path, bool is_open /*= true*/,
  * @param [in] hwndOwner Handle to owner window or NULL
  * @return `true` if valid folder selected (not cancelled)
  */
-bool SelectFolder(String& path, LPCTSTR root_path /*=NULL*/, 
+bool SelectFolder(String& path, LPCTSTR root_path /*= nullptr*/, 
                        const String& stitle /*=_T("")*/, 
-                       HWND hwndOwner /*=NULL*/) 
+                       HWND hwndOwner /*= nullptr*/) 
 {
        BROWSEINFO bi;
        LPITEMIDLIST pidl;
        TCHAR szPath[MAX_PATH_FULL] = {0};
        bool bRet = false;
        String title = stitle;
-       if (root_path == NULL)
+       if (root_path == nullptr)
                LastSelectedFolder.clear();
        else
                LastSelectedFolder = root_path;
 
        bi.hwndOwner = hwndOwner;
-       bi.pidlRoot = NULL;  // Start from desktop folder
+       bi.pidlRoot = nullptr;  // Start from desktop folder
        bi.pszDisplayName = szPath;
        bi.lpszTitle = title.c_str();
        bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_USENEWUI | BIF_VALIDATE;
@@ -155,7 +155,7 @@ bool SelectFolder(String& path, LPCTSTR root_path /*=NULL*/,
        bi.lParam = (LPARAM)root_path;
 
        pidl = SHBrowseForFolder(&bi);
-       if (pidl)
+       if (pidl != nullptr)
        {
                if (SHGetPathFromIDList(pidl, szPath))
                {
@@ -206,13 +206,13 @@ static int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam,
  * - If existing filename is selected return it
  * - If filename in (CFileDialog) editbox and current folder doesn't form
  * a valid path to file, return current folder.
- * @param [in] parent Handle to parent window. Can be a NULL, but then
+ * @param [in] parent Handle to parent window. Can be `nullptr`, but then
  *     CMainFrame is used which can cause modality problems.
  * @param [out] path Selected folder/filename
  * @param [in] initialPath Initial file or folder shown/selected.
  * @return `true` if user choosed a file/folder, `false` if user canceled dialog.
  */
-bool SelectFileOrFolder(HWND parent, String& path, LPCTSTR initialPath /*=NULL*/)
+bool SelectFileOrFolder(HWND parent, String& path, LPCTSTR initialPath /*= nullptr*/)
 {
        String title = _("Open");
 
@@ -221,7 +221,7 @@ bool SelectFileOrFolder(HWND parent, String& path, LPCTSTR initialPath /*=NULL*/
        TCHAR sSelectedFile[MAX_PATH_FULL];
 
        // check if specified path is a file
-       if (initialPath && initialPath[0])
+       if (initialPath!=nullptr && initialPath[0] != '\0')
        {
                // If initial path info includes a file
                // we put the bare filename into sSelectedFile
index ef3df2e..4e5fcd3 100644 (file)
 #include "UnicodeString.h"
 
 bool SelectFile(HWND parent, String& path, bool is_open = true,
-                       LPCTSTR initialPath = NULL, const String& stitle = _T(""),
-                       const String& sfilter = _T(""), LPCTSTR defaultExtension = NULL);
+                       LPCTSTR initialPath = nullptr, const String& stitle = _T(""),
+                       const String& sfilter = _T(""), LPCTSTR defaultExtension = nullptr);
 
-bool SelectFolder(String& path, LPCTSTR root_path = NULL
+bool SelectFolder(String& path, LPCTSTR root_path = nullptr
                         const String& title = _T(""),
-                        HWND hwndOwner = NULL);
+                        HWND hwndOwner = nullptr);
 
-bool SelectFileOrFolder(HWND parent, String& path, LPCTSTR root_path = NULL);
+bool SelectFileOrFolder(HWND parent, String& path, LPCTSTR root_path = nullptr);
index 627705d..b1ea3ef 100644 (file)
@@ -62,9 +62,9 @@ bool Packing(String & filepath, PackingInfo handler)
        bool bHandled = false;
 
        PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"FILE_PACK_UNPACK", handler.pluginName);
-       if (plugin == NULL)
+       if (plugin == nullptr)
                plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"FILE_FOLDER_PACK_UNPACK", handler.pluginName);
-       if (plugin == NULL)
+       if (plugin == nullptr)
                plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"BUFFER_PACK_UNPACK", handler.pluginName);
        LPDISPATCH piScript = plugin->m_lpDispatch;
        if (handler.bWithFile)
@@ -106,7 +106,7 @@ bool Packing(String & filepath, PackingInfo handler)
 bool Unpacking(String & filepath, const PackingInfo * handler, int * handlerSubcode)
 {
        // no handler : return true
-       if (!handler || handler->pluginName.empty())
+       if (handler == nullptr || handler->pluginName.empty())
                return true;
 
        storageForPlugins bufferData;
@@ -119,11 +119,11 @@ bool Unpacking(String & filepath, const PackingInfo * handler, int * handlerSubc
        bool bHandled = false;
 
        PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"FILE_PACK_UNPACK", handler->pluginName);
-       if (plugin == NULL)
+       if (plugin == nullptr)
                plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"FILE_FOLDER_PACK_UNPACK", handler->pluginName);
-       if (plugin == NULL)
+       if (plugin == nullptr)
                plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"BUFFER_PACK_UNPACK", handler->pluginName);
-       if (plugin == NULL)
+       if (plugin == nullptr)
                return false;
 
        LPDISPATCH piScript = plugin->m_lpDispatch;
@@ -188,9 +188,9 @@ bool Unpacking(String & filepath, const String& filteredText, PackingInfo * hand
        bool bHandled = false;
 
        PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"FILE_PACK_UNPACK", filteredText);
-       if (!plugin)
+       if (plugin == nullptr)
                plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"FILE_FOLDER_PACK_UNPACK", filteredText);
-       if (plugin)
+       if (plugin != nullptr)
        {
                handler->pluginName = plugin->m_name;
                handler->bWithFile = true;
@@ -211,7 +211,7 @@ bool Unpacking(String & filepath, const String& filteredText, PackingInfo * hand
        if (!bHandled)
        {
                plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"BUFFER_PACK_UNPACK", filteredText);
-               if (plugin)
+               if (plugin != nullptr)
                {
                        handler->pluginName = plugin->m_name;
                        handler->bWithFile = false;
@@ -275,10 +275,10 @@ bool Prediffing(String & filepath, PrediffingInfo handler, bool bMayOverwrite)
        bool bHandled = false;
 
        PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"FILE_PREDIFF", handler.pluginName);
-       if (!plugin)
+       if (plugin == nullptr)
        {
                plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(L"BUFFER_PREDIFF", handler.pluginName);
-               if (!plugin)
+               if (plugin == nullptr)
                        return false;
        }
        LPDISPATCH piScript = plugin->m_lpDispatch;
@@ -333,7 +333,7 @@ bool Prediffing(String & filepath, const String& filteredText, PrediffingInfo *
        bool bHandled = false;
 
        PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"FILE_PREDIFF", filteredText);
-       if (plugin)
+       if (plugin != nullptr)
        {
                handler->pluginName = plugin->m_name;
                handler->bWithFile = true;
@@ -351,7 +351,7 @@ bool Prediffing(String & filepath, const String& filteredText, PrediffingInfo *
        if (!bHandled)
        {
                plugin = CAllThreadsScripts::GetActiveSet()->GetAutomaticPluginByFilter(L"BUFFER_PREDIFF", filteredText);
-               if (plugin)
+               if (plugin != nullptr)
                {
                        handler->pluginName = plugin->m_name;
                        handler->bWithFile = false;
index 942eb1f..9421cc9 100644 (file)
@@ -84,7 +84,8 @@ public:
        int bToBeScanned; // TODO: Convert to PLUGIN_MODE and fix compile errors
        /// plugin name when it is defined
        String pluginName;
-       /// `true` is the plugins exchange data through a file, false is the data is passed as parameter (BSTR/ARRAY)
+
+       /// `true` if the plugins exchange data through a file, `false` is the data is passed as parameter (BSTR/ARRAY)
        bool    bWithFile;
 };
 
index f7139a3..844a2f8 100644 (file)
@@ -836,7 +836,7 @@ void CGhostTextBuffer::                     /* virtual override */
 AddUndoRecord(bool bInsert, const CPoint & ptStartPos,
        const CPoint & ptEndPos, LPCTSTR pszText, size_t cchText,
        int nActionType /*= CE_ACTION_UNKNOWN*/,
-       CDWordArray *paSavedRevisionNumbers)
+       CDWordArray *paSavedRevisionNumbers /*= nullptr*/)
 {
        CPoint real_ptStartPos(ptStartPos.x, ComputeRealLine(ptStartPos.y));
        CPoint real_ptEndPos(ptEndPos.x, real_ptStartPos.y + CountEol(pszText, cchText));
index e60d9fa..ee08aa8 100644 (file)
@@ -90,7 +90,7 @@ public :
 #endif
 
        virtual void AddUndoRecord (bool bInsert, const CPoint & ptStartPos, const CPoint & ptEndPos,
-                                   LPCTSTR pszText, size_t cchText, int nActionType = CE_ACTION_UNKNOWN, CDWordArray *paSavedRevisionNumbers = NULL) override;
+                                   LPCTSTR pszText, size_t cchText, int nActionType = CE_ACTION_UNKNOWN, CDWordArray *paSavedRevisionNumbers = nullptr) override;
        virtual UndoRecord GetUndoRecord(int nUndoPos) const override;
        virtual bool UndoInsert(CCrystalTextView * pSource, CPoint & ptCursorPos,
                                                        const CPoint apparent_ptStartPos, CPoint const apparent_ptEndPos, const UndoRecord & ur) override;
index b50983f..59ea8ca 100644 (file)
@@ -46,9 +46,9 @@ CGhostTextView::CGhostTextView()
 }
 
 void CGhostTextView::
-ReAttachToBuffer (CCrystalTextBuffer * pBuf /*= NULL*/ )
+ReAttachToBuffer (CCrystalTextBuffer * pBuf /*= nullptr*/ )
 {
-       if (pBuf == NULL)
+       if (pBuf == nullptr)
        {
                pBuf = LocateTextBuffer ();
                // ...
@@ -58,9 +58,9 @@ ReAttachToBuffer (CCrystalTextBuffer * pBuf /*= NULL*/ )
 }
 
 void CGhostTextView::
-AttachToBuffer (CCrystalTextBuffer * pBuf /*= NULL*/ )
+AttachToBuffer (CCrystalTextBuffer * pBuf /*= nullptr*/ )
 {
-       if (pBuf == NULL)
+       if (pBuf == nullptr)
        {
                pBuf = LocateTextBuffer ();
                // ...
@@ -72,8 +72,8 @@ AttachToBuffer (CCrystalTextBuffer * pBuf /*= NULL*/ )
 void CGhostTextView::
 DetachFromBuffer ()
 {
-       if (m_pGhostTextBuffer != NULL)
-               m_pGhostTextBuffer = NULL;
+       if (m_pGhostTextBuffer != nullptr)
+               m_pGhostTextBuffer = nullptr;
        CCrystalEditViewEx::DetachFromBuffer();
 }
 
index 5c34c8d..019ce78 100644 (file)
@@ -93,8 +93,8 @@ private:
        //   m_ptDropPos : only used inside one function which does not change the buffer
 
 public:
-       virtual void ReAttachToBuffer (CCrystalTextBuffer * pBuf = NULL);
-       virtual void AttachToBuffer (CCrystalTextBuffer * pBuf = NULL);
+       virtual void ReAttachToBuffer (CCrystalTextBuffer * pBuf = nullptr);
+       virtual void AttachToBuffer (CCrystalTextBuffer * pBuf = nullptr);
        virtual void DetachFromBuffer ();
 
        /** real cursor function to preserve cursor during Rescan */
index 4c003ff..99a6e68 100644 (file)
@@ -123,7 +123,7 @@ public:
                        bmpinfo.bmiHeader.biPlanes = 1;\r
                        bmpinfo.bmiHeader.biBitCount = 32;\r
                        bmpinfo.bmiHeader.biCompression = BI_RGB;\r
-                       HBITMAP hbmpImage = CreateDIBSection(NULL, &bmpinfo, DIB_RGB_COLORS, &pBits, NULL, NULL);\r
+                       HBITMAP hbmpImage = CreateDIBSection(nullptr, &bmpinfo, DIB_RGB_COLORS, &pBits, nullptr, 0);\r
                        if (hbmpImage)\r
                        {\r
                                HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmpImage);\r
@@ -131,8 +131,8 @@ public:
                                CImage image;\r
                                image.Attach(hbmpImage);\r
                                image.SetHasAlphaChannel(true);\r
-                               IStream *pStream = NULL;\r
-                               if (SUCCEEDED(CreateStreamOnHGlobal(NULL, TRUE, &pStream)))\r
+                               IStream *pStream = nullptr;\r
+                               if (SUCCEEDED(CreateStreamOnHGlobal(nullptr, TRUE, &pStream)))\r
                                {\r
                                        image.Save(pStream, Gdiplus::ImageFormatPNG);\r
                                        STATSTG stat;\r
@@ -140,8 +140,8 @@ public:
                                        {\r
                                                LARGE_INTEGER li = { 0 };\r
                                                ret.resize(stat.cbSize.LowPart, 0);\r
-                                               pStream->Seek(li, STREAM_SEEK_SET, NULL);\r
-                                               pStream->Read(&ret[0], stat.cbSize.LowPart, NULL);\r
+                                               pStream->Seek(li, STREAM_SEEK_SET, nullptr);\r
+                                               pStream->Read(&ret[0], stat.cbSize.LowPart, nullptr);\r
                                        }\r
                                        pStream->Release();\r
                                }\r