Eliminate remaining warnings
This commit is contained in:
parent
dfbd994d19
commit
cac0235f2c
1 changed files with 33 additions and 66 deletions
|
@ -153,7 +153,7 @@ unsafe extern "C" fn residue_pow(x: uint64_t, mut y: uint64_t) -> uint64_t {
|
|||
}
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn inverse(mut u: uint64_t, mut v: uint64_t) -> uint64_t {
|
||||
let mut tmp: int64_t = 0;
|
||||
let mut tmp;
|
||||
let mut xu: int64_t = 1_i32 as int64_t;
|
||||
let mut xv: int64_t = 0_i32 as int64_t;
|
||||
let v0: uint64_t = v;
|
||||
|
@ -181,26 +181,20 @@ unsafe extern "C" fn residue_sqrt(what: uint64_t) -> uint64_t {
|
|||
return 0_i32 as uint64_t;
|
||||
}
|
||||
let g: uint64_t = 43_i32 as uint64_t;
|
||||
let mut z: uint64_t = 0;
|
||||
let mut y: uint64_t = 0;
|
||||
let mut r: uint64_t = 0;
|
||||
let mut x: uint64_t = 0;
|
||||
let mut b: uint64_t = 0;
|
||||
let mut t: uint64_t = 0;
|
||||
let mut e: uint64_t = 0_i32 as uint64_t;
|
||||
let mut q: uint64_t = 0x16a6b036d7f2a79_u64.wrapping_sub(1_i32 as u64) as uint64_t;
|
||||
while q & 1_i32 as u64 == 0 {
|
||||
e = e.wrapping_add(1);
|
||||
q >>= 1_i32;
|
||||
}
|
||||
z = residue_pow(g, q);
|
||||
y = z;
|
||||
r = e;
|
||||
x = residue_pow(
|
||||
let z = residue_pow(g, q);
|
||||
let mut y = z;
|
||||
let mut r = e;
|
||||
let mut x = residue_pow(
|
||||
what,
|
||||
q.wrapping_sub(1_i32 as u64).wrapping_div(2_i32 as u64),
|
||||
);
|
||||
b = residue_mul(residue_mul(what, x), x);
|
||||
let mut b = residue_mul(residue_mul(what, x), x);
|
||||
x = residue_mul(what, x);
|
||||
while b != 1_i32 as u64 {
|
||||
let mut m: uint64_t = 0_i32 as uint64_t;
|
||||
|
@ -215,7 +209,7 @@ unsafe extern "C" fn residue_sqrt(what: uint64_t) -> uint64_t {
|
|||
if m == r {
|
||||
return 0xffffffffffffffff_u64 as uint64_t;
|
||||
}
|
||||
t = residue_pow(
|
||||
let t = residue_pow(
|
||||
y,
|
||||
(1_i32 << r.wrapping_sub(m).wrapping_sub(1_i32 as u64)) as uint64_t,
|
||||
);
|
||||
|
@ -231,7 +225,7 @@ unsafe extern "C" fn residue_sqrt(what: uint64_t) -> uint64_t {
|
|||
}
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn find_divisor_v(mut d: *mut TDivisor) -> i32 {
|
||||
let mut v1: uint64_t = 0;
|
||||
let mut v1;
|
||||
let mut f2: [uint64_t; 6] = [0; 6];
|
||||
let mut i: i32 = 0_i32;
|
||||
while i < 6_i32 {
|
||||
|
@ -316,9 +310,7 @@ unsafe extern "C" fn polynomial_mul(
|
|||
if adeg < 0_i32 || bdeg < 0_i32 {
|
||||
return resultprevdeg;
|
||||
}
|
||||
let mut i: i32 = 0;
|
||||
let mut j: i32 = 0;
|
||||
i = resultprevdeg + 1_i32;
|
||||
let mut i = resultprevdeg + 1_i32;
|
||||
while i <= adeg + bdeg {
|
||||
*result.offset(i as isize) = 0_i32 as uint64_t;
|
||||
i += 1;
|
||||
|
@ -326,7 +318,7 @@ unsafe extern "C" fn polynomial_mul(
|
|||
resultprevdeg = i - 1_i32;
|
||||
i = 0_i32;
|
||||
while i <= adeg {
|
||||
j = 0_i32;
|
||||
let mut j = 0_i32;
|
||||
while j <= bdeg {
|
||||
*result.offset((i + j) as isize) = residue_add(
|
||||
*result.offset((i + j) as isize),
|
||||
|
@ -349,15 +341,13 @@ unsafe extern "C" fn polynomial_div_monic(
|
|||
b: *const uint64_t,
|
||||
quotient: *mut uint64_t,
|
||||
) -> i32 {
|
||||
let mut i: i32 = 0;
|
||||
let mut j: i32 = 0;
|
||||
i = adeg - bdeg;
|
||||
let mut i = adeg - bdeg;
|
||||
while i >= 0_i32 {
|
||||
let q: uint64_t = *a.offset((i + bdeg) as isize);
|
||||
if !quotient.is_null() {
|
||||
*quotient.offset(i as isize) = q;
|
||||
}
|
||||
j = 0_i32;
|
||||
let mut j = 0_i32;
|
||||
while j < bdeg {
|
||||
*a.offset((i + j) as isize) = residue_sub(
|
||||
*a.offset((i + j) as isize),
|
||||
|
@ -411,19 +401,12 @@ unsafe extern "C" fn polynomial_xgcd(
|
|||
*gcd.offset(2_i32 as isize) = *a.offset(2_i32 as isize);
|
||||
while rdeg >= 0_i32 {
|
||||
if rdeg > gcddeg {
|
||||
let mut tmp: u32 = 0;
|
||||
let mut tmpi: i32 = 0;
|
||||
tmp = rdeg as u32;
|
||||
let tmp = rdeg as u32;
|
||||
rdeg = gcddeg;
|
||||
gcddeg = tmp as i32;
|
||||
tmpi = sdeg;
|
||||
sdeg = mult1deg;
|
||||
mult1deg = tmpi;
|
||||
tmpi = tdeg;
|
||||
tdeg = mult2deg;
|
||||
mult2deg = tmpi;
|
||||
let mut tmp2: uint64_t = 0;
|
||||
tmp2 = r[0_i32 as usize];
|
||||
std::mem::swap(&mut sdeg, &mut mult1deg);
|
||||
std::mem::swap(&mut tdeg, &mut mult2deg);
|
||||
let mut tmp2 = r[0_i32 as usize];
|
||||
r[0_i32 as usize] = *gcd.offset(0_i32 as isize);
|
||||
*gcd.offset(0_i32 as isize) = tmp2;
|
||||
tmp2 = r[1_i32 as usize];
|
||||
|
@ -588,8 +571,7 @@ unsafe extern "C" fn divisor_add(
|
|||
c2.as_mut_ptr(),
|
||||
);
|
||||
let dmult: uint64_t = residue_inv(d[ddeg as usize]);
|
||||
let mut i: i32 = 0;
|
||||
i = 0_i32;
|
||||
let mut i = 0_i32;
|
||||
while i < ddeg {
|
||||
d[i as usize] = residue_mul(d[i as usize], dmult);
|
||||
i += 1;
|
||||
|
@ -616,11 +598,9 @@ unsafe extern "C" fn divisor_add(
|
|||
);
|
||||
let mut v: [uint64_t; 7] = [0; 7];
|
||||
let mut tmp: [uint64_t; 7] = [0; 7];
|
||||
let mut vdeg: i32 = 0;
|
||||
let mut tmpdeg: i32 = 0;
|
||||
v[0_i32 as usize] = residue_sub(v2[0_i32 as usize], v1[0_i32 as usize]);
|
||||
v[1_i32 as usize] = residue_sub(v2[1_i32 as usize], v1[1_i32 as usize]);
|
||||
tmpdeg = polynomial_mul(
|
||||
let mut tmpdeg = polynomial_mul(
|
||||
e1deg,
|
||||
e1.as_mut_ptr() as *const uint64_t,
|
||||
1_i32,
|
||||
|
@ -628,7 +608,7 @@ unsafe extern "C" fn divisor_add(
|
|||
-1_i32,
|
||||
tmp.as_mut_ptr(),
|
||||
);
|
||||
vdeg = polynomial_mul(
|
||||
let mut vdeg = polynomial_mul(
|
||||
u1deg,
|
||||
u1.as_mut_ptr() as *const uint64_t,
|
||||
tmpdeg,
|
||||
|
@ -864,19 +844,13 @@ unsafe extern "C" fn rol(x: u32, shift: i32) -> u32 {
|
|||
}
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn sha1_single_block(input: *mut libc::c_uchar, output: *mut libc::c_uchar) {
|
||||
let mut a: u32 = 0;
|
||||
let mut b: u32 = 0;
|
||||
let mut c: u32 = 0;
|
||||
let mut d: u32 = 0;
|
||||
let mut e: u32 = 0;
|
||||
a = 0x67452301_i32 as u32;
|
||||
b = 0xefcdab89_u32;
|
||||
c = 0x98badcfe_u32;
|
||||
d = 0x10325476_i32 as u32;
|
||||
e = 0xc3d2e1f0_u32;
|
||||
let mut a = 0x67452301_i32 as u32;
|
||||
let mut b = 0xefcdab89_u32;
|
||||
let mut c = 0x98badcfe_u32;
|
||||
let mut d = 0x10325476_i32 as u32;
|
||||
let mut e = 0xc3d2e1f0_u32;
|
||||
let mut w: [u32; 80] = [0; 80];
|
||||
let mut i: size_t = 0;
|
||||
i = 0_i32 as size_t;
|
||||
let mut i = 0_i32 as size_t;
|
||||
while i < 16_i32 as u64 {
|
||||
w[i as usize] = ((*input.offset((4_i32 as u64).wrapping_mul(i) as isize) as i32) << 24_i32
|
||||
| (*input.offset((4_i32 as u64).wrapping_mul(i).wrapping_add(1_i32 as u64) as isize)
|
||||
|
@ -992,8 +966,7 @@ unsafe extern "C" fn Mix(
|
|||
let mut sha1_input: [libc::c_uchar; 64] = [0; 64];
|
||||
let mut sha1_result: [libc::c_uchar; 20] = [0; 20];
|
||||
let half: size_t = bufSize.wrapping_div(2_i32 as u64);
|
||||
let mut external_counter: i32 = 0;
|
||||
external_counter = 0_i32;
|
||||
let mut external_counter = 0_i32;
|
||||
while external_counter < 4_i32 {
|
||||
memset(
|
||||
sha1_input.as_mut_ptr() as *mut libc::c_void,
|
||||
|
@ -1019,8 +992,7 @@ unsafe extern "C" fn Mix(
|
|||
.wrapping_mul(8_i32 as u64)
|
||||
.wrapping_div(0x100_i32 as u64) as libc::c_uchar;
|
||||
sha1_single_block(sha1_input.as_mut_ptr(), sha1_result.as_mut_ptr());
|
||||
let mut i: size_t = 0;
|
||||
i = half & !3_i32 as u64;
|
||||
let mut i = half & !3_i32 as u64;
|
||||
while i < half {
|
||||
sha1_result[i as usize] = sha1_result[i
|
||||
.wrapping_add(4_i32 as u64)
|
||||
|
@ -1050,8 +1022,7 @@ unsafe extern "C" fn Unmix(
|
|||
let mut sha1_input: [libc::c_uchar; 64] = [0; 64];
|
||||
let mut sha1_result: [libc::c_uchar; 20] = [0; 20];
|
||||
let half: size_t = bufSize.wrapping_div(2_i32 as u64);
|
||||
let mut external_counter: i32 = 0;
|
||||
external_counter = 0_i32;
|
||||
let mut external_counter = 0_i32;
|
||||
while external_counter < 4_i32 {
|
||||
memset(
|
||||
sha1_input.as_mut_ptr() as *mut libc::c_void,
|
||||
|
@ -1077,8 +1048,7 @@ unsafe extern "C" fn Unmix(
|
|||
.wrapping_mul(8_i32 as u64)
|
||||
.wrapping_div(0x100_i32 as u64) as libc::c_uchar;
|
||||
sha1_single_block(sha1_input.as_mut_ptr(), sha1_result.as_mut_ptr());
|
||||
let mut i: size_t = 0;
|
||||
i = half & !3_i32 as u64;
|
||||
let mut i = half & !3_i32 as u64;
|
||||
while i < half {
|
||||
sha1_result[i as usize] = sha1_result[i
|
||||
.wrapping_add(4_i32 as u64)
|
||||
|
@ -1109,7 +1079,6 @@ unsafe extern "C" fn Generate(
|
|||
let mut count: size_t = 0_i32 as size_t;
|
||||
let mut totalCount: size_t = 0_i32 as size_t;
|
||||
let mut check: u32 = 0_i32 as u32;
|
||||
let mut i: size_t = 0;
|
||||
while *p != 0 {
|
||||
if !(*p as i32 == ' ' as i32 || *p as i32 == '-' as i32) {
|
||||
let d: i32 = *p as i32 - '0' as i32;
|
||||
|
@ -1143,7 +1112,7 @@ unsafe extern "C" fn Generate(
|
|||
return 2_i32;
|
||||
}
|
||||
let mut carry: libc::c_uchar = d as libc::c_uchar;
|
||||
i = 0_i32 as size_t;
|
||||
let mut i = 0_i32 as size_t;
|
||||
while i < installation_id_len {
|
||||
let x: u32 =
|
||||
(installation_id[i as usize] as i32 * 10_i32 + carry as i32) as u32;
|
||||
|
@ -1234,8 +1203,7 @@ unsafe extern "C" fn Generate(
|
|||
u: [0; 2],
|
||||
v: [0; 2],
|
||||
};
|
||||
let mut attempt: libc::c_uchar = 0;
|
||||
attempt = 0_i32 as libc::c_uchar;
|
||||
let mut attempt = 0_i32 as libc::c_uchar;
|
||||
while attempt as i32 <= 0x80_i32 {
|
||||
let mut u: C2RustUnnamed_3 = C2RustUnnamed_3 { buffer: [0; 14] };
|
||||
u.c2rust_unnamed.lo = 0_i32 as uint64_t;
|
||||
|
@ -1355,7 +1323,7 @@ unsafe extern "C" fn Generate(
|
|||
}
|
||||
}
|
||||
let mut decimal: [libc::c_uchar; 35] = [0; 35];
|
||||
i = 0_i32 as size_t;
|
||||
let mut i = 0_i32 as size_t;
|
||||
while i < 35_i32 as u64 {
|
||||
let c: u32 = (e.c2rust_unnamed_0.encoded[3_i32 as usize]).wrapping_rem(10_i32 as u32);
|
||||
e.c2rust_unnamed_0.encoded[3_i32 as usize] = e.c2rust_unnamed_0.encoded[3_i32 as usize]
|
||||
|
@ -1413,8 +1381,7 @@ unsafe extern "C" fn Generate(
|
|||
q = q.offset(6_i32 as isize);
|
||||
i = i.wrapping_add(1);
|
||||
}
|
||||
let fresh3 = q;
|
||||
q = q.offset(1);
|
||||
let fresh3 = q.offset(1);
|
||||
*fresh3 = 0_i32 as libc::c_char;
|
||||
0_i32
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue