Comment fixes in str

This commit is contained in:
Kevin Cantu
2012-01-30 20:06:38 -08:00
committed by Brian Anderson
parent 03b8c8df01
commit be9129f556

View File

@@ -183,7 +183,6 @@ fn from_chars(chs: [char]) -> str {
ret buf; ret buf;
} }
// FIXME: not unsafe now
/* /*
Function: from_cstr Function: from_cstr
@@ -1371,20 +1370,19 @@ An unsafe buffer of bytes. Corresponds to a C char pointer.
*/ */
type sbuf = *u8; type sbuf = *u8;
// Module: unsafe
//
// These functions may create invalid UTF-8 strings and eat your baby.
mod unsafe { mod unsafe {
export export
// UNSAFE // UNSAFE
from_bytes, from_bytes,
from_byte; from_byte;
/* // Function: unsafe::from_bytes
Function: unsafe::from_bytes //
// Converts a vector of bytes to a string. Does not verify that the
Converts a vector of bytes to a string. Does not verify that the // vector contains valid UTF-8.
vector contains valid UTF-8.
FIXME: stop exporting
*/
unsafe fn from_bytes(v: [const u8]) -> str unsafe { unsafe fn from_bytes(v: [const u8]) -> str unsafe {
let vcopy: [u8] = v + [0u8]; let vcopy: [u8] = v + [0u8];
let scopy: str = ::unsafe::reinterpret_cast(vcopy); let scopy: str = ::unsafe::reinterpret_cast(vcopy);
@@ -1392,14 +1390,10 @@ mod unsafe {
ret scopy; ret scopy;
} }
/* // Function: unsafe::from_byte
Function: unsafe::from_byte //
// Converts a byte to a string. Does not verify that the byte is
Converts a byte to a string. Does not verify that the byte is // valid UTF-8.
valid UTF-8.
FIXME: stop exporting
*/
unsafe fn from_byte(u: u8) -> str { unsafe::from_bytes([u]) } unsafe fn from_byte(u: u8) -> str { unsafe::from_bytes([u]) }
} }