Start proper stream support.

This commit is contained in:
jmsgrogan 2024-01-21 16:27:30 +00:00
parent 5183aa821a
commit e3e03dc31f
34 changed files with 421 additions and 402 deletions

View file

@ -11,7 +11,8 @@ Byte BitStream::getCurrentByte()
{
if (mByteOffset < 0)
{
readNextByte();
Byte buffer;
readNextByte(buffer);
}
return mCurrentByte;
}
@ -109,9 +110,10 @@ void BitStream::writeNBits(DWord data, size_t length)
bool BitStream::readNextNBits(size_t n, Byte& buffer)
{
Byte internal_buffer;
if (mByteOffset < 0)
{
if (!readNextByte())
if (!readNextByte(internal_buffer))
{
return false;
}
@ -121,7 +123,7 @@ bool BitStream::readNextNBits(size_t n, Byte& buffer)
if (overshoot > 0)
{
const auto last_byte = mCurrentByte;
if (!readNextByte())
if (!readNextByte(internal_buffer))
{
return false;
}