OSDN Git Service

Remove warning C4706: assignment in conditional
authorGreyMerlin <GreyMerlin7@gmail.com>
Thu, 28 Dec 2017 18:55:05 +0000 (10:55 -0800)
committerGreyMerlin <GreyMerlin7@gmail.com>
Thu, 28 Dec 2017 18:55:05 +0000 (10:55 -0800)
 * Remove all instances of the level=4 warning `warning C4706:
assignment within conditional expression`

Src/7zCommon.cpp
Src/Common/PreferencesDlg.cpp
Src/ImgMergeFrm.cpp
Src/TempFile.cpp

index 9d64a9f..7479acb 100644 (file)
@@ -624,7 +624,8 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
                USES_CONVERSION;\r
                // Handle archives using 7-zip\r
                Merge7z::Format *piHandler;\r
-               if (piHandler = ArchiveGuessFormat(res.files[0]))\r
+               piHandler = ArchiveGuessFormat(res.files[0]);\r
+               if (piHandler)\r
                {\r
                        res.pTempPathContext = new CTempPathContext;\r
                        path = env::GetTempChildPath();\r
@@ -645,10 +646,13 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
                                SysFreeString(pTmp);\r
                                res.files[0].insert(0, _T("\\"));\r
                                res.files[0].insert(0, path);\r
-                       } while (piHandler = ArchiveGuessFormat(res.files[0]));\r
+                               piHandler = ArchiveGuessFormat(res.files[0]);\r
+                       } while (piHandler);\r
                        res.files[0] = path;\r
                }\r
-               if (!res.files[1].empty() && (piHandler = ArchiveGuessFormat(res.files[1])))\r
+               piHandler = res.files[1].empty() ? nullptr\r
+                                                                                : ArchiveGuessFormat(res.files[1]);\r
+               if (piHandler)\r
                {\r
                        if (!res.pTempPathContext)\r
                        {\r
@@ -670,10 +674,12 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
                                SysFreeString(pTmp);\r
                                res.files[1].insert(0, _T("\\"));\r
                                res.files[1].insert(0, path);\r
-                       } while (piHandler = ArchiveGuessFormat(res.files[1]));\r
+                               piHandler = ArchiveGuessFormat(res.files[1]);\r
+                       } while (piHandler);\r
                        res.files[1] = path;\r
                }\r
-               if (res.files.GetSize() > 2 && (piHandler = ArchiveGuessFormat(res.files[2])))\r
+               piHandler = (res.files.GetSize() <= 2) ? nullptr : ArchiveGuessFormat(res.files[2]);\r
+               if (piHandler)\r
                {\r
                        if (!res.pTempPathContext)\r
                        {\r
@@ -695,7 +701,8 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
                                SysFreeString(pTmp);\r
                                res.files[2].insert(0, _T("\\"));\r
                                res.files[2].insert(0, path);\r
-                       } while (piHandler = ArchiveGuessFormat(res.files[2]));\r
+                               piHandler = ArchiveGuessFormat(res.files[2]);\r
+                       } while (piHandler);\r
                        res.files[2] = path;\r
                }\r
                if (res.files[1].empty())\r
index 6909ec2..d81f032 100644 (file)
@@ -241,8 +241,12 @@ CString CPreferencesDlg::GetItemPath(HTREEITEM hti)
 {
        CString sPath = m_tcPages.GetItemText(hti);
 
-       while (hti = m_tcPages.GetParentItem(hti))
+       hti = m_tcPages.GetParentItem(hti);
+       while (hti)
+       {
                sPath = m_tcPages.GetItemText(hti) + _T(" > ") + sPath;
+               hti = m_tcPages.GetParentItem(hti);
+       }
 
        return sPath;
 }
index 42f3f1d..70af7fd 100644 (file)
@@ -1114,19 +1114,22 @@ bool CImgMergeFrame::PromptAndSaveIfNeeded(bool bAllowCancel)
        {
                if (bLModified && dlg.m_leftSave == SaveClosingDlg::SAVECLOSING_SAVE)
                {
-                       if (!(bLSaveSuccess = DoFileSave(0)))
+                       bLSaveSuccess = DoFileSave(0);
+                       if (!bLSaveSuccess)
                                result = false;
                }
 
                if (bMModified && dlg.m_middleSave == SaveClosingDlg::SAVECLOSING_SAVE)
                {
-                       if (!(bMSaveSuccess = DoFileSave(1)))
+                       bMSaveSuccess = DoFileSave(1);
+                       if (!bMSaveSuccess)
                                result = false;
                }
 
                if (bRModified && dlg.m_rightSave == SaveClosingDlg::SAVECLOSING_SAVE)
                {
-                       if (!(bRSaveSuccess = DoFileSave(m_pImgMergeWindow->GetPaneCount() - 1)))
+                       bRSaveSuccess = DoFileSave(m_pImgMergeWindow->GetPaneCount() - 1);
+                       if (!bRSaveSuccess)
                                result = false;
                }
        }
index 210a421..6373b31 100644 (file)
@@ -181,7 +181,8 @@ static bool CleanupWMtempfolder(const vector <int>& processIDs)
                                if (!WMrunning(processIDs, pid))
                                {
                                        tempfolderPID = paths::ConcatPath(paths::GetParentPath(pattern), ff.cFileName); 
-                                       if (res = ClearTempfolder(tempfolderPID))
+                                       res = ClearTempfolder(tempfolderPID);
+                                       if (res)
                                                bok = !!FindNextFile(h, &ff) ;
                                        continue;
                                }