Fix invalid msg_send! (#702)

This commit is contained in:
Mads Marquart
2024-08-13 14:04:01 +02:00
committed by GitHub
parent 9d8c74ea34
commit 6541d9a789
4 changed files with 11 additions and 9 deletions
+4 -3
View File
@@ -240,7 +240,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
}
}
@@ -657,9 +658,9 @@ impl NSString for id {
unsafe fn init_str(self, string: &str) -> id {
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 {
+1 -1
View File
@@ -2402,7 +2402,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
+5 -4
View File
@@ -946,12 +946,12 @@ impl CALayer {
#[inline]
pub fn actions(&self) -> CFDictionary<CFStringRef, CFTypeRef> {
unsafe { msg_send![self.id(), actions] }
unsafe { 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`.
@@ -1362,6 +1362,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;
use objc::{class, msg_send, sel, sel_impl};
@@ -1454,7 +1455,7 @@ 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()]
}
}
@@ -1462,7 +1463,7 @@ pub mod transaction {
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()]
}
}
}
+1 -1
View File
@@ -244,7 +244,7 @@ pub fn new_ui_font_for_language(
unsafe {
let font_ref = CTFontCreateUIFontForLanguage(
ui_type,
size,
size as CGFloat,
language
.as_ref()
.map(|x| x.as_concrete_TypeRef())