OSDN Git Service

Fix GitHub issue #180: Performance using Unpacker
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Thu, 12 Sep 2019 23:03:23 +0000 (08:03 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Thu, 12 Sep 2019 23:03:23 +0000 (08:03 +0900)
Src/MergeDoc.cpp
Src/TempFile.cpp

index 21b5ca7..b3764ac 100644 (file)
@@ -349,10 +349,7 @@ int CMergeDoc::Rescan(bool &bBinary, IDENTLEVEL &identical,
 
                String temp = m_tempFiles[nBuffer].GetPath();
                if (temp.empty())
-               {
-                       temp = m_tempFiles[nBuffer].CreateFromFile(m_filePaths.GetPath(nBuffer),
-                               tnames[nBuffer]);
-               }
+                       temp = m_tempFiles[nBuffer].Create(tnames[nBuffer]);
                if (temp.empty())
                        return RESCAN_TEMP_ERR;
        }
index 548bc02..a2ed12d 100644 (file)
@@ -63,40 +63,6 @@ String TempFile::Create(const String& prefix, const String& ext)
 }
 
 /**
- * @brief Create a temporary file from existing file's contents.
- * This function creates a temporary file to temp folder and copies
- * given file's contents to there.
- * @param [in] filepath Full path to existing file.
- * @param [in] prefix Prefix for the temporary filename.
- * @return Full path to the temporary file.
- */
-String TempFile::CreateFromFile(const String& filepath, const String& prefix)
-{
-       String temp = env::GetTemporaryPath();
-       if (temp.empty())
-       {
-               return _T("");
-       }
-
-       String pref = prefix;
-       if (pref.empty())
-               pref = _T("wmtmp");
-
-       temp = env::GetTemporaryFileName(temp, pref, nullptr);
-       if (!temp.empty())
-       {
-               // Scratchpads don't have a file to copy.
-               m_path = temp;
-
-               if (::CopyFileW(TFile(filepath).wpath().c_str(), temp.c_str(), FALSE))
-               {
-                       ::SetFileAttributes(temp.c_str(), FILE_ATTRIBUTE_NORMAL);
-               }
-       }
-       return temp;
-}
-
-/**
  * @brief Delete the temporary file, if it exists.
  * @return true if there was no error.
  */