Skip to content

Commit

Permalink
Fixed deprecated vector syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mmeyerho committed Jul 13, 2012
1 parent 12a05da commit 1212f3d
Show file tree
Hide file tree
Showing 28 changed files with 128 additions and 127 deletions.
4 changes: 2 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ check-rust-opengles:
$(MAKE) check -C src/rust-opengles

.PHONY: check-rust-glut
check-rust-glut:
check-rust-glut: $(GLUT_DEPS)
RUSTFLAGS="-L ../rust-opengles" $(MAKE) check -C src/rust-glut

.PHONY: check-rust-layers
check-rust-layers:
check-rust-layers: $(LAYERS_DEPS)
RUSTFLAGS="-L ../rust-geom -L ../rust-opengles -L ../rust-glut -L ../rust-azure -L ../rust-cocoa" \
$(MAKE) check -C src/rust-layers

Expand Down
2 changes: 1 addition & 1 deletion src/rust-layers
Submodule rust-layers updated 1 files
+2 −2 rendergl.rs
2 changes: 1 addition & 1 deletion src/rust-mozjs
Submodule rust-mozjs updated 5 files
+5 −5 global.rs
+1 −1 js.rc
+2 −2 js.rs
+4 −3 name_pool.rs
+4 −4 rust.rs
2 changes: 1 addition & 1 deletion src/rust-sdl
Submodule rust-sdl updated 4 files
+0 −1 sdl.rc
+15 −11 sdl.rs
+7 −7 test.rs
+3 −3 video.rs
2 changes: 1 addition & 1 deletion src/rust-stb-image
Submodule rust-stb-image updated from 2d87ae to 30f1c0
7 changes: 4 additions & 3 deletions src/servo/dom/rcu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ of the RCU nodes themselves.

import ptr::extensions;
import core::libc::types::os::arch::c95::size_t;
import vec::push;

export Handle;
export ReaderMethods;
Expand All @@ -59,7 +60,7 @@ export Scope;

type ScopeData<T:send,A> = {
mut layout_active: bool,
mut free_list: [Handle<T,A>],
mut free_list: ~[Handle<T,A>],
mut first_dirty: Handle<T,A>
};

