OSDN Git Service

Various refactorings involving NULL, ASSERT, TRUE and FALSE (2)
authorGreyMerlin <greymerlin7@gmail.com>
Tue, 23 Oct 2018 21:27:28 +0000 (14:27 -0700)
committerGreyMerlin <greymerlin7@gmail.com>
Sun, 28 Oct 2018 15:00:29 +0000 (08:00 -0700)
* `assert(0)` -> `assert(false)`
* Some `return 0;` -> `return nullptr;`
* Also `ptr(0)` initializations -> `ptr(nullptr)`

57 files changed:
Externals/crystaledit/editlib/LineInfo.cpp
Externals/crystaledit/editlib/UndoRecord.h
Externals/crystaledit/editlib/cregexp_poco.cpp
Src/ChildFrm.cpp
Src/Common/BCMenu.cpp
Src/Common/ExConverter.cpp
Src/Common/LanguageSelect.cpp
Src/Common/MDITabBar.h
Src/Common/Picture.cpp
Src/Common/PropertyPageHost.cpp
Src/Common/RegKey.cpp
Src/Common/ShellContextMenu.cpp
Src/Common/ShellFileOperations.cpp
Src/Common/SuperComboBox.cpp
Src/Common/UniFile.cpp
Src/Common/VersionInfo.cpp
Src/Common/multiformatText.h
Src/Common/scbarcf.cpp
Src/CompareStats.h
Src/ConfigLog.cpp
Src/DiffContext.cpp
Src/DiffFileData.cpp
Src/DiffItem.h
Src/DiffItemList.cpp
Src/DiffList.cpp
Src/DiffThread.cpp
Src/DiffThread.h
Src/DiffViewBar.cpp
Src/DiffWrapper.cpp
Src/DirActions.cpp
Src/DirCmpReport.cpp
Src/DirCompProgressBar.cpp
Src/DirDoc.cpp
Src/DirFrame.cpp
Src/DirViewColItems.cpp
Src/FileActionScript.cpp
Src/FileTransform.h
Src/FilterList.cpp
Src/GhostTextView.cpp
Src/HexMergeDoc.cpp
Src/HexMergeFrm.cpp
Src/HexMergeView.cpp
Src/IListCtrlImpl.h
Src/ImgMergeFrm.cpp
Src/LineFiltersDlg.cpp
Src/LineFiltersList.cpp
Src/LocationBar.cpp
Src/MainFrm.cpp
Src/Merge.cpp
Src/Merge7zFormatMergePluginImpl.h
Src/MergeDoc.cpp
Src/MergeEditView.cpp
Src/OptionsFont.cpp
Src/PathContext.h
Src/Plugins.cpp
Src/PropRegistry.cpp
Src/markdown.cpp

index 607c2f7..1d7e119 100644 (file)
@@ -17,7 +17,7 @@
  @brief Constructor.
  */
 LineInfo::LineInfo()
-: m_pcLine(NULL)
+: m_pcLine(nullptr)
 , m_nLength(0)
 , m_nMax(0)
 , m_nEolChars(0)
index fe2c608..e85e189 100644 (file)
@@ -42,16 +42,16 @@ private:
   UndoRecord () // default constructor\r
     : m_dwFlags(0)\r
     , m_nAction(0)\r
-    , m_paSavedRevisionNumbers(NULL)\r
-    , m_pszText(NULL)\r
+    , m_paSavedRevisionNumbers(nullptr)\r
+    , m_pszText(nullptr)\r
   {\r
   }\r
 \r
   UndoRecord (const UndoRecord & src) // copy constructor\r
     : m_dwFlags(0)\r
     , m_nAction(0)\r
-    , m_paSavedRevisionNumbers(NULL)\r
-    , m_pszText(NULL)\r
+    , m_paSavedRevisionNumbers(nullptr)\r
+    , m_pszText(nullptr)\r
   {\r
     Clone(src);\r
   }\r
index 44f503b..ec0a574 100644 (file)
@@ -131,11 +131,11 @@ static int add(size_t *len, LPTSTR *s, LPCTSTR a, size_t alen, int &flag) {
                if (!p)
                        return 0;
                *s = p;
-               assert(*s);
+               assert(*s != 0);
                memcpy(*s + *len, a, alen * sizeof(TCHAR));
     } else {
         *s = (LPTSTR) malloc(NewLen * sizeof(TCHAR));
-        assert(*s);
+        assert(*s != 0);
         memcpy(*s, a, alen * sizeof(TCHAR));
         *len = 0;
     }
index f15ca4f..c4a3180 100644 (file)
@@ -75,8 +75,8 @@ END_MESSAGE_MAP()
  * @brief Constructor.
  */
 CChildFrame::CChildFrame()
-: m_hIdentical(NULL)
-, m_hDifferent(NULL)
+: m_hIdentical(nullptr)
+, m_hDifferent(nullptr)
 {
        m_bActivated = false;
        std::fill_n(m_nLastSplitPos, 2, 0);
index 55d6029..b488d25 100644 (file)
@@ -1218,7 +1218,8 @@ BCMenu *BCMenu::FindAnotherMenuOption(int nId,UINT& nLoc,CArray<BCMenu*,BCMenu*>
 #endif
                if(psubmenu){
                        pgoodmenu=psubmenu->FindAnotherMenuOption(nId,nLoc,bcsubs,bclocs);
-                       if(pgoodmenu)return(pgoodmenu);
+                       if(pgoodmenu != nullptr)
+                               return pgoodmenu;
                }
                else if(nId==(int)GetMenuItemID(i)){
                        INT_PTR numsubs=bcsubs.GetSize();
@@ -1231,12 +1232,12 @@ BCMenu *BCMenu::FindAnotherMenuOption(int nId,UINT& nLoc,CArray<BCMenu*,BCMenu*>
                        }
                        if(foundflag){
                                nLoc=static_cast<UINT>(i);
-                               return(this);
+                               return this;
                        }
                }
        }
        nLoc = static_cast<UINT>(-1);
-       return(NULL);
+       return nullptr;
 }
 
 BCMenu *BCMenu::FindMenuOption(int nId,UINT& nLoc)
@@ -1251,15 +1252,16 @@ BCMenu *BCMenu::FindMenuOption(int nId,UINT& nLoc)
 #endif
                if(psubmenu){
                        pgoodmenu=psubmenu->FindMenuOption(nId,nLoc);
-                       if(pgoodmenu)return(pgoodmenu);
+                       if(pgoodmenu != nullptr)
+                               return pgoodmenu;
                }
                else if(nId==(int)GetMenuItemID(i)){
                        nLoc=i;
-                       return(this);
+                       return this;
                }
        }
        nLoc = static_cast<UINT>(-1);
-       return(NULL);
+       return nullptr;
 }
 
 BCMenuData *BCMenu::FindMenuOption(wchar_t *lpstrText)
@@ -1274,20 +1276,21 @@ BCMenuData *BCMenu::FindMenuOption(wchar_t *lpstrText)
 #else
                psubmenu=static_cast<BCMenu *>(GetSubMenu(i));
 #endif
-               if(psubmenu){
+               if(psubmenu != nullptr){
                        pmenulist=psubmenu->FindMenuOption(lpstrText);
-                       if(pmenulist)return(pmenulist);
+                       if(pmenulist != nullptr)
+                               return pmenulist;
                }
                else{
                        for(j=0;j<=m_MenuList.GetUpperBound();++j){     
                                const wchar_t *szWide;//SK: we use const to prevent misuse of this Ptr
                                szWide = m_MenuList[j]->GetWideString ();
                                if(szWide && !wcscmp(lpstrText,szWide))//SK: modified for dynamic allocation
-                                       return(m_MenuList[j]);
+                                       return m_MenuList[j];
                        }
                }
        }
