Skip to content

Commit

Permalink
Merge pull request #50 from yuriks/master
Browse files Browse the repository at this point in the history
Fix type errors introducent by recent Rust changes.
  • Loading branch information
DaGenix committed Apr 20, 2014
2 parents 1fbfafc + 2e288d6 commit fc74f53
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/rust-crypto/cryptoutil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ pub fn write_u64_be(dst: &mut[u8], input: u64) {
use std::mem::to_be64;
assert!(dst.len() == 8);
unsafe {
let x: *mut i64 = transmute(dst.unsafe_mut_ref(0));
*x = to_be64(input as i64);
let x: *mut u64 = transmute(dst.unsafe_mut_ref(0));
*x = to_be64(input);
}
}

Expand All @@ -35,8 +35,8 @@ pub fn write_u32_be(dst: &mut[u8], input: u32) {
use std::mem::to_be32;
assert!(dst.len() == 4);
unsafe {
let x: *mut i32 = transmute(dst.unsafe_mut_ref(0));
*x = to_be32(input as i32);
let x: *mut u32 = transmute(dst.unsafe_mut_ref(0));
*x = to_be32(input);
}
}

Expand All @@ -47,8 +47,8 @@ pub fn write_u32_le(dst: &mut[u8], input: u32) {
use std::mem::to_le32;
assert!(dst.len() == 4);
unsafe {
let x: *mut i32 = transmute(dst.unsafe_mut_ref(0));
*x = to_le32(input as i32);
let x: *mut u32 = transmute(dst.unsafe_mut_ref(0));
*x = to_le32(input);
}
}

Expand All @@ -58,8 +58,8 @@ pub fn read_u64v_be(dst: &mut[u64], input: &[u8]) {
use std::mem::to_be64;
assert!(dst.len() * 8 == input.len());
unsafe {
let mut x: *mut i64 = transmute(dst.unsafe_mut_ref(0));
let mut y: *i64 = transmute(input.unsafe_ref(0));
let mut x: *mut u64 = transmute(dst.unsafe_mut_ref(0));
let mut y: *u64 = transmute(input.unsafe_ref(0));
for _ in range(0, dst.len()) {
*x = to_be64(*y);
x = x.offset(1);
Expand All @@ -74,8 +74,8 @@ pub fn read_u32v_be(dst: &mut[u32], input: &[u8]) {
use std::mem::to_be32;
assert!(dst.len() * 4 == input.len());
unsafe {
let mut x: *mut i32 = transmute(dst.unsafe_mut_ref(0));
let mut y: *i32 = transmute(input.unsafe_ref(0));
let mut x: *mut u32 = transmute(dst.unsafe_mut_ref(0));
let mut y: *u32 = transmute(input.unsafe_ref(0));
for _ in range(0, dst.len()) {
*x = to_be32(*y);
x = x.offset(1);
Expand All @@ -90,8 +90,8 @@ pub fn read_u32v_le(dst: &mut[u32], input: &[u8]) {
use std::mem::to_le32;
assert!(dst.len() * 4 == input.len());
unsafe {
let mut x: *mut i32 = transmute(dst.unsafe_mut_ref(0));
let mut y: *i32 = transmute(input.unsafe_ref(0));
let mut x: *mut u32 = transmute(dst.unsafe_mut_ref(0));
let mut y: *u32 = transmute(input.unsafe_ref(0));
for _ in range(0, dst.len()) {
*x = to_le32(*y);
x = x.offset(1);
Expand All @@ -106,8 +106,8 @@ pub fn read_u32_le(input: &[u8]) -> u32 {
use std::mem::to_le32;
assert!(input.len() == 4);
unsafe {
let tmp: *i32 = transmute(input.unsafe_ref(0));
return to_le32(*tmp) as u32;
let tmp: *u32 = transmute(input.unsafe_ref(0));
return to_le32(*tmp);
}
}

Expand All @@ -117,8 +117,8 @@ pub fn read_u32_be(input: &[u8]) -> u32 {
use std::mem::to_be32;
assert!(input.len() == 4);
unsafe {
let tmp: *i32 = transmute(input.unsafe_ref(0));
return to_be32(*tmp) as u32;
let tmp: *u32 = transmute(input.unsafe_ref(0));
return to_be32(*tmp);
}
}

Expand Down

0 comments on commit fc74f53

Please sign in to comment.