Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Side by Side Diff: third_party/lzma/v4_65/files/CPP/7zip/Common/LimitedStreams.h

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // LimitedStreams.h
2
3 #ifndef __LIMITEDSTREAMS_H
4 #define __LIMITEDSTREAMS_H
5
6 #include "../../Common/MyCom.h"
7 #include "../IStream.h"
8
9 class CLimitedSequentialInStream:
10 public ISequentialInStream,
11 public CMyUnknownImp
12 {
13 CMyComPtr<ISequentialInStream> _stream;
14 UInt64 _size;
15 UInt64 _pos;
16 bool _wasFinished;
17 public:
18 void SetStream(ISequentialInStream *stream) { _stream = stream; }
19 void Init(UInt64 streamSize)
20 {
21 _size = streamSize;
22 _pos = 0;
23 _wasFinished = false;
24 }
25
26 MY_UNKNOWN_IMP
27
28 STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
29 UInt64 GetSize() const { return _pos; }
30 bool WasFinished() const { return _wasFinished; }
31 };
32
33 class CLimitedSequentialOutStream:
34 public ISequentialOutStream,
35 public CMyUnknownImp
36 {
37 CMyComPtr<ISequentialOutStream> _stream;
38 UInt64 _size;
39 bool _overflow;
40 public:
41 MY_UNKNOWN_IMP
42 STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
43 void SetStream(ISequentialOutStream *stream) { _stream = stream; }
44 void ReleaseStream() { _stream.Release(); }
45 void Init(UInt64 size)
46 {
47 _size = size;
48 _overflow = false;
49 }
50 bool IsFinishedOK() const { return (_size == 0 && !_overflow); }
51 UInt64 GetRem() const { return _size; }
52 };
53
54 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698