OSDN Git Service

C++11のrange-based forを用いて書き直し。
authorsirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Thu, 8 Nov 2012 13:06:47 +0000 (13:06 +0000)
committersirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Thu, 8 Nov 2012 13:06:47 +0000 (13:06 +0000)
書庫のロードを高速化するために、進捗バーの更新を抑止。

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@631 9df91469-1e22-0410-86e7-ea8537beb833

src/common/Makefile.default
src/lychee/cls_filedroptarget.cpp
src/lychee/dlg_make.cpp
src/lychee/dlg_process.cpp
src/lychee/frm_main.cpp
src/lychee/functions.cpp

index 5344782..627465b 100644 (file)
@@ -3,7 +3,7 @@
 
 # Define compilers.
 CC = g++
-CPPFLAGS = -c -O3 -Wall -Wextra -fno-exceptions -fno-rtti -fPIC `wx-config --cxxflags`
+CPPFLAGS = -c -O3 -Wall -Wextra -fno-exceptions -fno-rtti -fPIC `wx-config --cxxflags` -std=c++11
 LDFLAGS  = -s
 
 # Check the architecture.
index ccea9c0..943c025 100644 (file)
@@ -92,10 +92,10 @@ bool myFileDropTarget::OnDropFiles(wxCoord, wxCoord, const wxArrayString & asFil
 myFileDataObject::~myFileDataObject()\r
 {\r
        // ファイルを削除。\r
-       for (size_t i = 0; i < this->m_filenames.GetCount(); i++)\r
+       for (auto f : this->m_filenames)\r
        {\r
-               chmod(this->m_filenames[i].ToUTF8(), 0600);\r
-               ::wxRemoveFile(this->m_filenames[i]);\r
+               chmod(f.ToUTF8(), 0600);\r
+               ::wxRemoveFile(f);\r
        }\r
 \r
        // 一時ディレクトリを削除。\r
@@ -107,9 +107,9 @@ myFileDataObject::~myFileDataObject()
 bool myFileDataObject::GetDataHere(void * buf) const\r
 {\r
        wxString filenames;\r
-       for (size_t i = 0; i < m_filenames.GetCount(); i++)\r
+       for (auto f : this->m_filenames)\r
        {\r
-               filenames += wxT("file:") + m_filenames[i] + wxT("\r\n");\r
+               filenames += wxT("file:") + f + wxT("\r\n");\r
        }\r
        memcpy(buf, filenames.mbc_str(), strlen(filenames.mbc_str()) + 1);\r
        return true;\r
@@ -118,9 +118,9 @@ bool myFileDataObject::GetDataHere(void * buf) const
 size_t myFileDataObject::GetDataSize() const\r
 {\r
        size_t res = 1;\r
-       for (size_t i = 0; i < m_filenames.GetCount(); i++)\r
+       for (auto f : this->m_filenames)\r
        {\r
-               res += strlen(m_filenames[i].mbc_str()) + 5 + 2; // "file:" (5) + "\r\n" (2)\r
+               res += strlen(f.mbc_str()) + 5 + 2; // "file:" (5) + "\r\n" (2)\r
        }\r
        return res;\r
 }\r
index 9d04a41..467fd2f 100644 (file)
@@ -406,37 +406,41 @@ void MakeDialog::OnTabChanged(wxNotebookEvent& e)
                wxString szOutputRootDir = WillMakeDirByArcName((MainFrame *) this->GetParent(), this) ? MakeDirPath(wxFileName::DirName(this->cbDir->GetValue()), wxFileName(this->cbFileName->GetValue()).GetName(), false).GetPath() : this->cbDir->GetValue();\r
 \r
                // 各ファイルにパスを付加。\r
+//             for (auto s : this->lcFiles->asInput)\r
                for (size_t i = 0; i < this->lcFiles->asInput->GetCount(); i++)\r
                {\r
+                       wxString s = this->lcFiles->asInput->Item(i);\r
                        wxString szOutputFile = szOutputRootDir + wxFileName::GetPathSeparator();\r
-                       wxFileName fnStored(this->lcFiles->asInput->Item(i));\r
+                       wxFileName fn(s);\r
                        if (! this->cbIgnorePath->IsChecked())\r
                        {\r
-                               szOutputFile += fnStored.GetPathWithSep();\r
+                               szOutputFile += fn.GetPathWithSep();\r
                        }\r
-                       wxFileName fnOutput(szOutputFile + fnStored.GetFullName());\r
-                       if (! fnOutput.Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE | wxPATH_NORM_LONG) || ! fnOutput.GetFullPath().StartsWith(szOutputRootDir))\r
+                       fn = wxFileName(szOutputFile + fn.GetFullName());\r
+                       if (! fn.Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE | wxPATH_NORM_LONG) || ! fn.GetFullPath().StartsWith(szOutputRootDir))\r
                        {\r
                                fDTVWarning = true;\r
                                this->lcFiles->apItem.Add(& this->lcFiles->atDangerItem);\r
                        }\r
                        else\r
                        {\r
-                               this->lcFiles->apItem.Add(fnOutput.FileExists() || ::wxDirExists(fnOutput.GetFullPath()) ? & this->lcFiles->atExistItem : NULL);\r
+                               this->lcFiles->apItem.Add(fn.FileExists() || ::wxDirExists(fn.GetFullPath()) ? & this->lcFiles->atExistItem : NULL);\r
                        }\r
-                       this->lcFiles->asOutput.Add(fnOutput.GetFullPath());\r
+                       this->lcFiles->asOutput.Add(fn.GetFullPath());\r
                }\r
                break;\r
        }\r
        case TPI_COMMAND_ADD:\r
        case TPI_COMMAND_CREATE:\r
                // 格納パスを推測。\r
