Eliminate more warnings

This commit is contained in:
Brian Anderson 2012-10-09 11:36:33 -07:00
parent ed4db46505
commit 6c3bab5ba1
8 changed files with 19 additions and 18 deletions

View file

@ -5,7 +5,8 @@ use geom::rect::Rect;
use image::base::Image; use image::base::Image;
use render_task::RenderContext; use render_task::RenderContext;
use std::arc::{ARC, clone}; use std::arc::ARC;
use clone_arc = std::arc::clone;
use dvec::DVec; use dvec::DVec;
use text::text_run::TextRun; use text::text_run::TextRun;
@ -43,7 +44,7 @@ fn draw_Text(self: &DisplayItem, ctx: &RenderContext) {
fn draw_Image(self: &DisplayItem, ctx: &RenderContext) { fn draw_Image(self: &DisplayItem, ctx: &RenderContext) {
match self.data { match self.data {
ImageData(img) => draw_image(ctx, self.bounds, img), ImageData(ref img) => draw_image(ctx, self.bounds, clone_arc(img)),
_ => fail _ => fail
} }
} }
@ -56,7 +57,7 @@ pub fn SolidColor(bounds: Rect<au>, r: u8, g: u8, b: u8) -> DisplayItem {
} }
} }
pub fn Text(bounds: Rect<au>, run: ~TextRun, offset: uint, length: uint) -> DisplayItem { pub fn Text(bounds: Rect<au>, +run: ~TextRun, offset: uint, length: uint) -> DisplayItem {
DisplayItem { DisplayItem {
draw: |self, ctx| draw_Text(self, ctx), draw: |self, ctx| draw_Text(self, ctx),
bounds: bounds, bounds: bounds,
@ -65,11 +66,11 @@ pub fn Text(bounds: Rect<au>, run: ~TextRun, offset: uint, length: uint) -> Disp
} }
// ARC should be cloned into ImageData, but Images are not sendable // ARC should be cloned into ImageData, but Images are not sendable
pub fn Image(bounds: Rect<au>, image: ARC<~image::base::Image>) -> DisplayItem { pub fn Image(bounds: Rect<au>, +image: ARC<~image::base::Image>) -> DisplayItem {
DisplayItem { DisplayItem {
draw: |self, ctx| draw_Image(self, ctx), draw: |self, ctx| draw_Image(self, ctx),
bounds: bounds, bounds: bounds,
data: ImageData(clone(&image)) data: ImageData(image)
} }
} }

View file

@ -35,7 +35,7 @@ impl au : cmp::Eq {
pub pure fn min(x: au, y: au) -> au { if x < y { x } else { y } } pub pure fn min(x: au, y: au) -> au { if x < y { x } else { y } }
pub pure fn max(x: au, y: au) -> au { if x > y { x } else { y } } pub pure fn max(x: au, y: au) -> au { if x > y { x } else { y } }
pub fn box<A:Copy Num>(x: A, y: A, w: A, h: A) -> Rect<A> { pub fn box<A:Copy Num>(+x: A, +y: A, +w: A, +h: A) -> Rect<A> {
Rect(Point2D(x, y), Size2D(w, h)) Rect(Point2D(x, y), Size2D(w, h))
} }

View file

@ -59,9 +59,9 @@ pub fn PngCompositor(output: Chan<~[u8]>) -> PngCompositor {
debug!("png_compositor: begin_drawing"); debug!("png_compositor: begin_drawing");
sender.send(draw_target.take()); sender.send(draw_target.take());
} }
Draw(sender, dt) => { Draw(move sender, move dt) => {
debug!("png_compositor: draw"); debug!("png_compositor: draw");
do_draw(sender, dt.clone(), output, cairo_surface); do_draw(sender, dt, output, &cairo_surface);
} }
Exit => break Exit => break
} }
@ -69,10 +69,10 @@ pub fn PngCompositor(output: Chan<~[u8]>) -> PngCompositor {
} }
} }
fn do_draw(sender: pipes::Chan<DrawTarget>, fn do_draw(+sender: pipes::Chan<DrawTarget>,
+dt: DrawTarget, +dt: DrawTarget,
output: Chan<~[u8]>, output: Chan<~[u8]>,
cairo_surface: ImageSurface) { cairo_surface: &ImageSurface) {
let buffer = BytesWriter(); let buffer = BytesWriter();
cairo_surface.write_to_png_stream(&buffer); cairo_surface.write_to_png_stream(&buffer);
output.send(buffer.buf.get()); output.send(buffer.buf.get());

View file

@ -120,7 +120,7 @@ pub fn draw_solid_color(ctx: &RenderContext, bounds: &Rect<au>, r: u8, g: u8, b:
ctx.canvas.fill_rect(&bounds.to_azure_rect(), &ColorPattern(color)); ctx.canvas.fill_rect(&bounds.to_azure_rect(), &ColorPattern(color));
} }
pub fn draw_image(ctx: &RenderContext, bounds: Rect<au>, image: ARC<~Image>) { pub fn draw_image(ctx: &RenderContext, bounds: Rect<au>, +image: ARC<~Image>) {
let image = std::arc::get(&image); let image = std::arc::get(&image);
let size = Size2D(image.width as i32, image.height as i32); let size = Size2D(image.width as i32, image.height as i32);
let stride = image.width * 4; let stride = image.width * 4;

View file

@ -50,10 +50,10 @@ impl u8 : U8Methods {
trait InputStateUtil { trait InputStateUtil {
fn get() -> CharOrEof; fn get() -> CharOrEof;
fn unget(ch: u8); fn unget(ch: u8);
fn parse_err(err: ~str) -> !; fn parse_err(+err: ~str) -> !;
fn expect(ch: u8); fn expect(ch: u8);
fn parse_ident() -> ~str; fn parse_ident() -> ~str;
fn expect_ident(expected: ~str); fn expect_ident(+expected: ~str);
fn eat_whitespace(); fn eat_whitespace();
} }
@ -98,7 +98,7 @@ impl InputState : InputStateUtil {
self.lookahead = Some(CoeChar(ch)); self.lookahead = Some(CoeChar(ch));
} }
fn parse_err(err: ~str) -> ! { fn parse_err(+err: ~str) -> ! {
fail err fail err
} }
@ -129,7 +129,7 @@ impl InputState : InputStateUtil {
return str::from_bytes(result); return str::from_bytes(result);
} }
fn expect_ident(expected: ~str) { fn expect_ident(+expected: ~str) {
let actual = self.parse_ident(); let actual = self.parse_ident();
if expected != actual { if expected != actual {
self.parse_err(#fmt("expected '%s' but found '%s'", expected, actual)); self.parse_err(#fmt("expected '%s' but found '%s'", expected, actual));

View file

@ -1,7 +1,7 @@
use gfx::surface; use gfx::surface;
use io::WriterUtil; use io::WriterUtil;
fn encode(writer: io::Writer, surface: surface::image_surface) { fn encode(writer: io::Writer, surface: &surface::image_surface) {
assert surface.format == gfx::surface::fo_rgba_8888; assert surface.format == gfx::surface::fo_rgba_8888;
writer.write_u8(0u8); // identsize writer.write_u8(0u8); // identsize

View file

@ -19,7 +19,7 @@ pub struct ImageHolder {
} }
fn ImageHolder(url : &Url, image_cache_task: ImageCacheTask, cb: fn~()) -> ImageHolder { fn ImageHolder(url : &Url, image_cache_task: ImageCacheTask, +cb: fn~()) -> ImageHolder {
debug!("ImageHolder() %?", url.to_str()); debug!("ImageHolder() %?", url.to_str());
let holder = ImageHolder { let holder = ImageHolder {
url : Some(copy *url), url : Some(copy *url),

View file

@ -279,7 +279,7 @@ impl RenderBox {
GenericBox(*) => { }, GenericBox(*) => { },
ImageBox(_,i) => { ImageBox(_,i) => {
match i.get_image() { match i.get_image() {
Some(image) => list.push(~dl::Image(bounds, image)), Some(image) => list.push(~dl::Image(bounds, arc::clone(&image))),
/* No image data at all? Okay, add some fallback content instead. */ /* No image data at all? Okay, add some fallback content instead. */
None => { None => {
// TODO: shouldn't need to unbox CSSValue by now // TODO: shouldn't need to unbox CSSValue by now