diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2016-09-29 03:00:00 +0300 |
---|---|---|
committer | Kornel LesinĚski <kornel@geekhood.net> | 2016-12-08 15:12:54 +0300 |
commit | 232ce7957441b06193c4cbdc1bc9e71436fadfdb (patch) | |
tree | cbfba61cb993434ebb38be4e058a977d91a8676a /CPP/7zip/Archive/Zip/ZipUpdate.cpp | |
parent | 1eddf527cacc149016ec987d554d3dfb52b69131 (diff) |
16.0316.03
Diffstat (limited to 'CPP/7zip/Archive/Zip/ZipUpdate.cpp')
-rw-r--r-- | CPP/7zip/Archive/Zip/ZipUpdate.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/CPP/7zip/Archive/Zip/ZipUpdate.cpp b/CPP/7zip/Archive/Zip/ZipUpdate.cpp index 8cb123e6..bc50c1d7 100644 --- a/CPP/7zip/Archive/Zip/ZipUpdate.cpp +++ b/CPP/7zip/Archive/Zip/ZipUpdate.cpp @@ -584,7 +584,7 @@ static HRESULT Update2( CInArchive *inArchive, const CObjectVector<CItemEx> &inputItems, CObjectVector<CUpdateItem> &updateItems, - const CCompressionMethodMode *options, + const CCompressionMethodMode &options, const CByteBuffer *comment, IArchiveUpdateCallback *updateCallback) { @@ -629,17 +629,15 @@ static HRESULT Update2( UInt64 totalComplexity = complexity; - CAddCommon compressor(*options); + CAddCommon compressor(options); complexity = 0; - CCompressionMethodMode options2; - if (options != 0) - options2 = *options; + CCompressionMethodMode options2 = options; #ifndef _7ZIP_ST - UInt32 numThreads = options->NumThreads; + UInt32 numThreads = options.NumThreads; const UInt32 kNumMaxThreads = 64; if (numThreads > kNumMaxThreads) numThreads = kNumMaxThreads; @@ -652,12 +650,12 @@ static HRESULT Update2( const size_t kMemPerThread = (1 << 25); const size_t kBlockSize = 1 << 16; - bool mtMode = ((options != 0) && (numThreads > 1)); + bool mtMode = (numThreads > 1); if (numFilesToCompress <= 1) mtMode = false; - Byte method = options->MethodSequence.Front(); + Byte method = options.MethodSequence.Front(); if (!mtMode) { @@ -670,7 +668,7 @@ static HRESULT Update2( } else { - if (method == NFileHeader::NCompressionMethod::kStored && !options->PasswordIsDefined) + if (method == NFileHeader::NCompressionMethod::kStored && !options.PasswordIsDefined) numThreads = 1; if (method == NFileHeader::NCompressionMethod::kBZip2) { @@ -855,16 +853,16 @@ static HRESULT Update2( if (isDir) { - WriteDirHeader(archive, options, ui, item); + WriteDirHeader(archive, &options, ui, item); } else { if (lastRealStreamItemIndex < (int)itemIndex) { lastRealStreamItemIndex = itemIndex; - SetFileHeader(archive, *options, ui, item); + SetFileHeader(archive, options, ui, item); // file Size can be 64-bit !!! - archive.PrepareWriteCompressedData(item.Name.Len(), ui.Size, options->IsRealAesMode()); + archive.PrepareWriteCompressedData(item.Name.Len(), ui.Size, options.IsRealAesMode()); } CMemBlocks2 &memRef = refs.Refs[itemIndex]; @@ -874,12 +872,12 @@ static HRESULT Update2( CMyComPtr<IOutStream> outStream; archive.CreateStreamForCompressing(&outStream); memRef.WriteToStream(memManager.GetBlockSize(), outStream); - SetFileHeader(archive, *options, ui, item); + SetFileHeader(archive, options, ui, item); // the BUG was fixed in 9.26: // SetItemInfoFromCompressingResult must be after SetFileHeader // to write correct Size. SetItemInfoFromCompressingResult(memRef.CompressingResult, - options->IsRealAesMode(), options->AesKeyMode, item); + options.IsRealAesMode(), options.AesKeyMode, item); archive.WriteLocalHeader_And_SeekToNextFile(item); // RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); memRef.FreeOpt(&memManager); @@ -920,9 +918,9 @@ static HRESULT Update2( { RINOK(threadInfo.OutStreamSpec->WriteToRealStream()); threadInfo.OutStreamSpec->ReleaseOutStream(); - SetFileHeader(archive, *options, ui, item); + SetFileHeader(archive, options, ui, item); SetItemInfoFromCompressingResult(threadInfo.CompressingResult, - options->IsRealAesMode(), options->AesKeyMode, item); + options.IsRealAesMode(), options.AesKeyMode, item); archive.WriteLocalHeader_And_SeekToNextFile(item); } else @@ -1173,7 +1171,7 @@ HRESULT Update( CObjectVector<CUpdateItem> &updateItems, ISequentialOutStream *seqOutStream, CInArchive *inArchive, bool removeSfx, - CCompressionMethodMode *compressionMethodMode, + const CCompressionMethodMode &compressionMethodMode, IArchiveUpdateCallback *updateCallback) { if (inArchive) |