зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #6484 - Stop using deprecated boxed::into_raw in cef (from Ms2ger:raw-cef); r=metajack
Source-Repo: https://github.com/servo/servo Source-Revision: ff979441210dd2f7037b565866446e755b5f3e24
This commit is contained in:
Родитель
7041651898
Коммит
418336ea22
|
@ -3,7 +3,6 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use libc::{c_int};
|
use libc::{c_int};
|
||||||
use std::boxed;
|
|
||||||
use std::slice;
|
use std::slice;
|
||||||
use string::cef_string_utf16_set;
|
use string::cef_string_utf16_set;
|
||||||
use types::{cef_string_list_t,cef_string_t};
|
use types::{cef_string_list_t,cef_string_t};
|
||||||
|
@ -14,7 +13,7 @@ use rustc_unicode::str::Utf16Encoder;
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn cef_string_list_alloc() -> *mut cef_string_list_t {
|
pub extern "C" fn cef_string_list_alloc() -> *mut cef_string_list_t {
|
||||||
boxed::into_raw(box vec!())
|
Box::into_raw(box vec!())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
@ -66,6 +65,6 @@ pub extern "C" fn cef_string_list_copy(lt: *mut cef_string_list_t) -> *mut cef_s
|
||||||
unsafe {
|
unsafe {
|
||||||
if lt.is_null() { return 0 as *mut cef_string_list_t; }
|
if lt.is_null() { return 0 as *mut cef_string_list_t; }
|
||||||
let copy = (*lt).clone();
|
let copy = (*lt).clone();
|
||||||
boxed::into_raw(box copy)
|
Box::into_raw(box copy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
use eutil::slice_to_str;
|
use eutil::slice_to_str;
|
||||||
use libc::{c_int};
|
use libc::{c_int};
|
||||||
use std::boxed;
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use string::{cef_string_userfree_utf16_alloc, cef_string_userfree_utf16_free};
|
use string::{cef_string_userfree_utf16_alloc, cef_string_userfree_utf16_free};
|
||||||
use string::{cef_string_utf16_set};
|
use string::{cef_string_utf16_set};
|
||||||
|
@ -14,7 +13,7 @@ use types::{cef_string_map_t, cef_string_t};
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn cef_string_map_alloc() -> *mut cef_string_map_t {
|
pub extern "C" fn cef_string_map_alloc() -> *mut cef_string_map_t {
|
||||||
boxed::into_raw(box BTreeMap::new())
|
Box::into_raw(box BTreeMap::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
use eutil::slice_to_str;
|
use eutil::slice_to_str;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use std::boxed;
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use string::{cef_string_userfree_utf16_alloc, cef_string_userfree_utf16_free};
|
use string::{cef_string_userfree_utf16_alloc, cef_string_userfree_utf16_free};
|
||||||
use string::{cef_string_utf16_set};
|
use string::{cef_string_utf16_set};
|
||||||
|
@ -14,7 +13,7 @@ use types::{cef_string_multimap_t,cef_string_t};
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn cef_string_multimap_alloc() -> *mut cef_string_multimap_t {
|
pub extern "C" fn cef_string_multimap_alloc() -> *mut cef_string_multimap_t {
|
||||||
boxed::into_raw(box BTreeMap::new())
|
Box::into_raw(box BTreeMap::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
|
@ -34,7 +34,6 @@ use types::{cef_v8_accesscontrol_t, cef_v8_propertyattribute_t, cef_value_type_t
|
||||||
use types::{cef_window_info_t, cef_window_open_disposition_t, cef_xml_encoding_type_t, cef_xml_node_type_t};
|
use types::{cef_window_info_t, cef_window_open_disposition_t, cef_xml_encoding_type_t, cef_xml_node_type_t};
|
||||||
|
|
||||||
use libc::{self, c_char, c_int, c_ushort, c_void};
|
use libc::{self, c_char, c_int, c_ushort, c_void};
|
||||||
use std::boxed;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
@ -201,7 +200,7 @@ impl<'a> CefWrap<*const cef_string_t> for &'a [u16] {
|
||||||
|
|
||||||
// FIXME(pcwalton): This leaks!! We should instead have the caller pass some scratch
|
// FIXME(pcwalton): This leaks!! We should instead have the caller pass some scratch
|
||||||
// stack space to create the object in. What a botch.
|
// stack space to create the object in. What a botch.
|
||||||
boxed::into_raw(box cef_string_utf16 {
|
Box::into_raw(box cef_string_utf16 {
|
||||||
str: ptr,
|
str: ptr,
|
||||||
length: buffer.len() as u64,
|
length: buffer.len() as u64,
|
||||||
dtor: Some(free_boxed_utf16_string as extern "C" fn(*mut c_ushort)),
|
dtor: Some(free_boxed_utf16_string as extern "C" fn(*mut c_ushort)),
|
||||||
|
|
Загрузка…
Ссылка в новой задаче