diff options
author | Ivan Penkov <ivanpe@chromium.org> | 2015-12-18 10:26:21 -0800 |
---|---|---|
committer | Ivan Penkov <ivanpe@chromium.org> | 2015-12-18 10:26:21 -0800 |
commit | 1be30279411c6b2bcd4782d70f9e325adf0836ee (patch) | |
tree | 49f8a7ec8c9d03cad3280068afce81e5b64fde19 /src | |
parent | Fix ExploitabilityLinuxUtilsTest::DisassembleBytesTest to not fail when temp ... (diff) | |
download | breakpad-1be30279411c6b2bcd4782d70f9e325adf0836ee.tar.xz |
Remove use of deprecated CFURLCreateDataAndPropertiesFromResource function.
Patch by Scott Hancher
BUG=
R=mark@chromium.org
Review URL: https://codereview.chromium.org/1527363003 .
Diffstat (limited to 'src')
-rw-r--r-- | src/client/mac/handler/minidump_generator.cc | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/client/mac/handler/minidump_generator.cc b/src/client/mac/handler/minidump_generator.cc index 38baa04e..7d6e81db 100644 --- a/src/client/mac/handler/minidump_generator.cc +++ b/src/client/mac/handler/minidump_generator.cc @@ -133,25 +133,34 @@ void MinidumpGenerator::GatherSystemInformation() { vers_path, kCFURLPOSIXPathStyle, false); - CFDataRef data; - SInt32 error; - CFURLCreateDataAndPropertiesFromResource(NULL, sys_vers, &data, NULL, NULL, - &error); - + CFReadStreamRef read_stream = CFReadStreamCreateWithFile(NULL, sys_vers); + CFRelease(sys_vers); + if (!read_stream) { + return; + } + if (!CFReadStreamOpen(read_stream)) { + CFRelease(read_stream); + return; + } + CFDataRef data = NULL; + CFIndex num_bytes_read = 0; + const UInt8 *data_bytes = + CFReadStreamGetBuffer(read_stream, 0, &num_bytes_read); + if (data_bytes) { + data = CFDataCreate(NULL, data_bytes, num_bytes_read); + } + CFReadStreamClose(read_stream); + CFRelease(read_stream); if (!data) { - CFRelease(sys_vers); return; } - CFDictionaryRef list = static_cast<CFDictionaryRef> (CFPropertyListCreateFromXMLData(NULL, data, kCFPropertyListImmutable, NULL)); + CFRelease(data); if (!list) { - CFRelease(sys_vers); - CFRelease(data); return; } - CFStringRef build_version = static_cast<CFStringRef> (CFDictionaryGetValue(list, CFSTR("ProductBuildVersion"))); CFStringRef product_version = static_cast<CFStringRef> @@ -160,8 +169,6 @@ void MinidumpGenerator::GatherSystemInformation() { string product_str = ConvertToString(product_version); CFRelease(list); - CFRelease(sys_vers); - CFRelease(data); strlcpy(build_string_, build_str.c_str(), sizeof(build_string_)); |