From bec3b479dcae1345a466ebe923989b0bd56fd5b6 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Fri, 20 May 2016 00:00:00 +0000 Subject: 16.01 --- CPP/7zip/Archive/Zip/ZipIn.cpp | 25 ++++++++++++++++--------- CPP/7zip/Archive/Zip/ZipUpdate.cpp | 16 ++++++++-------- 2 files changed, 24 insertions(+), 17 deletions(-) (limited to 'CPP/7zip/Archive/Zip') diff --git a/CPP/7zip/Archive/Zip/ZipIn.cpp b/CPP/7zip/Archive/Zip/ZipIn.cpp index fe5200f7..c71c40fd 100644 --- a/CPP/7zip/Archive/Zip/ZipIn.cpp +++ b/CPP/7zip/Archive/Zip/ZipIn.cpp @@ -297,11 +297,14 @@ HRESULT CInArchive::FindMarker(IInStream *stream, const UInt64 *searchLimit) if (searchLimit && *searchLimit == 0) { Byte startBuf[kMarkerSize]; - size_t processed = kMarkerSize; - RINOK(ReadStream(stream, startBuf, &processed)); - m_Position += processed; - if (processed < kMarkerSize) - return S_FALSE; + { + size_t processed = kMarkerSize; + RINOK(ReadStream(stream, startBuf, &processed)); + m_Position += processed; + if (processed != kMarkerSize) + return S_FALSE; + } + m_Signature = Get32(startBuf); if (m_Signature != NSignature::kEcd && @@ -318,7 +321,7 @@ HRESULT CInArchive::FindMarker(IInStream *stream, const UInt64 *searchLimit) size_t processed = kMarkerSize; RINOK(ReadStream(stream, startBuf, &processed)); m_Position += processed; - if (processed < kMarkerSize) + if (processed != kMarkerSize) return S_FALSE; m_Signature = Get32(startBuf); if (m_Signature != NSignature::kEcd && @@ -1567,7 +1570,7 @@ HRESULT CInArchive::ReadVols() if (Vols.StartIsZip) Vols.ZipStream = StartStream; - bool cdOK = false; + // bool cdOK = false; if (Vols.ZipStream) { @@ -1589,12 +1592,16 @@ HRESULT CInArchive::ReadVols() // Vols.EndVolIndex = ecd.ThisDisk; unsigned numMissingVols; if (cdDisk == zipDisk) - cdOK = true; + { + // cdOK = true; + } else { RINOK(ReadVols2(volCallback, cdDisk, zipDisk, zipDisk, 0, numMissingVols)); if (numMissingVols == 0) - cdOK = false; + { + // cdOK = false; + } } } else if (res != S_FALSE) diff --git a/CPP/7zip/Archive/Zip/ZipUpdate.cpp b/CPP/7zip/Archive/Zip/ZipUpdate.cpp index 1546a2af..8cb123e6 100644 --- a/CPP/7zip/Archive/Zip/ZipUpdate.cpp +++ b/CPP/7zip/Archive/Zip/ZipUpdate.cpp @@ -596,6 +596,7 @@ static HRESULT Update2( UInt64 numBytesToCompress = 0; unsigned i; + for (i = 0; i < updateItems.Size(); i++) { const CUpdateItem &ui = updateItems[i]; @@ -731,7 +732,6 @@ static HRESULT Update2( for (i = 0; i < updateItems.Size(); i++) refs.Refs.Add(CMemBlocks2()); - UInt32 i; for (i = 0; i < numThreads; i++) threads.Threads.Add(CThreadInfo(options2)); @@ -804,9 +804,9 @@ static HRESULT Update2( RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); } - for (UInt32 i = 0; i < numThreads; i++) + for (UInt32 k = 0; k < numThreads; k++) { - CThreadInfo &threadInfo = threads.Threads[i]; + CThreadInfo &threadInfo = threads.Threads[k]; if (threadInfo.IsFree) { threadInfo.IsFree = false; @@ -822,7 +822,7 @@ static HRESULT Update2( threadInfo.UpdateIndex = mtItemIndex - 1; compressingCompletedEvents.Add(threadInfo.CompressionCompletedEvent); - threadIndices.Add(i); + threadIndices.Add(k); break; } } @@ -927,10 +927,10 @@ static HRESULT Update2( } else { - CMemBlocks2 &memRef = refs.Refs[threadInfo.UpdateIndex]; - threadInfo.OutStreamSpec->DetachData(memRef); - memRef.CompressingResult = threadInfo.CompressingResult; - memRef.Defined = true; + CMemBlocks2 &memRef2 = refs.Refs[threadInfo.UpdateIndex]; + threadInfo.OutStreamSpec->DetachData(memRef2); + memRef2.CompressingResult = threadInfo.CompressingResult; + memRef2.Defined = true; continue; } } -- cgit v1.2.3