From 866e48d73a08e211b1067c25c27828b40b19b07c Mon Sep 17 00:00:00 2001 From: shunf4 Date: Fri, 10 May 2024 19:22:11 +0800 Subject: [PATCH] fix: compile error, using another way to pass down SoleFolderIndex --- CPP/7zip/UI/Agent/ArchiveFolder.cpp | 5 ++++- CPP/7zip/UI/Agent/IFolderArchive.h | 1 - CPP/7zip/UI/FileManager/ExtractCallback.cpp | 10 ++++++++++ CPP/7zip/UI/FileManager/ExtractCallback.h | 3 +++ CPP/7zip/UI/FileManager/IFolder.h | 2 ++ CPP/7zip/UI/FileManager/PanelCopy.cpp | 4 +++- 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CPP/7zip/UI/Agent/ArchiveFolder.cpp b/CPP/7zip/UI/Agent/ArchiveFolder.cpp index 719c1385..1ad8dd57 100644 --- a/CPP/7zip/UI/Agent/ArchiveFolder.cpp +++ b/CPP/7zip/UI/Agent/ArchiveFolder.cpp @@ -23,7 +23,7 @@ STDMETHODIMP CAgentFolder::SetZoneIdMode(NExtract::NZoneIdMode::EEnum zoneMode) } STDMETHODIMP CAgentFolder::CopyTo(Int32 moveMode, const UInt32 *indices, UInt32 numItems, - Int32 includeAltStreams, Int32 replaceAltStreamCharsMode, Int64 soleFolderIndex, + Int32 includeAltStreams, Int32 replaceAltStreamCharsMode, const wchar_t *path, IFolderOperationsExtractCallback *callback) { if (moveMode) @@ -42,6 +42,9 @@ STDMETHODIMP CAgentFolder::CopyTo(Int32 moveMode, const UInt32 *indices, UInt32 NExtract::NPathMode::kNoPathsAlt : NExtract::NPathMode::kNoPaths; + Int64 soleFolderIndex; + extractCallback2->GetSoleFolderIndex(&soleFolderIndex); + return Extract(indices, numItems, includeAltStreams, replaceAltStreamCharsMode, soleFolderIndex, diff --git a/CPP/7zip/UI/Agent/IFolderArchive.h b/CPP/7zip/UI/Agent/IFolderArchive.h index 6395a4af..92eb6160 100644 --- a/CPP/7zip/UI/Agent/IFolderArchive.h +++ b/CPP/7zip/UI/Agent/IFolderArchive.h @@ -28,7 +28,6 @@ IArchiveFolder is used by: STDMETHOD(Extract)(const UInt32 *indices, UInt32 numItems, \ Int32 includeAltStreams, \ Int32 replaceAltStreamCharsMode, \ - Int64 soleFolderIndex, \ NExtract::NPathMode::EEnum pathMode, \ NExtract::NOverwriteMode::EEnum overwriteMode, \ const wchar_t *path, Int32 testMode, \ diff --git a/CPP/7zip/UI/FileManager/ExtractCallback.cpp b/CPP/7zip/UI/FileManager/ExtractCallback.cpp index 232717f8..2470e21c 100644 --- a/CPP/7zip/UI/FileManager/ExtractCallback.cpp +++ b/CPP/7zip/UI/FileManager/ExtractCallback.cpp @@ -685,6 +685,16 @@ STDMETHODIMP CExtractCallbackImp::CryptoGetTextPassword(BSTR *password) #ifndef _SFX +STDMETHODIMP CExtractCallbackImp::SetSoleFolderIndex(Int64 soleFolderIndex) +{ + this->SoleFolderIndex = soleFolderIndex; +} + +STDMETHODIMP CExtractCallbackImp::GetSoleFolderIndex(Int64 *pSoleFolderIndex) +{ + (*pSoleFolderIndex) = this->SoleFolderIndex; +} + STDMETHODIMP CExtractCallbackImp::AskWrite( const wchar_t *srcPath, Int32 srcIsFolder, const FILETIME *srcTime, const UInt64 *srcSize, diff --git a/CPP/7zip/UI/FileManager/ExtractCallback.h b/CPP/7zip/UI/FileManager/ExtractCallback.h index 02578bb4..46d00a8d 100644 --- a/CPP/7zip/UI/FileManager/ExtractCallback.h +++ b/CPP/7zip/UI/FileManager/ExtractCallback.h @@ -272,6 +272,8 @@ public: bool ThereAreMessageErrors; NExtract::NOverwriteMode::EEnum OverwriteMode; + Int64 SoleFolderIndex; + #ifndef _NO_CRYPTO bool PasswordIsDefined; bool PasswordWasAsked; @@ -296,6 +298,7 @@ public: ProcessAltStreams(true), StreamMode(false), OverwriteMode(NExtract::NOverwriteMode::kAsk), + SoleFolderIndex(-1), #ifndef _NO_CRYPTO PasswordIsDefined(false), PasswordWasAsked(false), diff --git a/CPP/7zip/UI/FileManager/IFolder.h b/CPP/7zip/UI/FileManager/IFolder.h index ef9c0b6f..6ade24b5 100644 --- a/CPP/7zip/UI/FileManager/IFolder.h +++ b/CPP/7zip/UI/FileManager/IFolder.h @@ -69,6 +69,8 @@ FOLDER_INTERFACE_SUB(IFolderOperationsExtractCallback, IProgress, 0x0B) BSTR *destPathResult, Int32 *writeAnswer) PURE; STDMETHOD(ShowMessage)(const wchar_t *message) PURE; + STDMETHOD(SetSoleFolderIndex)(Int64 soleFolderIndex) PURE; + STDMETHOD(GetSoleFolderIndex)(Int64 *pSoleFolderIndex) PURE; STDMETHOD(SetCurrentFilePath)(const wchar_t *filePath) PURE; STDMETHOD(SetNumFiles)(UInt64 numFiles) PURE; }; diff --git a/CPP/7zip/UI/FileManager/PanelCopy.cpp b/CPP/7zip/UI/FileManager/PanelCopy.cpp index 0e929f4c..86df47e9 100644 --- a/CPP/7zip/UI/FileManager/PanelCopy.cpp +++ b/CPP/7zip/UI/FileManager/PanelCopy.cpp @@ -99,12 +99,14 @@ HRESULT CPanelCopyThread::ProcessVirt() options->folder, BoolToInt(true), extractCallback2); } else + CMyComPtr extractCallback2; + RINOK(ExtractCallback.QueryInterface(IID_IFolderArchiveExtractCallback, &extractCallback2)) + extractCallback2->SetSoleFolderIndex(options->soleFolderIndex); result2 = FolderOperations->CopyTo( BoolToInt(options->moveMode), &Indices.Front(), Indices.Size(), BoolToInt(options->includeAltStreams), BoolToInt(options->replaceAltStreamChars), - options->soleFolderIndex, options->folder, ExtractCallback); if (result2 == S_OK && !ExtractCallbackSpec->ThereAreMessageErrors)