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:
+21
-23
@@ -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
|
||||
|
||||
+330
-347
File diff suppressed because it is too large
Load Diff
+1757
-1767
File diff suppressed because it is too large
Load Diff
+1879
-1917
File diff suppressed because it is too large
Load Diff
+44
-47
@@ -25,47 +25,45 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
extern {
|
||||
fn strcmp(__s1 : *const u8, __s2 : *const u8) -> i32;
|
||||
fn strcspn(__s : *const u8, __charset : *const u8) -> usize;
|
||||
fn strncmp(__s1 : *const u8, __s2 : *const u8, __n : usize) -> i32;
|
||||
fn strspn(__s : *const u8, __charset : *const u8) -> usize;
|
||||
extern "C" {
|
||||
fn strcmp(__s1: *const u8, __s2: *const u8) -> i32;
|
||||
fn strcspn(__s: *const u8, __charset: *const u8) -> usize;
|
||||
fn strncmp(__s1: *const u8, __s2: *const u8, __n: usize) -> i32;
|
||||
fn strspn(__s: *const u8, __charset: *const u8) -> usize;
|
||||
}
|
||||
|
||||
unsafe extern fn my_strverscmp(
|
||||
mut s1 : *const u8, mut s2 : *const u8
|
||||
) -> i32 {
|
||||
unsafe extern "C" fn my_strverscmp(mut s1: *const u8, mut s2: *const u8) -> i32 {
|
||||
let mut _currentBlock;
|
||||
static mut digits : *const u8 = (*b"0123456789\0").as_ptr();
|
||||
let mut p1 : usize;
|
||||
let mut p2 : usize;
|
||||
p1 = strcspn(s1,digits);
|
||||
p2 = strcspn(s2,digits);
|
||||
static mut digits: *const u8 = (*b"0123456789\0").as_ptr();
|
||||
let mut p1: usize;
|
||||
let mut p2: usize;
|
||||
p1 = strcspn(s1, digits);
|
||||
p2 = strcspn(s2, digits);
|
||||
'loop1: loop {
|
||||
if !(p1 == p2 && (*s1.offset(
|
||||
p1 as (isize)
|
||||
) as (i32) != b'\0' as (i32)) && (*s2.offset(
|
||||
p2 as (isize)
|
||||
) as (i32) != b'\0' as (i32))) {
|
||||
if !(p1 == p2
|
||||
&& (*s1.offset(p1 as (isize)) as (i32) != b'\0' as (i32))
|
||||
&& (*s2.offset(p2 as (isize)) as (i32) != b'\0' as (i32)))
|
||||
{
|
||||
_currentBlock = 2;
|
||||
break;
|
||||
}
|
||||
let mut ret : i32;
|
||||
let mut lz1 : i32;
|
||||
let mut lz2 : i32;
|
||||
let mut ret: i32;
|
||||
let mut lz1: i32;
|
||||
let mut lz2: i32;
|
||||
if {
|
||||
ret = strncmp(s1,s2,p1);
|
||||
ret
|
||||
} != 0i32 {
|
||||
ret = strncmp(s1, s2, p1);
|
||||
ret
|
||||
} != 0i32
|
||||
{
|
||||
_currentBlock = 37;
|
||||
break;
|
||||
}
|
||||
s1 = s1.offset(p1 as (isize));
|
||||
s2 = s2.offset(p2 as (isize));
|
||||
lz1 = {
|
||||
lz2 = 0i32;
|
||||
lz2
|
||||
};
|
||||
lz2 = 0i32;
|
||||
lz2
|
||||
};
|
||||
if *s1 as (i32) == b'0' as (i32) {
|
||||
lz1 = 1i32;
|
||||
}
|
||||
@@ -92,8 +90,8 @@ unsafe extern fn my_strverscmp(
|
||||
s2 = s2.offset(1isize);
|
||||
_currentBlock = 11;
|
||||
} else {
|
||||
p1 = strspn(s1,digits);
|
||||
p2 = strspn(s2,digits);
|
||||
p1 = strspn(s1, digits);
|
||||
p2 = strspn(s2, digits);
|
||||
if p1 == 0usize && (p2 > 0usize) {
|
||||
_currentBlock = 33;
|
||||
break 'loop1;
|
||||
@@ -102,7 +100,10 @@ unsafe extern fn my_strverscmp(
|
||||
_currentBlock = 32;
|
||||
break 'loop1;
|
||||
}
|
||||
if *s1 as (i32) != *s2 as (i32) && (*s1 as (i32) != b'0' as (i32)) && (*s2 as (i32) != b'0' as (i32)) {
|
||||
if *s1 as (i32) != *s2 as (i32)
|
||||
&& (*s1 as (i32) != b'0' as (i32))
|
||||
&& (*s2 as (i32) != b'0' as (i32))
|
||||
{
|
||||
if p1 < p2 {
|
||||
_currentBlock = 31;
|
||||
break 'loop1;
|
||||
@@ -115,9 +116,9 @@ unsafe extern fn my_strverscmp(
|
||||
}
|
||||
} else {
|
||||
if p1 < p2 {
|
||||
ret = strncmp(s1,s2,p1);
|
||||
ret = strncmp(s1, s2, p1);
|
||||
} else if p1 > p2 {
|
||||
ret = strncmp(s1,s2,p2);
|
||||
ret = strncmp(s1, s2, p2);
|
||||
}
|
||||
if ret != 0i32 {
|
||||
_currentBlock = 20;
|
||||
@@ -128,8 +129,8 @@ unsafe extern fn my_strverscmp(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
p1 = strspn(s1,digits);
|
||||
p2 = strspn(s2,digits);
|
||||
p1 = strspn(s1, digits);
|
||||
p2 = strspn(s2, digits);
|
||||
if p1 < p2 {
|
||||
_currentBlock = 29;
|
||||
break 'loop1;
|
||||
@@ -143,19 +144,20 @@ unsafe extern fn my_strverscmp(
|
||||
break;
|
||||
}
|
||||
if {
|
||||
ret = strncmp(s1,s2,p1);
|
||||
ret
|
||||
} != 0i32 {
|
||||
ret = strncmp(s1, s2, p1);
|
||||
ret
|
||||
} != 0i32
|
||||
{
|
||||
_currentBlock = 27;
|
||||
break;
|
||||
}
|
||||
s1 = s1.offset(p1 as (isize));
|
||||
s2 = s2.offset(p2 as (isize));
|
||||
p1 = strcspn(s1,digits);
|
||||
p2 = strcspn(s2,digits);
|
||||
p1 = strcspn(s1, digits);
|
||||
p2 = strcspn(s2, digits);
|
||||
}
|
||||
if _currentBlock == 2 {
|
||||
strcmp(s1,s2)
|
||||
strcmp(s1, s2)
|
||||
} else if _currentBlock == 20 {
|
||||
ret
|
||||
} else if _currentBlock == 27 {
|
||||
@@ -182,13 +184,8 @@ unsafe extern fn my_strverscmp(
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern fn ykpiv_check_version(
|
||||
mut req_version : *const u8
|
||||
) -> *const u8 {
|
||||
if req_version.is_null() || my_strverscmp(
|
||||
req_version,
|
||||
(*b"@VERSION@\0").as_ptr()
|
||||
) <= 0i32 {
|
||||
pub unsafe extern "C" fn ykpiv_check_version(mut req_version: *const u8) -> *const u8 {
|
||||
if req_version.is_null() || my_strverscmp(req_version, (*b"@VERSION@\0").as_ptr()) <= 0i32 {
|
||||
(*b"@VERSION@\0").as_ptr()
|
||||
} else {
|
||||
0i32 as (*mut ::std::os::raw::c_void) as (*const u8)
|
||||
|
||||
Reference in New Issue
Block a user