diff --git a/librashader-capi/src/error.rs b/librashader-capi/src/error.rs index 519adcc..6fff6c2 100644 --- a/librashader-capi/src/error.rs +++ b/librashader-capi/src/error.rs @@ -107,7 +107,7 @@ pub extern "C" fn libra_error_free(error: *mut libra_error_t) -> i32 { /// Function pointer definition for libra_error_write pub type PFN_libra_error_write = - extern "C" fn(error: libra_error_t, out: *mut MaybeUninit<*mut c_char>) -> i32; +extern "C" fn(error: libra_error_t, out: *mut MaybeUninit<*mut c_char>) -> i32; #[no_mangle] /// Writes the error message into `out` /// @@ -194,12 +194,12 @@ impl LibrashaderError { macro_rules! assert_non_null { ($value:ident) => { - if $value.is_null() { + if $value.is_null() || !$value.is_aligned() { return $crate::error::LibrashaderError::InvalidParameter(stringify!($value)).export(); } }; (noexport $value:ident) => { - if $value.is_null() { + if $value.is_null() || !$value.is_aligned() { return Err($crate::error::LibrashaderError::InvalidParameter( stringify!($value), )); @@ -234,5 +234,6 @@ macro_rules! assert_some_ptr { use crate::ctypes::libra_error_t; pub(crate) use assert_non_null; + // pub(crate) use assert_some; pub(crate) use assert_some_ptr; diff --git a/librashader-capi/src/lib.rs b/librashader-capi/src/lib.rs index 6b60642..d3dd204 100644 --- a/librashader-capi/src/lib.rs +++ b/librashader-capi/src/lib.rs @@ -35,6 +35,7 @@ //! `libra_error_free`. #![allow(non_camel_case_types)] #![feature(try_blocks)] +#![feature(pointer_is_aligned)] #![feature(vec_into_raw_parts)] #![deny(unsafe_op_in_unsafe_fn)]