+//             for (auto s : this->lcFiles->asInput)\r
                for (size_t i = 0; i < this->lcFiles->asInput->GetCount(); i++)\r
                {\r
-                       wxFileName fnStored(this->lcFiles->asInput->Item(i));\r
-                       this->lcFiles->asOutput.Add(this->cbIgnorePath->IsChecked() ? fnStored.GetFullName() : fnStored.GetFullPath());\r
-                       fnStored = wxFileName(this->lcFiles->asOutput.Item(i));\r
-                       if (fnStored.GetPathWithSep(wxPATH_UNIX).Find(wxT("../")) != wxNOT_FOUND)\r
+                       wxString s = this->lcFiles->asInput->Item(i);\r
+                       wxFileName fn(s);\r
+                       fn = wxFileName(this->cbIgnorePath->IsChecked() ? fn.GetFullName() : fn.GetFullPath());\r
+                       this->lcFiles->asOutput.Add(fn.GetFullPath());\r
+                       if (fn.GetPathWithSep(wxPATH_UNIX).Find(wxT("../")) != wxNOT_FOUND)\r
                        {\r
                                fDTVWarning = true;\r
                                this->lcFiles->apItem.Add(& this->lcFiles->atDangerItem);\r
index bec6d8f..a0aecfe 100644 (file)
@@ -213,6 +213,7 @@ int ProcessDialog::CallbackProc(unsigned int _uMsg, void * _pStructure)
                        this->ebSource->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());\r
                        this->Update();\r
                        ((MainFrame *) this->hParent)->gFrame->Show();\r
+                       ::wxSafeYield(this->hParent, true);\r
                case 0x1001: // 閲覧時は最初にファイル数が分からないので、ここで設定。\r
                        this->gArchive->SetRange(piInfo->fiInfo.nUnpackedSize);\r
                        ((MainFrame *) this->hParent)->gFrame->SetRange(piInfo->fiInfo.nUnpackedSize);\r
@@ -220,24 +221,24 @@ int ProcessDialog::CallbackProc(unsigned int _uMsg, void * _pStructure)
 #ifdef __WINDOWS__\r
                        s_nFileCount = piInfo->fiInfo.nUnpackedSize;\r
 #endif\r
-                       sw.Start();\r
+//                     sw.Start();\r
                        if (piInfo->eStatus == 0x1001)\r
                        {\r
                                this->fOpen = true;\r
                        }\r
                        break;\r
                case 0x1002: // 各ファイルの処理を開始。\r
-                       if (sw.Time() > 500)\r
+//                     if (sw.Time() > 500)\r
                        {\r
                                if (this->IsShownOnScreen())\r
                                {\r
-                                       sw.Start();\r
+//                                     sw.Start();\r
                                        this->ebTarget->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());\r
                                        this->gArchive->SetValue(piInfo->nProcessedSize);\r
                                        this->Update();\r
-                                       ::wxSafeYield(this, true);\r
+//                                     ::wxSafeYield(this, true);\r
                                }\r
-                               ::wxSafeYield(this->hParent, true);\r
+//                             ::wxSafeYield(this->hParent, true);\r
                        }\r
                        ((MainFrame *) this->hParent)->gFrame->SetValue(piInfo->nProcessedSize);\r
 #ifdef __WINDOWS__\r
