This commit is contained in:
Igor Pavlov
2003-12-11 00:00:00 +00:00
committed by Kornel Lesiński
commit 8c1b5c7b7e
982 changed files with 118799 additions and 0 deletions

42
7zip/Common/MultiStream.cpp Executable file
View File

@@ -0,0 +1,42 @@
// MultiStream.cpp
#include "StdAfx.h"
#include "MultiStream.h"
HRESULT CLockedInStream::Read(UINT64 startPos, void *data, UINT32 size,
UINT32 *processedSize)
{
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
RINOK(_stream->Seek(startPos, STREAM_SEEK_SET, NULL));
return _stream->Read(data, size, processedSize);
}
HRESULT CLockedInStream::ReadPart(UINT64 startPos, void *data, UINT32 size,
UINT32 *processedSize)
{
NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
RINOK(_stream->Seek(startPos, STREAM_SEEK_SET, NULL));
return _stream->ReadPart(data, size, processedSize);
}
STDMETHODIMP CLockedSequentialInStreamImp::Read(void *data, UINT32 size, UINT32 *processedSize)
{
UINT32 realProcessedSize = 0;
HRESULT result = _lockedInStream->Read(_pos, data, size, &realProcessedSize);
_pos += realProcessedSize;
if (processedSize != NULL)
*processedSize = realProcessedSize;
return result;
}
STDMETHODIMP CLockedSequentialInStreamImp::ReadPart(void *data, UINT32 size, UINT32 *processedSize)
{
UINT32 realProcessedSize = 0;
HRESULT result = _lockedInStream->ReadPart(_pos, data, size, &realProcessedSize);
_pos += realProcessedSize;
if (processedSize != NULL)
*processedSize = realProcessedSize;
return result;
}