Skip to content

Commit 3b9868a

Browse files
committed
Fix invalid msg_send!
1 parent 2907f4d commit 3b9868a

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
@@ -248,7 +248,8 @@ impl NSProcessInfo for id {
248248
}
249249

250250
unsafe fn isOperatingSystemAtLeastVersion(self, version: NSOperatingSystemVersion) -> bool {
251-
msg_send![self, isOperatingSystemAtLeastVersion: version]
251+
let res: BOOL = msg_send![self, isOperatingSystemAtLeastVersion: version];
252+
res != NO
252253
}
253254
}
254255

@@ -664,9 +665,9 @@ impl NSString for id {
664665

665666
unsafe fn init_str(self, string: &str) -> id {
666667
return msg_send![self,
667-
initWithBytes:string.as_ptr()
668+
initWithBytes:string.as_ptr() as *const c_void
668669
length:string.len()
669-
encoding:UTF8_ENCODING as id];
670+
encoding:UTF8_ENCODING];
670671
}
671672

672673
unsafe fn len(self) -> usize {

cocoa/src/appkit.rs

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

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

23842384
// Managing the Pixel Format

cocoa/src/quartzcore.rs

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

941941
#[inline]
942942
pub fn actions(&self) -> CFDictionary<CFStringRef, CFTypeRef> {
943-
unsafe { msg_send![self.id(), actions] }
943+
unsafe { CFDictionary::wrap_under_get_rule(msg_send![self.id(), actions]) }
944944
}
945945

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

951951
// TODO(pcwalton): Wrap `CAAnimation`.
@@ -1353,6 +1353,7 @@ impl CARenderer {
13531353
// really just a module.
13541354
pub mod transaction {
13551355
use block::{Block, ConcreteBlock, IntoConcreteBlock, RcBlock};
1356+
use core_foundation::base::TCFType;
13561357
use core_foundation::date::CFTimeInterval;
13571358
use core_foundation::string::CFString;
13581359

@@ -1444,15 +1445,15 @@ pub mod transaction {
14441445
pub fn value_for_key(key: &str) -> id {
14451446
unsafe {
14461447
let key: CFString = CFString::from(key);
1447-
msg_send![class!(CATransaction), valueForKey: key]
1448+
msg_send![class!(CATransaction), valueForKey: key.as_concrete_TypeRef()]
14481449
}
14491450
}
14501451

14511452
#[inline]
14521453
pub fn set_value_for_key(value: id, key: &str) {
14531454
unsafe {
14541455
let key: CFString = CFString::from(key);
1455-
msg_send![class!(CATransaction), setValue:value forKey:key]
1456+
msg_send![class!(CATransaction), setValue: value forKey: key.as_concrete_TypeRef()]
14561457
}
14571458
}
14581459
}

core-text/src/font.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ pub fn new_ui_font_for_language(
206206
unsafe {
207207
let font_ref = CTFontCreateUIFontForLanguage(
208208
ui_type,
209-
size,
209+
size as CGFloat,
210210
language
211211
.as_ref()
212212
.map(|x| x.as_concrete_TypeRef())

0 commit comments

Comments
 (0)