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
path: root/CPP
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2016-01-01 03:00:00 +0300
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:16:58 +0300
commitc20d013055085bf49b4c93b2c617030b10c1fb4d (patch)
treeb756a7653ed875629c4434715c6f672280243997 /CPP
parent9608215ad8deb58355bae27692669fda067c4f43 (diff)
15.1415.14
Diffstat (limited to 'CPP')
-rw-r--r--CPP/7zip/Archive/Cab/CabHandler.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/CPP/7zip/Archive/Cab/CabHandler.cpp b/CPP/7zip/Archive/Cab/CabHandler.cpp
index e31de4fe..9c841545 100644
--- a/CPP/7zip/Archive/Cab/CabHandler.cpp
+++ b/CPP/7zip/Archive/Cab/CabHandler.cpp
@@ -572,6 +572,7 @@ public:
HRESULT FlushCorrupted(unsigned folderIndex);
HRESULT Unsupported();
+ bool NeedMoreWrite() const { return (m_FolderSize > m_PosInFolder); }
UInt64 GetRemain() const { return m_FolderSize - m_PosInFolder; }
UInt64 GetPosInFolder() const { return m_PosInFolder; }
};
@@ -831,9 +832,7 @@ STDMETHODIMP CFolderOutStream::Write(const void *data, UInt32 size, UInt32 *proc
HRESULT CFolderOutStream::FlushCorrupted(unsigned folderIndex)
{
- UInt64 remain = GetRemain();
-
- if (remain == 0)
+ if (!NeedMoreWrite())
{
CMyComPtr<IArchiveExtractCallbackMessage> callbackMessage;
m_ExtractCallback.QueryInterface(IID_IArchiveExtractCallbackMessage, &callbackMessage);
@@ -851,9 +850,9 @@ HRESULT CFolderOutStream::FlushCorrupted(unsigned folderIndex)
for (;;)
{
- UInt64 remain = GetRemain();
- if (remain == 0)
+ if (!NeedMoreWrite())
return S_OK;
+ UInt64 remain = GetRemain();
UInt32 size = (remain < kBufSize ? (UInt32)remain : (UInt32)kBufSize);
UInt32 processedSizeLocal = 0;
RINOK(Write2(buf, size, &processedSizeLocal, false));
@@ -1075,7 +1074,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
bool keepInputBuffer = false;
bool thereWasNotAlignedChunk = false;
- for (UInt32 bl = 0; cabFolderOutStream->GetRemain() != 0;)
+ for (UInt32 bl = 0; cabFolderOutStream->NeedMoreWrite();)
{
if (volIndex >= m_Database.Volumes.Size())
{
@@ -1217,7 +1216,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
}
}
- if (res != S_OK || cabFolderOutStream->GetRemain() != 0)
+ if (res != S_OK || cabFolderOutStream->NeedMoreWrite())
{
RINOK(cabFolderOutStream->FlushCorrupted(folderIndex2));
}