Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mismatch between the Swift function type declarations and the C function type declarations #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bwdmr
Copy link
Contributor

@bwdmr bwdmr commented Dec 23, 2024

The write handler in the C API expects a const buffer (which maps to UnsafePointer in Swift) since it shouldn't modify the data it's writing, while the Swift type declaration uses a mutable pointer.

This matches the C API's expectation that the write handler won't modify the buffer it's writing. The read handler keeps the mutable pointer since it needs to fill the buffer with data. This type safety is actually helping prevent potential bugs where the write handler might accidentally modify the source buffer, which isn't intended in the FFmpeg API design.

…ion type declarations

The write handler in the C API expects a const buffer (which maps to UnsafePointer in Swift) since it shouldn't modify the data it's writing, while the Swift type declaration uses a mutable pointer.

This matches the C API's expectation that the write handler won't modify the buffer it's writing. The read handler keeps the mutable pointer since it needs to fill the buffer with data. This type safety is actually helping prevent potential bugs where the write handler might accidentally modify the source buffer, which isn't intended in the FFmpeg API design.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant