OSDN Git Service

Cppcheck: The scope of the variable '...' can be reduced
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sun, 30 Jun 2019 02:40:07 +0000 (11:40 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sun, 30 Jun 2019 02:40:07 +0000 (11:40 +0900)
Src/Merge.cpp
Src/MergeEditView.cpp

index 9459039..783f848 100644 (file)
@@ -1119,23 +1119,20 @@ bool CMergeApp::LoadAndOpenProjectFile(const String& sProject, const String& sRe
        if (!LoadProjectFile(sProject, project))
                return false;
        
-       PathContext tFiles;
-       bool bLeftReadOnly = false;
-       bool bMiddleReadOnly = false;
-       bool bRightReadOnly = false;
-       bool bRecursive = false;
        bool rtn = true;
        for (auto& projItem : project.Items())
        {
+               PathContext tFiles;
+               bool bRecursive = false;
                projItem.GetPaths(tFiles, bRecursive);
                for (int i = 0; i < tFiles.GetSize(); ++i)
                {
                        if (!paths::IsPathAbsolute(tFiles[i]))
                                tFiles[i] = paths::ConcatPath(paths::GetParentPath(sProject), tFiles[i]);
                }
-               bLeftReadOnly = projItem.GetLeftReadOnly();
-               bMiddleReadOnly = projItem.GetMiddleReadOnly();
-               bRightReadOnly = projItem.GetRightReadOnly();
+               bool bLeftReadOnly = projItem.GetLeftReadOnly();
+               bool bMiddleReadOnly = projItem.GetMiddleReadOnly();
+               bool bRightReadOnly = projItem.GetRightReadOnly();
                if (projItem.HasFilter())
                {
                        String filter = projItem.GetFilter();
index ffef2b0..9f4a27b 100644 (file)
@@ -1787,9 +1787,9 @@ void CMergeEditView::OnX2Y(int srcPane, int dstPane)
 
        if (IsSelection())
        {
-               int firstDiff, lastDiff, firstWordDiff, lastWordDiff;
                if (!m_bColumnSelection)
                {
+                       int firstDiff, lastDiff, firstWordDiff, lastWordDiff;
                        GetFullySelectedDiffs(firstDiff, lastDiff, firstWordDiff, lastWordDiff);
                        if (firstDiff != -1 && lastDiff != -1)
                        {