Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2007-10-24 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:55 +0300
commitacd742622d1e0daf50ae815bec4ddb2143bafbf5 (patch)
tree9726a4b8de0935af6c892a2b8d632284f37570c4 /CPP/7zip/Archive/7z
parentb67ffe691bddceb89b47dd09a60203b77a2b72ed (diff)
4.56 beta
Diffstat (limited to 'CPP/7zip/Archive/7z')
-rwxr-xr-xCPP/7zip/Archive/7z/7zExtract.cpp2
-rwxr-xr-xCPP/7zip/Archive/7z/7zFolderInStream.cpp9
-rwxr-xr-xCPP/7zip/Archive/7z/7zFolderOutStream.cpp9
-rwxr-xr-xCPP/7zip/Archive/7z/7zFolderOutStream.h5
-rwxr-xr-xCPP/7zip/Archive/7z/7zHandler.cpp2
-rwxr-xr-xCPP/7zip/Archive/7z/7zHandler.h4
6 files changed, 21 insertions, 10 deletions
diff --git a/CPP/7zip/Archive/7z/7zExtract.cpp b/CPP/7zip/Archive/7z/7zExtract.cpp
index 65f9c9eb..42977097 100755
--- a/CPP/7zip/Archive/7z/7zExtract.cpp
+++ b/CPP/7zip/Archive/7z/7zExtract.cpp
@@ -195,7 +195,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
0,
#endif
startIndex,
- &efi.ExtractStatuses, extractCallback, testMode);
+ &efi.ExtractStatuses, extractCallback, testMode, _crcSize != 0);
RINOK(result);
diff --git a/CPP/7zip/Archive/7z/7zFolderInStream.cpp b/CPP/7zip/Archive/7z/7zFolderInStream.cpp
index fb1cfd3a..f60a7177 100755
--- a/CPP/7zip/Archive/7z/7zFolderInStream.cpp
+++ b/CPP/7zip/Archive/7z/7zFolderInStream.cpp
@@ -113,13 +113,14 @@ STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSiz
STDMETHODIMP CFolderInStream::GetSubStreamSize(UInt64 subStream, UInt64 *value)
{
*value = 0;
- if (subStream < Sizes.Size())
+ int subStreamIndex = (int)subStream;
+ if (subStreamIndex < 0 || subStream > Sizes.Size())
+ return E_FAIL;
+ if (subStreamIndex < Sizes.Size())
{
- *value= Sizes[(int)(size_t)subStream];
+ *value= Sizes[subStreamIndex];
return S_OK;
}
- if (subStream > Sizes.Size())
- return E_FAIL;
if (!_currentSizeIsDefined)
return S_FALSE;
*value = _currentSize;
diff --git a/CPP/7zip/Archive/7z/7zFolderOutStream.cpp b/CPP/7zip/Archive/7z/7zFolderOutStream.cpp
index 93bed3d9..6206ffec 100755
--- a/CPP/7zip/Archive/7z/7zFolderOutStream.cpp
+++ b/CPP/7zip/Archive/7z/7zFolderOutStream.cpp
@@ -19,7 +19,8 @@ HRESULT CFolderOutStream::Init(
UInt32 startIndex,
const CBoolVector *extractStatuses,
IArchiveExtractCallback *extractCallback,
- bool testMode)
+ bool testMode,
+ bool checkCrc)
{
_archiveDatabase = archiveDatabase;
_ref2Offset = ref2Offset;
@@ -29,6 +30,8 @@ HRESULT CFolderOutStream::Init(
_extractCallback = extractCallback;
_testMode = testMode;
+ _checkCrc = checkCrc;
+
_currentIndex = 0;
_fileIsOpen = false;
return WriteEmptyFiles();
@@ -49,7 +52,7 @@ HRESULT CFolderOutStream::OpenFile()
RINOK(_extractCallback->GetStream(_ref2Offset + index, &realOutStream, askMode));
_outStreamWithHashSpec->SetStream(realOutStream);
- _outStreamWithHashSpec->Init();
+ _outStreamWithHashSpec->Init(_checkCrc);
if (askMode == NArchive::NExtract::NAskMode::kExtract &&
(!realOutStream))
{
@@ -100,7 +103,7 @@ STDMETHODIMP CFolderOutStream::Write(const void *data,
if (_filePos == fileSize)
{
bool digestsAreEqual;
- if (fileInfo.IsFileCRCDefined)
+ if (fileInfo.IsFileCRCDefined && _checkCrc)
digestsAreEqual = fileInfo.FileCRC == _outStreamWithHashSpec->GetCRC();
else
digestsAreEqual = true;
diff --git a/CPP/7zip/Archive/7z/7zFolderOutStream.h b/CPP/7zip/Archive/7z/7zFolderOutStream.h
index c132c79a..8ca91e64 100755
--- a/CPP/7zip/Archive/7z/7zFolderOutStream.h
+++ b/CPP/7zip/Archive/7z/7zFolderOutStream.h
@@ -36,6 +36,8 @@ private:
bool _testMode;
bool _fileIsOpen;
+
+ bool _checkCrc;
UInt64 _filePos;
HRESULT OpenFile();
@@ -47,7 +49,8 @@ public:
UInt32 startIndex,
const CBoolVector *extractStatuses,
IArchiveExtractCallback *extractCallback,
- bool testMode);
+ bool testMode,
+ bool checkCrc);
HRESULT FlushCorrupted(Int32 resultEOperationResult);
HRESULT WasWritingFinished();
};
diff --git a/CPP/7zip/Archive/7z/7zHandler.cpp b/CPP/7zip/Archive/7z/7zHandler.cpp
index d5dc8720..bbef1ea5 100755
--- a/CPP/7zip/Archive/7z/7zHandler.cpp
+++ b/CPP/7zip/Archive/7z/7zHandler.cpp
@@ -33,6 +33,8 @@ namespace N7z {
CHandler::CHandler()
{
+ _crcSize = 4;
+
#ifdef EXTRACT_ONLY
#ifdef COMPRESS_MT
_numThreads = NWindows::NSystem::GetNumberOfProcessors();
diff --git a/CPP/7zip/Archive/7z/7zHandler.h b/CPP/7zip/Archive/7z/7zHandler.h
index 1006f204..ad4df41f 100755
--- a/CPP/7zip/Archive/7z/7zHandler.h
+++ b/CPP/7zip/Archive/7z/7zHandler.h
@@ -110,7 +110,9 @@ private:
#ifdef COMPRESS_MT
UInt32 _numThreads;
#endif
-
+
+ UInt32 _crcSize;
+
#else
CRecordVector<CBind> _binds;