index 52134ce..beafc25 100644 (file)
@@ -277,11 +277,13 @@ void MainFrame::OnArcCreate(wxCommandEvent& e)
                mkDlg.files = * (wxArrayString *) e.GetClientData();\r
                swInfo.fnDestinationDirectory = wxFileName::DirName(wxFileName(mkDlg.files[0]).GetPath());\r
                // 相対パスに変換。\r
+//             for (auto s : mkDlg.files)\r
                for (size_t n = 0; n < mkDlg.files.GetCount(); n++)\r
                {\r
-                       wxFileName fn(mkDlg.files[n]);\r
+                       wxString & s = mkDlg.files[n];\r
+                       wxFileName fn(s);\r
                        fn.MakeRelativeTo(swInfo.fnDestinationDirectory.GetPath());\r
-                       mkDlg.files[n] = fn.GetFullPath();\r
+                       s = fn.GetFullPath();\r
                }\r
        }\r
 \r
@@ -432,7 +434,7 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
                idArcRoot = this->tree_ctrl->AppendItem(idRoot, wxT("-----"), 0, 1);\r
 \r
        // 巨大書庫のときにファイル名検査を省略するか。\r
-       bool bDTVCheck = piInfo.fiInfo.nUnpackedSize < 10000 || AskDlg(_("This archive contains so many files that it takes long to check Directory Traversal Vulnerability(DTV) problem. If you are sure this archive is safe, you can skip this scanning process. Do you want to scan for DTV problem?"), this) == wxNO;\r
+       bool bDTVCheck = true;//piInfo.fiInfo.nUnpackedSize < 10000 || AskDlg(_("This archive contains so many files that it takes long to check Directory Traversal Vulnerability(DTV) problem. If you are sure this archive is safe, you can skip this scanning process. Do you want to scan for DTV problem?"), this) == wxNO;\r
 \r
        // ファイル情報をロード。\r
        if (tpi.GetFileInformation(& piInfo.fiInfo, true))\r
@@ -451,93 +453,98 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
                                return;\r
                        }\r
 \r
-                       // 拡張子のみ設定されている場合。\r
-                       if (piInfo.fiInfo.szStoredName.IsEmpty())\r
-                       {\r
-                               piInfo.fiInfo.szStoredName = this->fnArchive.GetName();\r
-                               if (piInfo.fiInfo.fnFileName.HasExt())\r
-                               {\r
-                                       piInfo.fiInfo.szStoredName += wxT('.') + piInfo.fiInfo.fnFileName.GetExt();\r
-                               }\r
-                               piInfo.fiInfo.fnFileName = wxFileName(piInfo.fiInfo.szStoredName);\r
-                       }\r
+                       // 情報を保存してカウントアップ。\r
+                       this->fileinfo.Add(piInfo.fiInfo);\r
+               }\r
+               while (tpi.GetFileInformation(& piInfo.fiInfo));\r
+       }\r
+\r
+       // GetFileInformationがエラー終了した場合。\r
+       this->ErrorCheck(tpi.nErrorCode, wxT("GetFileInformation"));\r
 \r