-       return(NULL);
+       return nullptr;
 }
 
 
@@ -1299,27 +1302,30 @@ BOOL BCMenu::LoadMenu(int nResource)
 BOOL BCMenu::LoadMenu(LPCTSTR lpszResourceName)
 {
        ASSERT_VALID(this);
-       ASSERT(lpszResourceName != NULL);
+       ASSERT(lpszResourceName != nullptr);
        
        // Find the Menu Resource:
        HINSTANCE hInst = AfxFindResourceHandle(lpszResourceName,RT_MENU);
        HRSRC hRsrc = ::FindResource(hInst,lpszResourceName,RT_MENU);
-       if (hRsrc == NULL){
-               hInst = NULL;
+       if (hRsrc == nullptr){
+               hInst = nullptr;
                hRsrc = ::FindResource(hInst,lpszResourceName,RT_MENU);
        }
-       if(hRsrc == NULL)return FALSE;
+       if(hRsrc == nullptr)
+               return FALSE;
        
        // Load the Menu Resource:
        
        HGLOBAL hGlobal = LoadResource(hInst, hRsrc);
-       if(hGlobal == NULL)return FALSE;
+       if(hGlobal == nullptr)
+               return FALSE;
 
        // first destroy the menu if we're trying to loadmenu again
        DestroyMenu();
 
        // Attempt to create us as a menu...
-       if(!CMenu::CreateMenu())return FALSE;
+       if(!CMenu::CreateMenu())
+               return FALSE;
        
        // Get Item template Header, and calculate offset of MENUITEMTEMPLATES
        
@@ -1524,10 +1530,10 @@ BCMenuData *BCMenu::FindMenuList(UINT_PTR nID)
        for(int i=0;i<=m_MenuList.GetUpperBound();++i){
                if(m_MenuList[i]->nID==nID && !m_MenuList[i]->syncflag){
                        m_MenuList[i]->syncflag=1;
-                       return(m_MenuList[i]);
+                       return m_MenuList[i];
                }
        }
-       return(NULL);
+       return nullptr;
 }
 
 void BCMenu::InitializeMenuList(int value)
@@ -1643,13 +1649,13 @@ void BCMenu::GetTransparentBitmap(CBitmap &bmp)
        BITMAP BitMap;
 
        bmp.GetBitmap(&BitMap);
-       ddc.CreateCompatibleDC(NULL);
+       ddc.CreateCompatibleDC(nullptr);
        CBitmap * pddcOldBmp = ddc.SelectObject(&bmp);
 
        // use this to get the background color, takes into account color shifting
        CDC ddc2;
        CBitmap bmp2;
-       ddc2.CreateCompatibleDC(NULL);
+       ddc2.CreateCompatibleDC(nullptr);
        bmp2.CreateCompatibleBitmap(&ddc,BitMap.bmWidth,BitMap.bmHeight);
        col=RGB(255,0,255); // Original was RGB(192,192,192)
        CBitmap * pddcOldBmp2 = ddc2.SelectObject(&bmp2);
@@ -1685,13 +1691,13 @@ void BCMenu::GetDisabledBitmap(CBitmap &bmp,COLORREF background)
        BITMAP BitMap;
 
        bmp.GetBitmap(&BitMap);
-       ddc.CreateCompatibleDC(NULL);
+       ddc.CreateCompatibleDC(nullptr);
        CBitmap * pddcOldBmp = ddc.SelectObject(&bmp);
 
        // use this to get the background color, takes into account color shifting
        CDC ddc2;
        CBitmap bmp2;
-       ddc2.CreateCompatibleDC(NULL);
+       ddc2.CreateCompatibleDC(nullptr);
        bmp2.CreateCompatibleBitmap(&ddc,BitMap.bmWidth,BitMap.bmHeight);
        CBitmap * pddcOldBmp2 = ddc2.SelectObject(&bmp2);
        CRect rect(0,0,BitMap.bmWidth,BitMap.bmHeight);
@@ -1795,13 +1801,13 @@ void BCMenu::DitherBlt2(CDC *drawdc, int nXDest, int nYDest, int nWidth,
 {
        // create a monochrome memory DC
        CDC ddc;
-       ddc.CreateCompatibleDC(0);
+       ddc.CreateCompatibleDC(nullptr);
        CBitmap bwbmp;
        bwbmp.CreateCompatibleBitmap(&ddc, nWidth, nHeight);
        CBitmap * pddcOldBmp = ddc.SelectObject(&bwbmp);
        
        CDC dc;
-       dc.CreateCompatibleDC(0);
+       dc.CreateCompatibleDC(nullptr);
        CBitmap * pdcOldBmp = dc.SelectObject(&bmp);
        
        // build a mask
@@ -1837,7 +1843,7 @@ void BCMenu::DitherBlt3(CDC *drawdc, int nXDest, int nYDest, int nWidth,
 {
        GetDisabledBitmap(bmp,bgcolor);
        CDC dc;
-       dc.CreateCompatibleDC(NULL);
+       dc.CreateCompatibleDC(nullptr);
        CBitmap * pdcOldBmp = dc.SelectObject(&bmp);
        drawdc->BitBlt(nXDest,nYDest,nWidth, nHeight, &dc,0,0,SRCCOPY);
        // reset DCs
@@ -1876,22 +1882,25 @@ HBITMAP BCMenu::LoadSysColorBitmap(int nResourceId)
                AfxFindResourceHandle(MAKEINTRESOURCE(nResourceId),RT_BITMAP);
        HRSRC hRsrc = 
                ::FindResource(hInst,MAKEINTRESOURCE(nResourceId),RT_BITMAP);
-       if (hRsrc == NULL){
-               hInst = NULL;
+       if (hRsrc == nullptr){
+               hInst = nullptr;
                hRsrc = ::FindResource(hInst,MAKEINTRESOURCE(nResourceId),RT_BITMAP);
        }
-       if (hRsrc == NULL)return NULL;
+       if (hRsrc == nullptr)
+               return nullptr;
 
        // determine how many colors in the bitmap
        HGLOBAL hglb;
-       if ((hglb = LoadResource(hInst, hRsrc)) == NULL)
-               return NULL;
+       if ((hglb = LoadResource(hInst, hRsrc)) == nullptr)
+               return nullptr;
        LPBITMAPINFOHEADER lpBitmap = (LPBITMAPINFOHEADER)LockResource(hglb);
-       if (lpBitmap == NULL)return NULL;
+       if (lpBitmap == nullptr)
+               return nullptr;
        WORD numcol = NumBitmapColors(lpBitmap);
        ::FreeResource(hglb);
 
-       if(numcol!=16)return(NULL);
+       if(numcol!=16)
+               return nullptr;
 
        return AfxLoadSysColorBitmap(hInst, hRsrc, FALSE);
 }
index 0ac4846..69c9228 100644 (file)
@@ -37,8 +37,8 @@ private:
 
 public:
        CExconverterMLang()
-       : m_pmlang(NULL)
-       , m_hLibMLang(NULL)
+       : m_pmlang(nullptr)
+       , m_hLibMLang(nullptr)
        , m_mlangcookie(0)
        {
        }
index e5c8979..f108392 100644 (file)
@@ -484,7 +484,7 @@ static HANDLE NTAPI FindFile(HANDLE h, LPCTSTR path, WIN32_FIND_DATA *fd)
 const WORD wSourceLangId = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
 
 CLanguageSelect::CLanguageSelect()
-: m_hCurrentDll(0)
+: m_hCurrentDll(nullptr)
 , m_wCurLanguage(wSourceLangId)
 , m_codepage(0)
 {
@@ -894,7 +894,7 @@ bool CLanguageSelect::TranslateString(const std::string& str, String &translated
 void CLanguageSelect::SetIndicators(CStatusBar &sb, const UINT *rgid, int n) const
 {
        HGDIOBJ hf = (HGDIOBJ)sb.SendMessage(WM_GETFONT);
-       CClientDC dc(0);
+       CClientDC dc(nullptr);
        if (hf)
                hf = dc.SelectObject(hf);
        if (n)
index b2101d8..2335f2d 100644 (file)
@@ -26,7 +26,7 @@ private:
        CFont m_font;
 
 public:
-       CMDITabBar() : m_bInSelchange(false), m_pMainFrame(NULL), m_bMouseTracking(false), m_bCloseButtonDown(false), m_bAutoMaxWidth(true), m_nDraggingTabItemIndex(-1) {}
+       CMDITabBar() : m_bInSelchange(false), m_pMainFrame(nullptr), m_bMouseTracking(false), m_bCloseButtonDown(false), m_bAutoMaxWidth(true), m_nDraggingTabItemIndex(-1) {}
        virtual ~CMDITabBar() {}
        BOOL Create(CMDIFrameWnd* pParentWnd);
        void UpdateTabs();
index c6dcfb1..7ce38ae 100644 (file)
@@ -131,7 +131,7 @@ CSize CPicture::GetImageSize(CDC* pDC) const
                return CSize(0, 0);
        CSize sz(hmWidth,hmHeight);
        if (pDC==NULL) {
-               CWindowDC dc(NULL);
+               CWindowDC dc(nullptr);
                dc.HIMETRICtoDP(&sz); // convert to pixels
        } else {
                pDC->HIMETRICtoDP(&sz);
index a45d35f..82bdf2c 100644 (file)
@@ -169,7 +169,7 @@ bool CPropertyPageHost::SetActivePage(int nIndex, bool bAndFocus /*= true*/)
        // move the focus to the first dlg ctrl
        if (bAndFocus)
        {
-               CWnd* pCtrl = pPage->GetNextDlgTabItem(NULL);
+               CWnd* pCtrl = pPage->GetNextDlgTabItem(nullptr);
 
                if (pCtrl)
                        pCtrl->SetFocus();
index 9e654b1..bfd8191 100644 (file)
@@ -15,7 +15,7 @@
  * @brief Default constructor.
  */
 CRegKeyEx::CRegKeyEx()
-: m_hKey(NULL)
+: m_hKey(nullptr)
 {
 }
 
@@ -113,8 +113,8 @@ bool CRegKeyEx::QueryRegUser(LPCTSTR key)
  */
 LONG CRegKeyEx::WriteDword(LPCTSTR pszKey, DWORD dwVal)
 {
-       assert(m_hKey);
-       assert(pszKey);
+       assert(m_hKey != nullptr);
+       assert(pszKey != nullptr);
        return RegSetValueEx(m_hKey, pszKey, 0L, REG_DWORD,
                (const LPBYTE) &dwVal, sizeof(DWORD));
 }
@@ -127,8 +127,8 @@ LONG CRegKeyEx::WriteDword(LPCTSTR pszKey, DWORD dwVal)
  */
 LONG CRegKeyEx::WriteBool(LPCTSTR pszKey, bool bVal)
 {
-       assert(m_hKey);
-       assert(pszKey);
+       assert(m_hKey != nullptr);
+       assert(pszKey != nullptr);
        DWORD dwVal = (DWORD)bVal; 
        return RegSetValueEx(m_hKey, pszKey, 0L, REG_DWORD,
                (const LPBYTE) &dwVal, sizeof(DWORD));
@@ -142,8 +142,8 @@ LONG CRegKeyEx::WriteBool(LPCTSTR pszKey, bool bVal)
  */
 LONG CRegKeyEx::WriteFloat(LPCTSTR pszKey, float fVal)
 {
-       assert(m_hKey);
-       assert(pszKey);
+       assert(m_hKey != nullptr);
+       assert(pszKey != nullptr);
        String s = strutils::to_str(fVal);
        return RegSetValueEx(m_hKey, pszKey, 0L, REG_SZ,
                (const LPBYTE) s.c_str(), static_cast<DWORD>((s.length() + 1))*sizeof(TCHAR) );
@@ -157,9 +157,9 @@ LONG CRegKeyEx::WriteFloat(LPCTSTR pszKey, float fVal)
  */
 LONG CRegKeyEx::WriteString(LPCTSTR pszKey, LPCTSTR pszData)
 {
-       assert(m_hKey);
-       assert(pszKey);
-       assert(pszData);
+       assert(m_hKey != nullptr);
+       assert(pszKey != nullptr);
+       assert(pszData != nullptr);
 
        return RegSetValueEx(m_hKey, pszKey, 0L, REG_SZ,
                (const LPBYTE) pszData, static_cast<DWORD>(_tcslen(pszData)+ 1)*sizeof(TCHAR));
@@ -173,8 +173,8 @@ LONG CRegKeyEx::WriteString(LPCTSTR pszKey, LPCTSTR pszData)
  */
 DWORD CRegKeyEx::ReadDword(LPCTSTR pszKey, DWORD defval)
 {
-       assert(m_hKey);
-       assert(pszKey);
+       assert(m_hKey != nullptr);
+       assert(pszKey != nullptr);
 
        DWORD dwType;
        DWORD dwSize = sizeof (DWORD);
@@ -252,8 +252,8 @@ BYTE CRegKeyEx::ReadByte(LPCTSTR pszKey, BYTE defval)
  */
 float CRegKeyEx::ReadFloat(LPCTSTR pszKey, float defval)
 {
-       assert(m_hKey);
-       assert(pszKey);
+       assert(m_hKey != nullptr);
+       assert(pszKey != nullptr);
 
        DWORD dwType;
        DWORD dwSize = 100;
@@ -276,8 +276,8 @@ float CRegKeyEx::ReadFloat(LPCTSTR pszKey, float defval)
  */
 bool CRegKeyEx::ReadBool(LPCTSTR pszKey, bool defval)
 {
-       assert(m_hKey);
-       assert(pszKey);
+       assert(m_hKey != nullptr);
+       assert(pszKey != nullptr);
 
        DWORD dwType;
        DWORD dwSize = sizeof(DWORD);
@@ -300,8 +300,8 @@ bool CRegKeyEx::ReadBool(LPCTSTR pszKey, bool defval)
  */
 String CRegKeyEx::ReadString (LPCTSTR pszKey, LPCTSTR defval)
 {
-       assert(m_hKey);
-       assert(pszKey);
+       assert(m_hKey != nullptr);
+       assert(pszKey != nullptr);
 
        DWORD dwType;
        DWORD dwSize = 0;
@@ -333,8 +333,8 @@ String CRegKeyEx::ReadString (LPCTSTR pszKey, LPCTSTR defval)
  */
 void CRegKeyEx::ReadChars (LPCTSTR pszKey, LPTSTR pData, DWORD dwLen, LPCTSTR defval)
 {
-       assert(m_hKey);
-       assert(pszKey);
+       assert(m_hKey != nullptr);
+       assert(pszKey != nullptr);
 
        DWORD dwType;
        DWORD len = dwLen;
index b31ffb9..7e852d6 100644 (file)
 #endif
 
 CShellContextMenu::CShellContextMenu(UINT cmdFirst, UINT cmdLast)
-: m_pPreferredMenu(NULL)
-, m_pShellContextMenu2(NULL)
-, m_pShellContextMenu3(NULL)
-, m_hShellContextMenu(NULL)
+: m_pPreferredMenu(nullptr)
+, m_pShellContextMenu2(nullptr)
+, m_pShellContextMenu3(nullptr)
+, m_hShellContextMenu(nullptr)
 , m_cmdFirst(cmdFirst)
 , m_cmdLast(cmdLast)
 {
@@ -94,7 +94,7 @@ bool CShellContextMenu::HandleMenuMessage(UINT message, WPARAM wParam, LPARAM lP
                                //        (HMENU)hMenu = (HMENU)lpDrawItem->hwndItem;
                                //        TRACE(_T("  hMenu == 0x%p\n"), hMenu);
                                //}
-                               //assert(0);
+                               //assert(false);
                        }
                }
                else if (m_pShellContextMenu2)
@@ -102,7 +102,7 @@ bool CShellContextMenu::HandleMenuMessage(UINT message, WPARAM wParam, LPARAM lP
                        if (FAILED(/*hr = */m_pShellContextMenu2->HandleMenuMsg(message, wParam, lParam)))
                        {
                                //TRACE(_T("HandleMenuMsg(%x) failed with error: %lx\n"), message, hr);
-                               //assert(0);
+                               //assert(false);
                        }
                }
                // indicate that we've processed the message
@@ -115,7 +115,7 @@ bool CShellContextMenu::HandleMenuMessage(UINT message, WPARAM wParam, LPARAM lP
                        if (FAILED(/*hr = */m_pShellContextMenu3->HandleMenuMsg2(message, wParam, lParam, &retval)))
                        {
                                //TRACE(_T("HandleMenuMsg2(%x) failed with error: %lx\n"), message, hr);
-                               //assert(0);
+                               //assert(false);
                        }
                        return true;
                }
index c2fa87e..75a916f 100644 (file)
@@ -36,7 +36,7 @@ ShellFileOperations::ShellFileOperations()
  : m_bOneToOneMapping(false)
  , m_function(0)
  , m_flags(0)
- , m_parentWindow(NULL)
+ , m_parentWindow(nullptr)
  , m_isCanceled(false)
 {
 }
index 3503873..daa15bc 100644 (file)
@@ -19,7 +19,7 @@
 HIMAGELIST CSuperComboBox::m_himlSystem = NULL;
 
 CSuperComboBox::CSuperComboBox()
-       : m_pDropHandler(NULL)
+       : m_pDropHandler(nullptr)
 {
        m_bEditChanged = false;
        m_bDoComplete = false;
@@ -38,7 +38,7 @@ CSuperComboBox::CSuperComboBox()
        _AFX_THREAD_STATE* pState = AfxGetThreadState();
        if (!pState->m_bNeedTerm)
        {
-               SCODE sc = ::OleInitialize(NULL);
+               SCODE sc = ::OleInitialize(nullptr);
                if (FAILED(sc))
                        AfxMessageBox(_T("OLE initialization failed. Make sure that the OLE libraries are the correct version"));
                else
index c9bb52b..bea0881 100644 (file)
@@ -178,10 +178,10 @@ void UniLocalFile::LastErrorCustom(const String& desc)
 /////////////
 
 UniMemFile::UniMemFile()
-               : m_hMapping(NULL)
-               , m_base(NULL)
-               , m_data(NULL)
-               , m_current(NULL)
+               : m_hMapping(nullptr)
+               , m_base(nullptr)
+               , m_data(nullptr)
+               , m_current(nullptr)
 {
 }
 
@@ -192,12 +192,12 @@ void UniMemFile::Close()
        {
                m_base = 0;
        }
-       m_data = NULL;
-       m_current = NULL;
-       if (m_hMapping != NULL)
+       m_data = nullptr;
+       m_current = nullptr;
+       if (m_hMapping != nullptr)
        {
                delete m_hMapping;
-               m_hMapping = NULL;
+               m_hMapping = nullptr;
        }
 }
 
@@ -692,7 +692,7 @@ bool UniMemFile::ReadString(String & line, String & eol, bool * lossy)
  */
 bool UniMemFile::WriteString(const String & line)
 {
-       assert(0); // unimplemented -- currently cannot write to a UniMemFile!
+       assert(false); // unimplemented -- currently cannot write to a UniMemFile!
        return false;
 }
 
@@ -701,7 +701,7 @@ bool UniMemFile::WriteString(const String & line)
 /////////////
 
 UniStdioFile::UniStdioFile()
-               : m_fp(0)
+               : m_fp(nullptr)
                , m_data(0)
                , m_ucrbuff(128)
 {
@@ -884,13 +884,13 @@ void UniStdioFile::SetBom(bool bom)
 
 bool UniStdioFile::ReadString(String & line, bool * lossy)
 {
-       assert(0); // unimplemented -- currently cannot read from a UniStdioFile!
+       assert(false); // unimplemented -- currently cannot read from a UniStdioFile!
        return false;
 }
 
 bool UniStdioFile::ReadString(String & line, String & eol, bool * lossy)
 {
-       assert(0); // unimplemented -- currently cannot read from a UniStdioFile!
+       assert(false); // unimplemented -- currently cannot read from a UniStdioFile!
        return false;
 }
 
index 350f231..c840dff 100644 (file)
@@ -382,7 +382,7 @@ void CVersionInfo::QueryStrings()
  */
 void CVersionInfo::QueryValue(LPCTSTR szId, String& s)
 {
-       assert(m_pVffInfo != NULL);
+       assert(m_pVffInfo != nullptr);
        LPTSTR   lpVersion;                     // String pointer to 'version' text
        UINT    uVersionLen;
        bool    bRetCode;
index 38a8e4e..bb1725f 100644 (file)
@@ -26,7 +26,7 @@ class storageForPlugins
 {
 public:
        storageForPlugins()
-       : m_bstr(NULL)
+       : m_bstr(nullptr)
        , m_bOriginalIsUnicode(false)
        , m_bCurrentIsUnicode(false)
        , m_bCurrentIsFile(false)
index 1057b4e..e7df95f 100644 (file)
@@ -52,7 +52,7 @@ CSizingControlBarCF::CSizingControlBarCF()
     m_bActive = false;
 
     CDC dc;
-    dc.CreateCompatibleDC(NULL);
+    dc.CreateCompatibleDC(nullptr);
 
     m_sFontFace = (::EnumFontFamilies(dc.m_hDC,
         _T("Tahoma"), (FONTENUMPROC) EnumFontFamProc, 0) == 0) ?
index 89f2b62..85747da 100644 (file)
@@ -104,7 +104,7 @@ private:
        int m_nDirs; /**< number of directories to compare */
        struct ThreadState
        {
-               ThreadState() : m_nHitCount(0), m_pDiffItem(NULL) {}
+               ThreadState() : m_nHitCount(0), m_pDiffItem(nullptr) {}
                Poco::AtomicCounter m_nHitCount;
                const DIFFITEM *m_pDiffItem;
        };
index 80b8ecf..b7c3d26 100644 (file)
@@ -341,17 +341,17 @@ bool CConfigLog::DoFile(String &sError)
        FileWriteString(GetCompilerVersion());
 
        LPCTSTR szCmdLine = ::GetCommandLine();
-       assert(szCmdLine != NULL);
+       assert(szCmdLine != nullptr);
 
        // Skip the quoted executable file name.
-       if (szCmdLine != NULL)
+       if (szCmdLine != nullptr)
        {
                szCmdLine = _tcschr(szCmdLine, '"');
-               if (szCmdLine != NULL)
+               if (szCmdLine != nullptr)
                {
                        szCmdLine += 1; // skip the opening quote.
                        szCmdLine = _tcschr(szCmdLine, '"');
-                       if (szCmdLine != NULL)
+                       if (szCmdLine != nullptr)
                        {
                                szCmdLine += 1; // skip the closing quote.
                        }
index f1954b4..8fa8783 100644 (file)
@@ -244,7 +244,7 @@ CompareOptions * CDiffContext::GetCompareOptions(int compareMethod)
 void CDiffContext::FetchPluginInfos(const String& filteredFilenames,
                PackingInfo ** infoUnpacker, PrediffingInfo ** infoPrediffer)
 {
-       assert(m_piPluginInfos);
+       assert(m_piPluginInfos != nullptr);
        m_piPluginInfos->FetchPluginInfos(filteredFilenames, infoUnpacker, infoPrediffer);
 }
 
index 998f698..8a0e50f 100644 (file)
@@ -102,7 +102,7 @@ bool DiffFileData::DoOpenFiles()
 /** @brief Clear inf structure to pristine */
 void DiffFileData::Reset()
 {
-       assert(m_inf);
+       assert(m_inf != nullptr);
        // If diffutils put data in, have it cleanup
        if (m_used)
        {
index 54037f9..e8ebc69 100644 (file)
@@ -189,7 +189,7 @@ struct DIFFITEM : ListEntry
 
        static DIFFITEM emptyitem; /**< singleton to represent a diffitem that doesn't have any data */
 
-       DIFFITEM() : parent(NULL), nidiffs(-1), nsdiffs(-1), customFlags1(0) { }
+       DIFFITEM() : parent(nullptr), nidiffs(-1), nsdiffs(-1), customFlags1(0) { }
        ~DIFFITEM();
 
        bool isEmpty() const { return this == &emptyitem; }
index c755cb1..38b3a1f 100644 (file)
@@ -157,9 +157,9 @@ DIFFITEM &DiffItemList::GetNextSiblingDiffRefPosition(uintptr_t & diffpos)
  */
 void DiffItemList::SetDiffStatusCode(uintptr_t diffpos, unsigned diffcode, unsigned mask)
 {
-       assert(diffpos);
+       assert(diffpos != NULL);
        DIFFITEM & di = GetDiffRefAt(diffpos);
-       assert(! ((~mask) & diffcode) ); // make sure they only set flags in their mask
+       assert( ((~mask) & diffcode) == 0 ); // make sure they only set flags in their mask
        di.diffcode.diffcode &= (~mask); // remove current data
        di.diffcode.diffcode |= diffcode; // add new data
 }
@@ -169,7 +169,7 @@ void DiffItemList::SetDiffStatusCode(uintptr_t diffpos, unsigned diffcode, unsig
  */
 void DiffItemList::SetDiffCounts(uintptr_t diffpos, unsigned diffs, unsigned ignored)
 {
-       assert(diffpos);
+       assert(diffpos != NULL);
        DIFFITEM & di = GetDiffRefAt(diffpos);
        di.nidiffs = ignored; // see StoreDiffResult() in DirScan.cpp
        di.nsdiffs = diffs;
@@ -182,7 +182,7 @@ void DiffItemList::SetDiffCounts(uintptr_t diffpos, unsigned diffs, unsigned ign
  */
 unsigned DiffItemList::GetCustomFlags1(uintptr_t diffpos) const
 {
-       assert(diffpos);
+       assert(diffpos != NULL);
        const DIFFITEM & di = GetDiffAt(diffpos);
        return di.customFlags1;
 }
@@ -194,7 +194,7 @@ unsigned DiffItemList::GetCustomFlags1(uintptr_t diffpos) const
  */
 void DiffItemList::SetCustomFlags1(uintptr_t diffpos, unsigned flag)
 {
-       assert(diffpos);
+       assert(diffpos != NULL);
        DIFFITEM & di = GetDiffRefAt(diffpos);
        di.customFlags1 = flag;
 }
index 92c2118..ec86bf5 100644 (file)
@@ -215,7 +215,7 @@ const DIFFRANGE * DiffList::DiffRangeAt(int nDiff) const
        }
        else
        {
-               assert(0);
+               assert(false);
                return NULL;
        }
 }
index 63f5879..da6bc6d 100644 (file)
@@ -57,7 +57,7 @@ public:
  * @brief Default constructor.
  */
 CDiffThread::CDiffThread()
-: m_pDiffContext(NULL)
+: m_pDiffContext(nullptr)
 , m_bAborting(false)
 , m_bPaused(false)
 , m_pDiffParm(new DiffFuncStruct)
index 9f81a9d..3882923 100644 (file)
@@ -49,11 +49,11 @@ struct DiffFuncStruct
        Poco::Semaphore *pSemaphore; /**< Semaphore for synchronizing threads. */
 
        DiffFuncStruct()
-               : context(NULL)
+               : context(nullptr)
                , nThreadState(0/*CDiffThread::THREAD_NOTSTARTED*/)
-               , m_pAbortgate(NULL)
+               , m_pAbortgate(nullptr)
                , bOnlyRequested(false)
-               , pSemaphore(NULL)
+               , pSemaphore(nullptr)
                {}
 };
 
index 1cfeaba..857394a 100644 (file)
@@ -20,7 +20,7 @@ IMPLEMENT_DYNAMIC(CDiffViewBar, TViewBarBase);
 //////////////////////////////////////////////////////////////////////
 
 CDiffViewBar::CDiffViewBar()
-: m_hwndFrame(NULL)
+: m_hwndFrame(nullptr)
 {
 }
 
index dd01775..48e9b8f 100644 (file)
@@ -159,7 +159,7 @@ void CDiffWrapper::SetCreateDiffList(DiffList *diffList)
  */
 void CDiffWrapper::GetOptions(DIFFOPTIONS *options) const
 {
-       assert(options);
+       assert(options != nullptr);
        DIFFOPTIONS tmpOptions = {0};
        m_options.GetAsDiffOptions(tmpOptions);
        *options = tmpOptions;
@@ -173,7 +173,7 @@ void CDiffWrapper::GetOptions(DIFFOPTIONS *options) const
  */
 void CDiffWrapper::SetOptions(const DIFFOPTIONS *options)
 {
-       assert(options);
+       assert(options != nullptr);
        m_options.SetFromDiffOptions(*options);
 }
 
@@ -204,7 +204,7 @@ void CDiffWrapper::GetPrediffer(PrediffingInfo * prediffer) const
  */
 void CDiffWrapper::SetPatchOptions(const PATCHOPTIONS *options)
 {
-       assert(options);
+       assert(options != nullptr);
        m_options.m_contextLines = options->nContext;
 
        switch (options->outputStyle)
@@ -1222,7 +1222,7 @@ CDiffWrapper::LoadWinMergeDiffsFromDiffUtilsScript(struct change * script, const
                                {
                                        if (thisob->match0>=0)
                                        {
-                                               assert(thisob->inserted);
+                                               assert(thisob->inserted > 0);
                                                for (int i=0; i<thisob->inserted; ++i)
                                                {
                                                        int line0 = i+thisob->match0 + (trans_a0-first0-1);
@@ -1232,7 +1232,7 @@ CDiffWrapper::LoadWinMergeDiffsFromDiffUtilsScript(struct change * script, const
                                        }
                                        if (thisob->match1>=0)
                                        {
-                                               assert(thisob->deleted);
+                                               assert(thisob->deleted > 0);
                                                for (int i=0; i<thisob->deleted; ++i)
                                                {
                                                        int line0 = i+thisob->line0 + (trans_a0-first0-1);
@@ -1383,7 +1383,7 @@ CDiffWrapper::LoadWinMergeDiffsFromDiffUtilsScript3(
                                                {
                                                        if (thisob->match0>=0)
                                                        {
-                                                               assert(thisob->inserted);
+                                                               assert(thisob->inserted > 0);
                                                                for (int i=0; i<thisob->inserted; ++i)
                                                                {
                                                                        int line0 = i+thisob->match0 + (trans_a0-first0-1);
@@ -1393,7 +1393,7 @@ CDiffWrapper::LoadWinMergeDiffsFromDiffUtilsScript3(
                                                        }
                                                        if (thisob->match1>=0)
                                                        {
-                                                               assert(thisob->deleted);
+                                                               assert(thisob->deleted > 0);
                                                                for (int i=0; i<thisob->deleted; ++i)
                                                                {
                                                                        int line0 = i+thisob->line0 + (trans_a0-first0-1);
index e80ca6b..c704f74 100644 (file)
@@ -1055,7 +1055,7 @@ void SetDiffStatus(DIFFITEM& di, unsigned  diffcode, unsigned mask)
        // Someone could figure out these pieces and probably simplify this.
 
        // Update DIFFITEM code (comparison result)
-       assert(! ((~mask) & diffcode) ); // make sure they only set flags in their mask
+       assert( ((~mask) & diffcode) == 0 ); // make sure they only set flags in their mask
        di.diffcode.diffcode &= (~mask); // remove current data
        di.diffcode.diffcode |= diffcode; // add new data
 
index 8ecee64..5e3bfb3 100644 (file)
@@ -61,12 +61,12 @@ static String EndEl(const String& elName)
  * @brief Constructor.
  */
 DirCmpReport::DirCmpReport(const std::vector<String> & colRegKeys)
-: m_pList(NULL)
-, m_pFile(NULL)
+: m_pList(nullptr)
+, m_pFile(nullptr)
 , m_nColumns(0)
 , m_colRegKeys(colRegKeys)
 , m_sSeparator(_T(","))
-, m_pFileCmpReport(NULL)
+, m_pFileCmpReport(nullptr)
 , m_bIncludeFileCmpReport(false)
 , m_bOutputUTF8(false)
 {
@@ -144,8 +144,8 @@ static HGLOBAL ConvertToUTF16ForClipboard(HGLOBAL hMem, int codepage)
  */
 bool DirCmpReport::GenerateReport(String &errStr)
 {
-       assert(m_pList != NULL);
-       assert(m_pFile == NULL);
+       assert(m_pList != nullptr);
+       assert(m_pFile == nullptr);
        bool bRet = false;
 
        DirCmpReportDlg dlg;
index 387fbff..a5c2ab3 100644 (file)
@@ -39,9 +39,9 @@ void DirCompProgressBar::ClearStat()
 DirCompProgressBar::DirCompProgressBar()
 : m_bCompareReady(false)
 , m_prevState(CompareStats::STATE_IDLE)
-, m_pCompareStats(NULL)
+, m_pCompareStats(nullptr)
 #ifdef __ITaskbarList3_INTERFACE_DEFINED__
-, m_pTaskbarList(NULL)
+, m_pTaskbarList(nullptr)
 #endif
 {
 }
index 101a6fc..f82e266 100644 (file)
@@ -357,7 +357,7 @@ void CDirDoc::UpdateResources()
        if (m_pDirView)
                m_pDirView->UpdateResources();
 
-       SetTitle(NULL);
+       SetTitle(nullptr);
 
        Redisplay();
 }
@@ -683,7 +683,7 @@ void CDirDoc::Swap(int idx1, int idx2)
        m_pCompareStats->Swap(idx1, idx2);
        for (int nIndex = 0; nIndex < m_nDirs; nIndex++)
                UpdateHeaderPath(nIndex);
-       SetTitle(NULL);
+       SetTitle(nullptr);
 }
 
 bool CDirDoc::MoveableToNextDiff()
index 41467b3..3118bdc 100644 (file)
@@ -78,8 +78,8 @@ static UINT RO_PANEL_WIDTH = 30;
 IMPLEMENT_DYNCREATE(CDirFrame, CMDIChildWnd)
 
 CDirFrame::CDirFrame()
-: m_hIdentical(NULL)
-, m_hDifferent(NULL)
+: m_hIdentical(nullptr)
+, m_hDifferent(nullptr)
 {
 }
 
index 67a082d..051ea9a 100644 (file)
@@ -1081,8 +1081,8 @@ DirViewColItems::GetDirColInfo(int col) const
        {
                if (col < 0 || col >= countof(f_cols))
                {
-                       assert(0); // fix caller, should not ask for nonexistent columns
-                       return 0;
+                       assert(false); // fix caller, should not ask for nonexistent columns
+                       return nullptr;
                }
                return &f_cols[col];
        }
@@ -1090,8 +1090,8 @@ DirViewColItems::GetDirColInfo(int col) const
        {
                if (col < 0 || col >= countof(f_cols3))
                {
-                       assert(0); // fix caller, should not ask for nonexistent columns
-                       return 0;
+                       assert(false); // fix caller, should not ask for nonexistent columns
+                       return nullptr;
                }
                return &f_cols3[col];
        }
@@ -1108,7 +1108,7 @@ DirViewColItems::IsColById(int col, const char *idname) const
        {
                if (col < 0 || col >= countof(f_cols))
                {
-                       assert(0); // fix caller, should not ask for nonexistent columns
+                       assert(false); // fix caller, should not ask for nonexistent columns
                        return false;
                }
                return f_cols[col].idName == idname;
@@ -1117,7 +1117,7 @@ DirViewColItems::IsColById(int col, const char *idname) const
        {
                if (col < 0 || col >= sizeof(f_cols3)/sizeof(f_cols3[0]))
                {
-                       assert(0); // fix caller, should not ask for nonexistent columns
+                       assert(false); // fix caller, should not ask for nonexistent columns
                        return false;
                }
                return f_cols3[col].idName == idname;
@@ -1182,8 +1182,8 @@ DirViewColItems::IsDefaultSortAscending(int col) const
        const DirColInfo * pColInfo = GetDirColInfo(col);
        if (!pColInfo)
        {
-               assert(0); // fix caller, should not ask for nonexistent columns
-               return 0;
+               assert(false); // fix caller, should not ask for nonexistent columns
+               return false;
        }
        return pColInfo->defSortUp;
 }
@@ -1237,7 +1237,7 @@ DirViewColItems::ColGetTextToDisplay(const CDiffContext *pCtxt, int col,
        const DirColInfo * pColInfo = GetDirColInfo(col);
        if (!pColInfo)
        {
-               assert(0); // fix caller, should not ask for nonexistent columns
+               assert(false); // fix caller, should not ask for nonexistent columns
                return _T("???");
        }
        ColGetFncPtrType fnc = pColInfo->getfnc;
@@ -1316,7 +1316,7 @@ DirViewColItems::ColSort(const CDiffContext *pCtxt, int col, const DIFFITEM & ld
        const DirColInfo * pColInfo = GetDirColInfo(col);
        if (!pColInfo)
        {
-               assert(0); // fix caller, should not ask for nonexistent columns
+               assert(false); // fix caller, should not ask for nonexistent columns
                return 0;
        }
        size_t offset = pColInfo->offset;
index 3d48271..bc55839 100644 (file)
@@ -41,7 +41,7 @@ FileActionScript::FileActionScript()
 , m_bHasMoveOperations(false)
 , m_bHasRenameOperations(false)
 , m_bHasDelOperations(false)
-, m_hParentWindow(NULL)
+, m_hParentWindow(nullptr)
 , m_pCopyOperations(new ShellFileOperations())
 , m_pMoveOperations(new ShellFileOperations())
 , m_pRenameOperations(new ShellFileOperations())
index 186dcdd..942eb1f 100644 (file)
@@ -101,7 +101,7 @@ public:
        explicit PackingInfo(PLUGIN_MODE bMode = (PLUGIN_MODE)FileTransform::g_bUnpackerMode)
        : PluginForFile(bMode)
        , subcode(0)
-       , pufile(0)
+       , pufile(nullptr)
        , disallowMixedEOL(false)
        {
        }
index 7e42f0e..bcd5f32 100644 (file)
@@ -15,7 +15,7 @@ using Poco::RegularExpression;
  * @brief Constructor.
  */
  FilterList::FilterList()
-: m_lastMatchExpression(NULL)
+: m_lastMatchExpression(nullptr)
 {
 }
 
index 58c9a17..b50983f 100644 (file)
@@ -40,7 +40,7 @@ IMPLEMENT_DYNCREATE (CGhostTextView, CCrystalEditViewEx)
  * @brief Constructor, initializes members.
  */
 CGhostTextView::CGhostTextView()
-: m_pGhostTextBuffer(NULL)
+: m_pGhostTextBuffer(nullptr)
 , m_nTopSubLinePushed(0)
 {
 }
index 12a0b8e..e9f461c 100644 (file)
@@ -123,11 +123,11 @@ END_MESSAGE_MAP()
  * @brief Constructor.
  */
 CHexMergeDoc::CHexMergeDoc()
-: m_pDirDoc(NULL)
+: m_pDirDoc(nullptr)
 {
        m_nBuffers = m_nBuffersTemp;
        m_filePaths.SetSize(m_nBuffers);
-       std::fill_n(m_pView, m_nBuffers, static_cast<CHexMergeView *>(NULL));
+       std::fill_n(m_pView, m_nBuffers, static_cast<CHexMergeView *>(nullptr));
        std::fill_n(m_nBufferType, m_nBuffers, BUFFER_NORMAL);
 }
 
@@ -574,7 +574,7 @@ void CHexMergeDoc::UpdateHeaderPath(int pane)
                sText.insert(0, _T("* "));
        pf->GetHeaderInterface()->SetText(pane, sText);
 
-       SetTitle(NULL);
+       SetTitle(nullptr);
 }
 
 
index 5130de9..772f5ff 100644 (file)
@@ -74,8 +74,8 @@ enum
 // CHexMergeFrame construction/destruction
 
 CHexMergeFrame::CHexMergeFrame()
-: m_hIdentical(NULL)
-, m_hDifferent(NULL)
+: m_hIdentical(nullptr)
+, m_hDifferent(nullptr)
 {
        std::fill_n(m_nLastSplitPos, 2, 0);
        m_pMergeDoc = 0;
index 82c6a84..307821d 100644 (file)
@@ -103,7 +103,7 @@ END_MESSAGE_MAP()
  * @brief Constructor.
  */
 CHexMergeView::CHexMergeView()
-: m_pif(0)
+: m_pif(nullptr)
 , m_nThisPane(0)
 {
 }
index 816e8a3..4c003ff 100644 (file)
@@ -112,7 +112,7 @@ public:
                std::string ret;\r
                if (ImageList_GetImageInfo(hImageList, iconIndex, &imageInfo))\r
                {\r
-                       HDC hdcMem = CreateCompatibleDC(NULL);\r
+                       HDC hdcMem = CreateCompatibleDC(nullptr);\r
                        BITMAPINFO bmpinfo = { 0 };\r
                        bmpinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);\r
                        int w = imageInfo.rcImage.right - imageInfo.rcImage.left;\r
index 37b382b..95ad389 100644 (file)
@@ -156,12 +156,12 @@ CMenu CImgMergeFrame::menu;
 // CImgMergeFrame construction/destruction
 
 CImgMergeFrame::CImgMergeFrame()
-: m_hIdentical(NULL)
-, m_hDifferent(NULL)
-, m_pDirDoc(NULL)
+: m_hIdentical(nullptr)
+, m_hDifferent(nullptr)
+, m_pDirDoc(nullptr)
 , m_bAutoMerged(false)
-, m_pImgMergeWindow(NULL)
-, m_pImgToolWindow(NULL)
+, m_pImgMergeWindow(nullptr)
+, m_pImgToolWindow(nullptr)
 {
        std::fill_n(m_nLastSplitPos, 2, 0);
        std::fill_n(m_nBufferType, 3, BUFFER_NORMAL);
@@ -209,7 +209,7 @@ bool CImgMergeFrame::OpenDocs(int nFiles, const FileLocation fileloc[], const bo
                m_strDesc[pane] = strDesc ? strDesc[pane] : _T("");
                m_nBufferType[pane] = (!strDesc || strDesc[pane].empty()) ? BUFFER_NORMAL : BUFFER_NORMAL_NAMED;
        }
-       SetTitle(NULL);
+       SetTitle(nullptr);
 
        LPCTSTR lpszWndClass = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW,
                        LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_WINDOW+1), NULL);
index a4c913c..1d2ff82 100644 (file)
@@ -26,7 +26,7 @@ IMPLEMENT_DYNAMIC(LineFiltersDlg, CTrPropertyPage)
  */
 LineFiltersDlg::LineFiltersDlg()
 : CTrPropertyPage(LineFiltersDlg::IDD)
-, m_pList(NULL)
+, m_pList(nullptr)
 {
        //{{AFX_DATA_INIT(LineFiltersDlg)
        m_bIgnoreRegExp = FALSE;
index b0dda5c..4354c40 100644 (file)
@@ -19,7 +19,7 @@ static const TCHAR FiltersRegPath[] =_T("LineFilters");
  * @brief Default constructor.
  */
 LineFiltersList::LineFiltersList()
-: m_pOptionsMgr(NULL)
+: m_pOptionsMgr(nullptr)
 {
 }
 
@@ -147,7 +147,7 @@ bool LineFiltersList::Compare(const LineFiltersList *list) const
  */
 void LineFiltersList::Initialize(COptionsMgr *pOptionsMgr)
 {
-       assert(pOptionsMgr);
+       assert(pOptionsMgr != nullptr);
        String valuename(FiltersRegPath);
 
        m_pOptionsMgr = pOptionsMgr;
@@ -177,7 +177,7 @@ void LineFiltersList::Initialize(COptionsMgr *pOptionsMgr)
  */
 void LineFiltersList::SaveFilters()
 {
-       assert(m_pOptionsMgr);
+       assert(m_pOptionsMgr != nullptr);
        String valuename(FiltersRegPath);
 
        size_t count = m_items.size();
index 1eae229..0950e25 100644 (file)
@@ -19,7 +19,7 @@ IMPLEMENT_DYNAMIC(CLocationBar, TViewBarBase);
 //////////////////////////////////////////////////////////////////////
 
 CLocationBar::CLocationBar()
-: m_hwndFrame(NULL)
+: m_hwndFrame(nullptr)
 {
 }
 
index f9df628..31430bc 100644 (file)
@@ -269,7 +269,7 @@ static CPtrList &GetDocList(CMultiDocTemplate *pTemplate)
  */
 CMainFrame::CMainFrame()
 : m_bFirstTime(true)
-, m_pDropHandler(NULL)
+, m_pDropHandler(nullptr)
 , m_bShowErrors(false)
 {
 }
index 60c5814..1631ffc 100644 (file)
@@ -106,11 +106,11 @@ END_MESSAGE_MAP()
 
 CMergeApp::CMergeApp() :
   m_bNeedIdleTimer(false)
-, m_pOpenTemplate(0)
-, m_pDiffTemplate(0)
-, m_pHexMergeTemplate(0)
-, m_pDirTemplate(0)
-, m_mainThreadScripts(NULL)
+, m_pOpenTemplate(nullptr)
+, m_pDiffTemplate(nullptr)
+, m_pHexMergeTemplate(nullptr)
+, m_pDirTemplate(nullptr)
+, m_mainThreadScripts(nullptr)
 , m_nLastCompareResult(0)
 , m_bNonInteractive(false)
 , m_pOptions(new CRegOptionsMgr())
@@ -715,7 +715,7 @@ void CMergeApp::UpdateDefaultCodepage(int cpDefaultMode, int cpCustomCodepage)
                        break;
                default:
                        // no other valid option
-                       assert (0);
+                       assert (false);
                        ucr::setDefaultCodepage(GetACP());
        }
 }
index f7964e2..1680ca5 100644 (file)
@@ -21,7 +21,7 @@ class PluginInfo;
 
 struct Merge7zFormatMergePluginImpl : public Merge7z::Format
 {
-       Merge7zFormatMergePluginImpl() : m_plugin(NULL) {}
+       Merge7zFormatMergePluginImpl() : m_plugin(nullptr) {}
        virtual HRESULT DeCompressArchive(HWND, LPCTSTR path, LPCTSTR folder);
        virtual HRESULT CompressArchive(HWND, LPCTSTR path, Merge7z::DirItemEnumerator *);
        virtual Inspector *Open(HWND, LPCTSTR);
index b4feb45..010e73e 100644 (file)
@@ -129,7 +129,7 @@ END_MESSAGE_MAP()
 CMergeDoc::CMergeDoc()
 : m_bEnableRescan(true)
 , m_nCurDiff(-1)
-, m_pDirDoc(NULL)
+, m_pDirDoc(nullptr)
 , m_bMixedEol(false)
 , m_pInfoUnpacker(new PackingInfo)
 , m_pEncodingErrorBar(nullptr)
index 6b87a6d..215427b 100644 (file)
@@ -69,7 +69,7 @@ CMergeEditView::CMergeEditView()
 , m_nThisPane(0)
 , m_nThisGroup(0)
 , m_bDetailView(false)
-, m_piMergeEditStatus(0)
+, m_piMergeEditStatus(nullptr)
 , m_bAutomaticRescan(false)
 , fTimerWaitingForIdle(0)
 , m_lineBegin(0)
index 8277c64..ea8a4b4 100644 (file)
@@ -40,7 +40,7 @@ void InitializeLogFont(LOGFONT &logfont, int lfHeight, int lfCharSet, int lfPitc
  */
 void SetDefaults(COptionsMgr *pOptionsMgr)
 {
-       HDC hDC = GetDC(NULL);
+       HDC hDC = GetDC(nullptr);
        const int logPixelsY = GetDeviceCaps(hDC, LOGPIXELSY);
 
        // *****
@@ -118,7 +118,7 @@ LOGFONT Load(const COptionsMgr *pOptionsMgr, const String& name)
        // Build a new LOGFONT with values from the 'actual' values of the in-memory Options::Font table.
        // The Registry is not accessed.
        LOGFONT lfnew = { 0 };
-       HDC hDC = GetDC(NULL);
+       HDC hDC = GetDC(nullptr);
        lfnew.lfHeight = -MulDiv(pOptionsMgr->GetInt(name + OPT_FONT_POINTSIZE), GetDeviceCaps(hDC, LOGPIXELSY), 72);
        if (lfnew.lfHeight == 0)
                lfnew.lfHeight = pOptionsMgr->GetInt(name + OPT_FONT_HEIGHT);
@@ -144,7 +144,7 @@ void Save(COptionsMgr *pOptionsMgr, const String& name, const LOGFONT* lf, bool
 {
        // Store LOGFONT values into both the 'actual' value of the in-memory Options::Font table, and 
        // into the appropriate Registry entries.
-       HDC hDC = GetDC(NULL);
+       HDC hDC = GetDC(nullptr);
        pOptionsMgr->SaveOption(name + OPT_FONT_USECUSTOM, bUseCustom);
        pOptionsMgr->SaveOption(name + OPT_FONT_POINTSIZE, -MulDiv(lf->lfHeight, 72, GetDeviceCaps(hDC, LOGPIXELSY)));
        pOptionsMgr->SaveOption(name + OPT_FONT_HEIGHT, lf->lfHeight);
index 4571ebe..da4b6e1 100644 (file)
@@ -83,7 +83,7 @@ public:
                m_sel =  (pPathContext->GetSize() == 0) ? -1 : 0;
        }
 
-       PathContextIterator() : m_pPathContext(NULL), m_sel(-1)
+       PathContextIterator() : m_pPathContext(nullptr), m_sel(-1)
        {
        }
 
index 49e6ad9..d19c6d0 100644 (file)
@@ -888,7 +888,7 @@ CScriptsOfThread * CAllThreadsScripts::GetActiveSet()
        for (size_t i = 0 ; i < m_aAvailableThreads.size() ; i++)
                if (m_aAvailableThreads[i] && m_aAvailableThreads[i]->m_nThreadId == nThreadId)
                        return m_aAvailableThreads[i];
-       assert(0);
+       assert(false);
        return NULL;
 }
 CScriptsOfThread * CAllThreadsScripts::GetActiveSetNoAssert()
@@ -946,8 +946,8 @@ CAssureScriptsForThread::~CAssureScriptsForThread()
 static void ShowPluginErrorMessage(IDispatch *piScript, LPTSTR description)
 {
        PluginInfo * pInfo = CAllThreadsScripts::GetActiveSet()->GetPluginInfo(piScript);
-       assert(pInfo != NULL);
-       assert(description != NULL);    
+       assert(pInfo != nullptr);
+       assert(description != nullptr); 
        AppErrorMessageBox(strutils::format(_T("%s: %s"), pInfo->m_name.c_str(), description));
 }
 
index 5394193..a72ed80 100644 (file)
@@ -38,7 +38,7 @@ static LPCTSTR f_RegValuePath = _T("Executable");
 
 PropRegistry::PropRegistry(COptionsMgr *optionsMgr)
 : OptionsPanel(optionsMgr, PropRegistry::IDD)
-, m_bUseRecycleBin(TRUE)
+, m_bUseRecycleBin(true)
 , m_tempFolderType(0)
 {
 }
index 1ff515c..c3b0cee 100644 (file)
@@ -266,7 +266,7 @@ static const char htmlUTags[] =
 );
 
 CMarkdown::CMarkdown(const char *upper, const char *ahead, unsigned flags):
-first(0), lower(0), upper(upper), ahead(ahead),
+first(nullptr), lower(nullptr), upper(upper), ahead(ahead),
 memcmp(flags & IgnoreCase ? ::_memicmp : ::memcmp),
 utags(flags & HtmlUTags ? htmlUTags : NULL)
 {
@@ -756,7 +756,7 @@ int CMarkdown::FileImage::GuessByteOrder(unsigned dwBOM)
 }
 
 CMarkdown::FileImage::FileImage(const TCHAR *path, size_t trunc, unsigned flags)
-: pImage(NULL), cbImage(0), nByteOrder(0), m_pSharedMemory(NULL), pCopy(NULL)
+: pImage(nullptr), cbImage(0), nByteOrder(0), m_pSharedMemory(nullptr), pCopy(nullptr)
 {
        if (flags & Mapping)
        {