File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -1827,10 +1827,10 @@ const tag_six_b: uint = 252u;
1827
1827
* let i = str::as_bytes("Hello World") { |bytes| vec::len(bytes) };
1828
1828
* ~~~
1829
1829
*/
1830
- pure fn as_bytes < T > ( s : & const ~str , f : fn ( ~[ u8 ] ) -> T ) -> T {
1830
+ pure fn as_bytes < T > ( s : & const ~str , f : fn ( ( & ~[ u8 ] ) ) -> T ) -> T {
1831
1831
unsafe {
1832
1832
let v: * ~[ u8 ] = cast:: transmute ( copy s) ;
1833
- f ( * v)
1833
+ f ( & * v)
1834
1834
}
1835
1835
}
1836
1836
@@ -1945,7 +1945,7 @@ fn reserve_at_least(s: &const ~str, n: uint) {
1945
1945
*/
1946
1946
pure fn capacity ( s : & const ~str ) -> uint {
1947
1947
do as_bytes ( s) |buf| {
1948
- let vcap = vec:: capacity ( buf) ;
1948
+ let vcap = vec:: capacity ( * buf) ;
1949
1949
assert vcap > 0 u;
1950
1950
vcap - 1 u
1951
1951
}
@@ -2037,7 +2037,7 @@ mod raw {
2037
2037
2038
2038
/// Form a slice from a *u8 buffer of the given length without copying.
2039
2039
unsafe fn buf_as_slice < T > ( buf: * u8, len: uint,
2040
- f: fn ( & & v: & str) -> T ) -> T {
2040
+ f: fn ( v: & str) -> T ) -> T {
2041
2041
let v = ( buf, len + 1 ) ;
2042
2042
assert is_utf8( :: cast:: reinterpret_cast( & v) ) ;
2043
2043
f( :: cast:: transmute( move v) )
Original file line number Diff line number Diff line change @@ -1175,7 +1175,7 @@ fn encode_metadata(parms: encode_parms, crate: @crate) -> ~[u8] {
1175
1175
// vec::from_slice(metadata_encoding_version) +
1176
1176
1177
1177
( do str:: as_bytes ( & ~"rust\x00 \x00 \x00 \x01 ") |bytes| {
1178
- vec:: slice ( bytes, 0 , 8 )
1178
+ vec:: slice ( * bytes, 0 , 8 )
1179
1179
} ) + flate:: deflate_bytes ( wr. buf . check_out ( |buf| buf) )
1180
1180
}
1181
1181
You can’t perform that action at this time.
0 commit comments