Merge pull request #330 from SSheldon/objc_ret

Audit msg_send return types
This commit is contained in:
tomaka 2015-03-28 20:27:05 +01:00
commit 1557cd227f

View file

@ -81,7 +81,7 @@ impl WindowDelegate {
let state: *mut libc::c_void = *this.get_ivar("glutinState"); let state: *mut libc::c_void = *this.get_ivar("glutinState");
let state = &mut *(state as *mut DelegateState); let state = &mut *(state as *mut DelegateState);
let _: id = msg_send![*state.context, update]; let _: () = msg_send![*state.context, update];
if let Some(handler) = state.handler { if let Some(handler) = state.handler {
let rect = NSView::frame(*state.view); let rect = NSView::frame(*state.view);
@ -120,7 +120,7 @@ impl WindowDelegate {
fn new(window: id) -> WindowDelegate { fn new(window: id) -> WindowDelegate {
unsafe { unsafe {
let delegate: id = msg_send![WindowDelegate::class(), new]; let delegate: id = msg_send![WindowDelegate::class(), new];
let _: id = msg_send![window, setDelegate:delegate]; let _: () = msg_send![window, setDelegate:delegate];
WindowDelegate { this: delegate } WindowDelegate { this: delegate }
} }
} }
@ -393,7 +393,7 @@ impl Window {
let device_description = NSScreen::deviceDescription(screen); let device_description = NSScreen::deviceDescription(screen);
let value = msg_send![device_description, objectForKey:*key]; let value = msg_send![device_description, objectForKey:*key];
if value != nil { if value != nil {
let screen_number: NSUInteger = msg_send![value, unsignedIntValue]; let screen_number: NSUInteger = msg_send![value, unsignedIntegerValue];
if screen_number as u32 == native_id { if screen_number as u32 == native_id {
matching_screen = Some(screen); matching_screen = Some(screen);
break; break;
@ -574,7 +574,7 @@ impl Window {
} }
pub unsafe fn make_current(&self) { pub unsafe fn make_current(&self) {
let _: id = msg_send![*self.context, update]; let _: () = msg_send![*self.context, update];
self.context.makeCurrentContext(); self.context.makeCurrentContext();
} }
@ -582,8 +582,8 @@ impl Window {
unsafe { unsafe {
let current = NSOpenGLContext::currentContext(nil); let current = NSOpenGLContext::currentContext(nil);
if current != nil { if current != nil {
let is_equal: bool = msg_send![current, isEqual:*self.context]; let is_equal: BOOL = msg_send![current, isEqual:*self.context];
is_equal is_equal != NO
} else { } else {
false false
} }
@ -657,7 +657,7 @@ impl Window {
unsafe { unsafe {
use objc::MessageArguments; use objc::MessageArguments;
let cursor: id = ().send(cls as *const _ as id, sel); let cursor: id = ().send(cls as *const _ as id, sel);
let _: id = msg_send![cursor, set]; let _: () = msg_send![cursor, set];
} }
} }
@ -685,7 +685,7 @@ impl IdRef {
fn retain(i: id) -> IdRef { fn retain(i: id) -> IdRef {
if i != nil { if i != nil {
unsafe { msg_send![i, retain] } let _: id = unsafe { msg_send![i, retain] };
} }
IdRef(i) IdRef(i)
} }
@ -698,7 +698,7 @@ impl IdRef {
impl Drop for IdRef { impl Drop for IdRef {
fn drop(&mut self) { fn drop(&mut self) {
if self.0 != nil { if self.0 != nil {
unsafe { msg_send![self.0, release] } let _: () = unsafe { msg_send![self.0, release] };
} }
} }
} }
@ -713,17 +713,17 @@ impl Deref for IdRef {
impl Clone for IdRef { impl Clone for IdRef {
fn clone(&self) -> IdRef { fn clone(&self) -> IdRef {
if self.0 != nil { if self.0 != nil {
unsafe { msg_send![self.0, retain] } let _: id = unsafe { msg_send![self.0, retain] };
} }
IdRef(self.0) IdRef(self.0)
} }
fn clone_from(&mut self, source: &IdRef) { fn clone_from(&mut self, source: &IdRef) {
if source.0 != nil { if source.0 != nil {
unsafe { msg_send![source.0, retain] } let _: id = unsafe { msg_send![source.0, retain] };
} }
if self.0 != nil { if self.0 != nil {
unsafe { msg_send![self.0, release] } let _: () = unsafe { msg_send![self.0, release] };
} }
self.0 = source.0; self.0 = source.0;
} }