-
Notifications
You must be signed in to change notification settings - Fork 53
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
Improves handling of size_t
FFI values.
#471
Conversation
65e1a61
to
4a6e638
Compare
size_t
FFI values.size_t
FFI values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch, looks good so far!
316fc8e
to
c163fac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in general it looks good and a lot of code got cleaner. I'm not a fan if leaving the commented-out code though but besides that 👍 Thanks!
@wiktor-k |
38d0b7c
to
50f24ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the effort! I hate how similar, yet just different enough the implementations of Marshall and UnMarshall have to be...
let mut buffer = vec![0; Self::BUFFER_SIZE]; | ||
let mut offset = 0; | ||
|
||
fn marshall_offset(&self, marshalled_data: &mut [u8], offset: &mut usize) -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one doesn't fit the macro patterns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
tss-esapi/src/traits.rs
Outdated
let mut dest = 0_u32; | ||
/// Macro used to implement Marshall and Unmarshall for types that | ||
/// can be converted from native to TSS i.e. it cannot fail and are | ||
/// passed to MUAPI by value(i.e. pointer). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by value (i.e. pointer)
- is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
} | ||
|
||
// Make the macros usable outside of the module. | ||
pub(crate) use impl_marshall_trait; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually imported somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but I thought it could be useful if you for some reason only wanted to implement one of the traits or there was a case where the implementation did not fit the other macros.
And I had some problem getting it to build if I did not export them as well.
- The size_t type that is used in all the MU APIs will be dependent on the compiler that ```bindgen``` uses to generate the bindings for the library. This attempts to make the crate less dependant on that value in the public APIs. - Changes the Marshall and Unmarshall traits to use usize as input. - Removed the ```private_in_public``` it is 'warn by default' and because documentation ci is run with ```-Dwarnings``` it will cause the lint to be enforced. Signed-off-by: Jesper Brynolf <[email protected]>
50f24ac
to
041d204
Compare
bindgen
uses to generate the bindings for the library. This attempts to make the crate less dependant on that value in the public APIs.size_t
in marshalling and unmarshalling trait implementation. #469