1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/other-licenses/7zstub/src/7zip/Common/LockedStream.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,23 @@ 1.4 +// LockedStream.cpp 1.5 + 1.6 +#include "StdAfx.h" 1.7 + 1.8 +#include "LockedStream.h" 1.9 + 1.10 +HRESULT CLockedInStream::Read(UInt64 startPos, void *data, UInt32 size, 1.11 + UInt32 *processedSize) 1.12 +{ 1.13 + NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); 1.14 + RINOK(_stream->Seek(startPos, STREAM_SEEK_SET, NULL)); 1.15 + return _stream->Read(data, size, processedSize); 1.16 +} 1.17 + 1.18 +STDMETHODIMP CLockedSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *processedSize) 1.19 +{ 1.20 + UInt32 realProcessedSize = 0; 1.21 + HRESULT result = _lockedInStream->Read(_pos, data, size, &realProcessedSize); 1.22 + _pos += realProcessedSize; 1.23 + if (processedSize != NULL) 1.24 + *processedSize = realProcessedSize; 1.25 + return result; 1.26 +}