MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / BitInput

Method BitInput

Libraries/unrar/getbits.cpp:3–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "rar.hpp"
2
3BitInput::BitInput(bool AllocBuffer)
4{
5 ExternalBuffer=false;
6 if (AllocBuffer)
7 {
8 // getbits32 attempts to read data from InAddr, ... InAddr+3 positions.
9 // So let's allocate 3 additional bytes for situation, when we need to
10 // read only 1 byte from the last position of buffer and avoid a crash
11 // from access to next 3 bytes, which contents we do not need.
12 size_t BufSize=MAX_SIZE+3;
13 InBuf=new byte[BufSize];
14
15 // Ensure that we get predictable results when accessing bytes in area
16 // not filled with read data.
17 memset(InBuf,0,BufSize);
18 }
19 else
20 InBuf=NULL;
21}
22
23
24BitInput::~BitInput()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected