forked from ddnet/ddnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support reading demo files larger than 2 GiB
Use `int64_t` for file sizes and offsets of `io_seek`, `io_tell`, `io_skip` and `io_length` functions to support reading larger files, in particular Teehistorian demos larger than 2 GiB. Implement the `io_seek` function using the `_fseeki64` function on Windows and the `fseeko` function on non-Windows. Implement the `io_tell` function using the `_ftelli64` function on Windows and the `ftello` function on non-Windows. Define `_FILE_OFFSET_BITS=64` to ensure that `off_t` is a 64 bit type for the `fseeko` and `ftello` functions. Change `io_read_all`, `io_read_all_str`, `IStorage::ReadFile` and `IStorage::ReadFileStr` functions to fail when loading files larger than 1 GiB. We should never load files that large into memory and this avoids issues with the file size exceeding `unsigned` limits. When writing map file data to demos, check if the map file is larger than `std::numeric_limits<unsigned>::max()` which would break the demo format. In that case, record the demo without embedding the map data. Add tests for the `io_length`, `io_seek`, `io_tell`, `io_skip` functions.
- Loading branch information
Showing
9 changed files
with
217 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.