mirror of
https://github.com/servo/servo.git
synced 2025-07-19 13:23:46 +01:00
auto merge of #4905 : servo/servo/warnings, r=jdm
This commit is contained in:
commit
b655b54f80
12 changed files with 29 additions and 18 deletions
|
@ -308,7 +308,7 @@ pub fn jsstring_to_str(cx: *mut JSContext, s: *mut JSString) -> DOMString {
|
|||
unsafe {
|
||||
let mut length = 0;
|
||||
let chars = JS_GetStringCharsAndLength(cx, s, &mut length);
|
||||
let char_vec = slice::from_raw_buf(&chars, length as uint);
|
||||
let char_vec = slice::from_raw_parts(chars, length as uint);
|
||||
String::from_utf16(char_vec).unwrap()
|
||||
}
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ impl FromJSValConvertible for ByteString {
|
|||
|
||||
let mut length = 0;
|
||||
let chars = JS_GetStringCharsAndLength(cx, string, &mut length);
|
||||
let char_vec = slice::from_raw_buf(&chars, length as uint);
|
||||
let char_vec = slice::from_raw_parts(chars, length as uint);
|
||||
|
||||
if char_vec.iter().any(|&c| c > 0xFF) {
|
||||
// XXX Throw
|
||||
|
|
|
@ -129,7 +129,7 @@ impl<'a> BlobMethods for JSRef<'a, Blob> {
|
|||
let start = relativeStart.to_uint().unwrap();
|
||||
let end = (relativeStart + span).to_uint().unwrap();
|
||||
let mut bytes: Vec<u8> = Vec::new();
|
||||
bytes.push_all(vec.slice(start, end));
|
||||
bytes.push_all(&vec[start..end]);
|
||||
Blob::new(global.r(), Some(bytes), relativeContentType.as_slice())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
|||
}
|
||||
|
||||
fn SubstringData(self, offset: u32, count: u32) -> Fallible<DOMString> {
|
||||
Ok(self.data.borrow().as_slice().slice(offset as uint, count as uint).to_owned())
|
||||
Ok(self.data.borrow()[offset as uint .. count as uint].to_owned())
|
||||
}
|
||||
|
||||
fn AppendData(self, arg: DOMString) -> ErrorResult {
|
||||
|
@ -107,9 +107,9 @@ impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
|||
} else {
|
||||
count
|
||||
};
|
||||
let mut data = self.data.borrow().as_slice().slice(0, offset as uint).to_owned();
|
||||
let mut data = self.data.borrow()[..offset as uint].to_owned();
|
||||
data.push_str(arg.as_slice());
|
||||
data.push_str(self.data.borrow().as_slice().slice((offset + count) as uint, length as uint));
|
||||
data.push_str(&self.data.borrow()[(offset + count) as uint..]);
|
||||
*self.data.borrow_mut() = data;
|
||||
// FIXME: Once we have `Range`, we should implement step7 to step11
|
||||
Ok(())
|
||||
|
|
|
@ -775,7 +775,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
root.traverse_preorder()
|
||||
.find(|node| node.type_id() == NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTitleElement)))
|
||||
.map(|title_elem| {
|
||||
let mut children = title_elem.children().filter_map(|n| {
|
||||
let children = title_elem.children().filter_map(|n| {
|
||||
let t: Option<JSRef<Text>> = TextCast::to_ref(n);
|
||||
t
|
||||
});
|
||||
|
|
|
@ -107,7 +107,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLBodyElement> {
|
|||
EventTargetCast::from_ref(*self)
|
||||
};
|
||||
evtarget.set_event_handler_uncompiled(cx, url, reflector,
|
||||
name.slice_from(2),
|
||||
&name[2..],
|
||||
attr.value().as_slice().to_owned());
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLElement> {
|
|||
window.r().reflector().get_jsobject());
|
||||
let evtarget: JSRef<EventTarget> = EventTargetCast::from_ref(*self);
|
||||
evtarget.set_event_handler_uncompiled(cx, url, reflector,
|
||||
name.slice_from(2),
|
||||
&name[2..],
|
||||
attr.value().as_slice().to_owned());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -332,7 +332,7 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
|
|||
// TODO: Handle `dirnames` (needs directionality support)
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#the-directionality
|
||||
let mut ret: Vec<FormDatum> = data_set.collect();
|
||||
for mut datum in ret.iter_mut() {
|
||||
for datum in ret.iter_mut() {
|
||||
match datum.ty.as_slice() {
|
||||
"file" | "textarea" => (),
|
||||
_ => {
|
||||
|
|
|
@ -317,7 +317,7 @@ fn broadcast_radio_checked(broadcaster: JSRef<HTMLInputElement>, group: Option<&
|
|||
fn do_broadcast<'a>(doc_node: JSRef<'a, Node>, broadcaster: JSRef<'a, HTMLInputElement>,
|
||||
owner: Option<JSRef<'a, HTMLFormElement>>, group: Option<&str>) {
|
||||
// There is no DOM tree manipulation here, so this is safe
|
||||
let mut iter = unsafe {
|
||||
let iter = unsafe {
|
||||
doc_node.query_selector_iter("input[type=radio]".to_owned()).unwrap()
|
||||
.filter_map(|t| HTMLInputElementCast::to_ref(t))
|
||||
.filter(|&r| in_same_group(r, owner, group) && broadcaster != r)
|
||||
|
|
|
@ -1663,7 +1663,7 @@ impl Node {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn collect_text_contents<'a, T: Iterator<Item=JSRef<'a, Node>>>(mut iterator: T) -> String {
|
||||
pub fn collect_text_contents<'a, T: Iterator<Item=JSRef<'a, Node>>>(iterator: T) -> String {
|
||||
let mut content = String::new();
|
||||
for node in iterator {
|
||||
let text: Option<JSRef<Text>> = TextCast::to_ref(node);
|
||||
|
|
|
@ -159,9 +159,9 @@ pub fn base64_atob(atob: DOMString) -> Fallible<DOMString> {
|
|||
// remove them from input."
|
||||
if input.len() % 4 == 0 {
|
||||
if input.ends_with("==") {
|
||||
input = input.slice_to(input.len() - 2)
|
||||
input = &input[..input.len() - 2]
|
||||
} else if input.ends_with("=") {
|
||||
input = input.slice_to(input.len() - 1)
|
||||
input = &input[..input.len() - 1]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,12 +2,23 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![feature(unsafe_destructor, plugin, box_syntax, int_uint, core)]
|
||||
#![feature(alloc)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(collections)]
|
||||
#![feature(core)]
|
||||
#![feature(hash)]
|
||||
#![feature(int_uint)]
|
||||
#![feature(io)]
|
||||
#![feature(libc)]
|
||||
#![feature(plugin)]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(std_misc)]
|
||||
#![feature(unicode)]
|
||||
#![feature(unsafe_destructor)]
|
||||
|
||||
#![deny(unsafe_blocks)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(missing_copy_implementations)]
|
||||
#![allow(unstable)]
|
||||
|
||||
#![doc="The script crate contains all matters DOM."]
|
||||
|
||||
|
|
|
@ -136,8 +136,8 @@ impl TextInput {
|
|||
let new_lines = {
|
||||
let prefix = self.lines[begin.line].slice_chars(0, begin.index);
|
||||
let suffix = self.lines[end.line].slice_chars(end.index, self.lines[end.line].chars().count());
|
||||
let lines_prefix = self.lines.slice(0, begin.line);
|
||||
let lines_suffix = self.lines.slice(end.line + 1, self.lines.len());
|
||||
let lines_prefix = &self.lines[..begin.line];
|
||||
let lines_suffix = &self.lines[end.line + 1..];
|
||||
|
||||
let mut insert_lines = if self.multiline {
|
||||
insert.as_slice().split('\n').map(|s| s.to_owned()).collect()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue