Remove use of deprecated CFURLCreateDataAndPropertiesFromResource function.
Original change (https://codereview.chromium.org/1527363003/) was failing in CFReadStreamGetBuffer() call, so changed to CFReadStreamRead() to be more conservative. Patch provided by Scott Hancher. BUG= R=mark@chromium.org Review URL: https://codereview.chromium.org/1637433003 .
This commit is contained in:
parent
528035ae4e
commit
0291f06d41
@ -142,12 +142,25 @@ void MinidumpGenerator::GatherSystemInformation() {
|
|||||||
CFRelease(read_stream);
|
CFRelease(read_stream);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CFDataRef data = NULL;
|
CFMutableDataRef data = NULL;
|
||||||
CFIndex num_bytes_read = 0;
|
while (true) {
|
||||||
const UInt8 *data_bytes =
|
// Actual data file tests: Mac at 480 bytes and iOS at 413 bytes.
|
||||||
CFReadStreamGetBuffer(read_stream, 0, &num_bytes_read);
|
const CFIndex kMaxBufferLength = 1024;
|
||||||
if (data_bytes) {
|
UInt8 data_bytes[kMaxBufferLength];
|
||||||
data = CFDataCreate(NULL, data_bytes, num_bytes_read);
|
CFIndex num_bytes_read =
|
||||||
|
CFReadStreamRead(read_stream, data_bytes, kMaxBufferLength);
|
||||||
|
if (num_bytes_read < 0) {
|
||||||
|
if (data) {
|
||||||
|
CFRelease(data);
|
||||||
|
data = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} else if (num_bytes_read == 0) {
|
||||||
|
break;
|
||||||
|
} else if (!data) {
|
||||||
|
data = CFDataCreateMutable(NULL, 0);
|
||||||
|
}
|
||||||
|
CFDataAppendBytes(data, data_bytes, num_bytes_read);
|
||||||
}
|
}
|
||||||
CFReadStreamClose(read_stream);
|
CFReadStreamClose(read_stream);
|
||||||
CFRelease(read_stream);
|
CFRelease(read_stream);
|
||||||
|
Loading…
Reference in New Issue
Block a user