Optimize MetaFileSystem::ReadEntireFile

This commit is contained in:
Henrik Rydgård
2021-09-11 19:32:37 +02:00
parent f53546362f
commit 8e2b73b05f
2 changed files with 4 additions and 2 deletions

View File

@@ -588,7 +588,9 @@ int MetaFileSystem::ReadEntireFile(const std::string &filename, std::vector<u8>
if (handle < 0)
return handle;
size_t dataSize = (size_t)GetFileInfo(filename).size;
SeekFile(handle, 0, FILEMOVE_END);
size_t dataSize = GetSeekPos(handle);
SeekFile(handle, 0, FILEMOVE_BEGIN);
data.resize(dataSize);
size_t result = ReadFile(handle, (u8 *)&data[0], dataSize);