diff options
| author | linouxis9 <[email protected]> | 2018-05-07 15:31:54 +0200 |
|---|---|---|
| committer | linouxis9 <[email protected]> | 2018-05-07 15:35:20 +0200 |
| commit | 4901431b02227416b08e5fbc9a7ac3f5ac2f44a7 (patch) | |
| tree | 7fb75cf805b8f0e9b7f169af37c9d2aa0c4aded6 /ctr-std/src/ffi/c_str.rs | |
| parent | Merge pull request #66 from FenrirWolf/swkbd (diff) | |
| download | archived-ctru-rs-4901431b02227416b08e5fbc9a7ac3f5ac2f44a7.tar.xz archived-ctru-rs-4901431b02227416b08e5fbc9a7ac3f5ac2f44a7.zip | |
Update for latest nightly 2018-05-06
Diffstat (limited to 'ctr-std/src/ffi/c_str.rs')
| -rw-r--r-- | ctr-std/src/ffi/c_str.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ctr-std/src/ffi/c_str.rs b/ctr-std/src/ffi/c_str.rs index c88c2bc..7f66b76 100644 --- a/ctr-std/src/ffi/c_str.rs +++ b/ctr-std/src/ffi/c_str.rs @@ -406,7 +406,7 @@ impl CString { /// ``` #[stable(feature = "cstr_memory", since = "1.4.0")] pub unsafe fn from_raw(ptr: *mut c_char) -> CString { - let len = sys::strlen(ptr) + 1; // Including the NUL byte + let len = sys::strlen(ptr as *const _) + 1; // Including the NUL byte let slice = slice::from_raw_parts_mut(ptr, len as usize); CString { inner: Box::from_raw(slice as *mut [c_char] as *mut [u8]) } } @@ -901,7 +901,7 @@ impl CStr { /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn from_ptr<'a>(ptr: *const c_char) -> &'a CStr { - let len = sys::strlen(ptr); + let len = sys::strlen(ptr as *const _); let ptr = ptr as *const u8; CStr::from_bytes_with_nul_unchecked(slice::from_raw_parts(ptr, len as usize + 1)) } @@ -988,6 +988,7 @@ impl CStr { /// behavior when `ptr` is used inside the `unsafe` block: /// /// ```no_run + /// # #![allow(unused_must_use)] /// use std::ffi::{CString}; /// /// let ptr = CString::new("Hello").unwrap().as_ptr(); @@ -1003,6 +1004,7 @@ impl CStr { /// To fix the problem, bind the `CString` to a local variable: /// /// ```no_run + /// # #![allow(unused_must_use)] /// use std::ffi::{CString}; /// /// let hello = CString::new("Hello").unwrap(); @@ -1118,6 +1120,7 @@ impl CStr { /// /// [`Cow`]: ../borrow/enum.Cow.html /// [`Borrowed`]: ../borrow/enum.Cow.html#variant.Borrowed + /// [`Owned`]: ../borrow/enum.Cow.html#variant.Owned /// [`str`]: ../primitive.str.html /// [`String`]: ../string/struct.String.html /// |