Update for library changes (current Rust commit 57b4d10ff652d3beddae64782c882a07822bac3c)

This commit is contained in:
Patrick Walton 2012-10-13 00:47:09 -07:00
parent cb1a25d69f
commit cb356cbcc4
4 changed files with 7 additions and 8 deletions

View file

@ -49,7 +49,7 @@ fn jsval_to_str(cx: *JSContext, v: jsval) -> Result<~str, ()> {
Err(()) Err(())
} else { } else {
unsafe { unsafe {
let buf = vec::raw::from_buf(chars as *u8, len as uint); let buf = vec::raw::from_buf_raw(chars as *u8, len as uint);
Ok(str::from_bytes(buf)) Ok(str::from_bytes(buf))
} }
} }

View file

@ -20,7 +20,6 @@ use render_task::{RenderTask, RenderMsg};
use task::spawn_listener; use task::spawn_listener;
use comm::{Chan, Port}; use comm::{Chan, Port};
use cast::reinterpret_cast; use cast::reinterpret_cast;
use vec_from_buf = vec::raw::from_buf;
use ptr::addr_of; use ptr::addr_of;
use dom::event::Event; use dom::event::Event;
use dvec::DVec; use dvec::DVec;

View file

@ -209,7 +209,7 @@ impl TextRunScanner {
// TODO: use a rope, simply give ownership of nonzero strs to rope // TODO: use a rope, simply give ownership of nonzero strs to rope
let mut run_str : ~str = ~""; let mut run_str : ~str = ~"";
for uint::range(0, transformed_strs.len()) |i| { for uint::range(0, transformed_strs.len()) |i| {
str::push_str(&run_str, transformed_strs[i]); str::push_str(&mut run_str, transformed_strs[i]);
} }
// TODO: use actual font for corresponding DOM node to create text run. // TODO: use actual font for corresponding DOM node to create text run.

View file

@ -28,7 +28,7 @@ impl CompressionMode : cmp::Eq {
// * record skipped and kept chars for mapping original to new text // * record skipped and kept chars for mapping original to new text
// * various edge cases for bidi, CJK, combining char seqs, etc. // * various edge cases for bidi, CJK, combining char seqs, etc.
pub fn transform_text(text: &str, mode: CompressionMode) -> ~str { pub fn transform_text(text: &str, mode: CompressionMode) -> ~str {
let out_str: ~str = ~""; let mut out_str: ~str = ~"";
match mode { match mode {
CompressNone | DiscardNewline => { CompressNone | DiscardNewline => {
for str::each_char(text) |ch: char| { for str::each_char(text) |ch: char| {
@ -39,7 +39,7 @@ pub fn transform_text(text: &str, mode: CompressionMode) -> ~str {
if ch == '\t' { if ch == '\t' {
// TODO: set "has tab" flag // TODO: set "has tab" flag
} }
str::push_char(&out_str, ch); str::push_char(&mut out_str, ch);
} }
} }
}, },
@ -65,14 +65,14 @@ pub fn transform_text(text: &str, mode: CompressionMode) -> ~str {
// TODO: record skipped char // TODO: record skipped char
} else { } else {
// TODO: record kept char // TODO: record kept char
str::push_char(&out_str, ch); str::push_char(&mut out_str, ch);
} }
} else { /* next_in_whitespace; possibly add a space char */ } else { /* next_in_whitespace; possibly add a space char */
if in_whitespace { if in_whitespace {
// TODO: record skipped char // TODO: record skipped char
} else { } else {
// TODO: record kept char // TODO: record kept char
str::push_char(&out_str, ' '); str::push_char(&mut out_str, ' ');
} }
} }
// save whitespace context for next char // save whitespace context for next char
@ -220,4 +220,4 @@ fn test_transform_compress_whitespace_newline() {
for uint::range(0, test_strs.len()) |i| { for uint::range(0, test_strs.len()) |i| {
assert transform_text(test_strs[i], mode) == oracle_strs[i]; assert transform_text(test_strs[i], mode) == oracle_strs[i];
} }
} }