-                       // セキュリティチェック。\r
-                       // ルート記号を削除。\r
-                       wxString szPath = piInfo.fiInfo.fnFileName.GetPathWithSep(wxPATH_UNIX);\r
-                       if (szPath.StartsWith(wxT("/")) || szPath.StartsWith(wxT("./")))\r
+//     for (auto f : this->fileinfo)\r
+       for (size_t i = 0; i < this->fileinfo.GetCount(); i++)\r
+       {\r
+               TPI_FILEINFO & f = this->fileinfo[i];\r
+               // 拡張子のみ設定されている場合。\r
+               if (f.szStoredName.IsEmpty())\r
+               {\r
+                       f.szStoredName = this->fnArchive.GetName();\r
+                       if (f.fnFileName.HasExt())\r
                        {\r
-                               piInfo.fiInfo.fnFileName = wxFileName(szPath.AfterFirst(wxT('/')), piInfo.fiInfo.fnFileName.GetFullName(), wxPATH_DOS);\r
+                               f.szStoredName += wxT('.') + f.fnFileName.GetExt();\r
                        }\r
-                       // ルートメンバの情報は無視する。\r
-                       if (piInfo.fiInfo.fnFileName.GetFullPath().IsEmpty() || piInfo.fiInfo.fnFileName.GetFullPath() == wxT("."))\r
+                       f.fnFileName = wxFileName(f.szStoredName);\r
+               }\r
+\r
+               // セキュリティチェック。\r
+               // ルート記号を削除。\r
+               wxString szPath = f.fnFileName.GetPathWithSep(wxPATH_UNIX);\r
+               if (szPath.StartsWith(wxT("/")) || szPath.StartsWith(wxT("./")))\r
+               {\r
+                       f.fnFileName = wxFileName(szPath.AfterFirst(wxT('/')), f.fnFileName.GetFullName(), wxPATH_DOS);\r
+               }\r
+               // ルートメンバの情報は無視する。\r
+               if (f.fnFileName.GetFullPath().IsEmpty() || f.fnFileName.GetFullPath() == wxT("."))\r
+               {\r
+                       continue;\r
+               }\r
+\r
+               // 改行文字/タブ文字などを削除。\r
+               if (f.szStoredName.Find(wxT('\r')) != wxNOT_FOUND\r
+               ||  f.szStoredName.Find(wxT('\n')) != wxNOT_FOUND\r
+               ||  f.szStoredName.Find(wxT('\t')) != wxNOT_FOUND)\r
+               {\r
+                       wxString sz = f.fnFileName.GetFullPath();\r
+                       sz.Replace(wxT("\r"), wxT(" "));\r
+                       sz.Replace(wxT("\n"), wxT(" "));\r
+                       sz.Replace(wxT("\t"), wxT(" "));\r
+                       f.eDanger = TRUE;\r
+                       f.fnFileName = wxFileName(sz);\r
+                       wxLogWarning(_("This archive may contain files whose name contains some special characters like CR(\\r), LF(\\n), Tab(\\t) and some problem would be happen if you extract these files. Don\'t extract these files carelessly.\nDanger file is:\n%s"), f.fnFileName.GetFullPath().c_str());\r
+               }\r
+\r
+               if (bDTVCheck)\r
+               {\r
+                       // DTV検査。\r
+                       if (f.fnFileName.GetPathWithSep(wxPATH_UNIX).Find(wxT("../")) != wxNOT_FOUND)\r
                        {\r
-                               continue;\r
+                               f.eDanger = TRUE;\r
+                               wxLogWarning(_("This archive may have Directory Traversal Vulnerability(DTV) problem, and some danger files may be extracted to the unexpected system directory! You should use the \"Ignore file pathes\" option when extracting this archive.\nDanger file is:\n%s"), f.fnFileName.GetFullPath().c_str());\r
                        }\r
-\r
-                       // 改行文字/タブ文字などを削除。\r
-                       if (piInfo.fiInfo.szStoredName.Find(wxT('\r')) != wxNOT_FOUND\r
-                       ||  piInfo.fiInfo.szStoredName.Find(wxT('\n')) != wxNOT_FOUND\r
-                       ||  piInfo.fiInfo.szStoredName.Find(wxT('\t')) != wxNOT_FOUND)\r
+                       // 空白の連続による拡張子偽装を検査。\r
+                       if (f.fnFileName.GetFullName().Find(wxT("        ")) != wxNOT_FOUND)\r
                        {\r
-                               wxString sz = piInfo.fiInfo.fnFileName.GetFullPath();\r
-                               sz.Replace(wxT("\r"), wxT(" "));\r
-                               sz.Replace(wxT("\n"), wxT(" "));\r
-                               sz.Replace(wxT("\t"), wxT(" "));\r
-                               piInfo.fiInfo.eDanger = TRUE;\r
-                               piInfo.fiInfo.fnFileName = wxFileName(sz);\r
-                               wxLogWarning(_("This archive may contain files whose name contains some special characters like CR(\\r), LF(\\n), Tab(\\t) and some problem would be happen if you extract these files. Don\'t extract these files carelessly.\nDanger file is:\n%s"), piInfo.fiInfo.fnFileName.GetFullPath().c_str());\r
+                               f.eDanger = TRUE;\r
+                               wxLogWarning(_("This archive may contain extension-disguised files whose real extension is hidden by using many blank charactor and you may mistake that it is a \"safe\" file. Don\'t execute these files carelessly.\nDanger file is:\n%s"), f.fnFileName.GetFullPath().c_str());\r
                        }\r
-\r
-                       if (bDTVCheck)\r
+                       // Unicode制御文字を検査。\r
+                       for (wxChar c = 0x200c; c <= 0x206f; c++)\r
                        {\r
-                               // DTV検査。\r
-                               if (piInfo.fiInfo.fnFileName.GetPathWithSep(wxPATH_UNIX).Find(wxT("../")) != wxNOT_FOUND)\r
-                               {\r
-                                       piInfo.fiInfo.eDanger = TRUE;\r
-                                       wxLogWarning(_("This archive may have Directory Traversal Vulnerability(DTV) problem, and some danger files may be extracted to the unexpected system directory! You should use the \"Ignore file pathes\" option when extracting this archive.\nDanger file is:\n%s"), piInfo.fiInfo.fnFileName.GetFullPath().c_str());\r
-                               }\r
-                               // 空白の連続による拡張子偽装を検査。\r
-                               if (piInfo.fiInfo.fnFileName.GetFullName().Find(wxT("        ")) != wxNOT_FOUND)\r
+                               if (f.fnFileName.GetFullName().Find(c) != wxNOT_FOUND)\r
                                {\r
-                                       piInfo.fiInfo.eDanger = TRUE;\r
-                                       wxLogWarning(_("This archive may contain extension-disguised files whose real extension is hidden by using many blank charactor and you may mistake that it is a \"safe\" file. Don\'t execute these files carelessly.\nDanger file is:\n%s"), piInfo.fiInfo.fnFileName.GetFullPath().c_str());\r
+                                       f.eDanger = TRUE;\r
+                                       wxLogWarning(_("This archive may contain extension-disguised files whose real extension is hidden by using Unicode control character and you may mistake that it is a \"safe\" file. Don\'t execute these files carelessly.\nDanger file is:\n%s"), f.fnFileName.GetFullPath().c_str());\r
                                }\r
-                               // Unicode制御文字を検査。\r
-                               for (wxChar c = 0x200c; c <= 0x206f; c++)\r
+                               switch (c)\r
                                {\r
-                                       if (piInfo.fiInfo.fnFileName.GetFullName().Find(c) != wxNOT_FOUND)\r
-                                       {\r
-                                               piInfo.fiInfo.eDanger = TRUE;\r
-                                               wxLogWarning(_("This archive may contain extension-disguised files whose real extension is hidden by using Unicode control character and you may mistake that it is a \"safe\" file. Don\'t execute these files carelessly.\nDanger file is:\n%s"), piInfo.fiInfo.fnFileName.GetFullPath().c_str());\r
-                                       }\r
-                                       switch (c)\r
-                                       {\r
-                                       case 0x200f: c = 0x2027; break;\r
-                                       case 0x202e: c = 0x2060; break;\r
-                                       }\r
+                               case 0x200f: c = 0x2027; break;\r
+                               case 0x202e: c = 0x2060; break;\r
                                }\r
                        }\r
+               }\r
 \r
-                       // ツリービューに反映。\r
-                       bool fDir = piInfo.fiInfo.dwAttribute & TPI_ATTRIBUTE_DIRECTORY ? true : false;\r
-                       TreeView_CheckNewerItem(this->tree_ctrl, idArcRoot, fDir ? piInfo.fiInfo.fnFileName.GetFullPath() : piInfo.fiInfo.fnFileName.GetPath(), true);\r
-\r
-                       // ディレクトリ属性を含むものについては情報を保存しない。\r
-                       if (fDir)\r
-                       {\r
-                               continue;\r
-                       }\r
+               // ツリービューに反映。\r
+               bool fDir = f.dwAttribute & TPI_ATTRIBUTE_DIRECTORY ? true : false;\r
+               TreeView_CheckNewerItem(this->tree_ctrl, idArcRoot, fDir ? f.fnFileName.GetFullPath() : f.fnFileName.GetPath(), true);\r
 \r
-                       // 情報を保存してカウントアップ。\r
-                       this->fileinfo.Add(piInfo.fiInfo);\r
+               // ディレクトリ属性を含むものについては情報を保存しない。\r
+               if (fDir)\r
+               {\r
+                       continue;\r
                }\r
-               while (tpi.GetFileInformation(& piInfo.fiInfo));\r
        }\r
 \r
