Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
beachtom committed Sep 7, 2023
1 parent f166114 commit 507567c
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/wasm/parsing/IfcTokenChunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ namespace webifc::parsing
IfcTokenStream::IfcTokenChunk::IfcTokenChunk(const size_t chunkSize, const size_t startRef, const size_t fileStartRef, IfcFileStream *fileStream) : _startRef(startRef), _fileStartRef(fileStartRef), _chunkSize(chunkSize), _fileStream(fileStream)
{
_chunkData = nullptr;
_loaded=true;
_currentSize = 0;
_chunkData = new uint8_t[_chunkSize];
if (_fileStream!=nullptr) Load();
else {
_loaded=true;
_currentSize = 0;
}
}

bool IfcTokenStream::IfcTokenChunk::Clear()
Expand Down Expand Up @@ -55,10 +54,6 @@ namespace webifc::parsing
void IfcTokenStream::IfcTokenChunk::Push(void *v, const size_t size)
{
_currentSize+=size;
if (_chunkData == nullptr)
{
_chunkData = new uint8_t[_chunkSize];
}
if (_currentSize > _chunkSize) {
uint8_t * tmp = _chunkData;
_chunkData = new uint8_t[_currentSize];
Expand All @@ -71,12 +66,9 @@ namespace webifc::parsing

void IfcTokenStream::IfcTokenChunk::Load()
{
_chunkData = new uint8_t[_chunkSize];
_loaded=true;
if (_fileStream->GetRef()!=_fileStartRef) _fileStream->Go(_fileStartRef);
std::vector<char> temp;
temp.reserve(50);
_currentSize = 0;
while ( !_fileStream->IsAtEnd() && _currentSize < _chunkSize)
{
const char c = _fileStream->Get();
Expand Down

0 comments on commit 507567c

Please sign in to comment.