other-licenses/7zstub/src/7zip/Common/LockedStream.h

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 // LockedStream.h
     3 #ifndef __LOCKEDSTREAM_H
     4 #define __LOCKEDSTREAM_H
     6 #include "../../Windows/Synchronization.h"
     7 #include "../../Common/MyCom.h"
     8 #include "../IStream.h"
    10 class CLockedInStream
    11 {
    12   CMyComPtr<IInStream> _stream;
    13   NWindows::NSynchronization::CCriticalSection _criticalSection;
    14 public:
    15   void Init(IInStream *stream)
    16     { _stream = stream; }
    17   HRESULT Read(UInt64 startPos, void *data, UInt32 size, UInt32 *processedSize);
    18 };
    20 class CLockedSequentialInStreamImp: 
    21   public ISequentialInStream,
    22   public CMyUnknownImp
    23 {
    24   CLockedInStream *_lockedInStream;
    25   UInt64 _pos;
    26 public:
    27   void Init(CLockedInStream *lockedInStream, UInt64 startPos)
    28   {
    29     _lockedInStream = lockedInStream;
    30     _pos = startPos;
    31   }
    33   MY_UNKNOWN_IMP
    35   STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
    36 };
    38 #endif

mercurial