aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2015-02-21 18:32:05 -0500
committerCorey Farwell <coreyf@rwell.org>2015-02-21 18:32:05 -0500
commit5ff649e5db99cd2ad4c8b22f5894b4283c35b6ea (patch)
tree299255aa957c3c256abaa1ebd3bfbceb51ff7548 /src
parent7fa19ab0dfd0624386ae1086ad1d740072d7f1a4 (diff)
downloadglutin-5ff649e5db99cd2ad4c8b22f5894b4283c35b6ea.tar.gz
glutin-5ff649e5db99cd2ad4c8b22f5894b4283c35b6ea.zip
Stop using deprecated CString::from_slice constructor
Diffstat (limited to 'src')
-rw-r--r--src/cocoa/mod.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cocoa/mod.rs b/src/cocoa/mod.rs
index 12f7a06..7690459 100644
--- a/src/cocoa/mod.rs
+++ b/src/cocoa/mod.rs
@@ -21,7 +21,7 @@ use core_foundation::string::CFString;
use core_foundation::bundle::{CFBundleGetBundleWithIdentifier, CFBundleGetFunctionPointerForName};
use std::cell::Cell;
-use std::ffi::{CString, c_str_to_bytes};
+use std::ffi::{CString, CStr};
use std::mem;
use std::ptr;
use std::collections::VecDeque;
@@ -115,15 +115,15 @@ impl WindowDelegate {
class_addMethod(delegate_class,
selector("windowShouldClose:"),
window_should_close,
- CString::from_slice("B@:@".as_bytes()).as_ptr());
+ CString::new("B@:@").unwrap().as_ptr());
class_addMethod(delegate_class,
selector("windowDidResize:"),
window_did_resize,
- CString::from_slice("V@:@".as_bytes()).as_ptr());
+ CString::new("V@:@").unwrap().as_ptr());
// Store internal state as user data
class_addIvar(delegate_class, WindowDelegate::state_ivar_name().as_ptr() as *const i8,
ptr_size as u64, 3,
- CString::from_slice("?".as_bytes()).as_ptr());
+ CString::new("?").unwrap().as_ptr());
objc_registerClassPair(delegate_class);
// Free class at exit
rt::at_exit(|| {
@@ -254,8 +254,8 @@ impl<'a> Iterator for PollEventsIterator<'a> {
NSKeyDown => {
let mut events = VecDeque::new();
let received_c_str = event.characters().UTF8String();
- let received_str = CString::from_slice(c_str_to_bytes(&received_c_str));
- for received_char in from_utf8(received_str.as_bytes()).unwrap().chars() {
+ let received_str = CStr::from_ptr(received_c_str);
+ for received_char in from_utf8(received_str.to_bytes()).unwrap().chars() {
if received_char.is_ascii() {
events.push_back(ReceivedCharacter(received_char));
}