Expand Down Expand Up @@ -159,7 +160,7 @@ fn null_handle<T:send,A>() -> Handle<T,A> {

fn Scope<T:send,A>() -> Scope<T,A> {
@ScopeResource({mut layout_active: false,
mut free_list: [],
mut free_list: ~[],
mut first_dirty: null_handle()})
}

Expand Down Expand Up @@ -219,7 +220,7 @@ impl WriterMethods<T:copy send,A> for Scope<T,A> {
(*d).read_aux = ptr::null();
(*d).next_dirty = null_handle();
let h = _Handle(d);
self.d.free_list += [h];
push(self.d.free_list, h);
ret h;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/servo/dom/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ enum Attr{
}

enum Selector{
Element(str, [Attr]),
Element(str, ~[Attr]),
Child(~Selector, ~Selector),
Descendant(~Selector, ~Selector),
Sibling(~Selector, ~Selector)
}

type Rule = ([~Selector], [StyleDeclaration]);
type Rule = (~[~Selector], ~[StyleDeclaration]);

type Stylesheet = [~Rule];
type Stylesheet = ~[~Rule];
14 changes: 7 additions & 7 deletions src/servo/gfx/pngsink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
A graphics sink that renders to PNG format buffers
Each time the renderer renders a frame the bufsink will output a
`[u8]` containing the frame in PNG format.
`~[u8]` containing the frame in PNG format.
"];

export PngSink, Msg, Exit;
Expand Down Expand Up @@ -45,7 +45,7 @@ impl PngSink of Sink for chan<Msg> {
}
}

fn PngSink(output: chan<[u8]>) -> PngSink {
fn PngSink(output: chan<~[u8]>) -> PngSink {
spawn_listener::<Msg>(|po| {
let cairo_surf = cairo_image_surface_create(
CAIRO_FORMAT_ARGB32, 800 as c_int, 600 as c_int
Expand Down Expand Up @@ -76,18 +76,18 @@ fn PngSink(output: chan<[u8]>) -> PngSink {

fn do_draw(sender: chan<AzDrawTargetRef>,
dt: AzDrawTargetRef,
output: chan<[u8]>,
output: chan<~[u8]>,
cairo_surf: *cairo_surface_t) {

listen(|data_ch: chan<[u8]>| {
listen(|data_ch: chan<~[u8]>| {

extern fn write_fn(closure: *c_void,
data: *c_uchar,
len: c_uint)

-> cairo_status_t unsafe {

let p: *chan<[u8]> = reinterpret_cast(closure);
let p: *chan<~[u8]> = reinterpret_cast(closure);
let data_ch = *p;

// Convert from *c_uchar to *u8
Expand All @@ -108,7 +108,7 @@ fn do_draw(sender: chan<AzDrawTargetRef>,
}

// Collect the entire image into a single vector
let mut result = [];
let mut result = ~[];
while data_ch.peek() {
result += data_ch.recv();
}
Expand All @@ -127,7 +127,7 @@ fn sanity_check() {
let sink = PngSink(self_channel);
let renderer = Renderer(sink);

let dlist = [];
let dlist = ~[];
renderer.send(RenderMsg(dlist));
listen(|from_renderer| {
renderer.send(renderer::ExitMsg(from_renderer));
Expand Down
2 changes: 1 addition & 1 deletion src/servo/gfx/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ enum format {
type image_surface = {
size: Size2D<int>,
format: format,
buffer: [u8]
buffer: ~[u8]
};

impl format for format {
Expand Down
22 changes: 13 additions & 9 deletions src/servo/layout/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import util::color::Color;
import text::text_box;
import style::style::computed_style;
import text::text_layout_methods;
import vec::{push, push_all};

enum BoxKind {
BlockBox,
Expand Down Expand Up @@ -171,7 +172,7 @@ mod test {
fn with_screen(f: fn(*sdl::surface)) {
let screen = video::set_video_mode(
320, 200, 32,
[video::hwsurface], [video::doublebuf]);
~[video::hwsurface], ~[video::doublebuf]);
assert screen != ptr::null();
f(screen);
Expand All @@ -180,12 +181,15 @@ mod test {
}
*/

fn flat_bounds(root: @Box) -> [Rect<au>] {
let mut r = [];
fn flat_bounds(root: @Box) -> ~[Rect<au>] {
let mut r = ~[];
for tree::each_child(BTree, root) |c| {
r += flat_bounds(c);
push_all(r, flat_bounds(c));
}
ret r + [copy root.bounds];

push(r, copy root.bounds);

ret r;
}

#[test]
Expand Down Expand Up @@ -218,10 +222,10 @@ mod test {
b3.reflow_block(au(100));
let fb = flat_bounds(b3);
#debug["fb=%?", fb];
assert fb == [geometry::box(au(0), au(0), au(10), au(10)), // n0
geometry::box(au(0), au(10), au(10), au(15)), // n1
geometry::box(au(0), au(25), au(10), au(20)), // n2
geometry::box(au(0), au(0), au(100), au(45))]; // n3
assert fb == ~[geometry::box(au(0), au(0), au(10), au(10)), // n0
geometry::box(au(0), au(10), au(10), au(15)), // n1
geometry::box(au(0), au(25), au(10), au(20)), // n2
geometry::box(au(0), au(0), au(100), au(45))]; // n3
}
}

2 changes: 1 addition & 1 deletion src/servo/layout/display_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ enum display_item = {
bounds: Rect<au>
};

type display_list = [display_item];
type display_list = ~[display_item];
35 changes: 17 additions & 18 deletions src/servo/layout/display_list_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import geom::size::Size2D;
import geom::point::Point2D;
import geom::rect::Rect;
import base::{Box, TextBox, BTree, BoxTreeReadMethods};
import vec::push;

#[doc = "
Expand Down Expand Up @@ -63,8 +64,8 @@ Creates a display list item for a single block.

"]
#[warn(no_non_implicitly_copyable_typarams)]
fn box_to_display_items(box: @Box, origin: Point2D<au>) -> [dl::display_item] {
let mut items = [];
fn box_to_display_items(box: @Box, origin: Point2D<au>) -> ~[dl::display_item] {
let mut items = ~[];
#debug("request to display a box from origin %?", origin);

Expand All @@ -74,38 +75,36 @@ fn box_to_display_items(box: @Box, origin: Point2D<au>) -> [dl::display_item] {
(TextBox(subbox), _, _) {
let run = copy subbox.run;
assert run.is_some();
items += [
dl::display_item({
item_type: dl::display_item_solid_color(255u8, 255u8, 255u8),
bounds: bounds
}),
dl::display_item({
item_type: dl::display_item_text(run.get()),
bounds: bounds
})
];
push(items, dl::display_item({
item_type: dl::display_item_solid_color(255u8, 255u8, 255u8),
bounds: bounds
}));
push(items, dl::display_item({
item_type: dl::display_item_text(run.get()),
bounds: bounds
}));
}
(_, some(image), some(*)) | (_, some(image), none) {
items += [dl::display_item({
push(items, dl::display_item({
item_type: dl::display_item_image(~copy *image),
bounds: bounds
})];
}));
}
(_, none, some(col)) {
#debug("Assigning color %? to box with bounds %?", col, bounds);
items += [dl::display_item({
push(items, dl::display_item({
item_type: dl::display_item_solid_color(col.red, col.green, col.blue),
bounds: bounds
})];
}));
}
(_, none, none) {
let r = rand::rng();
items += [dl::display_item({
push(items, dl::display_item({
item_type: dl::display_item_solid_color(r.next() as u8,
r.next() as u8,
r.next() as u8),
bounds: bounds
})];
}));
}
}

Expand Down
32 changes: 16 additions & 16 deletions src/servo/layout/style/matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ mod test {
let scope = NodeScope();
let node = new_node_from_attr(scope, "lang", "en-us");

let sel = Element("*", [StartsWith("lang", "en")]);
let sel = Element("*", ~[StartsWith("lang", "en")]);

assert node.matches_selector(~sel);
}
Expand All @@ -229,7 +229,7 @@ mod test {
let scope = NodeScope();
let node = new_node_from_attr(scope, "lang", "en");

let sel = Element("*", [StartsWith("lang", "en")]);
let sel = Element("*", ~[StartsWith("lang", "en")]);

assert node.matches_selector(~sel);
}
Expand All @@ -239,7 +239,7 @@ mod test {
let scope = NodeScope();
let node = new_node_from_attr(scope, "lang", "english");

let sel = Element("*", [StartsWith("lang", "en")]);
let sel = Element("*", ~[StartsWith("lang", "en")]);

assert !node.matches_selector(~sel);
}
Expand All @@ -249,7 +249,7 @@ mod test {
let scope = NodeScope();
let node = new_node_from_attr(scope, "mad", "hatter cobler cooper");

let sel = Element("div", [Includes("mad", "hatter")]);
let sel = Element("div", ~[Includes("mad", "hatter")]);

assert node.matches_selector(~sel);
}
Expand All @@ -259,8 +259,8 @@ mod test {
let scope = NodeScope();
let node = new_node_from_attr(scope, "mad", "hatter cobler cooper");

let sel1 = Element("div", [Exists("mad")]);
let sel2 = Element("div", [Exists("hatter")]);
let sel1 = Element("div", ~[Exists("mad")]);
let sel2 = Element("div", ~[Exists("hatter")]);

assert node.matches_selector(~sel1);
assert !node.matches_selector(~sel2);
Expand All @@ -272,7 +272,7 @@ mod test {
let node1 = new_node_from_attr(scope, "mad", "hatter cobler cooper");
let node2 = new_node_from_attr(scope, "mad", "hatter");

let sel = Element("div", [Exact("mad", "hatter")]);
let sel = Element("div", ~[Exact("mad", "hatter")]);

assert !node1.matches_selector(~copy sel);
assert node2.matches_selector(~sel);
Expand All @@ -295,8 +295,8 @@ mod test {
scope.add_child(gchild, ggchild);
scope.add_child(ggchild, gggchild);

let sel1 = Descendant(~Element("*", [Exact("class", "blue")]),
~Element("*", []));
let sel1 = Descendant(~Element("*", ~[Exact("class", "blue")]),
~Element("*", ~[]));

assert !root.matches_selector(~copy sel1);
assert child1.matches_selector(~copy sel1);
Expand All @@ -305,9 +305,9 @@ mod test {
assert ggchild.matches_selector(~copy sel1);
assert gggchild.matches_selector(~sel1);

let sel2 = Descendant(~Child(~Element("*", [Exact("class", "blue")]),
~Element("*", [])),
~Element("div", [Exists("flag")]));
let sel2 = Descendant(~Child(~Element("*", ~[Exact("class", "blue")]),
~Element("*", ~[])),
~Element("div", ~[Exists("flag")]));

assert !root.matches_selector(~copy sel2);
assert !child1.matches_selector(~copy sel2);
Expand All @@ -316,7 +316,7 @@ mod test {
assert ggchild.matches_selector(~copy sel2);
assert gggchild.matches_selector(~sel2);

let sel3 = Sibling(~Element("*", []), ~Element("*", []));
let sel3 = Sibling(~Element("*", ~[]), ~Element("*", ~[]));

assert !root.matches_selector(~copy sel3);
assert child1.matches_selector(~copy sel3);
Expand All @@ -325,9 +325,9 @@ mod test {
assert !ggchild.matches_selector(~copy sel3);
assert !gggchild.matches_selector(~sel3);

let sel4 = Descendant(~Child(~Element("*", [Exists("class")]),
~Element("*", [])),
~Element("*", []));
let sel4 = Descendant(~Child(~Element("*", ~[Exists("class")]),
~Element("*", ~[])),
~Element("*", ~[]));

assert !root.matches_selector(~copy sel4);
assert !child1.matches_selector(~copy sel4);
Expand Down
2 changes: 1 addition & 1 deletion src/servo/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import uri::uri;

iface input_stream {
fn close();
fn read() -> [u8];
fn read() -> ~[u8];
}

iface channel {
Expand Down
Loading

0 comments on commit 1212f3d

Please sign in to comment.