| 1 | #include "rar.hpp" |
| 2 | |
| 3 | BitInput::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 | |
| 24 | BitInput::~BitInput() |
nothing calls this directly
no outgoing calls
no test coverage detected