oxidize: Add pub mod directives and run rustfmt

Makes all translated files part of the crate, and then runs rustfmt
on all of them, hopefully making them marginally more bearable.
This commit is contained in:
Tony Arcieri
2019-08-10 14:53:25 -07:00
parent 5e0e0fe0c2
commit 4cd59cb992
5 changed files with 4031 additions and 4101 deletions
+21 -23
View File
@@ -50,29 +50,28 @@ pub enum Enum2 {
#[derive(Copy)]
#[repr(C)]
pub struct Struct1 {
pub rc : Enum2,
pub name : *const u8,
pub description : *const u8,
pub rc: Enum2,
pub name: *const u8,
pub description: *const u8,
}
impl Clone for Struct1 {
fn clone(&self) -> Self { *self }
fn clone(&self) -> Self {
*self
}
}
static mut errors
: *const Struct1
= Enum2::YKPIV_OK as (*const Struct1);
static mut errors: *const Struct1 = Enum2::YKPIV_OK as (*const Struct1);
#[no_mangle]
pub unsafe extern fn ykpiv_strerror(mut err : Enum2) -> *const u8 {
static mut unknown
: *const u8
= (*b"Unknown ykpiv error\0").as_ptr();
let mut p : *const u8;
if -(err as (i32)) < 0i32 || -(err as (i32)) >= ::std::mem::size_of::<*const Struct1>(
).wrapping_div(
::std::mem::size_of::<Struct1>()
) as (i32) {
pub unsafe extern "C" fn ykpiv_strerror(mut err: Enum2) -> *const u8 {
static mut unknown: *const u8 = (*b"Unknown ykpiv error\0").as_ptr();
let mut p: *const u8;
if -(err as (i32)) < 0i32
|| -(err as (i32))
>= ::std::mem::size_of::<*const Struct1>()
.wrapping_div(::std::mem::size_of::<Struct1>()) as (i32)
{
unknown
} else {
p = (*errors.offset(-(err as (i32)) as (isize))).description;
@@ -84,13 +83,12 @@ pub unsafe extern fn ykpiv_strerror(mut err : Enum2) -> *const u8 {
}
#[no_mangle]
pub unsafe extern fn ykpiv_strerror_name(
mut err : Enum2
) -> *const u8 {
if -(err as (i32)) < 0i32 || -(err as (i32)) >= ::std::mem::size_of::<*const Struct1>(
).wrapping_div(
::std::mem::size_of::<Struct1>()
) as (i32) {
pub unsafe extern "C" fn ykpiv_strerror_name(mut err: Enum2) -> *const u8 {
if -(err as (i32)) < 0i32
|| -(err as (i32))
>= ::std::mem::size_of::<*const Struct1>()
.wrapping_div(::std::mem::size_of::<Struct1>()) as (i32)
{
0i32 as (*mut ::std::os::raw::c_void) as (*const u8)
} else {
(*errors.offset(-(err as (i32)) as (isize))).name