aboutsummaryrefslogtreecommitdiffstats
path: root/src/servo/dom
diff options
context:
space:
mode:
Diffstat (limited to 'src/servo/dom')
-rw-r--r--src/servo/dom/bindings/document.rs10
-rw-r--r--src/servo/dom/bindings/element.rs12
-rw-r--r--src/servo/dom/bindings/node.rs8
-rw-r--r--src/servo/dom/bindings/utils.rs20
-rw-r--r--src/servo/dom/bindings/window.rs6
-rw-r--r--src/servo/dom/rcu.rs22
6 files changed, 39 insertions, 39 deletions
diff --git a/src/servo/dom/bindings/document.rs b/src/servo/dom/bindings/document.rs
index f6f0202c515..0c0093aaf72 100644
--- a/src/servo/dom/bindings/document.rs
+++ b/src/servo/dom/bindings/document.rs
@@ -36,7 +36,7 @@ enum Element = int;
alt jsval_to_str(cx, id) {
ok(s) {
unsafe {
- let doc: *Document = unsafe::reinterpret_cast(JS_GetContextPrivate(cx));
+ let doc: *Document = cast::reinterpret_cast(JS_GetContextPrivate(cx));
let elem = (*doc).getElementById(s);
}
//XXX wrap result
@@ -61,7 +61,7 @@ enum Element = int;
extern fn getDocumentElement(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
-> JSBool unsafe {
- let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
+ let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}
@@ -76,14 +76,14 @@ extern fn getDocumentElement(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
unsafe fn unwrap(obj: *JSObject) -> *rust_box<Document> {
//TODO: some kind of check if this is a Document object
let val = JS_GetReservedSlot(obj, 0);
- unsafe::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
+ cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
}
extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
#debug("document finalize!");
unsafe {
let val = JS_GetReservedSlot(obj, 0);
- let _doc: @Document = unsafe::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
+ let _doc: @Document = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
}
}
@@ -108,7 +108,7 @@ fn init(compartment: bare_compartment, doc: @Document) {
compartment.global_obj.ptr));
unsafe {
- let raw_ptr: *libc::c_void = unsafe::reinterpret_cast(&squirrel_away(doc));
+ let raw_ptr: *libc::c_void = cast::reinterpret_cast(&squirrel_away(doc));
JS_SetReservedSlot(instance.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
}
diff --git a/src/servo/dom/bindings/element.rs b/src/servo/dom/bindings/element.rs
index 6f9afd3c7da..d991bc25f51 100644
--- a/src/servo/dom/bindings/element.rs
+++ b/src/servo/dom/bindings/element.rs
@@ -23,7 +23,7 @@ extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
#debug("element finalize!");
unsafe {
let val = JS_GetReservedSlot(obj, 0);
- let _node: ~NodeBundle = unsafe::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
+ let _node: ~NodeBundle = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
}
}
@@ -63,7 +63,7 @@ fn init(compartment: bare_compartment) {
extern fn HTMLImageElement_getWidth(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
-> JSBool unsafe {
- let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
+ let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}
@@ -87,7 +87,7 @@ extern fn HTMLImageElement_getWidth(cx: *JSContext, _argc: c_uint, vp: *mut jsva
extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
-> JSBool unsafe {
- let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
+ let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}
@@ -98,7 +98,7 @@ extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut jsva
~Element(ed) => {
match ed.kind {
~HTMLImageElement(img) => {
- let arg = ptr::offset(JS_ARGV(cx, unsafe::reinterpret_cast(&vp)), 0);
+ let arg = ptr::offset(JS_ARGV(cx, cast::reinterpret_cast(&vp)), 0);
img.size.width = au::from_px(RUST_JSVAL_TO_INT(*arg) as int)
},
_ => fail ~"why is this not an image element?"
@@ -113,7 +113,7 @@ extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut jsva
extern fn getTagName(cx: *JSContext, _argc: c_uint, vp: *mut jsval)
-> JSBool {
unsafe {
- let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
+ let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}
@@ -160,7 +160,7 @@ fn create(cx: *JSContext, node: Node, scope: NodeScope) -> jsobj unsafe {
unsafe {
let raw_ptr: *libc::c_void =
- unsafe::reinterpret_cast(&squirrel_away_unique(~NodeBundle(node, scope)));
+ cast::reinterpret_cast(&squirrel_away_unique(~NodeBundle(node, scope)));
JS_SetReservedSlot(obj.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
}
return obj;
diff --git a/src/servo/dom/bindings/node.rs b/src/servo/dom/bindings/node.rs
index 94d4d65036e..3731913e362 100644
--- a/src/servo/dom/bindings/node.rs
+++ b/src/servo/dom/bindings/node.rs
@@ -74,12 +74,12 @@ fn NodeBundle(n: Node, s: NodeScope) -> NodeBundle {
unsafe fn unwrap(obj: *JSObject) -> *rust_box<NodeBundle> {
let val = JS_GetReservedSlot(obj, 0);
- unsafe::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
+ cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
}
extern fn getFirstChild(cx: *JSContext, _argc: c_uint, vp: *mut jsval) -> JSBool {
unsafe {
- let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
+ let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}
@@ -102,7 +102,7 @@ extern fn getFirstChild(cx: *JSContext, _argc: c_uint, vp: *mut jsval) -> JSBool
extern fn getNextSibling(cx: *JSContext, _argc: c_uint, vp: *mut jsval) -> JSBool {
unsafe {
- let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
+ let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}
@@ -125,7 +125,7 @@ extern fn getNextSibling(cx: *JSContext, _argc: c_uint, vp: *mut jsval) -> JSBoo
extern fn getNodeType(cx: *JSContext, _argc: c_uint, vp: *mut jsval) -> JSBool {
unsafe {
- let obj = JS_THIS_OBJECT(cx, unsafe::reinterpret_cast(&vp));
+ let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
if obj.is_null() {
return 0;
}
diff --git a/src/servo/dom/bindings/utils.rs b/src/servo/dom/bindings/utils.rs
index af1036e0a0c..0ccb7386cd3 100644
--- a/src/servo/dom/bindings/utils.rs
+++ b/src/servo/dom/bindings/utils.rs
@@ -19,16 +19,16 @@ enum DOMString {
type rust_box<T> = {rc: uint, td: *sys::TypeDesc, next: *(), prev: *(), payload: T};
unsafe fn squirrel_away<T>(+x: @T) -> *rust_box<T> {
- let y: *rust_box<T> = unsafe::reinterpret_cast(&x);
- unsafe::forget(x);
+ let y: *rust_box<T> = cast::reinterpret_cast(&x);
+ cast::forget(x);
y
}
type rust_unique<T> = {payload: T};
unsafe fn squirrel_away_unique<T>(+x: ~T) -> *rust_box<T> {
- let y: *rust_box<T> = unsafe::reinterpret_cast(&x);
- unsafe::forget(x);
+ let y: *rust_box<T> = cast::reinterpret_cast(&x);
+ cast::forget(x);
y
}
@@ -63,7 +63,7 @@ unsafe fn domstring_to_jsval(cx: *JSContext, str: DOMString) -> jsval {
}
str(s) => {
str::as_buf(s, |buf, len| {
- let cbuf = unsafe::reinterpret_cast(&buf);
+ let cbuf = cast::reinterpret_cast(&buf);
RUST_STRING_TO_JSVAL(JS_NewStringCopyN(cx, cbuf, len as libc::size_t))
})
}
@@ -73,7 +73,7 @@ unsafe fn domstring_to_jsval(cx: *JSContext, str: DOMString) -> jsval {
fn get_compartment(cx: *JSContext) -> *bare_compartment {
unsafe {
let privptr: *libc::c_void = JS_GetContextPrivate(cx);
- let compartment: *bare_compartment = unsafe::reinterpret_cast(&privptr);
+ let compartment: *bare_compartment = cast::reinterpret_cast(&privptr);
assert cx == (*compartment).cx.ptr;
compartment
}
@@ -94,8 +94,8 @@ extern fn has_instance(_cx: *JSContext, obj: **JSObject, v: *jsval, bp: *mut JSB
return 1;
}
-fn prototype_jsclass(name: ~str) -> fn(bare_compartment) -> JSClass {
- |compartment: bare_compartment, copy name| {
+fn prototype_jsclass(name: ~str) -> fn(+bare_compartment) -> JSClass {
+ |+compartment: bare_compartment, copy name| {
{name: compartment.add_name(name),
flags: 0,
addProperty: GetJSClassHookStubPointer(PROPERTY_STUB) as *u8,
@@ -123,8 +123,8 @@ fn prototype_jsclass(name: ~str) -> fn(bare_compartment) -> JSClass {
}
fn instance_jsclass(name: ~str, finalize: *u8)
- -> fn(bare_compartment) -> JSClass {
- |compartment: bare_compartment, copy name| {
+ -> fn(+bare_compartment) -> JSClass {
+ |+compartment: bare_compartment, copy name| {
{name: compartment.add_name(name),
flags: JSCLASS_HAS_RESERVED_SLOTS(1),
addProperty: GetJSClassHookStubPointer(PROPERTY_STUB) as *u8,
diff --git a/src/servo/dom/bindings/window.rs b/src/servo/dom/bindings/window.rs
index bccc65599a2..0215ad38b5f 100644
--- a/src/servo/dom/bindings/window.rs
+++ b/src/servo/dom/bindings/window.rs
@@ -72,14 +72,14 @@ extern fn setTimeout(cx: *JSContext, argc: c_uint, vp: *jsval) -> JSBool unsafe
unsafe fn unwrap(obj: *JSObject) -> *rust_box<Window> {
let val = JS_GetReservedSlot(obj, 0);
- unsafe::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
+ cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
}
extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
#debug("finalize!");
unsafe {
let val = JS_GetReservedSlot(obj, 0);
- let _: @Window = unsafe::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
+ let _: @Window = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
}
}
@@ -108,7 +108,7 @@ fn init(compartment: bare_compartment, win: @Window) {
});
unsafe {
- let raw_ptr: *libc::c_void = unsafe::reinterpret_cast(&squirrel_away(win));
+ let raw_ptr: *libc::c_void = cast::reinterpret_cast(&squirrel_away(win));
JS_SetReservedSlot(obj.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
}
diff --git a/src/servo/dom/rcu.rs b/src/servo/dom/rcu.rs
index 544f166bd02..17abd6bf099 100644
--- a/src/servo/dom/rcu.rs
+++ b/src/servo/dom/rcu.rs
@@ -68,7 +68,7 @@ struct ScopeResource<T:Send,A> {
d : ScopeData<T,A>,
drop unsafe {
- for self.d.free_list.each |h| { free_handle(h); }
+ for self.d.free_list.each |h| { free_handle(*h); }
}
}
@@ -132,26 +132,26 @@ impl<T:Send,A> Handle<T,A> {
impl<T: Copy Send,A> Scope<T,A> {
fn clone(v: *T) -> *T unsafe {
let n: *mut T =
- unsafe::reinterpret_cast(&libc::calloc(sys::size_of::<T>() as size_t, 1u as size_t));
+ cast::reinterpret_cast(&libc::calloc(sys::size_of::<T>() as size_t, 1u as size_t));
// n.b.: this assignment will run the drop glue for <T,A>. *Hopefully* the fact that
// everything is initialized to NULL by calloc will make this ok. We may have to make the
// take glue be tolerant of this.
*n = unsafe{*v};
- return unsafe::reinterpret_cast(&n);
+ return cast::reinterpret_cast(&n);
}
}
unsafe fn free<T:Send>(t: *T) {
- let _x <- *unsafe::reinterpret_cast::<*T,*mut T>(&t);
- libc::free(unsafe::reinterpret_cast(&t));
+ let _x <- *cast::reinterpret_cast::<*T,*mut T>(&t);
+ libc::free(cast::reinterpret_cast(&t));
}
unsafe fn free_handle<T:Send,A>(h: Handle<T,A>) {
free(h.read_ptr());
- if h.write_ptr() != unsafe::reinterpret_cast(&h.read_ptr()) {
- free(unsafe::reinterpret_cast::<*mut T,*T>(&h.write_ptr()));
+ if h.write_ptr() != cast::reinterpret_cast(&h.read_ptr()) {
+ free(cast::reinterpret_cast::<*mut T,*T>(&h.write_ptr()));
}
}
@@ -185,7 +185,7 @@ impl<T:Copy Send,A> Scope<T,A> {
while (*handle).is_not_null() {
free(handle.read_ptr());
- handle.set_read_ptr(unsafe::reinterpret_cast(&handle.write_ptr()));
+ handle.set_read_ptr(cast::reinterpret_cast(&handle.write_ptr()));
let next_handle = handle.next_dirty();
handle.set_next_dirty(null_handle());
handle = next_handle;
@@ -207,7 +207,7 @@ impl<T:Copy Send,A> Scope<T,A> {
let const_write_ptr = ptr::const_offset(h.write_ptr(), 0);
if self.d.layout_active && const_read_ptr == const_write_ptr {
#debug["marking handle %? as dirty", h];
- h.set_write_ptr(unsafe::reinterpret_cast(&self.clone(h.read_ptr())));
+ h.set_write_ptr(cast::reinterpret_cast(&self.clone(h.read_ptr())));
h.set_next_dirty(self.d.first_dirty);
self.d.first_dirty = h;
}
@@ -217,10 +217,10 @@ impl<T:Copy Send,A> Scope<T,A> {
#[allow(non_implicitly_copyable_typarams)]
fn handle(v: T) -> Handle<T,A> unsafe {
let d: *HandleData<T,A> =
- unsafe::reinterpret_cast(
+ cast::reinterpret_cast(
&libc::malloc(sys::size_of::<HandleData<T,A>>() as size_t));
(*d).read_ptr = self.clone(ptr::addr_of(v));
- (*d).write_ptr = unsafe::reinterpret_cast(&(*d).read_ptr);
+ (*d).write_ptr = cast::reinterpret_cast(&(*d).read_ptr);
(*d).read_aux = ptr::null();
(*d).next_dirty = null_handle();
let h = _Handle(d);