Always cast pread, lseek etc. offsets to off_t.#1442
Merged
Conversation
When calling libc functions that take `off_t` arguments, always cast to `off_t`. On platforms where this cast is a no-op, these casts should be optimized away. This eliminates the need for explicit `cfg`s for platforms which need the casts. Fixes #1432.
kulp
reviewed
Apr 9, 2025
|
|
||
| // ESP-IDF and Vita don't support 64-bit offsets, for example. | ||
| let offset = offset.try_into().map_err(|_| io::Errno::OVERFLOW)?; | ||
|
|
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
Due to unrelated changes between v0.38.44 and v1.0.5, I cannot right now directly test the branch in the current MR, but I did successfully compile my project after cherry-picking 5dbcf91 plus an extra cast for Thanks! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When calling libc functions that take
off_targuments, always cast tooff_t. On platforms where this cast is a no-op, these casts should be optimized away. This eliminates the need for explicitcfgs for platforms which need the casts.Fixes #1432.