- rewrote the operator>> methods of FileReader as normal functions for clarity.

This commit is contained in:
Christoph Oelckers 2018-03-11 18:20:49 +01:00
commit 0be1ed252b
12 changed files with 150 additions and 133 deletions

View file

@ -324,14 +324,17 @@ public:
buf.Resize(length);
memcpy(&buf[0], buffer, length);
}
Length = length;
FilePos = 0;
bufptr = (const char *)&buf[0];
UpdateBuffer();
}
TArray<uint8_t> &GetArray() { return buf; }
void UpdateLength() { Length = buf.Size(); }
void UpdateBuffer()
{
bufptr = (const char*)&buf[0];
FilePos = 0;
Length = buf.Size();
}
};
@ -381,7 +384,7 @@ bool FileRdr::OpenMemoryArray(std::function<bool(TArray<uint8_t>&)> getter)
if (getter(reader->GetArray()))
{
Close();
reader->UpdateLength();
reader->UpdateBuffer();
mReader = reader;
return true;
}