4.56 beta

This commit is contained in:
Igor Pavlov
2007-10-24 00:00:00 +00:00
committed by Kornel Lesiński
parent b67ffe691b
commit acd742622d
39 changed files with 280 additions and 141 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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();
};

View File

@@ -33,6 +33,8 @@ namespace N7z {
CHandler::CHandler()
{
_crcSize = 4;
#ifdef EXTRACT_ONLY
#ifdef COMPRESS_MT
_numThreads = NWindows::NSystem::GetNumberOfProcessors();

View File

@@ -110,7 +110,9 @@ private:
#ifdef COMPRESS_MT
UInt32 _numThreads;
#endif
UInt32 _crcSize;
#else
CRecordVector<CBind> _binds;