mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user