-       // GetFileInformationがエラー終了した場合。\r
-       this->ErrorCheck(tpi.nErrorCode, wxT("GetFileInformation"));\r
-\r
        // 書庫の情報を取得。\r
        tpi.GetArchiveInformation(& this->aiArchive);\r
        this->ErrorCheck(tpi.nErrorCode, wxT("GetArchiveInformation"));\r
@@ -552,17 +559,17 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
 \r
        // 以下、UI処理。\r
        this->fileinfo.Shrink();\r
-       if (this->fileinfo.Count() < 10000)\r
+//     if (this->fileinfo.Count() < 10000)\r
        {\r
                this->tree_ctrl->ExpandAll();\r
                this->tree_ctrl->SelectItem(idArchive);\r
        }\r
-       else\r
+/*     else\r
        {\r
                // ファイル数が多いとソートに時間がかかるので、書庫のルートを表示させる。\r
                this->tree_ctrl->Expand(idArcRoot);\r
                this->tree_ctrl->SelectItem(idArcRoot);\r
-       }\r
+       }*/\r
        // ツリービューの位置合わせ。\r
        this->tree_ctrl->ScrollTo(idArchive);\r
        this->tree_ctrl->SetScrollPos(wxHORIZONTAL, 0);\r
@@ -713,11 +720,13 @@ void MainFrame::OnArcAdd(wxCommandEvent& e)
                mkDlg.files = * (wxArrayString *) e.GetClientData();\r
                swInfo.fnDestinationDirectory = wxFileName::DirName(wxFileName(mkDlg.files[0]).GetPath());\r
                // 相対パスに変換。\r
