vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / media / plugins / ape_reader / MAClib / UnBitArray.h
blob9450c63a59f5df516b24068be8e6abc2e4b61f3b
1 #ifndef APE_UNBITARRAY_H
2 #define APE_UNBITARRAY_H
5 #include "UnBitArrayBase.h"
8 class IAPEDecompress;
11 struct RANGE_CODER_STRUCT_DECOMPRESS
13 unsigned int low; // low end of interval
14 unsigned int range; // length of interval
15 unsigned int buffer; // buffer for input/output
19 class CUnBitArray : public CUnBitArrayBase
21 public:
22 CUnBitArray(CIO* pIO, int nVersion);
23 ~CUnBitArray();
25 uint DecodeValue(DECODE_VALUE_METHOD DecodeMethod,
26 int nParam1 = 0, int nParam2 = 0);
28 void GenerateArray(int * pOutputArray, int nElements,
29 int nBytesRequired = -1);
31 int DecodeValueRange(UNBIT_ARRAY_STATE & BitArrayState);
33 void FlushState(UNBIT_ARRAY_STATE & BitArrayState);
34 void FlushBitArray();
35 void Finalize();
37 private:
38 void GenerateArrayRange(int * pOutputArray, int nElements);
40 // data
41 int m_nFlushCounter;
42 int m_nFinalizeCounter;
44 RANGE_CODER_STRUCT_DECOMPRESS m_RangeCoderInfo;
46 uint32 m_nRefillBitThreshold;
48 // functions
49 inline int RangeDecodeFast(int nShift);
50 inline int RangeDecodeFastWithUpdate(int nShift);
51 inline uchar GetC();
55 #endif // #ifndef APE_UNBITARRAY_H