|
@@ -111,13 +111,20 @@ static void log_available_memory(void)
|
|
memory_available / 1024 / 1024);
|
|
memory_available / 1024 / 1024);
|
|
}
|
|
}
|
|
|
|
|
|
-static void log_os_name(id pi, SEL UTF8String)
|
|
|
|
|
|
+static void log_os_name(id pi, SEL UTF8StringSel)
|
|
{
|
|
{
|
|
- unsigned long os_id = (unsigned long)objc_msgSend(
|
|
|
|
|
|
+ typedef int (*os_func)(id, SEL);
|
|
|
|
+ os_func operatingSystem = (os_func)objc_msgSend;
|
|
|
|
+ unsigned long os_id = (unsigned long)operatingSystem(
|
|
pi, sel_registerName("operatingSystem"));
|
|
pi, sel_registerName("operatingSystem"));
|
|
|
|
|
|
- id os = objc_msgSend(pi, sel_registerName("operatingSystemName"));
|
|
|
|
- const char *name = (const char *)objc_msgSend(os, UTF8String);
|
|
|
|
|
|
+ typedef id (*os_name_func)(id, SEL);
|
|
|
|
+ os_name_func operatingSystemName = (os_name_func)objc_msgSend;
|
|
|
|
+ id os = operatingSystemName(pi,
|
|
|
|
+ sel_registerName("operatingSystemName"));
|
|
|
|
+ typedef const char *(*utf8_func)(id, SEL);
|
|
|
|
+ utf8_func UTF8String = (utf8_func)objc_msgSend;
|
|
|
|
+ const char *name = UTF8String(os, UTF8StringSel);
|
|
|
|
|
|
if (os_id == 5 /*NSMACHOperatingSystem*/) {
|
|
if (os_id == 5 /*NSMACHOperatingSystem*/) {
|
|
blog(LOG_INFO, "OS Name: Mac OS X (%s)", name);
|
|
blog(LOG_INFO, "OS Name: Mac OS X (%s)", name);
|
|
@@ -127,11 +134,15 @@ static void log_os_name(id pi, SEL UTF8String)
|
|
blog(LOG_INFO, "OS Name: %s", name ? name : "Unknown");
|
|
blog(LOG_INFO, "OS Name: %s", name ? name : "Unknown");
|
|
}
|
|
}
|
|
|
|
|
|
-static void log_os_version(id pi, SEL UTF8String)
|
|
|
|
|
|
+static void log_os_version(id pi, SEL UTF8StringSel)
|
|
{
|
|
{
|
|
- id vs = objc_msgSend(pi,
|
|
|
|
- sel_registerName("operatingSystemVersionString"));
|
|
|
|
- const char *version = (const char *)objc_msgSend(vs, UTF8String);
|
|
|
|
|
|
+ typedef id (*version_func)(id, SEL);
|
|
|
|
+ version_func operatingSystemVersionString = (version_func)objc_msgSend;
|
|
|
|
+ id vs = operatingSystemVersionString(
|
|
|
|
+ pi, sel_registerName("operatingSystemVersionString"));
|
|
|
|
+ typedef const char *(*utf8_func)(id, SEL);
|
|
|
|
+ utf8_func UTF8String = (utf8_func)objc_msgSend;
|
|
|
|
+ const char *version = UTF8String(vs, UTF8StringSel);
|
|
|
|
|
|
blog(LOG_INFO, "OS Version: %s", version ? version : "Unknown");
|
|
blog(LOG_INFO, "OS Version: %s", version ? version : "Unknown");
|
|
}
|
|
}
|
|
@@ -139,8 +150,9 @@ static void log_os_version(id pi, SEL UTF8String)
|
|
static void log_os(void)
|
|
static void log_os(void)
|
|
{
|
|
{
|
|
Class NSProcessInfo = objc_getClass("NSProcessInfo");
|
|
Class NSProcessInfo = objc_getClass("NSProcessInfo");
|
|
- id pi = objc_msgSend((id)NSProcessInfo,
|
|
|
|
- sel_registerName("processInfo"));
|
|
|
|
|
|
+ typedef id (*func)(id, SEL);
|
|
|
|
+ func processInfo = (func)objc_msgSend;
|
|
|
|
+ id pi = processInfo((id)NSProcessInfo, sel_registerName("processInfo"));
|
|
|
|
|
|
SEL UTF8String = sel_registerName("UTF8String");
|
|
SEL UTF8String = sel_registerName("UTF8String");
|
|
|
|
|
|
@@ -1673,9 +1685,11 @@ static bool mouse_button_pressed(obs_key_t key, bool *pressed)
|
|
}
|
|
}
|
|
|
|
|
|
Class NSEvent = objc_getClass("NSEvent");
|
|
Class NSEvent = objc_getClass("NSEvent");
|
|
- SEL pressedMouseButtons = sel_registerName("pressedMouseButtons");
|
|
|
|
- NSUInteger buttons =
|
|
|
|
- (NSUInteger)objc_msgSend((id)NSEvent, pressedMouseButtons);
|
|
|
|
|
|
+ SEL pressedMouseButtonsSel = sel_registerName("pressedMouseButtons");
|
|
|
|
+ typedef int (*func)(id, SEL);
|
|
|
|
+ func pressedMouseButtons = (func)objc_msgSend;
|
|
|
|
+ NSUInteger buttons = (NSUInteger)pressedMouseButtons(
|
|
|
|
+ (id)NSEvent, pressedMouseButtonsSel);
|
|
|
|
|
|
*pressed = (buttons & (1 << button)) != 0;
|
|
*pressed = (buttons & (1 << button)) != 0;
|
|
return true;
|
|
return true;
|