Index: src/libchcore/TFilesystemFeedbackWrapper.cpp =================================================================== diff -u -r3c248d4f6d0fdb1e487cc868b2f0b219eec37ef4 -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TFilesystemFeedbackWrapper.cpp (.../TFilesystemFeedbackWrapper.cpp) (revision 3c248d4f6d0fdb1e487cc868b2f0b219eec37ef4) +++ src/libchcore/TFilesystemFeedbackWrapper.cpp (.../TFilesystemFeedbackWrapper.cpp) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -313,7 +313,7 @@ return TSubTaskBase::eSubResult_Continue; } - TSubTaskBase::ESubOperationResult TFilesystemFeedbackWrapper::FastMoveFB(const TFileInfoPtr& spFileInfo, const TSmartPath& pathDestination, const TBasePathDataPtr& spBasePath, bool& bSkip) + TSubTaskBase::ESubOperationResult TFilesystemFeedbackWrapper::FastMoveFB(const TFileInfoPtr& spFileInfo, const TSmartPath& pathDestination, const TBasePathDataPtr& spBasePath) { bool bRetry = false; do @@ -337,7 +337,6 @@ // check if this is one of the errors, that will just cause fast move to skip if (dwLastError == ERROR_ACCESS_DENIED || dwLastError == ERROR_ALREADY_EXISTS || dwLastError == ERROR_NOT_SAME_DEVICE) { - bSkip = true; return TSubTaskBase::eSubResult_Continue; } @@ -362,8 +361,7 @@ return TSubTaskBase::eSubResult_PauseRequest; case EFeedbackResult::eResult_Skip: - bSkip = true; - return TSubTaskBase::eSubResult_Continue; + return TSubTaskBase::eSubResult_SkipFile; default: BOOST_ASSERT(FALSE); // unknown result @@ -378,7 +376,7 @@ return TSubTaskBase::eSubResult_Continue; } - TSubTaskBase::ESubOperationResult TFilesystemFeedbackWrapper::GetFileInfoFB(const TSmartPath& pathCurrent, TFileInfoPtr& spFileInfo, const TBasePathDataPtr& spBasePath, bool& bSkip) + TSubTaskBase::ESubOperationResult TFilesystemFeedbackWrapper::GetFileInfoFB(const TSmartPath& pathCurrent, TFileInfoPtr& spFileInfo, const TBasePathDataPtr& spBasePath) { bool bRetry = false; do @@ -411,8 +409,7 @@ return TSubTaskBase::eSubResult_PauseRequest; case EFeedbackResult::eResult_Skip: - bSkip = true; - return TSubTaskBase::eSubResult_Continue; + return TSubTaskBase::eSubResult_SkipFile; default: BOOST_ASSERT(FALSE); // unknown result Index: src/libchcore/TFilesystemFeedbackWrapper.h =================================================================== diff -u -r12b36349f6214befeace08efa9acc7e03be0d847 -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TFilesystemFeedbackWrapper.h (.../TFilesystemFeedbackWrapper.h) (revision 12b36349f6214befeace08efa9acc7e03be0d847) +++ src/libchcore/TFilesystemFeedbackWrapper.h (.../TFilesystemFeedbackWrapper.h) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -40,10 +40,10 @@ TSubTaskBase::ESubOperationResult DeleteFileFB(const TFileInfoPtr& spFileInfo, bool bProtectReadOnlyFiles); TSubTaskBase::ESubOperationResult FastMoveFB(const TFileInfoPtr& spFileInfo, const TSmartPath& pathDestination, - const TBasePathDataPtr& spBasePath, bool& bSkip); + const TBasePathDataPtr& spBasePath); TSubTaskBase::ESubOperationResult GetFileInfoFB(const TSmartPath& pathCurrent, - TFileInfoPtr& spFileInfo, const TBasePathDataPtr& spBasePath, bool& bSkip); + TFileInfoPtr& spFileInfo, const TBasePathDataPtr& spBasePath); private: bool WasKillRequested(const TFeedbackResult& rFeedbackResult) const; Index: src/libchcore/TFilesystemFileFeedbackWrapper.cpp =================================================================== diff -u -ra0de3c317cb73a42ed4efbdf29b3a87243b03df4 -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TFilesystemFileFeedbackWrapper.cpp (.../TFilesystemFileFeedbackWrapper.cpp) (revision a0de3c317cb73a42ed4efbdf29b3a87243b03df4) +++ src/libchcore/TFilesystemFileFeedbackWrapper.cpp (.../TFilesystemFileFeedbackWrapper.cpp) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -43,9 +43,8 @@ throw TCoreException(eErr_InvalidArgument, L"spFilesystem is NULL", LOCATION); } - TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::HandleFileAlreadyExistsFB(const TFileInfoPtr& spSrcFileInfo, bool& bShouldAppend, bool& bSkip) + TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::HandleFileAlreadyExistsFB(const TFileInfoPtr& spSrcFileInfo, bool& bShouldAppend) { - bSkip = false; bShouldAppend = false; // read info about the existing destination file, @@ -65,8 +64,7 @@ return TSubTaskBase::eSubResult_Continue; case EFeedbackResult::eResult_Skip: - bSkip = true; - return TSubTaskBase::eSubResult_Continue; + return TSubTaskBase::eSubResult_SkipFile; case EFeedbackResult::eResult_Cancel: { @@ -86,10 +84,8 @@ } } - TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::TruncateFileFB(file_size_t fsNewSize, bool& bSkip) + TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::TruncateFileFB(file_size_t fsNewSize) { - bSkip = false; - bool bRetry = false; do { @@ -124,8 +120,7 @@ return TSubTaskBase::eSubResult_PauseRequest; case EFeedbackResult::eResult_Skip: - bSkip = true; - return TSubTaskBase::eSubResult_Continue; + return TSubTaskBase::eSubResult_SkipFile; default: BOOST_ASSERT(FALSE); // unknown result @@ -140,9 +135,8 @@ return TSubTaskBase::eSubResult_Continue; } - TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::ReadFileFB(TOverlappedDataBuffer& rBuffer, bool& bSkip) + TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::ReadFileFB(TOverlappedDataBuffer& rBuffer) { - bSkip = false; bool bRetry = false; do { @@ -180,8 +174,7 @@ return TSubTaskBase::eSubResult_PauseRequest; case EFeedbackResult::eResult_Skip: - bSkip = true; - return TSubTaskBase::eSubResult_Continue; + return TSubTaskBase::eSubResult_SkipFile; default: BOOST_ASSERT(FALSE); // unknown result @@ -196,10 +189,8 @@ return TSubTaskBase::eSubResult_Continue; } - TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::WriteFileFB(TOverlappedDataBuffer& rBuffer, bool& bSkip) + TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::WriteFileFB(TOverlappedDataBuffer& rBuffer) { - bSkip = false; - bool bRetry = false; do { @@ -237,8 +228,7 @@ return TSubTaskBase::eSubResult_PauseRequest; case EFeedbackResult::eResult_Skip: - bSkip = true; - return TSubTaskBase::eSubResult_Continue; + return TSubTaskBase::eSubResult_SkipFile; default: BOOST_ASSERT(FALSE); // unknown result @@ -253,10 +243,8 @@ return TSubTaskBase::eSubResult_Continue; } - TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::FinalizeFileFB(TOverlappedDataBuffer& rBuffer, bool& bSkip) + TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::FinalizeFileFB(TOverlappedDataBuffer& rBuffer) { - bSkip = false; - bool bRetry = false; do { @@ -293,8 +281,7 @@ return TSubTaskBase::eSubResult_PauseRequest; case EFeedbackResult::eResult_Skip: - bSkip = true; - return TSubTaskBase::eSubResult_Continue; + return TSubTaskBase::eSubResult_SkipFile; default: BOOST_ASSERT(FALSE); // unknown result @@ -309,12 +296,10 @@ return TSubTaskBase::eSubResult_Continue; } - TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::HandleReadError(TOverlappedDataBuffer& rBuffer, bool& bSkip) + TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::HandleReadError(TOverlappedDataBuffer& rBuffer) { DWORD dwLastError = rBuffer.GetErrorCode(); - bSkip = false; - // log TString strFormat = _T("Error %errno while requesting read of %count bytes from source file %path (CustomCopyFileFB)"); strFormat.Replace(_T("%errno"), boost::lexical_cast(dwLastError).c_str()); @@ -335,21 +320,18 @@ return TSubTaskBase::eSubResult_PauseRequest; case EFeedbackResult::eResult_Skip: - bSkip = true; - return TSubTaskBase::eSubResult_Continue; + return TSubTaskBase::eSubResult_SkipFile; default: BOOST_ASSERT(FALSE); // unknown result throw TCoreException(eErr_UnhandledCase, L"Unknown feedback result", LOCATION); } } - TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::HandleWriteError(TOverlappedDataBuffer& rBuffer, bool& bSkip) + TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::HandleWriteError(TOverlappedDataBuffer& rBuffer) { DWORD dwLastError = rBuffer.GetErrorCode(); - bSkip = false; - // log TString strFormat = _T("Error %errno while trying to write %count bytes to destination file %path (CustomCopyFileFB)"); strFormat.Replace(_T("%errno"), boost::lexical_cast(rBuffer.GetErrorCode()).c_str()); @@ -370,8 +352,7 @@ return TSubTaskBase::eSubResult_PauseRequest; case EFeedbackResult::eResult_Skip: - bSkip = true; - return TSubTaskBase::eSubResult_Continue; + return TSubTaskBase::eSubResult_SkipFile; default: BOOST_ASSERT(FALSE); // unknown result @@ -389,10 +370,8 @@ return m_spFile->GetFilePath(); } - TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::GetFileSize(file_size_t& fsSize, bool& bSkip) const + TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::GetFileSize(file_size_t& fsSize) const { - bSkip = false; - bool bRetry = false; do { @@ -429,8 +408,7 @@ return TSubTaskBase::eSubResult_PauseRequest; case EFeedbackResult::eResult_Skip: - bSkip = true; - return TSubTaskBase::eSubResult_Continue; + return TSubTaskBase::eSubResult_SkipFile; default: BOOST_ASSERT(FALSE); // unknown result Index: src/libchcore/TFilesystemFileFeedbackWrapper.h =================================================================== diff -u -ra0de3c317cb73a42ed4efbdf29b3a87243b03df4 -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TFilesystemFileFeedbackWrapper.h (.../TFilesystemFileFeedbackWrapper.h) (revision a0de3c317cb73a42ed4efbdf29b3a87243b03df4) +++ src/libchcore/TFilesystemFileFeedbackWrapper.h (.../TFilesystemFileFeedbackWrapper.h) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -37,21 +37,21 @@ const IFilesystemPtr& spFilesystem); TFilesystemFileFeedbackWrapper& operator=(const TFilesystemFileFeedbackWrapper&) = delete; - TSubTaskBase::ESubOperationResult HandleFileAlreadyExistsFB(const TFileInfoPtr& spSrcFileInfo, bool& bShouldAppend, bool& bSkip); + TSubTaskBase::ESubOperationResult HandleFileAlreadyExistsFB(const TFileInfoPtr& spSrcFileInfo, bool& bShouldAppend); - TSubTaskBase::ESubOperationResult TruncateFileFB(file_size_t fsNewSize, bool& bSkip); + TSubTaskBase::ESubOperationResult TruncateFileFB(file_size_t fsNewSize); - TSubTaskBase::ESubOperationResult ReadFileFB(TOverlappedDataBuffer& rBuffer, bool& bSkip); - TSubTaskBase::ESubOperationResult WriteFileFB(TOverlappedDataBuffer& rBuffer, bool& bSkip); + TSubTaskBase::ESubOperationResult ReadFileFB(TOverlappedDataBuffer& rBuffer); + TSubTaskBase::ESubOperationResult WriteFileFB(TOverlappedDataBuffer& rBuffer); - TSubTaskBase::ESubOperationResult FinalizeFileFB(TOverlappedDataBuffer& rBuffer, bool& bSkip); + TSubTaskBase::ESubOperationResult FinalizeFileFB(TOverlappedDataBuffer& rBuffer); - TSubTaskBase::ESubOperationResult HandleReadError(TOverlappedDataBuffer& rBuffer, bool& bSkip); - TSubTaskBase::ESubOperationResult HandleWriteError(TOverlappedDataBuffer& rBuffer, bool& bSkip); + TSubTaskBase::ESubOperationResult HandleReadError(TOverlappedDataBuffer& rBuffer); + TSubTaskBase::ESubOperationResult HandleWriteError(TOverlappedDataBuffer& rBuffer); bool IsFreshlyCreated() const; TSmartPath GetFilePath() const; - TSubTaskBase::ESubOperationResult GetFileSize(file_size_t& fsSize, bool& bSkip) const; + TSubTaskBase::ESubOperationResult GetFileSize(file_size_t& fsSize) const; file_size_t GetSeekPositionForResume(file_size_t fsLastAvailablePosition); bool IsOpen() const { return m_spFile->IsOpen(); } Index: src/libchcore/TOverlappedReaderFB.cpp =================================================================== diff -u -re7ca9e2c6306cd94e5e5caecc9cfdb3b562d3cdf -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TOverlappedReaderFB.cpp (.../TOverlappedReaderFB.cpp) (revision e7ca9e2c6306cd94e5e5caecc9cfdb3b562d3cdf) +++ src/libchcore/TOverlappedReaderFB.cpp (.../TOverlappedReaderFB.cpp) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -49,61 +49,36 @@ m_spReader->ReleaseBuffers(); } - TSubTaskBase::ESubOperationResult TOverlappedReaderFB::OnReadPossible(bool& bStopProcessing, bool& bProcessedFlag) + TSubTaskBase::ESubOperationResult TOverlappedReaderFB::OnReadPossible() { TOverlappedDataBuffer* pBuffer = m_spReader->GetEmptyBuffer(); if(!pBuffer) throw TCoreException(eErr_InternalProblem, L"Read was possible, but no buffer is available", LOCATION); - bool bSkip = false; - TSubTaskBase::ESubOperationResult eResult = m_spSrcFile->ReadFileFB(*pBuffer, bSkip); + TSubTaskBase::ESubOperationResult eResult = m_spSrcFile->ReadFileFB(*pBuffer); if(eResult != TSubTaskBase::eSubResult_Continue) - { m_spReader->AddEmptyBuffer(pBuffer, false); - bStopProcessing = true; - } - else if(bSkip) - { - m_spReader->AddEmptyBuffer(pBuffer, false); - m_spStats->AdjustProcessedSize(m_spStats->GetCurrentItemProcessedSize(), m_spSrcFileInfo->GetLength64()); - - bProcessedFlag = false; - bStopProcessing = true; - } - return eResult; } - TSubTaskBase::ESubOperationResult TOverlappedReaderFB::OnReadFailed(bool& bStopProcessing, bool& bProcessedFlag) + TSubTaskBase::ESubOperationResult TOverlappedReaderFB::OnReadFailed() { TOverlappedDataBuffer* pBuffer = m_spReader->GetFailedReadBuffer(); if(!pBuffer) throw TCoreException(eErr_InternalProblem, L"Cannot retrieve failed read buffer", LOCATION); // read error encountered - handle it - bool bSkip = false; - TSubTaskBase::ESubOperationResult eResult = m_spSrcFile->HandleReadError(*pBuffer, bSkip); + TSubTaskBase::ESubOperationResult eResult = m_spSrcFile->HandleReadError(*pBuffer); if(eResult == TSubTaskBase::eSubResult_Retry) { m_spSrcFile->Close(); m_spReader->AddEmptyBuffer(pBuffer, true); + eResult = TSubTaskBase::eSubResult_Continue; } else if(eResult != TSubTaskBase::eSubResult_Continue) - { m_spReader->AddEmptyBuffer(pBuffer, false); - bStopProcessing = true; - } - else if(bSkip) - { - m_spReader->AddEmptyBuffer(pBuffer, false); - m_spStats->AdjustProcessedSize(m_spStats->GetCurrentItemProcessedSize(), m_spSrcFileInfo->GetLength64()); - - bProcessedFlag = false; - bStopProcessing = true; - } - return eResult; } } Index: src/libchcore/TOverlappedReaderFB.h =================================================================== diff -u -r980c1a0de537813728871676200a0960410b11fb -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TOverlappedReaderFB.h (.../TOverlappedReaderFB.h) (revision 980c1a0de537813728871676200a0960410b11fb) +++ src/libchcore/TOverlappedReaderFB.h (.../TOverlappedReaderFB.h) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -38,8 +38,8 @@ TOverlappedReaderPtr GetReader() const { return m_spReader; } void SetReleaseMode(); - TSubTaskBase::ESubOperationResult OnReadPossible(bool& bStopProcessing, bool& bProcessedFlag); - TSubTaskBase::ESubOperationResult OnReadFailed(bool& bStopProcessing, bool& bProcessedFlag); + TSubTaskBase::ESubOperationResult OnReadPossible(); + TSubTaskBase::ESubOperationResult OnReadFailed(); private: TOverlappedReaderPtr m_spReader; Index: src/libchcore/TOverlappedReaderWriterFB.cpp =================================================================== diff -u -r980c1a0de537813728871676200a0960410b11fb -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TOverlappedReaderWriterFB.cpp (.../TOverlappedReaderWriterFB.cpp) (revision 980c1a0de537813728871676200a0960410b11fb) +++ src/libchcore/TOverlappedReaderWriterFB.cpp (.../TOverlappedReaderWriterFB.cpp) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -21,7 +21,6 @@ #include "TCoreException.h" #include "ErrorCodes.h" #include -#include namespace chcore { @@ -43,7 +42,7 @@ { } - TSubTaskBase::ESubOperationResult TOverlappedReaderWriterFB::WaitForMissingBuffersAndResetState(bool& bProcessed) + TSubTaskBase::ESubOperationResult TOverlappedReaderWriterFB::WaitForMissingBuffersAndResetState() { m_spReader->SetReleaseMode(); m_spWriter->SetReleaseMode(); @@ -63,8 +62,6 @@ bool bStopProcessing = false; while(!bStopProcessing) { - bool bIgnoreStop = false; - DWORD dwResult = WaitForMultipleObjectsEx(eHandleCount, arrHandles.data(), false, INFINITE, true); switch(dwResult) { @@ -82,19 +79,20 @@ case WAIT_OBJECT_0 + eWritePossible: { - eResult = m_spWriter->OnWritePossible(bIgnoreStop, bProcessed); + m_spWriter->OnWritePossible(); break; } case WAIT_OBJECT_0 + eWriteFailed: { - eResult = m_spWriter->OnWriteFailed(bIgnoreStop, bProcessed); + m_spWriter->OnWriteFailed(); break; } case WAIT_OBJECT_0 + eWriteFinished: { - eResult = m_spWriter->OnWriteFinished(bIgnoreStop, bProcessed); + bool bIgnoreStop = false; + m_spWriter->OnWriteFinished(bIgnoreStop); break; } @@ -106,7 +104,7 @@ return eResult; } - TSubTaskBase::ESubOperationResult TOverlappedReaderWriterFB::Start(HANDLE hKill, bool& bProcessed) + TSubTaskBase::ESubOperationResult TOverlappedReaderWriterFB::Start(HANDLE hKill) { // read data from file to buffer // NOTE: order is critical here: @@ -130,7 +128,7 @@ TSubTaskBase::ESubOperationResult eResult = TSubTaskBase::eSubResult_Continue; bool bStopProcessing = false; - while(!bStopProcessing) + while(!bStopProcessing && eResult == TSubTaskBase::eSubResult_Continue) { DWORD dwResult = WaitForMultipleObjectsEx(eHandleCount, arrHandles.data(), false, INFINITE, true); switch(dwResult) @@ -150,29 +148,29 @@ case WAIT_OBJECT_0 + eReadPossible: { - eResult = m_spReader->OnReadPossible(bStopProcessing, bProcessed); + eResult = m_spReader->OnReadPossible(); break; } case WAIT_OBJECT_0 + eReadFailed: { - eResult = m_spReader->OnReadFailed(bStopProcessing, bProcessed); + eResult = m_spReader->OnReadFailed(); break; } case WAIT_OBJECT_0 + eWritePossible: { - eResult = m_spWriter->OnWritePossible(bStopProcessing, bProcessed); + eResult = m_spWriter->OnWritePossible(); break; } case WAIT_OBJECT_0 + eWriteFailed: { - eResult = m_spWriter->OnWriteFailed(bStopProcessing, bProcessed); + eResult = m_spWriter->OnWriteFailed(); break; } case WAIT_OBJECT_0 + eWriteFinished: { - eResult = m_spWriter->OnWriteFinished(bStopProcessing, bProcessed); + eResult = m_spWriter->OnWriteFinished(bStopProcessing); break; } @@ -181,7 +179,7 @@ } } - WaitForMissingBuffersAndResetState(bProcessed); + WaitForMissingBuffersAndResetState(); return eResult; } Index: src/libchcore/TOverlappedReaderWriterFB.h =================================================================== diff -u -r980c1a0de537813728871676200a0960410b11fb -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TOverlappedReaderWriterFB.h (.../TOverlappedReaderWriterFB.h) (revision 980c1a0de537813728871676200a0960410b11fb) +++ src/libchcore/TOverlappedReaderWriterFB.h (.../TOverlappedReaderWriterFB.h) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -40,14 +40,14 @@ TOverlappedReaderWriterFB& operator=(const TOverlappedReaderWriterFB&) = delete; - TSubTaskBase::ESubOperationResult Start(HANDLE hKill, bool& bProcessed); + TSubTaskBase::ESubOperationResult Start(HANDLE hKill); // reader/writer TOverlappedReaderFBPtr GetReader() const { return m_spReader; } TOverlappedWriterFBPtr GetWriter() const { return m_spWriter; } // event access - TSubTaskBase::ESubOperationResult WaitForMissingBuffersAndResetState(bool& bProcessed); + TSubTaskBase::ESubOperationResult WaitForMissingBuffersAndResetState(); private: logger::TLoggerPtr m_spLog; Index: src/libchcore/TOverlappedWriterFB.cpp =================================================================== diff -u -ra0de3c317cb73a42ed4efbdf29b3a87243b03df4 -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TOverlappedWriterFB.cpp (.../TOverlappedWriterFB.cpp) (revision a0de3c317cb73a42ed4efbdf29b3a87243b03df4) +++ src/libchcore/TOverlappedWriterFB.cpp (.../TOverlappedWriterFB.cpp) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -50,7 +50,7 @@ { } - TSubTaskBase::ESubOperationResult TOverlappedWriterFB::OnWritePossible(bool& bStopProcessing, bool& bProcessedFlag) + TSubTaskBase::ESubOperationResult TOverlappedWriterFB::OnWritePossible() { TOverlappedDataBuffer* pBuffer = m_spWriter->GetWriteBuffer(); if(!pBuffer) @@ -62,27 +62,14 @@ return TSubTaskBase::eSubResult_Continue; } - bool bSkip = false; - TSubTaskBase::ESubOperationResult eResult = m_spDstFile->WriteFileFB(*pBuffer, bSkip); + TSubTaskBase::ESubOperationResult eResult = m_spDstFile->WriteFileFB(*pBuffer); if(eResult != TSubTaskBase::eSubResult_Continue) - { m_spEmptyBuffers->Push(pBuffer); - bStopProcessing = true; - } - else if(bSkip) - { - m_spEmptyBuffers->Push(pBuffer); - m_spStats->AdjustProcessedSize(m_spStats->GetCurrentItemProcessedSize(), m_spSrcFileInfo->GetLength64()); - - bProcessedFlag = false; - bStopProcessing = true; - } - return eResult; } - TSubTaskBase::ESubOperationResult TOverlappedWriterFB::OnWriteFailed(bool& bStopProcessing, bool& bProcessedFlag) + TSubTaskBase::ESubOperationResult TOverlappedWriterFB::OnWriteFailed() { TOverlappedDataBuffer* pBuffer = m_spWriter->GetFailedWriteBuffer(); if(!pBuffer) @@ -94,32 +81,20 @@ return TSubTaskBase::eSubResult_Continue; } - bool bSkip = false; - TSubTaskBase::ESubOperationResult eResult = m_spDstFile->HandleWriteError(*pBuffer, bSkip); + TSubTaskBase::ESubOperationResult eResult = m_spDstFile->HandleWriteError(*pBuffer); if(eResult == TSubTaskBase::eSubResult_Retry) { m_spDstFile->Close(); m_spWriter->AddRetryBuffer(pBuffer); + eResult = TSubTaskBase::eSubResult_Continue; } else if(eResult != TSubTaskBase::eSubResult_Continue) - { m_spEmptyBuffers->Push(pBuffer); - bStopProcessing = true; - } - else if(bSkip) - { - m_spEmptyBuffers->Push(pBuffer); - m_spStats->AdjustProcessedSize(m_spStats->GetCurrentItemProcessedSize(), m_spSrcFileInfo->GetLength64()); - - bProcessedFlag = false; - bStopProcessing = true; - } - return eResult; } - TSubTaskBase::ESubOperationResult TOverlappedWriterFB::OnWriteFinished(bool& bStopProcessing, bool& bProcessedFlag) + TSubTaskBase::ESubOperationResult TOverlappedWriterFB::OnWriteFinished(bool& bStopProcessing) { TOverlappedDataBuffer* pBuffer = m_spWriter->GetFinishedBuffer(); if(!pBuffer) @@ -129,97 +104,63 @@ if(m_bReleaseMode) { - bool bSkip = false; - AdjustProcessedSize(fsWritten, bSkip); // ignore return value as we're already in release mode + AdjustProcessedSize(fsWritten); // ignore return value as we're already in release mode m_spEmptyBuffers->Push(pBuffer); - bProcessedFlag = pBuffer->IsLastPart() && (pBuffer->GetBytesTransferred() == fsWritten); return TSubTaskBase::eSubResult_Continue; } TSubTaskBase::ESubOperationResult eResult = TSubTaskBase::eSubResult_Continue; if(pBuffer->IsLastPart()) { - bool bSkip = false; - eResult = m_spDstFile->FinalizeFileFB(*pBuffer, bSkip); - if(eResult != TSubTaskBase::eSubResult_Continue) + eResult = m_spDstFile->FinalizeFileFB(*pBuffer); + if (eResult != TSubTaskBase::eSubResult_Continue) { m_spEmptyBuffers->Push(pBuffer); - bStopProcessing = true; return eResult; } - else if(bSkip) - { - m_spEmptyBuffers->Push(pBuffer); - - m_spStats->AdjustProcessedSize(m_spStats->GetCurrentItemProcessedSize(), m_spSrcFileInfo->GetLength64()); - - bProcessedFlag = false; - bStopProcessing = true; - return eResult; - } } // in case we read past the original eof, try to get new file size from filesystem - bool bSkip = false; - eResult = AdjustProcessedSize(fsWritten, bSkip); + eResult = AdjustProcessedSize(fsWritten); if(eResult != TSubTaskBase::eSubResult_Continue) { m_spEmptyBuffers->Push(pBuffer); - bStopProcessing = true; return eResult; } - else if(bSkip) - { - m_spEmptyBuffers->Push(pBuffer); - bProcessedFlag = false; - bStopProcessing = true; - return eResult; - } - // stop iterating through file bStopProcessing = pBuffer->IsLastPart(); if(bStopProcessing) { m_spWriter->MarkAsFinalized(pBuffer); // this is the end of copying of src file - in case it is smaller than expected fix the stats so that difference is accounted for - eResult = AdjustFinalSize(bSkip); + eResult = AdjustFinalSize(); if(eResult != TSubTaskBase::eSubResult_Continue) { m_spEmptyBuffers->Push(pBuffer); - bStopProcessing = true; return eResult; } - else if(bSkip) - { - m_spEmptyBuffers->Push(pBuffer); - bProcessedFlag = false; - bStopProcessing = true; - return eResult; - } - - bProcessedFlag = true; m_spStats->ResetCurrentItemProcessedSize(); } m_spEmptyBuffers->Push(pBuffer); return eResult; } - TSubTaskBase::ESubOperationResult TOverlappedWriterFB::AdjustProcessedSize(file_size_t fsWritten, bool& bSkip) + TSubTaskBase::ESubOperationResult TOverlappedWriterFB::AdjustProcessedSize(file_size_t fsWritten) { TSubTaskBase::ESubOperationResult eResult = TSubTaskBase::eSubResult_Continue; // in case we read past the original eof, try to get new file size from filesystem if(m_spStats->WillAdjustProcessedSizeExceedTotalSize(0, fsWritten)) { file_size_t fsNewSize = 0; - eResult = m_spSrcFile->GetFileSize(fsNewSize, bSkip); - if(eResult != TSubTaskBase::eSubResult_Continue || bSkip) + eResult = m_spSrcFile->GetFileSize(fsNewSize); + if(eResult != TSubTaskBase::eSubResult_Continue) return eResult; if(fsNewSize == m_spSrcFileInfo->GetLength64()) @@ -234,7 +175,7 @@ return eResult; } - TSubTaskBase::ESubOperationResult TOverlappedWriterFB::AdjustFinalSize(bool& bSkip) + TSubTaskBase::ESubOperationResult TOverlappedWriterFB::AdjustFinalSize() { TSubTaskBase::ESubOperationResult eResult = TSubTaskBase::eSubResult_Continue; @@ -243,8 +184,8 @@ if(ullCIProcessedSize < ullCITotalSize) { file_size_t fsNewSize = 0; - eResult = m_spSrcFile->GetFileSize(fsNewSize, bSkip); - if(eResult != TSubTaskBase::eSubResult_Continue || bSkip) + eResult = m_spSrcFile->GetFileSize(fsNewSize); + if(eResult != TSubTaskBase::eSubResult_Continue) return eResult; if(fsNewSize == m_spSrcFileInfo->GetLength64()) Index: src/libchcore/TOverlappedWriterFB.h =================================================================== diff -u -ra0de3c317cb73a42ed4efbdf29b3a87243b03df4 -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TOverlappedWriterFB.h (.../TOverlappedWriterFB.h) (revision a0de3c317cb73a42ed4efbdf29b3a87243b03df4) +++ src/libchcore/TOverlappedWriterFB.h (.../TOverlappedWriterFB.h) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -37,13 +37,13 @@ void SetReleaseMode() { m_bReleaseMode = true; } - TSubTaskBase::ESubOperationResult OnWritePossible(bool& bStopProcessing, bool& bProcessedFlag); - TSubTaskBase::ESubOperationResult OnWriteFailed(bool& bStopProcessing, bool& bProcessedFlag); - TSubTaskBase::ESubOperationResult OnWriteFinished(bool& bStopProcessing, bool& bProcessedFlag); + TSubTaskBase::ESubOperationResult OnWritePossible(); + TSubTaskBase::ESubOperationResult OnWriteFailed(); + TSubTaskBase::ESubOperationResult OnWriteFinished(bool& bStopProcessing); private: - TSubTaskBase::ESubOperationResult AdjustProcessedSize(file_size_t fsWritten, bool& bSkip); - TSubTaskBase::ESubOperationResult AdjustFinalSize(bool& bSkip); + TSubTaskBase::ESubOperationResult AdjustProcessedSize(file_size_t fsWritten); + TSubTaskBase::ESubOperationResult AdjustFinalSize(); private: TOverlappedWriterPtr m_spWriter; Index: src/libchcore/TSubTaskBase.h =================================================================== diff -u -r4fe995b304ea342b50293f92d3c1992b43b820f7 -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TSubTaskBase.h (.../TSubTaskBase.h) (revision 4fe995b304ea342b50293f92d3c1992b43b820f7) +++ src/libchcore/TSubTaskBase.h (.../TSubTaskBase.h) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -49,6 +49,7 @@ eSubResult_CancelRequest, eSubResult_PauseRequest, eSubResult_Retry, + eSubResult_SkipFile }; public: Index: src/libchcore/TSubTaskCopyMove.cpp =================================================================== diff -u -ra0de3c317cb73a42ed4efbdf29b3a87243b03df4 -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision a0de3c317cb73a42ed4efbdf29b3a87243b03df4) +++ src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -61,7 +61,6 @@ TBufferSizes tBufferSizes; TOverlappedMemoryPoolPtr spMemoryPool; // buffer handling bool bOnlyCreate = false; // flag from configuration - skips real copying - only create - bool bProcessed = false; // has the element been processed ? (false if skipped) }; /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -142,7 +141,6 @@ // create a buffer of size m_nBufferSize CUSTOM_COPY_PARAMS ccp; - ccp.bProcessed = false; ccp.bOnlyCreate = GetTaskPropValue(rConfig); // remove changes in buffer sizes to avoid re-creation later @@ -225,15 +223,21 @@ { // start copying/moving file ccp.spSrcFile = spFileInfo; - ccp.bProcessed = false; // copy data eResult = CustomCopyFileFB(spFeedbackHandler, &ccp); - if(eResult != TSubTaskBase::eSubResult_Continue) + if (eResult == TSubTaskBase::eSubResult_SkipFile) + { + spFileInfo->MarkAsProcessed(false); + AdjustProcessedSizeForSkip(spFileInfo); + + eResult = TSubTaskBase::eSubResult_Continue; + } + else if(eResult != TSubTaskBase::eSubResult_Continue) return eResult; + else + spFileInfo->MarkAsProcessed(true); - spFileInfo->MarkAsProcessed(ccp.bProcessed); - // if moving - delete file (only if config flag is set) if(bMove && spFileInfo->IsProcessed() && !GetTaskPropValue(rConfig)) { @@ -354,12 +358,9 @@ TFilesystemFileFeedbackWrapperPtr spSrcFileWrapper(std::make_shared(fileSrc, spFeedbackHandler, GetContext().GetLogFileData(), rThreadController, spFilesystem)); TFilesystemFileFeedbackWrapperPtr spDstFileWrapper(std::make_shared(fileDst, spFeedbackHandler, GetContext().GetLogFileData(), rThreadController, spFilesystem)); - bool bSkip = false; - TSubTaskBase::ESubOperationResult eResult = OpenSrcAndDstFilesFB(*spSrcFileWrapper, *spDstFileWrapper, pData, bSkip); + TSubTaskBase::ESubOperationResult eResult = OpenSrcAndDstFilesFB(*spSrcFileWrapper, *spDstFileWrapper, pData); if(eResult != TSubTaskBase::eSubResult_Continue) return eResult; - else if(bSkip) - return TSubTaskBase::eSubResult_Continue; // recreate buffer if needed AdjustBufferIfNeeded(pData->spMemoryPool, pData->tBufferSizes); @@ -380,7 +381,7 @@ TOverlappedReaderWriterFB tReaderWriter(spSrcFileWrapper, pData->spSrcFile, spDstFileWrapper, m_spSubTaskStats, m_spLog->GetLogFileData(), pData->spMemoryPool, ullNextReadPos, dwCurrentBufferSize); - eResult = tReaderWriter.Start(rThreadController.GetKillThreadHandle(), pData->bProcessed); + eResult = tReaderWriter.Start(rThreadController.GetKillThreadHandle()); return eResult; } @@ -391,12 +392,10 @@ } TSubTaskCopyMove::ESubOperationResult TSubTaskCopyMove::OpenSrcAndDstFilesFB(TFilesystemFileFeedbackWrapper& rSrcFile, TFilesystemFileFeedbackWrapper& rDstFile, - CUSTOM_COPY_PARAMS* pData, bool& bSkip) + CUSTOM_COPY_PARAMS* pData) { IFilesystemPtr spFilesystem = GetContext().GetLocalFilesystem(); - bSkip = false; - // first open the source file and handle any failures ESubOperationResult eResult = eSubResult_Continue; @@ -408,14 +407,9 @@ file_size_t fsOldSize = pData->spSrcFile->GetLength64(); file_size_t fsNewSize = 0; - eResult = rSrcFile.GetFileSize(fsNewSize, bSkip); + eResult = rSrcFile.GetFileSize(fsNewSize); if(eResult != eSubResult_Continue) return eResult; - else if(bSkip) - { - pData->bProcessed = false; - return eSubResult_Continue; - } if(fsNewSize != fsOldSize) { @@ -430,14 +424,9 @@ bool bDstFileFreshlyCreated = rDstFile.IsFreshlyCreated(); file_size_t fsDstFileSize = 0; - eResult = rDstFile.GetFileSize(fsDstFileSize, bSkip); + eResult = rDstFile.GetFileSize(fsDstFileSize); if(eResult != eSubResult_Continue) return eResult; - else if(bSkip) - { - pData->bProcessed = false; - return eSubResult_Continue; - } // try to resume if possible bool bCanSilentResume = false; @@ -453,14 +442,9 @@ if(!bCanSilentResume && !bDstFileFreshlyCreated && fsDstFileSize > 0) { bool bShouldAppend = false; - eResult = rDstFile.HandleFileAlreadyExistsFB(pData->spSrcFile, bShouldAppend, bSkip); + eResult = rDstFile.HandleFileAlreadyExistsFB(pData->spSrcFile, bShouldAppend); if(eResult != eSubResult_Continue) return eResult; - else if(bSkip) - { - pData->bProcessed = false; - return eSubResult_Continue; - } if(bShouldAppend) ullSeekTo = std::min(fsDstFileSize, fsNewSize); @@ -499,14 +483,9 @@ if(!bDstFileFreshlyCreated) { // if destination file was opened (as opposed to newly created) - eResult = rDstFile.TruncateFileFB(fsMoveTo, bSkip); + eResult = rDstFile.TruncateFileFB(fsMoveTo); if(eResult != TSubTaskBase::eSubResult_Continue) return eResult; - else if(bSkip) - { - pData->bProcessed = false; - return TSubTaskBase::eSubResult_Continue; - } } // at this point user already decided that he want to write data into destination file; Index: src/libchcore/TSubTaskCopyMove.h =================================================================== diff -u -r734408890246965d47e6bbf2c2978371269dd1fd -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision 734408890246965d47e6bbf2c2978371269dd1fd) +++ src/libchcore/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -65,7 +65,7 @@ ESubOperationResult CustomCopyFileFB(const IFeedbackHandlerPtr& spFeedbackHandler, CUSTOM_COPY_PARAMS* pData); ESubOperationResult OpenSrcAndDstFilesFB(TFilesystemFileFeedbackWrapper& rSrcFile, TFilesystemFileFeedbackWrapper& rDstFile, - CUSTOM_COPY_PARAMS* pData, bool& bSkip); + CUSTOM_COPY_PARAMS* pData); void AdjustProcessedSizeForSkip(const TFileInfoPtr& spSrcFileInfo); Index: src/libchcore/TSubTaskFastMove.cpp =================================================================== diff -u -r8a2ff3b2b71b45fb525e030167e62f316cb32869 -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TSubTaskFastMove.cpp (.../TSubTaskFastMove.cpp) (revision 8a2ff3b2b71b45fb525e030167e62f316cb32869) +++ src/libchcore/TSubTaskFastMove.cpp (.../TSubTaskFastMove.cpp) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -143,15 +143,14 @@ TFileInfoPtr spFileInfo(std::make_shared()); - bool bSkip = false; - ESubOperationResult eResult = tFilesystemFBWrapper.GetFileInfoFB(pathCurrent, spFileInfo, spBasePath, bSkip); - if (eResult != TSubTaskBase::eSubResult_Continue) - return eResult; - else if (bSkip) + ESubOperationResult eResult = tFilesystemFBWrapper.GetFileInfoFB(pathCurrent, spFileInfo, spBasePath); + if (eResult == TSubTaskBase::eSubResult_SkipFile) { spBasePath->SetSkipFurtherProcessing(true); continue; } + else if (eResult != TSubTaskBase::eSubResult_Continue) + return eResult; // does it match the input filter? if (!spFileInfo->IsDirectory() && !rafFilters.Match(spFileInfo)) @@ -161,11 +160,9 @@ } // try to fast move - eResult = tFilesystemFBWrapper.FastMoveFB(spFileInfo, tDstPathProvider.CalculateDestinationPath(spFileInfo), spBasePath, bSkip); + eResult = tFilesystemFBWrapper.FastMoveFB(spFileInfo, tDstPathProvider.CalculateDestinationPath(spFileInfo), spBasePath); if (eResult != TSubTaskBase::eSubResult_Continue) return eResult; - //else if (bSkip) - // continue; // check for kill need if (rThreadController.KillRequested()) Index: src/libchcore/TSubTaskScanDirectory.cpp =================================================================== diff -u -r12b36349f6214befeace08efa9acc7e03be0d847 -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision 12b36349f6214befeace08efa9acc7e03be0d847) +++ src/libchcore/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -136,12 +136,11 @@ continue; // try to get some info about the input path; let user know if the path does not exist. - bool bSkip = false; - ESubOperationResult eResult = tFilesystemFBWrapper.GetFileInfoFB(pathCurrent, spFileInfo, spBasePath, bSkip); - if (eResult != TSubTaskBase::eSubResult_Continue) - return eResult; - else if (bSkip) + ESubOperationResult eResult = tFilesystemFBWrapper.GetFileInfoFB(pathCurrent, spFileInfo, spBasePath); + if (eResult == TSubTaskBase::eSubResult_SkipFile) continue; + else if (eResult != TSubTaskBase::eSubResult_Continue) + return eResult; // log strFormat = _T("Adding file/folder (clipboard) : %path ..."); Index: src/libchcore/libchcore.vc140.vcxproj.filters =================================================================== diff -u -r2a34de9ddfcfb4a1ed4c61ece641d37b91c23b6b -rc0d9a798f9fbbeda239b84721ed864f9727e1ddc --- src/libchcore/libchcore.vc140.vcxproj.filters (.../libchcore.vc140.vcxproj.filters) (revision 2a34de9ddfcfb4a1ed4c61ece641d37b91c23b6b) +++ src/libchcore/libchcore.vc140.vcxproj.filters (.../libchcore.vc140.vcxproj.filters) (revision c0d9a798f9fbbeda239b84721ed864f9727e1ddc) @@ -102,6 +102,9 @@ {076cbf8f-0110-48a9-9cbe-9929534ba1d1} + + {0015d34a-19cb-41da-a52d-1aedece5682c} + @@ -449,12 +452,6 @@ Source Files\Filesystems\Exceptions - - Source Files\SubTasks - - - Source Files\SubTasks - Source Files\Feedback @@ -506,15 +503,6 @@ Source Files\Tools\Data Buffer\Queues\Complex - - Source Files\Tools\Data Buffer\ReaderWriter - - - Source Files\Tools\Data Buffer\ReaderWriter - - - Source Files\Tools\Data Buffer\ReaderWriter - Source Files\Tools @@ -528,6 +516,21 @@ Source Files\Shared + + Source Files\Feedback Wrappers + + + Source Files\Feedback Wrappers + + + Source Files\Feedback Wrappers + + + Source Files\Feedback Wrappers + + + Source Files\Feedback Wrappers + @@ -866,12 +869,6 @@ Source Files\Filesystems\Exceptions - - Source Files\SubTasks - - - Source Files\SubTasks - Source Files\Feedback @@ -956,15 +953,6 @@ Source Files\Tools\Data Buffer\Queues\Complex - - Source Files\Tools\Data Buffer\ReaderWriter - - - Source Files\Tools\Data Buffer\ReaderWriter - - - Source Files\Tools\Data Buffer\ReaderWriter - Source Files\Tools @@ -974,6 +962,21 @@ Source Files\Tools + + Source Files\Feedback Wrappers + + + Source Files\Feedback Wrappers + + + Source Files\Feedback Wrappers + + + Source Files\Feedback Wrappers + + + Source Files\Feedback Wrappers +