Skip to content

Commit 6541d9a

Browse files
authored
Fix invalid msg_send! (#702)
1 parent 9d8c74e commit 6541d9a

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

cocoa-foundation/src/foundation.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ impl NSProcessInfo for id {
240240
}
241241

242242
unsafe fn isOperatingSystemAtLeastVersion(self, version: NSOperatingSystemVersion) -> bool {
243-
msg_send![self, isOperatingSystemAtLeastVersion: version]
243+
let res: BOOL = msg_send![self, isOperatingSystemAtLeastVersion: version];
244+
res != NO
244245
}
245246
}
246247

@@ -657,9 +658,9 @@ impl NSString for id {
657658

658659
unsafe fn init_str(self, string: &str) -> id {
659660
msg_send![self,
660-
initWithBytes:string.as_ptr()
661+
initWithBytes:string.as_ptr() as *const c_void
661662
length:string.len()
662-
encoding:UTF8_ENCODING as id]
663+
encoding:UTF8_ENCODING]
663664
}
664665

665666
unsafe fn len(self) -> usize {

cocoa/src/appkit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2402,7 +2402,7 @@ impl NSOpenGLPixelFormat for id {
24022402
// Creating an NSOpenGLPixelFormat Object
24032403

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

24082408
// Managing the Pixel Format

cocoa/src/quartzcore.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -946,12 +946,12 @@ impl CALayer {
946946

947947
#[inline]
948948
pub fn actions(&self) -> CFDictionary<CFStringRef, CFTypeRef> {
949-
unsafe { msg_send![self.id(), actions] }
949+
unsafe { CFDictionary::wrap_under_get_rule(msg_send![self.id(), actions]) }
950950
}
951951

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

957957
// TODO(pcwalton): Wrap `CAAnimation`.
@@ -1362,6 +1362,7 @@ impl CARenderer {
13621362
// really just a module.
13631363
pub mod transaction {
13641364
use block::{Block, ConcreteBlock, IntoConcreteBlock, RcBlock};
1365+
use core_foundation::base::TCFType;
13651366
use core_foundation::date::CFTimeInterval;
13661367
use core_foundation::string::CFString;
13671368
use objc::{class, msg_send, sel, sel_impl};
@@ -1454,15 +1455,15 @@ pub mod transaction {
14541455
pub fn value_for_key(key: &str) -> id {
14551456
unsafe {
14561457
let key: CFString = CFString::from(key);
1457-
msg_send![class!(CATransaction), valueForKey: key]
1458+
msg_send![class!(CATransaction), valueForKey: key.as_concrete_TypeRef()]
14581459
}
14591460
}
14601461

14611462
#[inline]
14621463
pub fn set_value_for_key(value: id, key: &str) {
14631464
unsafe {
14641465
let key: CFString = CFString::from(key);
1465-
msg_send![class!(CATransaction), setValue:value forKey:key]
1466+
msg_send![class!(CATransaction), setValue: value forKey: key.as_concrete_TypeRef()]
14661467
}
14671468
}
14681469
}

core-text/src/font.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ pub fn new_ui_font_for_language(
244244
unsafe {
245245
let font_ref = CTFontCreateUIFontForLanguage(
246246
ui_type,
247-
size,
247+
size as CGFloat,
248248
language
249249
.as_ref()
250250
.map(|x| x.as_concrete_TypeRef())

0 commit comments

Comments
 (0)