projects
/
ldk-c-bindings
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
072a9e1
)
Add support for resolving 33-byte arrays, though its unused
author
Matt Corallo
<git@bluematt.me>
Tue, 23 Jan 2024 20:02:35 +0000
(20:02 +0000)
committer
Matt Corallo
<git@bluematt.me>
Tue, 23 Jan 2024 23:19:39 +0000
(23:19 +0000)
c-bindings-gen/src/types.rs
patch
|
blob
|
history
diff --git
a/c-bindings-gen/src/types.rs
b/c-bindings-gen/src/types.rs
index bd04ba2b8c590889b2b5c4f74b5ffa32f2637cb6..47ff515ffa85651ec424fc95fe3aa477aa3e55ad 100644
(file)
--- a/
c-bindings-gen/src/types.rs
+++ b/
c-bindings-gen/src/types.rs
@@
-1037,6
+1037,7
@@
impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
// Note that no !is_ref types can map to an array because Rust and C's call semantics
// for arrays are different (https://github.com/eqrion/cbindgen/issues/528)
// Note that no !is_ref types can map to an array because Rust and C's call semantics
// for arrays are different (https://github.com/eqrion/cbindgen/issues/528)
+ "[u8; 33]" if !is_ref => Some("crate::c_types::ThirtyThreeBytes"),
"[u8; 32]" if !is_ref => Some("crate::c_types::ThirtyTwoBytes"),
"[u8; 20]" if !is_ref => Some("crate::c_types::TwentyBytes"),
"[u8; 16]" if !is_ref => Some("crate::c_types::SixteenBytes"),
"[u8; 32]" if !is_ref => Some("crate::c_types::ThirtyTwoBytes"),
"[u8; 20]" if !is_ref => Some("crate::c_types::TwentyBytes"),
"[u8; 16]" if !is_ref => Some("crate::c_types::SixteenBytes"),
@@
-1145,6
+1146,7
@@
impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
"Option" if is_ref => Some("&local_"),
"Option" => Some("local_"),
"Option" if is_ref => Some("&local_"),
"Option" => Some("local_"),
+ "[u8; 33]" if !is_ref => Some(""),
"[u8; 32]" if is_ref => Some("unsafe { &*"),
"[u8; 32]" if !is_ref => Some(""),
"[u8; 20]" if !is_ref => Some(""),
"[u8; 32]" if is_ref => Some("unsafe { &*"),
"[u8; 32]" if !is_ref => Some(""),
"[u8; 20]" if !is_ref => Some(""),
@@
-1259,6
+1261,7
@@
impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
"Option" => Some(""),
"Result" if !is_ref => Some(""),
"Option" => Some(""),
"Result" if !is_ref => Some(""),
+ "[u8; 33]" if !is_ref => Some(".data"),
"[u8; 32]" if is_ref => Some("}"),
"[u8; 32]" if !is_ref => Some(".data"),
"[u8; 20]" if !is_ref => Some(".data"),
"[u8; 32]" if is_ref => Some("}"),
"[u8; 32]" if !is_ref => Some(".data"),
"[u8; 20]" if !is_ref => Some(".data"),
@@
-1373,6
+1376,7
@@
impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
"Vec" if !is_ref => Some("local_"),
"Option" => Some("local_"),
"Vec" if !is_ref => Some("local_"),
"Option" => Some("local_"),
+ "[u8; 33]" if is_ref => Some(""),
"[u8; 32]" if !is_ref => Some("crate::c_types::ThirtyTwoBytes { data: "),
"[u8; 32]" if is_ref => Some(""),
"[u8; 20]" if !is_ref => Some("crate::c_types::TwentyBytes { data: "),
"[u8; 32]" if !is_ref => Some("crate::c_types::ThirtyTwoBytes { data: "),
"[u8; 32]" if is_ref => Some(""),
"[u8; 20]" if !is_ref => Some("crate::c_types::TwentyBytes { data: "),
@@
-1477,6
+1481,7
@@
impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
"Vec" if !is_ref => Some(".into()"),
"Option" => Some(""),
"Vec" if !is_ref => Some(".into()"),
"Option" => Some(""),
+ "[u8; 33]" if is_ref => Some(""),
"[u8; 32]" if !is_ref => Some(" }"),
"[u8; 32]" if is_ref => Some(""),
"[u8; 20]" if !is_ref => Some(" }"),
"[u8; 32]" if !is_ref => Some(" }"),
"[u8; 32]" if is_ref => Some(""),
"[u8; 20]" if !is_ref => Some(" }"),