MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / SetPosition

Method SetPosition

Source/Engine/Serialization/FileReadStream.cpp:78–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78void FileReadStream::SetPosition(uint32 seek)
79{
80#if USE_FILE_POS
81 // Skip if position won't change
82 if (GetPosition() == seek)
83 {
84 return;
85 }
86
87 // Try to seek with virtual position
88 uint32 bufferStartPos = _filePosition - _bufferSize;
89 if (seek >= GetPosition() && seek < _filePosition)
90 {
91 _virtualPosInBuffer = seek - bufferStartPos;
92 return;
93 }
94#endif
95
96 // Seek
97 _file->SetPosition(seek);
98 _filePosition = _file->GetPosition();
99
100 // Update buffer
101 _hasError |= _file->Read(_buffer, FILESTREAM_BUFFER_SIZE, &_bufferSize) != 0;
102#if USE_FILE_POS
103 _filePosition += _bufferSize;
104#endif
105 _virtualPosInBuffer = 0;
106}
107
108void FileReadStream::ReadBytes(void* data, uint32 bytes)
109{

Callers 1

ExtractShaderIncludesMethod · 0.45

Calls 3

GetPositionFunction · 0.50
GetPositionMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected