aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-09-20 15:04:00 -0700
committerPatrick Walton <pcwalton@mimiga.net>2012-09-20 15:04:00 -0700
commitff6cefb798246cd82d603b7bce89280812affe3c (patch)
tree434554e74fa510033457ba82cef3118553aaf7ca
parentf3a8253bc8728e67f88334ef0c7d4b0590557d28 (diff)
downloadservo-ff6cefb798246cd82d603b7bce89280812affe3c.tar.gz
servo-ff6cefb798246cd82d603b7bce89280812affe3c.zip
Update for language changes
m---------src/rust-azure0
m---------src/rust-core-foundation0
m---------src/rust-geom0
m---------src/rust-http-client0
m---------src/rust-hubbub0
m---------src/rust-layers0
m---------src/rust-mozjs0
-rw-r--r--src/servo/content/content_task.rs2
-rw-r--r--src/servo/css/resolve/matching.rs6
-rw-r--r--src/servo/css/values.rs68
-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
-rw-r--r--src/servo/gfx/display_list.rs6
-rw-r--r--src/servo/gfx/geometry.rs12
-rw-r--r--src/servo/gfx/png_compositor.rs8
-rw-r--r--src/servo/gfx/surface.rs6
-rw-r--r--src/servo/html/hubbub_html_parser.rs2
-rw-r--r--src/servo/html/lexer_util.rs6
-rw-r--r--src/servo/layout/base.rs6
-rw-r--r--src/servo/layout/block.rs8
-rw-r--r--src/servo/layout/box_builder.rs2
-rw-r--r--src/servo/layout/inline.rs2
-rw-r--r--src/servo/layout/traverse_parallel.rs4
-rw-r--r--src/servo/resource/image_cache_task.rs10
-rw-r--r--src/servo/resource/resource_task.rs8
-rwxr-xr-xsrc/servo/servo.rc2
-rw-r--r--src/servo/servo.rs2
-rw-r--r--src/servo/text/native_font/ft_native_font.rs2
-rw-r--r--src/servo/text/native_font/quartz_native_font.rs2
-rw-r--r--src/servo/text/shaper.rs2
-rw-r--r--src/servo/util/color.rs4
35 files changed, 125 insertions, 123 deletions
diff --git a/src/rust-azure b/src/rust-azure
-Subproject 7ecba6aa7afd69ad970b2a041367a295d830799
+Subproject 0b520a6caf17b05d25db0026431873ae3f86a45
diff --git a/src/rust-core-foundation b/src/rust-core-foundation
-Subproject ac7115cc7e1dd26b629c289fa527e5d40aa07d2
+Subproject be4e26b2c76bf7706f4da479cf06bf46094f056
diff --git a/src/rust-geom b/src/rust-geom
-Subproject 01de30b15bfb3ecdfb921b7571ff98e63c0d448
+Subproject 5dea272fc5f6a9b3812a845d003724d1bcdaf0b
diff --git a/src/rust-http-client b/src/rust-http-client
-Subproject 402d663658c6f10da2769fa9cbd406160bc89e6
+Subproject 28857cda6e86d4da58cb0e25206b7def6bd8753
diff --git a/src/rust-hubbub b/src/rust-hubbub
-Subproject 425d4598525f43de331c017f0c8408954dcbd66
+Subproject b1184364a73b2269b29897466d984aeb5d6e464
diff --git a/src/rust-layers b/src/rust-layers
-Subproject 4ff373b328f646d1ff1c9e67337bd284ff0fddd
+Subproject 9223fe2a99ec5c76dc98a98ca99a10ff3513a84
diff --git a/src/rust-mozjs b/src/rust-mozjs
-Subproject de66662c301b2c00dacabdf0d82adf22d16232b
+Subproject a4ef0a56c990d979fa34fed93293c305a03f67c
diff --git a/src/servo/content/content_task.rs b/src/servo/content/content_task.rs
index c74ccae58b6..46db1fbb6f5 100644
--- a/src/servo/content/content_task.rs
+++ b/src/servo/content/content_task.rs
@@ -189,7 +189,7 @@ impl<C:Compositor> Content<C> {
option::get(self.window));
for vec::each(js_scripts) |bytes| {
- self.cx.evaluate_script(compartment.global_obj, bytes, ~"???", 1u);
+ self.cx.evaluate_script(compartment.global_obj, *bytes, ~"???", 1u);
}
return true;
diff --git a/src/servo/css/resolve/matching.rs b/src/servo/css/resolve/matching.rs
index 7846212403e..fc49240e23f 100644
--- a/src/servo/css/resolve/matching.rs
+++ b/src/servo/css/resolve/matching.rs
@@ -192,11 +192,11 @@ impl Node : MatchingMethods {
// information as we go.
for styles.each |sty| {
- let (selectors, decls) = copy *sty;
+ let (selectors, decls) = copy **sty;
for selectors.each |sel| {
- if self.matches_selector(sel) {
+ if self.matches_selector(*sel) {
for decls.each |decl| {
- self.update_style(decl);
+ self.update_style(*decl);
}
}
}
diff --git a/src/servo/css/values.rs b/src/servo/css/values.rs
index 085482c2e05..feabbca6b62 100644
--- a/src/servo/css/values.rs
+++ b/src/servo/css/values.rs
@@ -36,15 +36,15 @@ pure fn extract<T : Copy, U>(res: ParseResult<T>, f: fn(CSSValue<T>) -> U) -> Op
}
impl<T: Eq Copy> CSSValue<T> : Eq {
- pure fn eq(&&other: CSSValue<T>) -> bool {
- match (self, other) {
+ pure fn eq(other: &CSSValue<T>) -> bool {
+ match (self, *other) {
(Initial, Initial) => true,
(Inherit, Inherit) => true,
(Specified(a), Specified(b)) => a == b,
_ => false
}
}
- pure fn ne(&&other: CSSValue<T>) -> bool {
+ pure fn ne(other: &CSSValue<T>) -> bool {
return !self.eq(other);
}
}
@@ -182,46 +182,46 @@ type Stylesheet = ~[~Rule];
impl Length: cmp::Eq {
- pure fn eq(&&other: Length) -> bool {
- match (self, other) {
+ pure fn eq(other: &Length) -> bool {
+ match (self, *other) {
(Em(a), Em(b)) => a == b,
(Px(a), Px(b)) => a == b,
(_, _) => false
}
}
- pure fn ne(&&other: Length) -> bool {
+ pure fn ne(other: &Length) -> bool {
return !self.eq(other);
}
}
impl BoxSizing: cmp::Eq {
- pure fn eq(&&other: BoxSizing) -> bool {
- match (self, other) {
+ pure fn eq(other: &BoxSizing) -> bool {
+ match (self, *other) {
(BoxLength(a), BoxLength(b)) => a == b,
(BoxPercent(a), BoxPercent(b)) => a == b,
(BoxAuto, BoxAuto) => true,
(_, _) => false
}
}
- pure fn ne(&&other: BoxSizing) -> bool {
+ pure fn ne(other: &BoxSizing) -> bool {
return !self.eq(other);
}
}
impl AbsoluteSize: cmp::Eq {
- pure fn eq(&&other: AbsoluteSize) -> bool {
- self as uint == other as uint
+ pure fn eq(other: &AbsoluteSize) -> bool {
+ self as uint == (*other) as uint
}
- pure fn ne(&&other: AbsoluteSize) -> bool {
+ pure fn ne(other: &AbsoluteSize) -> bool {
return !self.eq(other);
}
}
impl RelativeSize: cmp::Eq {
- pure fn eq(&&other: RelativeSize) -> bool {
- self as uint == other as uint
+ pure fn eq(other: &RelativeSize) -> bool {
+ self as uint == (*other) as uint
}
- pure fn ne(&&other: RelativeSize) -> bool {
+ pure fn ne(other: &RelativeSize) -> bool {
return !self.eq(other);
}
}
@@ -229,43 +229,43 @@ impl RelativeSize: cmp::Eq {
impl CSSBackgroundColor: cmp::Eq {
- pure fn eq(&&other: CSSBackgroundColor) -> bool {
- match (self, other) {
+ pure fn eq(other: &CSSBackgroundColor) -> bool {
+ match (self, *other) {
(BgColor(a), BgColor(b)) => a == b,
(BgTransparent, BgTransparent) => true,
(_, _) => false
}
}
- pure fn ne(&&other: CSSBackgroundColor) -> bool {
+ pure fn ne(other: &CSSBackgroundColor) -> bool {
return !self.eq(other);
}
}
impl CSSColor: cmp::Eq {
- pure fn eq(&&other: CSSColor) -> bool {
- match (self, other) {
+ pure fn eq(other: &CSSColor) -> bool {
+ match (self, *other) {
(TextColor(a), TextColor(b)) => a == b
}
}
- pure fn ne(&&other: CSSColor) -> bool {
+ pure fn ne(other: &CSSColor) -> bool {
return !self.eq(other);
}
}
impl CSSDisplay: cmp::Eq {
- pure fn eq(&&other: CSSDisplay) -> bool {
- self as uint == other as uint
+ pure fn eq(other: &CSSDisplay) -> bool {
+ self as uint == (*other) as uint
}
- pure fn ne(&&other: CSSDisplay) -> bool {
+ pure fn ne(other: &CSSDisplay) -> bool {
return !self.eq(other);
}
}
impl CSSFontSize: cmp::Eq {
- pure fn eq(&&other: CSSFontSize) -> bool {
- match (self, other) {
+ pure fn eq(other: &CSSFontSize) -> bool {
+ match (self, *other) {
(AbsoluteSize(a), AbsoluteSize(b)) => a == b,
(RelativeSize(a), RelativeSize(b)) => a == b,
(LengthSize(a), LengthSize(b)) => a == b,
@@ -273,7 +273,7 @@ impl CSSFontSize: cmp::Eq {
(_, _) => false
}
}
- pure fn ne(&&other: CSSFontSize) -> bool {
+ pure fn ne(other: &CSSFontSize) -> bool {
return !self.eq(other);
}
}
@@ -299,8 +299,8 @@ impl StyleDeclaration: cmp::Eq {
}*/
impl Attr: cmp::Eq {
- pure fn eq(&&other: Attr) -> bool {
- match (copy self, copy other) {
+ pure fn eq(other: &Attr) -> bool {
+ match (copy self, copy *other) {
(Exists(a), Exists(b)) => a == b,
(Exact(a, aa), Exact(b, bb))
@@ -313,15 +313,15 @@ impl Attr: cmp::Eq {
| (StartsWith(*), _) => false
}
}
- pure fn ne(&&other: Attr) -> bool {
+ pure fn ne(other: &Attr) -> bool {
return !self.eq(other);
}
}
impl Selector: cmp::Eq {
- pure fn eq(&&other: Selector) -> bool {
+ pure fn eq(other: &Selector) -> bool {
// FIXME: Lots of copying here
- match (copy self, copy other) {
+ match (copy self, copy *other) {
(Element(s_a, attrs_a), Element(s_b, attrs_b)) => s_a == s_b && attrs_a == attrs_b,
(Child(s1a, s2a), Child(s1b, s2b))
@@ -336,7 +336,7 @@ impl Selector: cmp::Eq {
(Sibling(*), _) => false
}
}
- pure fn ne(&&other: Selector) -> bool {
+ pure fn ne(other: &Selector) -> bool {
return !self.eq(other);
}
-} \ No newline at end of file
+}
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);
diff --git a/src/servo/gfx/display_list.rs b/src/servo/gfx/display_list.rs
index 29fa62f8bfa..916fc1d58d9 100644
--- a/src/servo/gfx/display_list.rs
+++ b/src/servo/gfx/display_list.rs
@@ -90,8 +90,8 @@ trait DisplayListMethods {
impl DisplayList : DisplayListMethods {
fn draw(ctx: &RenderContext) {
for self.each |item| {
- debug!("drawing %?", item);
- item.draw(item, ctx);
+ debug!("drawing %?", *item);
+ item.draw(*item, ctx);
}
}
-} \ No newline at end of file
+}
diff --git a/src/servo/gfx/geometry.rs b/src/servo/gfx/geometry.rs
index 4b9292d3701..b498c236574 100644
--- a/src/servo/gfx/geometry.rs
+++ b/src/servo/gfx/geometry.rs
@@ -21,15 +21,15 @@ impl au : Num {
}
impl au : cmp::Ord {
- pure fn lt(&&other: au) -> bool { *self < *other }
- pure fn le(&&other: au) -> bool { *self <= *other }
- pure fn ge(&&other: au) -> bool { *self >= *other }
- pure fn gt(&&other: au) -> bool { *self > *other }
+ pure fn lt(other: &au) -> bool { *self < **other }
+ pure fn le(other: &au) -> bool { *self <= **other }
+ pure fn ge(other: &au) -> bool { *self >= **other }
+ pure fn gt(other: &au) -> bool { *self > **other }
}
impl au : cmp::Eq {
- pure fn eq(&&other: au) -> bool { *self == *other }
- pure fn ne(&&other: au) -> bool { *self != *other }
+ pure fn eq(other: &au) -> bool { *self == **other }
+ pure fn ne(other: &au) -> bool { *self != **other }
}
pure fn min(x: au, y: au) -> au { if x < y { x } else { y } }
diff --git a/src/servo/gfx/png_compositor.rs b/src/servo/gfx/png_compositor.rs
index 2e80cac7a9c..2fd89948765 100644
--- a/src/servo/gfx/png_compositor.rs
+++ b/src/servo/gfx/png_compositor.rs
@@ -19,13 +19,14 @@ use compositor::Compositor;
use render_task::{RenderTask, RenderMsg};
use task::spawn_listener;
use comm::{Chan, Port};
-use unsafe::reinterpret_cast;
+use cast::reinterpret_cast;
use vec_from_buf = vec::raw::from_buf;
use ptr::addr_of;
use dom::event::Event;
use dvec::DVec;
use display_list::DisplayList;
use std::cell::Cell;
+use core::io::BytesWriter;
pub type PngCompositor = Chan<Msg>;
@@ -72,10 +73,9 @@ fn do_draw(sender: pipes::Chan<DrawTarget>,
+dt: DrawTarget,
output: Chan<~[u8]>,
cairo_surface: ImageSurface) {
- let buffer = io::mem_buffer();
+ let buffer = BytesWriter();
cairo_surface.write_to_png_stream(&buffer);
- let @{ buf: buffer, pos: _ } <- buffer;
- output.send(dvec::unwrap(move buffer));
+ output.send(buffer.buf.get());
// Send the next draw target to the renderer
sender.send(move dt);
diff --git a/src/servo/gfx/surface.rs b/src/servo/gfx/surface.rs
index a5212d03791..030522adbe8 100644
--- a/src/servo/gfx/surface.rs
+++ b/src/servo/gfx/surface.rs
@@ -6,12 +6,12 @@ enum format {
}
impl format: cmp::Eq {
- pure fn eq(&&other: format) -> bool {
- match (self, other) {
+ pure fn eq(other: &format) -> bool {
+ match (self, *other) {
(fo_rgba_8888, fo_rgba_8888) => true,
}
}
- pure fn ne(&&other: format) -> bool {
+ pure fn ne(other: &format) -> bool {
return !self.eq(other);
}
}
diff --git a/src/servo/html/hubbub_html_parser.rs b/src/servo/html/hubbub_html_parser.rs
index 0846540b622..8c366e94109 100644
--- a/src/servo/html/hubbub_html_parser.rs
+++ b/src/servo/html/hubbub_html_parser.rs
@@ -14,7 +14,7 @@ use JSMessage = html::dom_builder::js_message;
use comm::{Chan, Port};
use str::from_slice;
-use unsafe::reinterpret_cast;
+use cast::reinterpret_cast;
use std::net::url::Url;
type JSResult = ~[~[u8]];
diff --git a/src/servo/html/lexer_util.rs b/src/servo/html/lexer_util.rs
index 4f99f5b6441..0e54d0836fd 100644
--- a/src/servo/html/lexer_util.rs
+++ b/src/servo/html/lexer_util.rs
@@ -12,14 +12,14 @@ enum CharOrEof {
}
impl CharOrEof: cmp::Eq {
- pure fn eq(&&other: CharOrEof) -> bool {
- match (self, other) {
+ pure fn eq(other: &CharOrEof) -> bool {
+ match (self, *other) {
(CoeChar(a), CoeChar(b)) => a == b,
(CoeChar(*), _) | (_, CoeChar(*)) => false,
(CoeEof, CoeEof) => true,
}
}
- pure fn ne(&&other: CharOrEof) -> bool {
+ pure fn ne(other: &CharOrEof) -> bool {
return !self.eq(other);
}
}
diff --git a/src/servo/layout/base.rs b/src/servo/layout/base.rs
index 1bde59b569b..b8a810a3d13 100644
--- a/src/servo/layout/base.rs
+++ b/src/servo/layout/base.rs
@@ -137,8 +137,8 @@ fn FlowContext(id: int, kind: FlowContextData, tree: tree::Tree<@FlowContext>) -
}
impl @FlowContext : cmp::Eq {
- pure fn eq(&&other: @FlowContext) -> bool { box::ptr_eq(self, other) }
- pure fn ne(&&other: @FlowContext) -> bool { !box::ptr_eq(self, other) }
+ pure fn eq(other: &@FlowContext) -> bool { box::ptr_eq(self, *other) }
+ pure fn ne(other: &@FlowContext) -> bool { !box::ptr_eq(self, *other) }
}
@@ -387,7 +387,7 @@ impl @RenderBox {
bounds.size.height = runs[i].size().height;
let glyph_run = make_glyph_run(&runs[i]);
list.push(~dl::Glyphs(bounds, glyph_run));
- bounds.origin.y += bounds.size.height;
+ bounds.origin.y = bounds.origin.y.add(bounds.size.height);
}
return;
diff --git a/src/servo/layout/block.rs b/src/servo/layout/block.rs
index 38203596b68..76ea82f1749 100644
--- a/src/servo/layout/block.rs
+++ b/src/servo/layout/block.rs
@@ -94,8 +94,8 @@ impl @FlowContext : BlockLayout {
/* if not an anonymous block context, add in block box's widths.
these widths will not include child elements, just padding etc. */
do self.with_block_box |box| {
- min_width += box.get_min_width();
- pref_width += box.get_pref_width();
+ min_width = min_width.add(box.get_min_width());
+ pref_width = pref_width.add(box.get_pref_width());
}
self.data.min_width = min_width;
@@ -121,7 +121,7 @@ impl @FlowContext : BlockLayout {
do self.with_block_box |box| {
box.data.position.size.width = remaining_width;
let (left_used, right_used) = box.get_used_width();
- remaining_width -= (left_used + right_used);
+ remaining_width = remaining_width.sub(left_used.add(right_used));
}
for FlowTree.each_child(self) |child_ctx| {
@@ -138,7 +138,7 @@ impl @FlowContext : BlockLayout {
for FlowTree.each_child(self) |child_ctx| {
child_ctx.data.position.origin.y = cur_y;
- cur_y += child_ctx.data.position.size.height;
+ cur_y = cur_y.add(child_ctx.data.position.size.height);
}
self.data.position.size.height = cur_y;
diff --git a/src/servo/layout/box_builder.rs b/src/servo/layout/box_builder.rs
index 8d6048f883a..4f6ea1be285 100644
--- a/src/servo/layout/box_builder.rs
+++ b/src/servo/layout/box_builder.rs
@@ -111,7 +111,7 @@ impl LayoutTreeBuilder {
debug!("Adding child box b%? of b%?", parent_box.id, new_box.id);
RenderBoxTree.add_child(parent_box, new_box);
- if (!next_ctx.eq(parent_ctx)) {
+ if (!next_ctx.eq(&parent_ctx)) {
debug!("Adding child flow f%? of f%?", parent_ctx.id, next_ctx.id);
FlowTree.add_child(parent_ctx, next_ctx);
}
diff --git a/src/servo/layout/inline.rs b/src/servo/layout/inline.rs
index fe1e2527fdb..e11dced4a67 100644
--- a/src/servo/layout/inline.rs
+++ b/src/servo/layout/inline.rs
@@ -123,7 +123,7 @@ impl @FlowContext : InlineLayout {
};
box.data.position.origin = Point2D(au(0), cur_y);
- cur_y += au::max(line_height, box.data.position.size.height);
+ cur_y = cur_y.add(au::max(line_height, box.data.position.size.height));
} // for boxes.each |box|
}
diff --git a/src/servo/layout/traverse_parallel.rs b/src/servo/layout/traverse_parallel.rs
index 802604242f7..bde84aa05b8 100644
--- a/src/servo/layout/traverse_parallel.rs
+++ b/src/servo/layout/traverse_parallel.rs
@@ -23,13 +23,13 @@ type shared_box<T> = {
#[doc="Transform and @ into its underlying representation. The reference count stays constant."]
fn unwrap_box(-b : @RenderBox) -> *shared_box<RenderBox> unsafe {
- let new_box : *shared_box<RenderBox> = unsafe::transmute(b);
+ let new_box : *shared_box<RenderBox> = cast::transmute(b);
return new_box;
}
#[doc="Transform an underlying representation back to an @. The reference count stays constant."]
fn rewrap_box(-b : *shared_box<RenderBox>) -> @RenderBox unsafe {
- let new_box : @RenderBox = unsafe::transmute(b);
+ let new_box : @RenderBox = cast::transmute(b);
return new_box;
}
diff --git a/src/servo/resource/image_cache_task.rs b/src/servo/resource/image_cache_task.rs
index feec4f02f00..953a089917e 100644
--- a/src/servo/resource/image_cache_task.rs
+++ b/src/servo/resource/image_cache_task.rs
@@ -53,7 +53,7 @@ pub enum ImageResponseMsg {
impl ImageResponseMsg {
pure fn clone() -> ImageResponseMsg {
match self {
- ImageReady(img) => ImageReady(unchecked { clone_arc(&img) }),
+ ImageReady(img) => ImageReady(unsafe { clone_arc(&img) }),
ImageNotReady => ImageNotReady,
ImageFailed => ImageFailed
}
@@ -61,7 +61,7 @@ impl ImageResponseMsg {
}
impl ImageResponseMsg: cmp::Eq {
- pure fn eq(&&other: ImageResponseMsg) -> bool {
+ pure fn eq(other: &ImageResponseMsg) -> bool {
// FIXME: Bad copies
match (self.clone(), other.clone()) {
(ImageReady(*), ImageReady(*)) => fail ~"unimplemented comparison",
@@ -73,7 +73,7 @@ impl ImageResponseMsg: cmp::Eq {
| (ImageFailed, _) => false
}
}
- pure fn ne(&&other: ImageResponseMsg) -> bool {
+ pure fn ne(other: &ImageResponseMsg) -> bool {
return !self.eq(other);
}
}
@@ -160,7 +160,7 @@ impl ImageCache {
loop {
let msg = self.from_client.recv();
- for msg_handlers.each |handler| { handler(&msg) }
+ for msg_handlers.each |handler| { (*handler)(&msg) }
#debug("image_cache_task: received: %?", msg);
@@ -1093,4 +1093,4 @@ fn sync_cache_should_wait_for_images() {
image_cache_task.exit();
mock_resource_task.send(resource_task::Exit);
-} \ No newline at end of file
+}
diff --git a/src/servo/resource/resource_task.rs b/src/servo/resource/resource_task.rs
index 6ff0cddb0b6..65c45b0d025 100644
--- a/src/servo/resource/resource_task.rs
+++ b/src/servo/resource/resource_task.rs
@@ -28,8 +28,8 @@ enum ProgressMsg {
}
impl ProgressMsg: cmp::Eq {
- pure fn eq(&&other: ProgressMsg) -> bool {
- match (copy self, copy other) {
+ pure fn eq(other: &ProgressMsg) -> bool {
+ match (copy self, copy *other) {
(Payload(a), Payload(b)) => a == b,
(Done(a), Done(b)) => a == b,
@@ -37,7 +37,7 @@ impl ProgressMsg: cmp::Eq {
| (Done(*), _) => false
}
}
- pure fn ne(&&other: ProgressMsg) -> bool {
+ pure fn ne(other: &ProgressMsg) -> bool {
return !self.eq(other);
}
}
@@ -115,7 +115,7 @@ impl ResourceManager {
fn get_loader_factory(url: Url) -> Option<LoaderTaskFactory> {
for self.loaders.each |scheme_loader| {
- let (scheme, loader_factory) = copy scheme_loader;
+ let (scheme, loader_factory) = copy *scheme_loader;
if scheme == url.scheme {
return Some(loader_factory);
}
diff --git a/src/servo/servo.rc b/src/servo/servo.rc
index 3ebaca479fd..559dbca4ac2 100755
--- a/src/servo/servo.rc
+++ b/src/servo/servo.rc
@@ -7,6 +7,8 @@
#[license = "MPL"];
#[crate_type = "lib"];
+#[legacy_modes];
+
extern mod std;
extern mod azure;
extern mod js;
diff --git a/src/servo/servo.rs b/src/servo/servo.rs
index f69000237ab..b8e1b4e98a1 100644
--- a/src/servo/servo.rs
+++ b/src/servo/servo.rs
@@ -41,7 +41,7 @@ fn run_pipeline_screen(urls: ~[~str]) {
let mut engine_task = Some(EngineTask(osmain));
for urls.each |filename| {
- let url = make_url(filename, None);
+ let url = make_url(*filename, None);
#debug["master: Sending url `%s`", url_to_str(copy url)];
engine_task =
Some(EngineProto::client::LoadURL(swap_unwrap(&mut engine_task),
diff --git a/src/servo/text/native_font/ft_native_font.rs b/src/servo/text/native_font/ft_native_font.rs
index a78bc8d89b5..84115583a22 100644
--- a/src/servo/text/native_font/ft_native_font.rs
+++ b/src/servo/text/native_font/ft_native_font.rs
@@ -2,7 +2,7 @@ export FreeTypeNativeFont, with_test_native_font, create;
use vec_as_buf = vec::as_imm_buf;
use ptr::{addr_of, null};
-use unsafe::reinterpret_cast;
+use cast::reinterpret_cast;
use glyph::GlyphIndex;
use font::FontMetrics;
use azure::freetype;
diff --git a/src/servo/text/native_font/quartz_native_font.rs b/src/servo/text/native_font/quartz_native_font.rs
index 237b2bc7325..0e5f9a260df 100644
--- a/src/servo/text/native_font/quartz_native_font.rs
+++ b/src/servo/text/native_font/quartz_native_font.rs
@@ -17,7 +17,7 @@ use cocoa::cg::cg::{
CGFontCreateWithDataProvider,
CGFontRelease
};
-use unsafe::transmute;
+use cast::transmute;
use coretext::CTFontRef;
use coretext::coretext::CFRelease;
diff --git a/src/servo/text/shaper.rs b/src/servo/text/shaper.rs
index 13735f553fd..7f3367f58b6 100644
--- a/src/servo/text/shaper.rs
+++ b/src/servo/text/shaper.rs
@@ -12,7 +12,7 @@ use gfx::geometry::au;
use geom::point::Point2D;
use font_cache::FontCache;
-use unsafe::reinterpret_cast;
+use cast::reinterpret_cast;
use harfbuzz::{HB_MEMORY_MODE_READONLY,
HB_DIRECTION_LTR};
use harfbuzz::{hb_blob_t, hb_face_t, hb_font_t, hb_buffer_t,
diff --git a/src/servo/util/color.rs b/src/servo/util/color.rs
index 8449346c8c0..51526d33a34 100644
--- a/src/servo/util/color.rs
+++ b/src/servo/util/color.rs
@@ -12,11 +12,11 @@ use cmp::Eq;
enum Color = {red : u8, green : u8, blue : u8, alpha : float};
impl Color : Eq {
- pure fn eq(&&other: Color) -> bool {
+ pure fn eq(other: &Color) -> bool {
return self.red == other.red && self.green == other.green && self.blue == other.blue &&
self.alpha == other.alpha;
}
- pure fn ne(&&other: Color) -> bool {
+ pure fn ne(other: &Color) -> bool {
!self.eq(other)
}
}