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

Side by Side Diff: third_party/lzma/v4_65/files/CPP/7zip/Common/OutBuffer.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 // OutBuffer.h
2
3 #ifndef __OUTBUFFER_H
4 #define __OUTBUFFER_H
5
6 #include "../IStream.h"
7 #include "../../Common/MyCom.h"
8 #include "../../Common/MyException.h"
9
10 #ifndef _NO_EXCEPTIONS
11 struct COutBufferException: public CSystemException
12 {
13 COutBufferException(HRESULT errorCode): CSystemException(errorCode) {}
14 };
15 #endif
16
17 class COutBuffer
18 {
19 protected:
20 Byte *_buffer;
21 UInt32 _pos;
22 UInt32 _limitPos;
23 UInt32 _streamPos;
24 UInt32 _bufferSize;
25 CMyComPtr<ISequentialOutStream> _stream;
26 UInt64 _processedSize;
27 Byte *_buffer2;
28 bool _overDict;
29
30 HRESULT FlushPart();
31 public:
32 #ifdef _NO_EXCEPTIONS
33 HRESULT ErrorCode;
34 #endif
35
36 COutBuffer(): _buffer(0), _pos(0), _stream(0), _buffer2(0) {}
37 ~COutBuffer() { Free(); }
38
39 bool Create(UInt32 bufferSize);
40 void Free();
41
42 void SetMemStream(Byte *buffer) { _buffer2 = buffer; }
43 void SetStream(ISequentialOutStream *stream);
44 void Init();
45 HRESULT Flush();
46 void FlushWithCheck();
47 void ReleaseStream() { _stream.Release(); }
48
49 void WriteByte(Byte b)
50 {
51 _buffer[_pos++] = b;
52 if(_pos == _limitPos)
53 FlushWithCheck();
54 }
55 void WriteBytes(const void *data, size_t size)
56 {
57 for (size_t i = 0; i < size; i++)
58 WriteByte(((const Byte *)data)[i]);
59 }
60
61 UInt64 GetProcessedSize() const;
62 };
63
64 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698