Repository navigation
Conversation
Preserve original length and capacity for tracked byte returns, keep the even-buffer fallback for odd addresses, and test ownership, cancellation, and failure paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Changes in this pull request
Update
to_c_bytesto hand off the original RustVec<u8>allocation to C when its address is even, eliminating the intermediate allocation and copy.No public API or C ABI changes. Callers continue to treat returned bytes as read-only and release them through the existing library cleanup mechanism.
Validation
The following commands passed against the cimpl manifest:
cargo test --manifest-path /Users/gsharma/source/c2pa/cimpl/Cargo.toml— 61 tests passed; 27 documentation examples ignored.cargo clippy --manifest-path /Users/gsharma/source/c2pa/cimpl/Cargo.toml --all-targets -- -D warnings— passed.cargo fmt --manifest-path /Users/gsharma/source/c2pa/cimpl/Cargo.toml --check— passed.cargo +nightly miri test --manifest-path /Users/gsharma/source/c2pa/cimpl/Cargo.toml --lib to_c_bytes— 8 tests passed.Regression coverage includes allocation identity, retained spare capacity, odd-address fallback, empty inputs, tracking refusal, cancellation, cross-thread release, double-free rejection, and untracked pointers.
Miri exercised genuine odd-addressed allocations. It emits exposed-provenance warnings for pointer reconstruction, so these results are not a strict-provenance proof.
No crate version bump or publication is included.
Checklist
TO DOitems (or similar) have been entered as GitHub issues and the link to that issue has been included in a comment.