allow coexistance of N build and AC build.
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / scripts / squashfs / lzma / C / 7zip / Compress / LZ / LZOutWindow.h
blobba38c5e20b16e9d0f8e9b1df0dd3bb39db1b3f48
1 // LZOutWindow.h
3 #ifndef __LZ_OUT_WINDOW_H
4 #define __LZ_OUT_WINDOW_H
6 #include "../../IStream.h"
7 #include "../../Common/OutBuffer.h"
9 /*
10 #ifndef _NO_EXCEPTIONS
11 class CLZOutWindowException
13 public:
14 HRESULT ErrorCode;
15 CLZOutWindowException(HRESULT errorCode): ErrorCode(errorCode) {}
17 #endif
19 typedef COutBufferException CLZOutWindowException;
21 class CLZOutWindow: public COutBuffer
23 public:
24 void Init(bool solid = false);
26 // distance >= 0, len > 0,
27 bool CopyBlock(UInt32 distance, UInt32 len)
29 UInt32 pos = _pos - distance - 1;
30 if (pos >= _bufferSize)
32 if (!_overDict)
33 return false;
34 pos += _bufferSize;
38 if (pos == _bufferSize)
39 pos = 0;
40 _buffer[_pos++] = _buffer[pos++];
41 if (_pos == _limitPos)
42 FlushWithCheck();
44 while(--len != 0);
45 return true;
48 void PutByte(Byte b)
50 _buffer[_pos++] = b;
51 if (_pos == _limitPos)
52 FlushWithCheck();
55 Byte GetByte(UInt32 distance) const
57 UInt32 pos = _pos - distance - 1;
58 if (pos >= _bufferSize)
59 pos += _bufferSize;
60 return _buffer[pos];
64 #endif