diff --git a/ports/cef/browser.rs b/ports/cef/browser.rs index cf1403d55d4..7121c89e637 100644 --- a/ports/cef/browser.rs +++ b/ports/cef/browser.rs @@ -18,9 +18,9 @@ use libc::c_int; use util::opts; use std::borrow::ToOwned; use std::cell::{Cell, RefCell, BorrowState}; -use std::sync::atomic::{AtomicInt, Ordering}; +use std::sync::atomic::{AtomicIsize, Ordering}; -thread_local!(pub static ID_COUNTER: AtomicInt = AtomicInt::new(0)); +thread_local!(pub static ID_COUNTER: AtomicIsize = AtomicIsize::new(0)); thread_local!(pub static BROWSERS: RefCell> = RefCell::new(vec!())); pub enum ServoBrowser { diff --git a/ports/cef/command_line.rs b/ports/cef/command_line.rs index 39b08869a9f..d4d4006d713 100644 --- a/ports/cef/command_line.rs +++ b/ports/cef/command_line.rs @@ -34,9 +34,8 @@ pub fn command_line_init(argc: c_int, argv: *const *const u8) { unsafe { let mut a: Vec = vec!(); for i in 0u..(argc as uint) { - let offset = *argv.offset(i as int) as *const c_char; - let slice = ffi::c_str_to_bytes(&offset); - let s = str::from_utf8(slice).unwrap(); + let slice = ffi::CStr::from_ptr(*argv.offset(i as int) as *const c_char); + let s = str::from_utf8(slice.to_bytes()).unwrap(); a.push(String::from_str(s)); } let cl = command_line_new(); diff --git a/ports/cef/core.rs b/ports/cef/core.rs index 111d2c72487..25563526a8c 100644 --- a/ports/cef/core.rs +++ b/ports/cef/core.rs @@ -128,8 +128,8 @@ pub extern "C" fn cef_log(_file: *const c_char, _severity: c_int, message: *const c_char) { unsafe { - let slice = ffi::c_str_to_bytes(&message); - println!("{}", str::from_utf8(slice).unwrap()) + let slice = ffi::CStr::from_ptr(message); + println!("{}", str::from_utf8(slice.to_bytes()).unwrap()) } } diff --git a/ports/cef/string.rs b/ports/cef/string.rs index 4ad1d00a92a..f758b907c25 100644 --- a/ports/cef/string.rs +++ b/ports/cef/string.rs @@ -94,7 +94,7 @@ pub extern "C" fn cef_string_utf8_set(src: *const u8, src_len: size_t, output: * return 0; } - ptr::copy_memory((*output).str, src, src_len as uint); + ptr::copy((*output).str, src, src_len as uint); (*output).length = src_len; (*output).dtor = Some(string_utf8_dtor as extern "C" fn(*mut u8)); } @@ -175,7 +175,7 @@ pub extern "C" fn cef_string_utf16_set(src: *const c_ushort, src_len: size_t, ou return 0; } - ptr::copy_memory((*output).str, src, src_len as uint); + ptr::copy((*output).str, src, src_len as uint); (*output).length = src_len; (*output).dtor = Some(string_utf16_dtor as extern "C" fn(*mut c_ushort)); } @@ -233,7 +233,7 @@ pub extern "C" fn cef_string_wide_set(src: *const wchar_t, src_len: size_t, outp return 0; } - ptr::copy_memory((*output).str, src, src_len as uint); + ptr::copy((*output).str, src, src_len as uint); (*output).length = src_len; (*output).dtor = Some(string_wide_dtor as extern "C" fn(*mut wchar_t)); } diff --git a/ports/cef/wrappers.rs b/ports/cef/wrappers.rs index a93531c198f..3bfd1c27464 100644 --- a/ports/cef/wrappers.rs +++ b/ports/cef/wrappers.rs @@ -182,7 +182,7 @@ impl<'a> CefWrap<*const cef_string_t> for &'a [u16] { fn to_c(buffer: &'a [u16]) -> *const cef_string_t { unsafe { let ptr: *mut c_ushort = mem::transmute(libc::malloc(((buffer.len() + 1) * 2) as u64)); - ptr::copy_memory(ptr, mem::transmute(buffer.as_ptr()), buffer.len()); + ptr::copy(ptr, mem::transmute(buffer.as_ptr()), buffer.len()); *ptr.offset(buffer.len() as int) = 0; // FIXME(pcwalton): This leaks!! We should instead have the caller pass some scratch