OSDN Git Service

Additional low-level cleanups (4)
authorGreyMerlin <greymerlin7@gmail.com>
Tue, 25 Dec 2018 02:59:44 +0000 (18:59 -0800)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sat, 5 Jan 2019 01:34:10 +0000 (10:34 +0900)
12 files changed:
Externals/crystaledit/editlib/ccrystaltextview.cpp
Externals/crystaledit/editlib/cs2cs.cpp
Src/Common/lwdisp.c
Src/DirActions.cpp
Src/DirScan.cpp
Src/DirView.cpp
Src/FolderCmp.cpp
Src/MergeDoc.cpp
Src/Plugins.cpp
Src/PluginsListDlg.cpp
Src/Test.cpp
Src/paths.cpp

index 23f406e..6514d74 100644 (file)
@@ -5696,7 +5696,7 @@ bracetype (TCHAR c)
 {
   static LPCTSTR braces = _T("{}()[]<>");
   LPCTSTR pos = _tcschr (braces, c);
-  return pos ? (int) (pos - braces) + 1 : 0;
+  return pos != nullptr ? (int) (pos - braces) + 1 : 0;
 }
 
 int
index 5e51766..7057115 100644 (file)
@@ -190,7 +190,7 @@ iconvert (LPTSTR string, int source_coding, int destination_coding, bool alphabe
     if (source_coding < 0)
       {
         posit = fget_coding (string, &source_coding);
-        if (posit)
+        if (posit != 0)
           cod_pos = string + posit;
       }
     if (source_coding < 0)
index a50b368..420de7f 100644 (file)
@@ -201,7 +201,7 @@ LPDISPATCH CreateDispatchBySourceAndCLSID(LPCTSTR source, CLSID *pObjectCLSID)
                                sc = piClassFactory->lpVtbl->CreateInstance(piClassFactory, 0, &IID_IDispatch, &pv);
                        }
                }
-               if (!pv)
+               if (pv == NULL)
                        FreeLibrary(hLibrary);
        }
        return pv;
