mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-12-05 06:22:18 +00:00
fix macOS build/resource ownership
This commit is contained in:
3 files changed
+22
-14
No files matched your search
@@ -54,6 +54,7 @@ elif system == 'darwin'
|
||||
sysinfo_includes += 'shared'
|
||||
sysinfo_sources += 'shared/df.c'
|
||||
add_languages('objc')
|
||||
sysinfo_deps += dependency('appleframeworks', modules: ['Cocoa', 'IOKit'])
|
||||
sysinfo_sources += 'osx/backend.m'
|
||||
|
||||
elif system == 'windows'
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
#include <mach/mach.h>
|
||||
@@ -38,6 +40,7 @@
|
||||
|
||||
#include "format.h"
|
||||
#include "df.h"
|
||||
#include "sysinfo-backend.h"
|
||||
|
||||
static char *
|
||||
get_os (void)
|
||||
@@ -48,10 +51,7 @@ get_os (void)
|
||||
return NULL;
|
||||
NSString *version = [systemversion objectForKey:@"ProductUserVisibleVersion"];
|
||||
if (!version)
|
||||
{
|
||||
[build release];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NSDictionary *profiler = [NSDictionary dictionaryWithContentsOfFile:[@"~/Library/Preferences/com.apple.SystemProfiler.plist" stringByExpandingTildeInPath]];
|
||||
NSDictionary *names = [profiler objectForKey:@"OS Names"];
|
||||
@@ -65,18 +65,11 @@ get_os (void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
[build release];
|
||||
|
||||
/* Dictionary values are borrowed; releasing them would over-release. */
|
||||
if (!os_name)
|
||||
{
|
||||
[version release];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *ret = g_strdup_printf ("%s %s", [os_name UTF8String], [version UTF8String]);
|
||||
[version release];
|
||||
|
||||
return ret;
|
||||
return g_strdup_printf ("%s %s", [os_name UTF8String], [version UTF8String]);
|
||||
}
|
||||
|
||||
static char *
|
||||
@@ -219,9 +212,14 @@ get_gpu(void)
|
||||
}
|
||||
|
||||
const void *class = CFDictionaryGetValue(serviceDictionary, @"class-code");
|
||||
if (!class || *(guint32*)CFDataGetBytePtr(class) != 0x30000) /* DISPLAY_VGA */
|
||||
guint32 class_code = 0;
|
||||
if (class && CFGetTypeID (class) == CFDataGetTypeID () &&
|
||||
CFDataGetLength (class) >= sizeof (class_code))
|
||||
memcpy (&class_code, CFDataGetBytePtr (class), sizeof (class_code));
|
||||
if (GUINT32_FROM_LE (class_code) != 0x30000) /* DISPLAY_VGA */
|
||||
{
|
||||
CFRelease(serviceDictionary);
|
||||
IOObjectRelease (serviceObject);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -237,7 +235,9 @@ get_gpu(void)
|
||||
}
|
||||
|
||||
CFRelease(serviceDictionary);
|
||||
IOObjectRelease (serviceObject);
|
||||
}
|
||||
IOObjectRelease (entry_iterator);
|
||||
|
||||
if (gpu_list->len == 0)
|
||||
{
|
||||
@@ -265,6 +265,13 @@ sysinfo_backend_get_gpu(void)
|
||||
return g_strdup (gpu_str);
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_chipset (void)
|
||||
{
|
||||
/* No chipset detector exists in the legacy macOS backend. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_sound(void)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user