Make all file access 64-bit (uint64_t)#48768
Conversation
ef339bc to
c92d454
Compare
|
I made a test build for Windows (32-bit and 64-bit, both editor and templates) to help validate this PR: https://downloads.tuxfamily.org/godotengine/testing/4.0-dev-pr48768-windows.zip See #47254 (comment) for suggestions on how to make a reproduction project. |
Did some testing with this build like in #47254 (comment) I have the same results, big PCKs are working properly, and this error also happens when trying to get too big a buffer: That seems to be related to #46842. Also tested the "Embed PCK" option with a Win32 binary exported from the Win32 editor and it works fine. Edit: However I seem to get a different MD5 sum every time I export, so it seems there's something that makes the PCK non-deterministic in |
This changes the types of a big number of variables. General rules: - Using `uint64_t` in general. We also considered `int64_t` but eventually settled on keeping it unsigned, which is also closer to what one would expect with `size_t`/`off_t`. - We only keep `int64_t` for `seek_end` (takes a negative offset from the end) and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means we only need to guard against passing negative values in `core_bind.cpp`. - Using `uint32_t` integers for concepts not needing such a huge range, like pages, blocks, etc. In addition: - Improve usage of integer types in some related places; namely, `DirAccess`, core binds. Note: - On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for big files on 32-bit Windows builds made with that toolchain. We might add a workaround. Fixes godotengine#44363. Fixes godotengine/godot-proposals#400. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
c92d454 to
469fa47
Compare
|
Should be good to go as since it works in my tests (I just pushed an amend to handle a few missed |
Forward port of #47254 to
master. Draft for now as I haven't tested the changes yet, nor done a full pass to check potential type mismatches on calls toget_buffer()and similar.This changes the types of a big number of variables.
General rules:
uint64_tin general. We also consideredint64_tbut eventuallysettled on keeping it unsigned, which is also closer to what one would expect
with
size_t/off_t.int64_tforseek_end(takes a negative offset from the end)and for the
Variantbindings, sinceVariant::INTisint64_t. This meanswe only need to guard against passing negative values in
core_bind.cpp.uint32_tintegers for concepts not needing such a huge range, likepages, blocks, etc.
In addition:
DirAccess,core binds.
Note:
_ftelli64reports invalid values when using 32-bit MinGW withversion < 8.0. This was an upstream bug fixed in 8.0. It breaks support for
big files on 32-bit Windows builds made with that toolchain. We might add a
workaround.
Fixes #44363.
Fixes godotengine/godot-proposals#400.