index 338a60f..2b93607 100644 (file)
@@ -1365,7 +1365,7 @@ CheckAllowUpwardDirectory(const CDiffContext& ctxt, const CTempPathContext *pTem
                path[i] = ctxt.GetNormalizedPath(i);
 
        // If we have temp context it means we are comparing archives
-       if (pTempPathContext)
+       if (pTempPathContext != nullptr)
        {
                std::vector<String> name(path.size());
                for (int i = 0; i < static_cast<int>(path.size()); ++i)
index aa26df9..f1a8fc5 100644 (file)
@@ -91,7 +91,7 @@ public:
                while (pNf.get() != nullptr)
                {
                        WorkNotification* pWorkNf = dynamic_cast<WorkNotification*>(pNf.get());
-                       if (pWorkNf) {
+                       if (pWorkNf != nullptr) {
                                m_pCtxt->m_pCompareStats->BeginCompare(&pWorkNf->data(), m_id);
                                if (!m_pCtxt->ShouldAbort())
                                        CompareDiffItem(pWorkNf->data(), m_pCtxt);
index 2aa9c36..35845df 100644 (file)
@@ -3644,7 +3644,7 @@ LRESULT CDirView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
 
        CShellContextMenu* pMenu = GetCorrespondingShellContextMenu(m_hCurrentMenu);
 
-       if (pMenu)
+       if (pMenu != nullptr)
        {
                LRESULT res = 0;
                pMenu->HandleMenuMessage(message, wParam, lParam, res);
index 2225bcd..5649136 100644 (file)
@@ -96,7 +96,7 @@ int FolderCmp::prepAndCompareFiles(CDiffContext * pCtxt, DIFFITEM &di)
                PrediffingInfo * infoPrediffer = nullptr;
 
                // Get existing or new plugin infos
-               if (pCtxt->m_piPluginInfos)
+               if (pCtxt->m_piPluginInfos != nullptr)
                        pCtxt->FetchPluginInfos(filteredFilenames, &infoUnpacker,
                                        &infoPrediffer);
 
index 96d5055..3c6a1ee 100644 (file)
@@ -216,7 +216,7 @@ CMergeEditView * CMergeDoc::GetActiveMergeView()
 {
        CView * pActiveView = GetParentFrame()->GetActiveView();
        CMergeEditView * pMergeEditView = dynamic_cast<CMergeEditView *>(pActiveView);
-       if (!pMergeEditView)
+       if (pMergeEditView == nullptr)
                pMergeEditView = GetView(0, 0); // default to left view (in case some location or detail view active)
        return pMergeEditView;
 }
@@ -228,7 +228,7 @@ CMergeEditView * CMergeDoc::GetActiveMergeGroupView(int nBuffer)
 
 void CMergeDoc::SetUnpacker(const PackingInfo * infoNewHandler)
 {
-       if (infoNewHandler)
+       if (infoNewHandler != nullptr)
        {
                *m_pInfoUnpacker = *infoNewHandler;
        }
index 0e6bc7f..ea3ef8b 100644 (file)
@@ -83,7 +83,7 @@ static FastMutex scriptletsSem;
 template<class T> struct AutoReleaser
 {
        explicit AutoReleaser(T *ptr) : p(ptr) {}
-       ~AutoReleaser() { if (p) p->Release(); }
+       ~AutoReleaser() { if (p!=nullptr) p->Release(); }
        T *p;
 };
 
@@ -118,7 +118,7 @@ bool IsWindowsScriptThere()
 int GetFunctionsFromScript(IDispatch *piDispatch, vector<String>& namesArray, vector<int>& IdArray, INVOKEKIND wantedKind)
 {
        UINT iValidFunc = 0;
-       if (piDispatch)
+       if (piDispatch != nullptr)
        {
                ITypeInfo *piTypeInfo=nullptr;
                unsigned  iTInfo = 0; // 0 for type information of IDispatch itself
index 8e3e063..2e5ffc7 100644 (file)
@@ -134,13 +134,13 @@ void PluginsListDlg::OnBnClickedOk()
 void PluginsListDlg::OnBnClickedPluginSettings()
 {
        POSITION pos = m_list.GetFirstSelectedItemPosition();
-       if (pos)
+       if (pos != nullptr)
        {
                String pluginName = static_cast<const TCHAR *>(m_list.GetItemText(m_list.GetNextSelectedItem(pos), 0));
                for (int i = 0; TransformationCategories[i] != nullptr; ++i)
                {
                        PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(TransformationCategories[i], pluginName);
-                       if (plugin)
+                       if (plugin != nullptr)
                        {
                                EnableWindow(false);
                                plugin::InvokeShowSettingsDialog(plugin->m_lpDispatch);
index f3ca527..c9b9c76 100644 (file)
@@ -472,7 +472,7 @@ TEST(FileMenu, OpenProject)
        theApp.LoadAndOpenProjectFile(projectFile);\r
        CFrameWnd *pFrame = GetMainFrame()->GetActiveFrame();\r
        EXPECT_NE(nullptr, pFrame);\r
-       if (pFrame)\r
+       if (pFrame != nullptr)\r
                pFrame->PostMessage(WM_CLOSE);\r
 }\r
 \r
@@ -483,7 +483,7 @@ TEST(FileMenu, OpenProject3)
        theApp.LoadAndOpenProjectFile(projectFile);\r
        CFrameWnd *pFrame = GetMainFrame()->GetActiveFrame();\r
        EXPECT_NE(nullptr, pFrame);\r
-       if (pFrame)\r
+       if (pFrame != nullptr)\r
                pFrame->PostMessage(WM_CLOSE);\r
 }\r
 \r
index 608c467..25831d8 100644 (file)
@@ -224,7 +224,7 @@ String GetLongPath(const String& szPath, bool bExpandEnvs)
        // Convert "%userprofile%\My Documents" to "C:\Documents and Settings\username\My Documents"
        TCHAR expandedPath[MAX_PATH_FULL];
        const TCHAR *lpcszPath = sPath.c_str();
-       if (bExpandEnvs && _tcschr(lpcszPath, '%'))
+       if (bExpandEnvs && _tcschr(lpcszPath, '%') != nullptr)
        {
                DWORD dwLen = ExpandEnvironmentStrings(lpcszPath, expandedPath, MAX_PATH_FULL);
                if (dwLen > 0 && dwLen < MAX_PATH_FULL)