+//             for (auto s : mkDlg.files)\r
                for (size_t n = 0; n < mkDlg.files.GetCount(); n++)\r
                {\r
-                       wxFileName fn(mkDlg.files[n]);\r
+                       wxString & s = mkDlg.files[n];\r
+                       wxFileName fn(s);\r
                        fn.MakeRelativeTo(swInfo.fnDestinationDirectory.GetPath());\r
-                       mkDlg.files[n] = fn.GetFullPath();\r
+                       s = fn.GetFullPath();\r
                }\r
        }\r
 \r
@@ -919,9 +928,11 @@ void MainFrame::OnArcExtract(wxCommandEvent& e)
                        wxArrayString asFiles;\r
                        myFileDataObject * objFile = new myFileDataObject();\r
                        objFile->szTempDir = nMode == 3 ? swInfo.fnDestinationDirectory.GetPath() : swInfo.fnDestinationDirectory.GetFullPath();\r
-                       for (size_t i = 0; i < mkDlg.files.GetCount(); i++)\r
+//                     for (auto s : mkDlg.files)\r
+                       for (size_t n = 0; n < mkDlg.files.GetCount(); n++)\r
                        {\r
-                               wxString szFileName = swInfo.fnDestinationDirectory.GetPathWithSep() + wxFileName(mkDlg.files[i], wxPATH_DOS).GetFullName();\r
+                               wxString & s = mkDlg.files[n];\r
+                               wxString szFileName = swInfo.fnDestinationDirectory.GetPathWithSep() + wxFileName(s, wxPATH_DOS).GetFullName();\r
                                if (nMode == 3)\r
                                {\r
                                        asFiles.Add(szFileName);\r
@@ -961,10 +972,12 @@ void MainFrame::OnArcExtract(wxCommandEvent& e)
                                // ディレクトリDnDのときは、先にディレクトリの中のファイルを消しておく。\r
                                if (nMode == 3)\r
                                {\r
+//                                     for (auto s : asFiles)\r
                                        for (size_t i = 0; i < asFiles.GetCount(); i++)\r
                                        {\r
-                                               chmod(asFiles[i].ToUTF8(), 0600);\r
-                                               ::wxRemoveFile(asFiles[i]);\r
+                                               wxString & s = asFiles[i];\r
+                                               chmod(s.ToUTF8(), 0600);\r
+                                               ::wxRemoveFile(s);\r
                                        }\r
                                }\r
 \r
@@ -1103,24 +1116,26 @@ void MainFrame::OnTreeChanged(wxTreeEvent& e)
        this->list_ctrl->SetImageList(& g_hIconLS, wxIMAGE_LIST_SMALL);\r
 \r
        // 配列と比較し、パスが一致しなければ消す。\r
+//     for (auto f : this->fileinfo)\r
        for (size_t i = 0; i < this->fileinfo.GetCount(); i++)\r
        {\r
                // パスを比較。\r
-               if (szNodePath == wxT("*") || szNodePath == this->fileinfo[i].fnFileName.GetPath())\r
+               TPI_FILEINFO & f = this->fileinfo[i];\r
+               if (szNodePath == wxT("*") || szNodePath == f.fnFileName.GetPath())\r
                {\r
                        // 項目がフォルダであるなら無視。\r
-                       if (this->fileinfo[i].fnFileName.IsDir() || ! TreeView_CheckNewerItem(this->tree_ctrl, this->tree_ctrl->GetLastChild(this->tree_ctrl->GetRootItem()), this->fileinfo[i].fnFileName.GetFullPath(), false))\r
+                       if (f.fnFileName.IsDir() || ! TreeView_CheckNewerItem(this->tree_ctrl, this->tree_ctrl->GetLastChild(this->tree_ctrl->GetRootItem()), f.fnFileName.GetFullPath(), false))\r
                        {\r
                                continue;\r
                        }\r
 \r
                        // フィルタにかからなければ無視。\r
-                       if (this->fileinfo[i].fnFileName.GetFullName().MakeLower().Find(this->tcFilter->GetValue().MakeLower()) == wxNOT_FOUND)\r
+                       if (f.fnFileName.GetFullName().MakeLower().Find(this->tcFilter->GetValue().MakeLower()) == wxNOT_FOUND)\r
                        {\r
                                continue;\r
                        }\r
 \r
-                       this->list_ctrl->apShowFile.Add(& this->fileinfo[i]);\r
+                       this->list_ctrl->apShowFile.Add(& f);\r
                }\r
        }\r
 \r
index 1598702..e7cb6cf 100644 (file)
@@ -212,9 +212,11 @@ bool WillMakeDirByArcName(MainFrame * frm, MakeDialog * mk)
        {\r
                // ディレクトリがないので、ルートにファイルが2個以上あるかどうかを判定。\r
                bool fFlag = false;\r
+//             for (auto f : frm->fileinfo)\r
                for (size_t i = 0; i < frm->fileinfo.GetCount(); i++)\r
                {\r
-                       if (frm->fileinfo[i].fnFileName.GetPath().IsEmpty())\r
+                       TPI_FILEINFO & f = frm->fileinfo[i];\r
+                       if (f.fnFileName.GetPath().IsEmpty())\r
                        {\r
                                // ファイルはルートにある。\r
                                if (fFlag)\r
@@ -229,10 +231,12 @@ bool WillMakeDirByArcName(MainFrame * frm, MakeDialog * mk)
        }\r
        case 1:\r
                // ディレクトリが1個なので、ルートにファイルがないかどうかを判定。\r
+//             for (auto f : frm->fileinfo)\r
                for (size_t i = 0; i < frm->fileinfo.GetCount(); i++)\r
                {\r
                        // ディレクトリメンバが格納されている場合には、その名前がツリービューのアイテム名に一致した場合はカウントしない。\r
-                       if (frm->fileinfo[i].fnFileName.GetPath().IsEmpty() && frm->fileinfo[i].fnFileName.GetFullName() != frm->tree_ctrl->GetItemText(frm->tree_ctrl->GetLastChild(tiArcRoot)))\r
+                       TPI_FILEINFO & f = frm->fileinfo[i];\r
+                       if (f.fnFileName.GetPath().IsEmpty() && f.fnFileName.GetFullName() != frm->tree_ctrl->GetItemText(frm->tree_ctrl->GetLastChild(tiArcRoot)))\r
                        {\r
                                return true;\r
                        }\r