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

ndk: Replace HardwareBufferError with std::io::Error through new helper conversion function #295

Merged
merged 1 commit into from
Jul 5, 2022

Commits on Jul 5, 2022

  1. ndk: Replace HardwareBufferError with std::io::Error through new …

    …helper conversion function
    
    These `AHardwareBuffer` functions all return [standard `errno.h` error
    codes] which can be communicated back to the user in ergonomic form
    instead of appearing as a newtyped struct holding a "meaningless" `i32`.
    
    Perform the same conversion to just `NativeWindow::set_buffers_geometry`
    which also returns `errno.h` codes: this change is small enough to not
    warrant _yet another_ PR, as we've already changed the exact same for
    `InputQueueError` in [#292].
    (Note that this is intentionally omitted from the changelog since
     `set_buffers_geometry()` is only making its debut in the upcoming
     release, this change isn't breaking).
    
    This pattern is now prevalent across the codebase (`hardware_buffer`,
    `surface_texture`, and `native_window` all use it), warranting the new
    `status_to_io_result()` helper function to be introduced in an also-new
    `utils.rs` module.
    
    [standard `errno.h` error codes]: https://cs.android.com/android/platform/superproject/+/master:frameworks/native/libs/nativewindow/AHardwareBuffer.cpp;drc=4120991d92a0265ce480672f704612556328057e
    [#292]: #292
    MarijnS95 committed Jul 5, 2022
    Configuration menu
    Copy the full SHA
    d9e44b0 View commit details
    Browse the repository at this point in the history