mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
auto merge of #5288 : Ms2ger/servo/warnings, r=SimonSapin
This commit is contained in:
commit
0663cd6325
16 changed files with 32 additions and 35 deletions
|
@ -58,7 +58,7 @@ use std::fmt;
|
||||||
use std::iter::Zip;
|
use std::iter::Zip;
|
||||||
use std::num::FromPrimitive;
|
use std::num::FromPrimitive;
|
||||||
use std::raw;
|
use std::raw;
|
||||||
use std::sync::atomic::{AtomicUint, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
use std::slice::IterMut;
|
use std::slice::IterMut;
|
||||||
use style::computed_values::{clear, empty_cells, float, position, text_align};
|
use style::computed_values::{clear, empty_cells, float, position, text_align};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
|
@ -740,9 +740,9 @@ pub struct BaseFlow {
|
||||||
/// NB: Must be the first element.
|
/// NB: Must be the first element.
|
||||||
///
|
///
|
||||||
/// The necessity of this will disappear once we have dynamically-sized types.
|
/// The necessity of this will disappear once we have dynamically-sized types.
|
||||||
strong_ref_count: AtomicUint,
|
strong_ref_count: AtomicUsize,
|
||||||
|
|
||||||
weak_ref_count: AtomicUint,
|
weak_ref_count: AtomicUsize,
|
||||||
|
|
||||||
pub restyle_damage: RestyleDamage,
|
pub restyle_damage: RestyleDamage,
|
||||||
|
|
||||||
|
@ -951,8 +951,8 @@ impl BaseFlow {
|
||||||
damage.remove(RECONSTRUCT_FLOW);
|
damage.remove(RECONSTRUCT_FLOW);
|
||||||
|
|
||||||
BaseFlow {
|
BaseFlow {
|
||||||
strong_ref_count: AtomicUint::new(1),
|
strong_ref_count: AtomicUsize::new(1),
|
||||||
weak_ref_count: AtomicUint::new(1),
|
weak_ref_count: AtomicUsize::new(1),
|
||||||
restyle_damage: damage,
|
restyle_damage: damage,
|
||||||
children: FlowList::new(),
|
children: FlowList::new(),
|
||||||
intrinsic_inline_sizes: IntrinsicISizes::new(),
|
intrinsic_inline_sizes: IntrinsicISizes::new(),
|
||||||
|
@ -982,11 +982,11 @@ impl BaseFlow {
|
||||||
self.children.iter_mut()
|
self.children.iter_mut()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn strong_ref_count<'a>(&'a self) -> &'a AtomicUint {
|
pub unsafe fn strong_ref_count<'a>(&'a self) -> &'a AtomicUsize {
|
||||||
&self.strong_ref_count
|
&self.strong_ref_count
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn weak_ref_count<'a>(&'a self) -> &'a AtomicUint {
|
pub unsafe fn weak_ref_count<'a>(&'a self) -> &'a AtomicUsize {
|
||||||
&self.weak_ref_count
|
&self.weak_ref_count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,9 +102,7 @@ impl Drop for FlowRef {
|
||||||
let object_align = vtable[2];
|
let object_align = vtable[2];
|
||||||
|
|
||||||
let fake_data = heap::allocate(object_size, object_align);
|
let fake_data = heap::allocate(object_size, object_align);
|
||||||
ptr::copy_memory(fake_data,
|
ptr::copy(fake_data, flow_ref.object.data as *const u8, object_size);
|
||||||
flow_ref.object.data as *const u8,
|
|
||||||
object_size);
|
|
||||||
|
|
||||||
let fake_box = raw::TraitObject { vtable: flow_ref.object.vtable, data: fake_data as *mut () };
|
let fake_box = raw::TraitObject { vtable: flow_ref.object.vtable, data: fake_data as *mut () };
|
||||||
let fake_flow = mem::transmute::<raw::TraitObject, Box<Flow>>(fake_box);
|
let fake_flow = mem::transmute::<raw::TraitObject, Box<Flow>>(fake_box);
|
||||||
|
|
|
@ -25,7 +25,7 @@ use util::time::{TimeProfilerCategory, ProfilerMetadata, TimeProfilerChan, profi
|
||||||
use util::workqueue::{WorkQueue, WorkUnit, WorkerProxy};
|
use util::workqueue::{WorkQueue, WorkUnit, WorkerProxy};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::sync::atomic::{AtomicInt, Ordering};
|
use std::sync::atomic::{AtomicIsize, Ordering};
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn static_assertion(node: UnsafeLayoutNode) {
|
fn static_assertion(node: UnsafeLayoutNode) {
|
||||||
|
@ -68,13 +68,13 @@ pub fn mut_borrowed_flow_to_unsafe_flow(flow: &mut Flow) -> UnsafeFlow {
|
||||||
/// Information that we need stored in each DOM node.
|
/// Information that we need stored in each DOM node.
|
||||||
pub struct DomParallelInfo {
|
pub struct DomParallelInfo {
|
||||||
/// The number of children that still need work done.
|
/// The number of children that still need work done.
|
||||||
pub children_count: AtomicInt,
|
pub children_count: AtomicIsize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DomParallelInfo {
|
impl DomParallelInfo {
|
||||||
pub fn new() -> DomParallelInfo {
|
pub fn new() -> DomParallelInfo {
|
||||||
DomParallelInfo {
|
DomParallelInfo {
|
||||||
children_count: AtomicInt::new(0),
|
children_count: AtomicIsize::new(0),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ trait ParallelPostorderDomTraversal : PostorderDomTraversal {
|
||||||
/// Information that we need stored in each flow.
|
/// Information that we need stored in each flow.
|
||||||
pub struct FlowParallelInfo {
|
pub struct FlowParallelInfo {
|
||||||
/// The number of children that still need work done.
|
/// The number of children that still need work done.
|
||||||
pub children_count: AtomicInt,
|
pub children_count: AtomicIsize,
|
||||||
/// The address of the parent flow.
|
/// The address of the parent flow.
|
||||||
pub parent: UnsafeFlow,
|
pub parent: UnsafeFlow,
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ pub struct FlowParallelInfo {
|
||||||
impl FlowParallelInfo {
|
impl FlowParallelInfo {
|
||||||
pub fn new() -> FlowParallelInfo {
|
pub fn new() -> FlowParallelInfo {
|
||||||
FlowParallelInfo {
|
FlowParallelInfo {
|
||||||
children_count: AtomicInt::new(0),
|
children_count: AtomicIsize::new(0),
|
||||||
parent: null_unsafe_flow(),
|
parent: null_unsafe_flow(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ impl CallbackInterface {
|
||||||
-> Result<JSVal, ()> {
|
-> Result<JSVal, ()> {
|
||||||
let mut callable = UndefinedValue();
|
let mut callable = UndefinedValue();
|
||||||
unsafe {
|
unsafe {
|
||||||
let name = CString::from_slice(name.as_bytes());
|
let name = CString::new(name).unwrap();
|
||||||
if JS_GetProperty(cx, self.callback(), name.as_ptr(), &mut callable) == 0 {
|
if JS_GetProperty(cx, self.callback(), name.as_ptr(), &mut callable) == 0 {
|
||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ pub fn report_pending_exception(cx: *mut JSContext, obj: *mut JSObject) {
|
||||||
pub fn throw_not_in_union(cx: *mut JSContext, names: &'static str) -> JSBool {
|
pub fn throw_not_in_union(cx: *mut JSContext, names: &'static str) -> JSBool {
|
||||||
assert!(unsafe { JS_IsExceptionPending(cx) } == 0);
|
assert!(unsafe { JS_IsExceptionPending(cx) } == 0);
|
||||||
let message = format!("argument could not be converted to any of: {}", names);
|
let message = format!("argument could not be converted to any of: {}", names);
|
||||||
let string = CString::from_slice(message.as_bytes());
|
let string = CString::new(message).unwrap();
|
||||||
unsafe { ReportError(cx, string.as_ptr()) };
|
unsafe { ReportError(cx, string.as_ptr()) };
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ unsafe extern fn get_error_message(_user_ref: *mut libc::c_void,
|
||||||
|
|
||||||
/// Throw a `TypeError` with the given message.
|
/// Throw a `TypeError` with the given message.
|
||||||
pub fn throw_type_error(cx: *mut JSContext, error: &str) {
|
pub fn throw_type_error(cx: *mut JSContext, error: &str) {
|
||||||
let error = CString::from_slice(error.as_bytes());
|
let error = CString::new(error).unwrap();
|
||||||
unsafe {
|
unsafe {
|
||||||
JS_ReportErrorNumber(cx,
|
JS_ReportErrorNumber(cx,
|
||||||
Some(get_error_message as
|
Some(get_error_message as
|
||||||
|
|
|
@ -92,7 +92,7 @@ pub fn trace_jsval(tracer: *mut JSTracer, description: &str, val: JSVal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let name = CString::from_slice(description.as_bytes());
|
let name = CString::new(description).unwrap();
|
||||||
(*tracer).debugPrinter = None;
|
(*tracer).debugPrinter = None;
|
||||||
(*tracer).debugPrintIndex = -1;
|
(*tracer).debugPrintIndex = -1;
|
||||||
(*tracer).debugPrintArg = name.as_ptr() as *const libc::c_void;
|
(*tracer).debugPrintArg = name.as_ptr() as *const libc::c_void;
|
||||||
|
@ -110,7 +110,7 @@ pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Ref
|
||||||
/// Trace a `JSObject`.
|
/// Trace a `JSObject`.
|
||||||
pub fn trace_object(tracer: *mut JSTracer, description: &str, obj: *mut JSObject) {
|
pub fn trace_object(tracer: *mut JSTracer, description: &str, obj: *mut JSObject) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let name = CString::from_slice(description.as_bytes());
|
let name = CString::new(description).unwrap();
|
||||||
(*tracer).debugPrinter = None;
|
(*tracer).debugPrinter = None;
|
||||||
(*tracer).debugPrintIndex = -1;
|
(*tracer).debugPrintIndex = -1;
|
||||||
(*tracer).debugPrintArg = name.as_ptr() as *const libc::c_void;
|
(*tracer).debugPrintArg = name.as_ptr() as *const libc::c_void;
|
||||||
|
|
|
@ -197,7 +197,7 @@ pub fn do_create_interface_objects(cx: *mut JSContext, global: *mut JSObject,
|
||||||
|
|
||||||
match constructor {
|
match constructor {
|
||||||
Some((native, name, nargs)) => {
|
Some((native, name, nargs)) => {
|
||||||
let s = CString::from_slice(name.as_bytes());
|
let s = CString::new(name).unwrap();
|
||||||
create_interface_object(cx, global, receiver,
|
create_interface_object(cx, global, receiver,
|
||||||
native, nargs, proto,
|
native, nargs, proto,
|
||||||
members, s.as_ptr())
|
members, s.as_ptr())
|
||||||
|
@ -516,7 +516,7 @@ pub fn get_dictionary_property(cx: *mut JSContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let property = CString::from_slice(property.as_bytes());
|
let property = CString::new(property).unwrap();
|
||||||
if object.is_null() {
|
if object.is_null() {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,8 +126,8 @@ impl<'a> BlobMethods for JSRef<'a, Blob> {
|
||||||
match self.bytes {
|
match self.bytes {
|
||||||
None => Blob::new(global.r(), None, relativeContentType.as_slice()),
|
None => Blob::new(global.r(), None, relativeContentType.as_slice()),
|
||||||
Some(ref vec) => {
|
Some(ref vec) => {
|
||||||
let start = relativeStart.to_uint().unwrap();
|
let start = relativeStart.to_usize().unwrap();
|
||||||
let end = (relativeStart + span).to_uint().unwrap();
|
let end = (relativeStart + span).to_usize().unwrap();
|
||||||
let mut bytes: Vec<u8> = Vec::new();
|
let mut bytes: Vec<u8> = Vec::new();
|
||||||
bytes.push_all(&vec[start..end]);
|
bytes.push_all(&vec[start..end]);
|
||||||
Blob::new(global.r(), Some(bytes), relativeContentType.as_slice())
|
Blob::new(global.r(), Some(bytes), relativeContentType.as_slice())
|
||||||
|
|
|
@ -198,8 +198,8 @@ impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
|
||||||
scope: *mut JSObject,
|
scope: *mut JSObject,
|
||||||
ty: &str,
|
ty: &str,
|
||||||
source: DOMString) {
|
source: DOMString) {
|
||||||
let url = CString::from_slice(url.serialize().as_bytes());
|
let url = CString::new(url.serialize()).unwrap();
|
||||||
let name = CString::from_slice(ty.as_bytes());
|
let name = CString::new(ty).unwrap();
|
||||||
let lineno = 0; //XXXjdm need to get a real number here
|
let lineno = 0; //XXXjdm need to get a real number here
|
||||||
|
|
||||||
let nargs = 1; //XXXjdm not true for onerror
|
let nargs = 1; //XXXjdm not true for onerror
|
||||||
|
|
|
@ -32,7 +32,6 @@ use util::str::DOMString;
|
||||||
|
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
|
|
||||||
use std::ascii::AsciiExt;
|
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl ImageData {
|
||||||
|
|
||||||
if let Some(vec) = data {
|
if let Some(vec) = data {
|
||||||
let js_object_data: *mut uint8_t = JS_GetUint8ClampedArrayData(js_object, cx);
|
let js_object_data: *mut uint8_t = JS_GetUint8ClampedArrayData(js_object, cx);
|
||||||
ptr::copy_nonoverlapping_memory(js_object_data, vec.as_ptr(), vec.len())
|
ptr::copy_nonoverlapping(js_object_data, vec.as_ptr(), vec.len())
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageData {
|
ImageData {
|
||||||
|
|
|
@ -470,7 +470,7 @@ impl<'a, T: Reflectable> ScriptHelpers for JSRef<'a, T> {
|
||||||
let global = global_object_for_js_object(this).root().r().reflector().get_jsobject();
|
let global = global_object_for_js_object(this).root().r().reflector().get_jsobject();
|
||||||
let code: Vec<u16> = code.as_slice().utf16_units().collect();
|
let code: Vec<u16> = code.as_slice().utf16_units().collect();
|
||||||
let mut rval = UndefinedValue();
|
let mut rval = UndefinedValue();
|
||||||
let filename = CString::from_slice(filename.as_bytes());
|
let filename = CString::new(filename).unwrap();
|
||||||
|
|
||||||
with_compartment(cx, global, || {
|
with_compartment(cx, global, || {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -30,8 +30,8 @@ use net::resource_task::{ProgressMsg, LoadResponse};
|
||||||
use util::task_state;
|
use util::task_state;
|
||||||
use util::task_state::IN_HTML_PARSER;
|
use util::task_state::IN_HTML_PARSER;
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
|
use std::borrow::Cow;
|
||||||
use std::old_io::{Writer, IoResult};
|
use std::old_io::{Writer, IoResult};
|
||||||
use std::string::CowString;
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use html5ever::Attribute;
|
use html5ever::Attribute;
|
||||||
use html5ever::serialize::{Serializable, Serializer, AttrRef};
|
use html5ever::serialize::{Serializable, Serializer, AttrRef};
|
||||||
|
@ -120,7 +120,7 @@ impl<'a> TreeSink for servohtmlparser::Sink {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_error(&mut self, msg: CowString<'static>) {
|
fn parse_error(&mut self, msg: Cow<'static, str>) {
|
||||||
debug!("Parse error: {}", msg);
|
debug!("Parse error: {}", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ fn redirect_output(file_no: c_int) {
|
||||||
let mut pipes: [c_int; 2] = [ 0, 0 ];
|
let mut pipes: [c_int; 2] = [ 0, 0 ];
|
||||||
pipe(pipes.as_mut_ptr());
|
pipe(pipes.as_mut_ptr());
|
||||||
dup2(pipes[1], file_no);
|
dup2(pipes[1], file_no);
|
||||||
let mode = CString::from_slice("r".as_bytes());
|
let mode = CString::new("r").unwrap();
|
||||||
let input_file = FilePtr(fdopen(pipes[0], mode.as_ptr()));
|
let input_file = FilePtr(fdopen(pipes[0], mode.as_ptr()));
|
||||||
spawn_named("android-logger".to_owned(), move || {
|
spawn_named("android-logger".to_owned(), move || {
|
||||||
loop {
|
loop {
|
||||||
|
|
|
@ -67,7 +67,7 @@ pub extern "C" fn command_line_get_switch_value(cmd: *mut cef_command_line_t, na
|
||||||
if o.as_slice().starts_with(opt.as_slice()) {
|
if o.as_slice().starts_with(opt.as_slice()) {
|
||||||
let mut string = mem::uninitialized();
|
let mut string = mem::uninitialized();
|
||||||
let arg = o[opt.len() + 1..].as_bytes();
|
let arg = o[opt.len() + 1..].as_bytes();
|
||||||
let c_str = ffi::CString::from_slice(arg);
|
let c_str = ffi::CString::new(arg).unwrap();
|
||||||
cef_string_utf16_set(c_str.as_bytes().as_ptr() as *const _,
|
cef_string_utf16_set(c_str.as_bytes().as_ptr() as *const _,
|
||||||
arg.len() as size_t,
|
arg.len() as size_t,
|
||||||
&mut string,
|
&mut string,
|
||||||
|
|
|
@ -47,7 +47,7 @@ fn load_gl() {
|
||||||
|
|
||||||
gl::load_with(|s| {
|
gl::load_with(|s| {
|
||||||
unsafe {
|
unsafe {
|
||||||
let c_str = CString::from_slice(s.as_bytes());
|
let c_str = CString::new(s).unwrap();
|
||||||
dlsym(RTLD_DEFAULT, c_str.as_ptr()) as *const c_void
|
dlsym(RTLD_DEFAULT, c_str.as_ptr()) as *const c_void
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -61,7 +61,7 @@ fn load_gl() {
|
||||||
|
|
||||||
gl::load_with(|s| {
|
gl::load_with(|s| {
|
||||||
unsafe {
|
unsafe {
|
||||||
let c_str = CString::from_slice(s.as_bytes());
|
let c_str = CString::new(s).unwrap();
|
||||||
glXGetProcAddress(c_str.as_ptr()) as *const c_void
|
glXGetProcAddress(c_str.as_ptr()) as *const c_void
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue