diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2015-10-05 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:56 +0300 |
commit | 6543c280208393fa32cb0094f770d14c1cfb13b2 (patch) | |
tree | beb90f5e81e85e7957463ee5ad89cab0b3566560 /CPP/7zip/Archive/Rar | |
parent | f6444c32568553e0261ca0105083658f12be6284 (diff) |
15.0815.08
Diffstat (limited to 'CPP/7zip/Archive/Rar')
-rw-r--r-- | CPP/7zip/Archive/Rar/Rar5Handler.cpp | 11 | ||||
-rw-r--r-- | CPP/7zip/Archive/Rar/RarHandler.cpp | 31 |
2 files changed, 7 insertions, 35 deletions
diff --git a/CPP/7zip/Archive/Rar/Rar5Handler.cpp b/CPP/7zip/Archive/Rar/Rar5Handler.cpp index 72fe4f68..2cfe805e 100644 --- a/CPP/7zip/Archive/Rar/Rar5Handler.cpp +++ b/CPP/7zip/Archive/Rar/Rar5Handler.cpp @@ -30,6 +30,8 @@ #include "../Common/FindSignature.h" #include "../Common/ItemNameUtils.h" +#include "../HandlerCont.h" + #include "RarVol.h" #include "Rar5Handler.h" @@ -38,13 +40,6 @@ using namespace NWindows; #define Get32(p) GetUi32(p) namespace NArchive { - -namespace NRar { - -HRESULT ReadZeroTail(ISequentialInStream *stream, bool &areThereNonZeros, UInt64 &numZeros, UInt64 maxSize); - -} - namespace NRar5 { static const unsigned kMarkerSize = 8; @@ -1938,7 +1933,7 @@ HRESULT CHandler::Open2(IInStream *stream, bool areThereNonZeros; UInt64 numZeros; const UInt64 maxSize = 1 << 12; - RINOK(NRar::ReadZeroTail(inStream, areThereNonZeros, numZeros, maxSize)); + RINOK(ReadZeroTail(inStream, areThereNonZeros, numZeros, maxSize)); if (!areThereNonZeros && numZeros != 0 && numZeros <= maxSize) arcInfo.EndPos += numZeros; } diff --git a/CPP/7zip/Archive/Rar/RarHandler.cpp b/CPP/7zip/Archive/Rar/RarHandler.cpp index d6d894f4..dde15958 100644 --- a/CPP/7zip/Archive/Rar/RarHandler.cpp +++ b/CPP/7zip/Archive/Rar/RarHandler.cpp @@ -30,6 +30,8 @@ #include "../Common/ItemNameUtils.h" #include "../Common/OutStreamWithCRC.h" +#include "../HandlerCont.h" + #include "RarVol.h" #include "RarHandler.h" @@ -938,7 +940,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val if (item.BaseFileIndex >= 0) mainItem = &_items[_refItems[item.BaseFileIndex].ItemIndex]; */ - switch(propID) + switch (propID) { case kpidPath: { @@ -998,31 +1000,6 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val } -HRESULT ReadZeroTail(ISequentialInStream *stream, bool &areThereNonZeros, UInt64 &numZeros, UInt64 maxSize) -{ - areThereNonZeros = false; - numZeros = 0; - const size_t kBufSize = 1 << 9; - Byte buf[kBufSize]; - for (;;) - { - UInt32 size = 0; - HRESULT(stream->Read(buf, kBufSize, &size)); - if (size == 0) - return S_OK; - for (UInt32 i = 0; i < size; i++) - if (buf[i] != 0) - { - areThereNonZeros = true; - numZeros += i; - return S_OK; - } - numZeros += size; - if (numZeros > maxSize) - return S_OK; - } -} - HRESULT CHandler::Open2(IInStream *stream, const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *openCallback) @@ -1593,7 +1570,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems, CMyComPtr<ICompressCoder> commonCoder; - switch(item.Method) + switch (item.Method) { case '0': { |