Fixes lseek for big files on Windows

It was broken in ef69c37f66, before that we were using _lseeki64.

Fixes #8459
This commit is contained in:
Vladislav Belov
2025-10-15 17:40:33 +02:00
parent 7b1d4426aa
commit cb58116270
3 changed files with 12 additions and 1 deletions
+6
View File
@@ -56,8 +56,14 @@ Status LoadHeightmapImageOs(const OsPath& filepath, std::vector<u16>& heightmap)
File file;
RETURN_STATUS_IF_ERR(file.Open(OsString(filepath), O_RDONLY));
#if OS_WIN
// sizeof(long) == 4 on Windows so we can't use lseek.
size_t fileSize = _lseeki64(file.Descriptor(), 0, SEEK_END);
_lseeki64(file.Descriptor(), 0, SEEK_SET);
#else
size_t fileSize = lseek(file.Descriptor(), 0, SEEK_END);
lseek(file.Descriptor(), 0, SEEK_SET);
#endif
std::shared_ptr<u8> fileData;
RETURN_STATUS_IF_ERR(AllocateAligned(fileData, fileSize, maxSectorSize));