summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/macosx
diff options
context:
space:
mode:
authorJean-Daniel Dupas <devlists@shadowlab.org>2014-07-08 17:42:17 +0000
committerJean-Daniel Dupas <devlists@shadowlab.org>2014-07-08 17:42:17 +0000
commitc3aba6aafa2c85ef01001fc223b2f988d5e76bfe (patch)
tree7749c638175153bb812816b5e119704176ffb72b /lldb/source/Host/macosx
parent113308546153d6eb66708152ab83a7eab55741c7 (diff)
downloadbcm5719-llvm-c3aba6aafa2c85ef01001fc223b2f988d5e76bfe.tar.gz
bcm5719-llvm-c3aba6aafa2c85ef01001fc223b2f988d5e76bfe.zip
Simplify Host::GetOSVersion() on macosx.
It removes usage of the deprecated function CFURLCreateDataAndPropertiesFromResource(). llvm-svn: 212552
Diffstat (limited to 'lldb/source/Host/macosx')
-rw-r--r--lldb/source/Host/macosx/Host.mm53
1 files changed, 7 insertions, 46 deletions
diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm
index 289ee9ae8ac..a9a1dc8e09a 100644
--- a/lldb/source/Host/macosx/Host.mm
+++ b/lldb/source/Host/macosx/Host.mm
@@ -917,53 +917,14 @@ Host::GetOSVersion
if (g_major == 0)
{
- static const char *version_plist_file = "/System/Library/CoreServices/SystemVersion.plist";
- char buffer[256];
- const char *product_version_str = NULL;
-
- CFCReleaser<CFURLRef> plist_url(CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
- (UInt8 *) version_plist_file,
- strlen (version_plist_file), NO));
- if (plist_url.get())
- {
- CFCReleaser<CFPropertyListRef> property_list;
- CFCReleaser<CFStringRef> error_string;
- CFCReleaser<CFDataRef> resource_data;
- SInt32 error_code;
-
- // Read the XML file.
- if (CFURLCreateDataAndPropertiesFromResource (kCFAllocatorDefault,
- plist_url.get(),
- resource_data.ptr_address(),
- NULL,
- NULL,
- &error_code))
- {
- // Reconstitute the dictionary using the XML data.
- property_list = CFPropertyListCreateFromXMLData (kCFAllocatorDefault,
- resource_data.get(),
- kCFPropertyListImmutable,
- error_string.ptr_address());
- if (CFGetTypeID(property_list.get()) == CFDictionaryGetTypeID())
- {
- CFDictionaryRef property_dict = (CFDictionaryRef) property_list.get();
- CFStringRef product_version_key = CFSTR("ProductVersion");
- CFPropertyListRef product_version_value;
- product_version_value = CFDictionaryGetValue(property_dict, product_version_key);
- if (product_version_value && CFGetTypeID(product_version_value) == CFStringGetTypeID())
- {
- CFStringRef product_version_cfstr = (CFStringRef) product_version_value;
- product_version_str = CFStringGetCStringPtr(product_version_cfstr, kCFStringEncodingUTF8);
- if (product_version_str != NULL) {
- if (CFStringGetCString(product_version_cfstr, buffer, 256, kCFStringEncodingUTF8))
- product_version_str = buffer;
- }
- }
- }
- }
+ @autoreleasepool {
+ NSDictionary *version_info = [NSDictionary dictionaryWithContentsOfFile:
+ @"/System/Library/CoreServices/SystemVersion.plist"];
+ NSString *version_value = [version_info objectForKey:@"ProductVersion"];
+ const char *version_str = [version_value UTF8String];
+ if (version_str)
+ Args::StringToVersion(version_str, g_major, g_minor, g_update);
}
- if (product_version_str)
- Args::StringToVersion(product_version_str, g_major, g_minor, g_update);
}
if (g_major != 0)
OpenPOWER on IntegriCloud