From 7e5c51077a294379398a42fcfdb2809ec55d9f88 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 23 Jan 2024 20:02:35 +0000 Subject: [PATCH] Add support for resolving 33-byte arrays, though its unused --- c-bindings-gen/src/types.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index bd04ba2..47ff515 100644 --- 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) + "[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"), @@ -1145,6 +1146,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "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(""), @@ -1259,6 +1261,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "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"), @@ -1373,6 +1376,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "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: "), @@ -1477,6 +1481,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "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(" }"), -- 2.30.2