Skip to content

Commit

Permalink
more fiddling with anon unions
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Theil <[email protected]>
  • Loading branch information
thillux committed Oct 12, 2023
1 parent 3108366 commit fee105d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
16 changes: 14 additions & 2 deletions openssl-sys/src/handwritten/x509_sbgp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ pub union ASIdOrRange_st_anon_union {
#[cfg(ossl110)]
stack!(stack_st_ASIdOrRange);

#[repr(C)]
#[cfg(ossl110)]
pub union ASIdsOrRanges_st_anon_union {
pub asIdsOrRanges: *mut stack_st_ASIdOrRange,
}

#[repr(C)]
#[cfg(ossl110)]
pub struct ASIdentifierChoice {
pub type_: c_int,
pub asIdsOrRanges: *mut stack_st_ASIdOrRange,
pub u: ASIdsOrRanges_st_anon_union,
}

#[repr(C)]
Expand Down Expand Up @@ -66,11 +72,17 @@ stack!(stack_st_IPAddressOrRange);
#[cfg(ossl110)]
type IPAddressOrRanges = stack_st_IPAddressOrRange;

#[repr(C)]
#[cfg(ossl110)]
pub union IPAddressOrRanges_st_anon_union {
pub addressesOrRanges: *mut IPAddressOrRanges
}

#[repr(C)]
#[cfg(ossl110)]
pub struct IPAddressChoice {
pub type_: c_int,
pub addressesOrRanges: *mut IPAddressOrRanges,
pub u: IPAddressOrRanges_st_anon_union,
}

#[repr(C)]
Expand Down
10 changes: 1 addition & 9 deletions openssl/src/x509/sbgp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ impl ASIdentifiers {
if (*asnum).type_ != ASIdentifierChoice_asIdsOrRanges {
return None;
}
#[cfg(ossl310)]
let as_range = StackRef::<ASIdOrRange>::from_const_ptr_opt((*asnum).u.asIdsOrRanges);
#[cfg(any(not(ossl310),ossl320))]
let as_range = StackRef::<ASIdOrRange>::from_const_ptr_opt((*asnum).asIdsOrRanges);
if let Some(s) = as_range {
if let Some(s) = StackRef::<ASIdOrRange>::from_const_ptr_opt((*asnum).u.asIdsOrRanges) {
for a_ptr in s {
let a = a_ptr.as_ptr();
if (*a).type_ == ASIdOrRange_id {
Expand Down Expand Up @@ -159,12 +155,8 @@ impl IPAddressFamily {
if (*choice).type_ != IPAddressChoice_addressesOrRanges {
return None;
}
#[cfg(ossl310)]
let stack =
StackRef::<IPAddressOrRange>::from_const_ptr_opt((*choice).u.addressesOrRanges)?;
#[cfg(any(not(ossl310),ossl320))]
let stack =
StackRef::<IPAddressOrRange>::from_const_ptr_opt((*choice).addressesOrRanges)?;
for e in stack {
let mut min = MaybeUninit::<[u8; 16]>::uninit();
let mut max = MaybeUninit::<[u8; 16]>::uninit();
Expand Down

0 comments on commit fee105d

Please sign in to comment.