diff options
author | tjenssen <tim.jenssen@nokia.com> | 2012-03-13 13:38:26 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@nokia.com> | 2012-03-13 17:35:19 +0100 |
commit | fea754a77e599328c0a7d0801792ae1b5bc155fc (patch) | |
tree | 74d1b6fe4c43ca93e71585ea0719ec0e342ea90b /installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.cpp | |
parent | c1da312f182ad1b81a1f0ce627e4f9b3eddbf92b (diff) |
remove old 7zip version
Change-Id: I8fa14b3132599ddd164633ad932eff4ef7734c74
Reviewed-by: Karsten Heimrich <karsten.heimrich@nokia.com>
Diffstat (limited to 'installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.cpp')
-rw-r--r-- | installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.cpp | 140 |
1 files changed, 0 insertions, 140 deletions
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.cpp deleted file mode 100644 index 755058638..000000000 --- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// 7zFolderOutStream.cpp - -#include "StdAfx.h" - -#include "7zFolderOutStream.h" - -namespace NArchive { -namespace N7z { - -CFolderOutStream::CFolderOutStream() -{ - _crcStreamSpec = new COutStreamWithCRC; - _crcStream = _crcStreamSpec; -} - -HRESULT CFolderOutStream::Init( - const CArchiveDatabaseEx *archiveDatabase, - UInt32 ref2Offset, UInt32 startIndex, - const CBoolVector *extractStatuses, - IArchiveExtractCallback *extractCallback, - bool testMode, bool checkCrc) -{ - _db = archiveDatabase; - _ref2Offset = ref2Offset; - _startIndex = startIndex; - - _extractStatuses = extractStatuses; - _extractCallback = extractCallback; - _testMode = testMode; - _checkCrc = checkCrc; - - _currentIndex = 0; - _fileIsOpen = false; - return ProcessEmptyFiles(); -} - -HRESULT CFolderOutStream::OpenFile() -{ - Int32 askMode = ((*_extractStatuses)[_currentIndex]) ? (_testMode ? - NArchive::NExtract::NAskMode::kTest : - NArchive::NExtract::NAskMode::kExtract): - NArchive::NExtract::NAskMode::kSkip; - CMyComPtr<ISequentialOutStream> realOutStream; - UInt32 index = _startIndex + _currentIndex; - RINOK(_extractCallback->GetStream(_ref2Offset + index, &realOutStream, askMode)); - _crcStreamSpec->SetStream(realOutStream); - _crcStreamSpec->Init(_checkCrc); - _fileIsOpen = true; - const CFileItem &fi = _db->Files[index]; - _rem = fi.Size; - if (askMode == NArchive::NExtract::NAskMode::kExtract && !realOutStream && - !_db->IsItemAnti(index) && !fi.IsDir) - askMode = NArchive::NExtract::NAskMode::kSkip; - return _extractCallback->PrepareOperation(askMode); -} - -HRESULT CFolderOutStream::CloseFileAndSetResult(Int32 res) -{ - _crcStreamSpec->ReleaseStream(); - _fileIsOpen = false; - _currentIndex++; - return _extractCallback->SetOperationResult(res); -} - -HRESULT CFolderOutStream::CloseFileAndSetResult() -{ - const CFileItem &fi = _db->Files[_startIndex + _currentIndex]; - return CloseFileAndSetResult( - (fi.IsDir || !fi.CrcDefined || !_checkCrc || fi.Crc == _crcStreamSpec->GetCRC()) ? - NArchive::NExtract::NOperationResult::kOK : - NArchive::NExtract::NOperationResult::kCRCError); -} - -HRESULT CFolderOutStream::ProcessEmptyFiles() -{ - while (_currentIndex < _extractStatuses->Size() && _db->Files[_startIndex + _currentIndex].Size == 0) - { - RINOK(OpenFile()); - RINOK(CloseFileAndSetResult()); - } - return S_OK; -} - -STDMETHODIMP CFolderOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - if (processedSize != NULL) - *processedSize = 0; - while (size != 0) - { - if (_fileIsOpen) - { - UInt32 cur = size < _rem ? size : (UInt32)_rem; - RINOK(_crcStream->Write(data, cur, &cur)); - if (cur == 0) - break; - data = (const Byte *)data + cur; - size -= cur; - _rem -= cur; - if (processedSize != NULL) - *processedSize += cur; - if (_rem == 0) - { - RINOK(CloseFileAndSetResult()); - RINOK(ProcessEmptyFiles()); - continue; - } - } - else - { - RINOK(ProcessEmptyFiles()); - if (_currentIndex == _extractStatuses->Size()) - { - // we support partial extracting - if (processedSize != NULL) - *processedSize += size; - break; - } - RINOK(OpenFile()); - } - } - return S_OK; -} - -HRESULT CFolderOutStream::FlushCorrupted(Int32 resultEOperationResult) -{ - while (_currentIndex < _extractStatuses->Size()) - { - if (_fileIsOpen) - { - RINOK(CloseFileAndSetResult(resultEOperationResult)); - } - else - { - RINOK(OpenFile()); - } - } - return S_OK; -} - -}} |