-
Notifications
You must be signed in to change notification settings - Fork 26
Large file support #51
Comments
I'd put this on the backburner because you'd fix an issue that will probably never hit. Instead, I'd focus on defining and stabilizing the 2.0.0 API, and it would be perfectly fine for me to have all 2.y.z without 2-GB-module support. But I can really appreciate this desire to fix obscure corner cases. This would likely get merged if you made a thoroughly-tested PR. |
Indeed it is quite unlikely. But at least it should not crash. I have not checked whether it does, but right now the Maybe I will create a PR that -- as a first step -- extends the API, but still only supports 2GB files for the file-based-backend, i.e. will cleanly error. Otherwise we would need yet another ABI-bump (or write wrapper code for compatibility) to support the function-pointers with a different signature. |
Sounds good to me -- have this in the 2.0 API where breakage okay, and treat small modules as before. Then add full support later. |
Fixing the ftell so it handles errors is sort of important, but many things in the new interface will automatically fail if the position is greater than the size, and with a negative size, this is always the case. At least I think I made that happen. Not totally sure without actually looking at it again. |
@Rondom, could you propose the new API within 2-3 days? This seems to be the final change to the 2.0 API. I'd love to adapt my A5 pull request to any changes here, then get it merged. The A5 team plan a release in early-mid October, otherwise music support would wait another 3 months. |
I don't mind changing certain APIs and variables to the declared LONG_LONG macro type. I just need to change all of the relevant loaders and parsers to use that variable type to receive file offsets. Just note that we may only need to support rejecting files with offsets that large. It is still possible to use the current API to create a 32-bit or smaller window within a large file, and keep your own private base file offset for seeking operations, as well as a private size for the file size operation. Note that quite a number of the formats are limited to 32 bit addressing anyway. At least Impulse Tracker modules contain 32 bit file offsets to most of the structures. And the three RIFF based formats are limited to RIFF 32 bit, and have never been seen in RF64 format. |
I'm fine with either strategy:
The publicly visible typedef Do we even need a macro anymore? C99 defines If you still prefer the 64-bit API, here's my take:
|
I agree with everything you said. Defining LONG_LONG bothered me as well. I might have a look tonight or tomorrow. |
@kode54: any comments on my suggested API? That's a release candidate of the 2.0 API, please scrutinize: Did I miss functions that need 64-bit offsets? Did I put 64-bit arguments in functions that don't need them? If you're OK with it, and unless @Rondom has something within 12 hours, I'll implement the above API tomorrow, and make a PR in about 24 hours. I'll watch the issues and PRs in case anything happens in-between, and I'll also sit in IRC for chat or questions: irc.freenode.net #allegro, or irc.quakenet.org #lix. |
Enable large-file support, but change the API to accept file offsets larger than 2GB (unlikely for module files). Check the return-code of ftell to fail early when a file larger than 2GB is supplied.
Enable large-file support, but change the API to accept file offsets larger than 2GB (unlikely for module files). Check the return-code of ftell to fail early when a file larger than 2GB is supplied.
I posted a PR #59. Your suggested changes are fine except that getnc should not return and take off_t, but rather size_t. On a 32-bit system Please review carefully, because I agree with you, that it is easy to miss things or change too much. |
Thanks for the work, most of it looked very good already. PR #60 is a smaller change for the remainder. @kode54: What is a
PR #60 keeps it as |
I know that 2GB-MOD-files are very unlikely to occur, but I am wondering whether it makes sense to support files >2GB.
I propose the following
-D_FILE_OFFSET_BITS=64
during build andftello
returns a 64-bit-type on 32-bit Unix-platformsDUMBFILE_SYSTEM
to takeDUMB_OFF_T
which resolves to a 64-bit-type (can be checked at compile-time)What do others think?
The text was updated successfully, but these errors were encountered: