Skip to content

Commit

Permalink
Fix invalid msg_send!
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Jun 16, 2022
1 parent 614d43a commit 48d510a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
7 changes: 4 additions & 3 deletions cocoa-foundation/src/foundation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ impl NSProcessInfo for id {
}

unsafe fn isOperatingSystemAtLeastVersion(self, version: NSOperatingSystemVersion) -> bool {
msg_send![self, isOperatingSystemAtLeastVersion: version]
let res: BOOL = msg_send![self, isOperatingSystemAtLeastVersion: version];
res != NO
}
}

Expand Down Expand Up @@ -628,9 +629,9 @@ impl NSString for id {

unsafe fn init_str(self, string: &str) -> id {
return msg_send![self,
initWithBytes:string.as_ptr()
initWithBytes:string.as_ptr() as *const c_void
length:string.len()
encoding:UTF8_ENCODING as id];
encoding:UTF8_ENCODING];
}

unsafe fn len(self) -> usize {
Expand Down
2 changes: 1 addition & 1 deletion cocoa/src/appkit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2108,7 +2108,7 @@ impl NSOpenGLPixelFormat for id {
// Creating an NSOpenGLPixelFormat Object

unsafe fn initWithAttributes_(self, attributes: &[u32]) -> id {
msg_send![self, initWithAttributes:attributes]
msg_send![self, initWithAttributes:attributes.as_ptr()]
}

// Managing the Pixel Format
Expand Down
9 changes: 5 additions & 4 deletions cocoa/src/quartzcore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1096,13 +1096,13 @@ impl CALayer {
#[inline]
pub fn actions(&self) -> CFDictionary<CFStringRef, CFTypeRef> {
unsafe {
msg_send![self.id(), actions]
CFDictionary::wrap_under_get_rule(msg_send![self.id(), actions])
}
}

#[inline]
pub unsafe fn set_actions(&self, actions: CFDictionary<CFStringRef, CFTypeRef>) {
msg_send![self.id(), setActions:actions]
msg_send![self.id(), setActions: actions.as_concrete_TypeRef()]
}

// TODO(pcwalton): Wrap `CAAnimation`.
Expand Down Expand Up @@ -1531,6 +1531,7 @@ impl CARenderer {
// really just a module.
pub mod transaction {
use block::{Block, ConcreteBlock, IntoConcreteBlock, RcBlock};
use core_foundation::base::TCFType;
use core_foundation::date::CFTimeInterval;
use core_foundation::string::CFString;

Expand Down Expand Up @@ -1638,15 +1639,15 @@ pub mod transaction {
pub fn value_for_key(key: &str) -> id {
unsafe {
let key: CFString = CFString::from(key);
msg_send![class!(CATransaction), valueForKey:key]
msg_send![class!(CATransaction), valueForKey: key.as_concrete_TypeRef()]
}
}

#[inline]
pub fn set_value_for_key(value: id, key: &str) {
unsafe {
let key: CFString = CFString::from(key);
msg_send![class!(CATransaction), setValue:value forKey:key]
msg_send![class!(CATransaction), setValue: value forKey: key.as_concrete_TypeRef()]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core-text/src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ pub fn new_from_name(name: &str, pt_size: f64) -> Result<CTFont, ()> {
}

pub fn new_ui_font_for_language(ui_type: CTFontUIFontType,
size: f64,
size: CGFloat,
language: Option<CFString>)
-> CTFont {
unsafe {
Expand Down

0 comments on commit 48d510a

Please sign in to comment.