aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2015-02-20 14:43:29 +0100
committerMs2ger <ms2ger@gmail.com>2015-02-20 14:45:47 +0100
commit6d30ec77c89d157819a7c8e99d34b6aabf5bc5c6 (patch)
tree4c8fa052611da7fa05f107fb206d79aa17be1ecb /components
parent9c863a6bd42e1cbcdf2c54299145d266534f25c0 (diff)
downloadservo-6d30ec77c89d157819a7c8e99d34b6aabf5bc5c6.tar.gz
servo-6d30ec77c89d157819a7c8e99d34b6aabf5bc5c6.zip
Replace uint/int by usize/isize in various places.
Diffstat (limited to 'components')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py12
-rw-r--r--components/script/dom/bindings/conversions.rs4
-rw-r--r--components/script/dom/bindings/js.rs4
-rw-r--r--components/script/dom/bindings/refcounted.rs6
-rw-r--r--components/script/dom/bindings/str.rs2
-rw-r--r--components/script/dom/bindings/trace.rs4
-rw-r--r--components/script/dom/bindings/utils.rs10
-rw-r--r--components/script/dom/characterdata.rs6
-rw-r--r--components/script/dom/cssstyledeclaration.rs7
-rw-r--r--components/script/dom/domparser.rs2
-rw-r--r--components/script/dom/domrectlist.rs2
-rw-r--r--components/script/dom/domtokenlist.rs2
-rw-r--r--components/script/dom/htmlcollection.rs5
-rw-r--r--components/script/dom/nodelist.rs4
14 files changed, 36 insertions, 34 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index d614e4de7b2..ebac6455b1f 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -1014,7 +1014,7 @@ class CGArgumentConverter(CGThing):
seqType = CGTemplatedType("Vec", declType)
variadicConversion = string.Template(
- "let mut vector: ${seqType} = Vec::with_capacity((${argc} - ${index}) as uint);\n"
+ "let mut vector: ${seqType} = Vec::with_capacity((${argc} - ${index}) as usize);\n"
"for variadicArg in range(${index}, ${argc}) {\n"
"${inner}\n"
" vector.push(slot);\n"
@@ -1835,7 +1835,7 @@ def CreateBindingJSObject(descriptor, parent=None):
if descriptor.proxy:
assert not descriptor.isGlobal()
create += """
-let handler = RegisterBindings::proxy_handlers[PrototypeList::Proxies::%s as uint];
+let handler = RegisterBindings::proxy_handlers[PrototypeList::Proxies::%s as usize];
let mut private = PrivateValue(boxed::into_raw(object) as *const libc::c_void);
let obj = with_compartment(cx, proto, || {
NewProxyObject(cx, handler,
@@ -2800,7 +2800,7 @@ class CGEnum(CGThing):
CGThing.__init__(self)
decl = """\
-#[repr(uint)]
+#[repr(usize)]
#[derive(PartialEq, Copy)]
#[jstraceable]
pub enum %s {
@@ -2819,7 +2819,7 @@ pub const strings: &'static [&'static str] = &[
impl ToJSValConvertible for super::%s {
fn to_jsval(&self, cx: *mut JSContext) -> JSVal {
- strings[*self as uint].to_jsval(cx)
+ strings[*self as usize].to_jsval(cx)
}
}
""" % (",\n ".join(['"%s"' % val for val in enum.values()]), enum.identifier.name)
@@ -4496,7 +4496,7 @@ class CGRegisterProxyHandlersMethod(CGAbstractMethod):
def definition_body(self):
return CGList([
- CGGeneric("proxy_handlers[Proxies::%s as uint] = codegen::Bindings::%sBinding::DefineProxyHandler();" % (desc.name, desc.name))
+ CGGeneric("proxy_handlers[Proxies::%s as usize] = codegen::Bindings::%sBinding::DefineProxyHandler();" % (desc.name, desc.name))
for desc in self.descriptors
], "\n")
@@ -5225,7 +5225,7 @@ class GlobalGenRoots():
return CGList([
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
- CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
+ CGGeneric("pub const MAX_PROTO_CHAIN_LENGTH: usize = %d;\n\n" % config.maxProtoChainLength),
CGNonNamespacedEnum('ID', protos, [0], deriving="PartialEq, Copy"),
CGNonNamespacedEnum('Proxies', proxies, [0], deriving="PartialEq, Copy"),
])
diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs
index 4d5c0ee668a..dfcb9b71d3f 100644
--- a/components/script/dom/bindings/conversions.rs
+++ b/components/script/dom/bindings/conversions.rs
@@ -306,7 +306,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_parts(chars, length as uint);
+ let char_vec = slice::from_raw_parts(chars, length as usize);
String::from_utf16(char_vec).unwrap()
}
}
@@ -365,7 +365,7 @@ impl FromJSValConvertible for ByteString {
let mut length = 0;
let chars = JS_GetStringCharsAndLength(cx, string, &mut length);
- let char_vec = slice::from_raw_parts(chars, length as uint);
+ let char_vec = slice::from_raw_parts(chars, length as usize);
if char_vec.iter().any(|&c| c > 0xFF) {
// XXX Throw
diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs
index a842583cecb..622368af6d2 100644
--- a/components/script/dom/bindings/js.rs
+++ b/components/script/dom/bindings/js.rs
@@ -585,7 +585,7 @@ pub trait TemporaryPushable<T> {
/// Push a new value onto this container.
fn push_unrooted(&mut self, val: &T);
/// Insert a new value into this container.
- fn insert_unrooted(&mut self, index: uint, val: &T);
+ fn insert_unrooted(&mut self, index: usize, val: &T);
}
impl<T: Assignable<U>, U: Reflectable> TemporaryPushable<T> for Vec<JS<U>> {
@@ -593,7 +593,7 @@ impl<T: Assignable<U>, U: Reflectable> TemporaryPushable<T> for Vec<JS<U>> {
self.push(unsafe { val.get_js() });
}
- fn insert_unrooted(&mut self, index: uint, val: &T) {
+ fn insert_unrooted(&mut self, index: usize, val: &T) {
self.insert(index, unsafe { val.get_js() });
}
}
diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs
index 56e681e41dd..a0183aac59c 100644
--- a/components/script/dom/bindings/refcounted.rs
+++ b/components/script/dom/bindings/refcounted.rs
@@ -50,7 +50,7 @@ pub struct Trusted<T> {
/// A pointer to the Rust DOM object of type T, but void to allow
/// sending `Trusted<T>` between tasks, regardless of T's sendability.
ptr: *const libc::c_void,
- refcount: Arc<Mutex<uint>>,
+ refcount: Arc<Mutex<usize>>,
script_chan: Box<ScriptChan + Send>,
owner_thread: *const libc::c_void,
}
@@ -123,7 +123,7 @@ impl<T: Reflectable> Drop for Trusted<T> {
/// from being garbage collected due to outstanding references.
pub struct LiveDOMReferences {
// keyed on pointer to Rust DOM object
- table: RefCell<HashMap<*const libc::c_void, Arc<Mutex<uint>>>>
+ table: RefCell<HashMap<*const libc::c_void, Arc<Mutex<usize>>>>
}
impl LiveDOMReferences {
@@ -136,7 +136,7 @@ impl LiveDOMReferences {
});
}
- fn addref<T: Reflectable>(&self, cx: *mut JSContext, ptr: *const T) -> Arc<Mutex<uint>> {
+ fn addref<T: Reflectable>(&self, cx: *mut JSContext, ptr: *const T) -> Arc<Mutex<usize>> {
let mut table = self.table.borrow_mut();
match table.entry(ptr as *const libc::c_void) {
Occupied(mut entry) => {
diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs
index 54ad9c45fb3..3c47826b023 100644
--- a/components/script/dom/bindings/str.rs
+++ b/components/script/dom/bindings/str.rs
@@ -34,7 +34,7 @@ impl ByteString {
}
/// Returns the length.
- pub fn len(&self) -> uint {
+ pub fn len(&self) -> usize {
let ByteString(ref vector) = *self;
vector.len()
}
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index 2dfb35d3f48..ebac215ec9f 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -204,8 +204,8 @@ impl<A: JSTraceable, B: JSTraceable> JSTraceable for (A, B) {
no_jsmanaged_fields!(bool, f32, f64, String, Url);
-no_jsmanaged_fields!(uint, u8, u16, u32, u64);
-no_jsmanaged_fields!(int, i8, i16, i32, i64);
+no_jsmanaged_fields!(usize, u8, u16, u32, u64);
+no_jsmanaged_fields!(isize, i8, i16, i32, i64);
no_jsmanaged_fields!(Sender<T>);
no_jsmanaged_fields!(Receiver<T>);
no_jsmanaged_fields!(Rect<T>);
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index 568d52eba46..56c9b58288d 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -335,7 +335,7 @@ pub unsafe extern fn throwing_constructor(cx: *mut JSContext, _argc: c_uint,
/// Fails if the argument is not a DOM global.
pub fn initialize_global(global: *mut JSObject) {
let proto_array = box ()
- ([0 as *mut JSObject; PrototypeList::ID::Count as uint]);
+ ([0 as *mut JSObject; PrototypeList::ID::Count as usize]);
unsafe {
assert!(((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0);
let box_ = boxed::into_raw(proto_array);
@@ -460,7 +460,7 @@ pub fn get_array_index_from_id(_cx: *mut JSContext, id: jsid) -> Option<u32> {
pub fn find_enum_string_index(cx: *mut JSContext,
v: JSVal,
values: &[&'static str])
- -> Result<Option<uint>, ()> {
+ -> Result<Option<usize>, ()> {
unsafe {
let jsstr = JS_ValueToString(cx, v);
if jsstr.is_null() {
@@ -474,9 +474,9 @@ pub fn find_enum_string_index(cx: *mut JSContext,
}
Ok(values.iter().position(|value| {
- value.len() == length as uint &&
- range(0, length as uint).all(|j| {
- value.as_bytes()[j] as u16 == *chars.offset(j as int)
+ value.len() == length as usize &&
+ range(0, length as usize).all(|j| {
+ value.as_bytes()[j] as u16 == *chars.offset(j as isize)
})
}))
}
diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs
index 598fc11213e..9fc2f5ec0ff 100644
--- a/components/script/dom/characterdata.rs
+++ b/components/script/dom/characterdata.rs
@@ -81,7 +81,7 @@ impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
}
fn SubstringData(self, offset: u32, count: u32) -> Fallible<DOMString> {
- Ok(self.data.borrow()[offset as uint .. count as uint].to_owned())
+ Ok(self.data.borrow()[offset as usize .. count as usize].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()[..offset as uint].to_owned();
+ let mut data = self.data.borrow()[..offset as usize].to_owned();
data.push_str(arg.as_slice());
- data.push_str(&self.data.borrow()[(offset + count) as uint..]);
+ data.push_str(&self.data.borrow()[(offset + count) as usize..]);
*self.data.borrow_mut() = data;
// FIXME: Once we have `Range`, we should implement step7 to step11
Ok(())
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs
index 2de0942f968..2337e6c061a 100644
--- a/components/script/dom/cssstyledeclaration.rs
+++ b/components/script/dom/cssstyledeclaration.rs
@@ -109,17 +109,18 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
}
fn Item(self, index: u32) -> DOMString {
+ let index = index as usize;
let owner = self.owner.root();
let elem: JSRef<Element> = ElementCast::from_ref(owner.r());
let style_attribute = elem.style_attribute().borrow();
let result = style_attribute.as_ref().and_then(|declarations| {
- if index as uint > declarations.normal.len() {
+ if index > declarations.normal.len() {
declarations.important
- .get(index as uint - declarations.normal.len())
+ .get(index - declarations.normal.len())
.map(|decl| format!("{:?} !important", decl))
} else {
declarations.normal
- .get(index as uint)
+ .get(index)
.map(|decl| format!("{:?}", decl))
}
});
diff --git a/components/script/dom/domparser.rs b/components/script/dom/domparser.rs
index 5fe79f5156c..c33b151d9cf 100644
--- a/components/script/dom/domparser.rs
+++ b/components/script/dom/domparser.rs
@@ -51,7 +51,7 @@ impl<'a> DOMParserMethods for JSRef<'a, DOMParser> {
-> Fallible<Temporary<Document>> {
let window = self.window.root();
let url = window.r().get_url();
- let content_type = DOMParserBinding::SupportedTypeValues::strings[ty as uint].to_owned();
+ let content_type = DOMParserBinding::SupportedTypeValues::strings[ty as usize].to_owned();
match ty {
Text_html => {
let document = Document::new(window.r(), Some(url.clone()),
diff --git a/components/script/dom/domrectlist.rs b/components/script/dom/domrectlist.rs
index 86cb64c6454..8ef7b8fce52 100644
--- a/components/script/dom/domrectlist.rs
+++ b/components/script/dom/domrectlist.rs
@@ -43,7 +43,7 @@ impl<'a> DOMRectListMethods for JSRef<'a, DOMRectList> {
fn Item(self, index: u32) -> Option<Temporary<DOMRect>> {
let rects = &self.rects;
if index < rects.len() as u32 {
- Some(Temporary::new(rects[index as uint].clone()))
+ Some(Temporary::new(rects[index as usize].clone()))
} else {
None
}
diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs
index 59a7f0d3e0a..c0ba2e1ebd1 100644
--- a/components/script/dom/domtokenlist.rs
+++ b/components/script/dom/domtokenlist.rs
@@ -74,7 +74,7 @@ impl<'a> DOMTokenListMethods for JSRef<'a, DOMTokenList> {
// http://dom.spec.whatwg.org/#dom-domtokenlist-item
fn Item(self, index: u32) -> Option<DOMString> {
self.attribute().root().and_then(|attr| attr.r().value().tokens().and_then(|tokens| {
- tokens.get(index as uint).map(|token| token.as_slice().to_owned())
+ tokens.get(index as usize).map(|token| token.as_slice().to_owned())
}))
}
diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs
index 161e72ddc69..29cd1dfbb74 100644
--- a/components/script/dom/htmlcollection.rs
+++ b/components/script/dom/htmlcollection.rs
@@ -189,16 +189,17 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> {
// http://dom.spec.whatwg.org/#dom-htmlcollection-item
fn Item(self, index: u32) -> Option<Temporary<Element>> {
+ let index = index as usize;
match self.collection {
CollectionTypeId::Static(ref elems) => elems
.as_slice()
- .get(index as uint)
+ .get(index)
.map(|elem| Temporary::new(elem.clone())),
CollectionTypeId::Live(ref root, ref filter) => {
let root = root.root();
HTMLCollection::traverse(root.r())
.filter(|element| filter.filter(*element, root.r()))
- .nth(index as uint)
+ .nth(index)
.clone()
.map(Temporary::from_rooted)
}
diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs
index 7a1bcd8ecac..319004e4b46 100644
--- a/components/script/dom/nodelist.rs
+++ b/components/script/dom/nodelist.rs
@@ -60,10 +60,10 @@ impl<'a> NodeListMethods for JSRef<'a, NodeList> {
fn Item(self, index: u32) -> Option<Temporary<Node>> {
match self.list_type {
_ if index >= self.Length() => None,
- NodeListType::Simple(ref elems) => Some(Temporary::new(elems[index as uint].clone())),
+ NodeListType::Simple(ref elems) => Some(Temporary::new(elems[index as usize].clone())),
NodeListType::Children(ref node) => {
let node = node.root();
- node.r().children().nth(index as uint)
+ node.r().children().nth(index as usize)
.map(|child| Temporary::from_rooted(child))
}
}