Various fixes related to explicit copying and reinterpret_cast use.

This commit is contained in:
Brian J. Burg 2012-09-05 13:23:55 -07:00
parent aea47f6b99
commit 3f2d253a71
10 changed files with 18 additions and 18 deletions

View file

@ -138,7 +138,7 @@ struct Content<C:Compositor> {
fn handle_control_msg(control_msg: ControlMsg) -> bool {
match control_msg {
ParseMsg(url) => {
#debug["content: Received url `%s` to parse", url_to_str(url)];
#debug["content: Received url `%s` to parse", url_to_str(copy url)];
// Note: we can parse the next document in parallel
// with any previous documents.
@ -199,11 +199,11 @@ struct Content<C:Compositor> {
ExecuteMsg(url) => {
#debug["content: Received url `%s` to execute", url_to_str(url)];
#debug["content: Received url `%s` to execute", url_to_str(copy url)];
match read_whole_file(&Path(url.path)) {
Err(msg) => {
println(#fmt["Error opening %s: %s", url_to_str(url), msg]);
println(#fmt["Error opening %s: %s", url_to_str(copy url), msg]);
}
Ok(bytes) => {
let compartment = option::expect(self.compartment, ~"TODO error checking");

View file

@ -33,7 +33,7 @@ struct Window {
match timer_port.recv() {
Close => break,
Fire(td) => {
content_chan.send(Timer(td));
content_chan.send(Timer(copy td));
}
}
}

View file

@ -19,7 +19,7 @@ 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);
let y: *rust_box<T> = unsafe::reinterpret_cast(&x);
unsafe::forget(x);
y
}
@ -27,7 +27,7 @@ unsafe fn squirrel_away<T>(+x: @T) -> *rust_box<T> {
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);
let y: *rust_box<T> = unsafe::reinterpret_cast(&x);
unsafe::forget(x);
y
}

View file

@ -108,7 +108,7 @@ impl StyleDeclaration: cmp::Eq {
impl Attr: cmp::Eq {
pure fn eq(&&other: Attr) -> bool {
match (self, other) {
match (copy self, copy other) {
(Exists(a), Exists(b)) => a == b,
(Exact(a, aa), Exact(b, bb))
@ -126,7 +126,7 @@ impl Attr: cmp::Eq {
impl Selector: cmp::Eq {
pure fn eq(&&other: Selector) -> bool {
// FIXME: Lots of copying here
match (self, 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))

View file

@ -27,7 +27,7 @@ fn from_cmdline_args(args: ~[~str]) -> Opts {
let opt_match = match getopts::getopts(args, opts) {
result::Ok(m) => { copy m }
result::Err(f) => { fail getopts::fail_str(f) }
result::Err(f) => { fail getopts::fail_str(copy f) }
};
let urls = if opt_match.free.is_empty() {

View file

@ -108,7 +108,7 @@ fn SyncImageCacheTask(resource_task: ResourceTask) -> ImageCacheTask {
let msg = from_client.recv();
match msg {
GetImage(url, response) => inner_cache.send(WaitForImage(url, response)),
GetImage(url, response) => inner_cache.send(WaitForImage(copy url, response)),
Exit(response) => {
inner_cache.send(Exit(response));
break;

View file

@ -28,7 +28,7 @@ enum ProgressMsg {
impl ProgressMsg: cmp::Eq {
pure fn eq(&&other: ProgressMsg) -> bool {
match (self, other) {
match (copy self, copy other) {
(Payload(a), Payload(b)) => a == b,
(Done(a), Done(b)) => a == b,
@ -92,7 +92,7 @@ struct ResourceManager {
match self.get_loader_factory(url) {
Some(loader_factory) => {
#debug("resource_task: loading url: %s", to_str(url));
#debug("resource_task: loading url: %s", to_str(copy url));
loader_factory(url, progress_chan);
}
None => {

View file

@ -42,7 +42,7 @@ fn run_pipeline_screen(urls: ~[~str]) {
for urls.each |filename| {
let url = make_url(filename, None);
#debug["master: Sending url `%s`", url_to_str(url)];
#debug["master: Sending url `%s`", url_to_str(copy url)];
engine_task =
Some(EngineProto::client::LoadURL(swap_unwrap(&mut engine_task),
url));

View file

@ -54,7 +54,7 @@ fn create(buf: &~[u8]) -> Result<QuartzNativeFont, ()> {
let fontprov = vec::as_buf(*buf, |cbuf, len| {
CGDataProviderCreateWithData(
null(),
unsafe { reinterpret_cast(cbuf) },
unsafe { reinterpret_cast(&cbuf) },
len as size_t,
null())
});

View file

@ -40,7 +40,7 @@ fn shape_text(font: &Font, text: ~str) -> ~[Glyph] unsafe {
#debug("shaping text '%s'", text);
let face_blob = vec::as_buf(*(*font).buf(), |buf, len| {
hb_blob_create(reinterpret_cast(buf),
hb_blob_create(reinterpret_cast(&buf),
len as c_uint,
HB_MEMORY_MODE_READONLY,
null(),
@ -56,7 +56,7 @@ fn shape_text(font: &Font, text: ~str) -> ~[Glyph] unsafe {
let funcs = hb_font_funcs_create();
hb_font_funcs_set_glyph_func(funcs, glyph_func, null(), null());
hb_font_funcs_set_glyph_h_advance_func(funcs, glyph_h_advance_func, null(), null());
hb_font_set_funcs(hbfont, funcs, reinterpret_cast(addr_of(*font)), null());
hb_font_set_funcs(hbfont, funcs, reinterpret_cast(&addr_of(*font)), null());
let buffer = hb_buffer_create();
@ -109,7 +109,7 @@ extern fn glyph_func(_font: *hb_font_t,
glyph: *mut hb_codepoint_t,
_user_data: *c_void) -> hb_bool_t unsafe {
let font: *Font = reinterpret_cast(font_data);
let font: *Font = reinterpret_cast(&font_data);
assert font.is_not_null();
return match (*font).glyph_index(unicode as char) {
@ -127,7 +127,7 @@ extern fn glyph_h_advance_func(_font: *hb_font_t,
font_data: *c_void,
glyph: hb_codepoint_t,
_user_data: *c_void) -> hb_position_t unsafe {
let font: *Font = reinterpret_cast(font_data);
let font: *Font = reinterpret_cast(&font_data);
assert font.is_not_null();
let h_advance = (*font).glyph_h_advance(glyph as uint);