DO NOT MERGE - Merge pie-platform-release (PPRL.190705.004) into master
Bug: 136196576
Change-Id: I2ecaea1e2e59807dbf153c9ec0d2fccbec27fc88
diff --git a/Parcel.cpp b/Parcel.cpp
index 1c11df7..5142143 100644
--- a/Parcel.cpp
+++ b/Parcel.cpp
@@ -186,7 +186,7 @@
status_t flatten_binder(const sp<ProcessState>& /*proc*/,
const sp<IBinder>& binder, Parcel* out)
{
- flat_binder_object obj;
+ flat_binder_object obj = {};
if (binder != nullptr) {
BHwBinder *local = binder->localBinder();
@@ -228,7 +228,7 @@
status_t flatten_binder(const sp<ProcessState>& /*proc*/,
const wp<IBinder>& binder, Parcel* out)
{
- flat_binder_object obj;
+ flat_binder_object obj = {};
obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS;
if (binder != nullptr) {
@@ -817,15 +817,16 @@
LOG_BUFFER("writeEmbeddedBuffer(%p, %zu, parent = (%zu, %zu)) -> %zu",
buffer, length, parent_buffer_handle,
parent_offset, mObjectsSize);
- binder_buffer_object obj;
- obj.hdr.type = BINDER_TYPE_PTR;
- obj.buffer = reinterpret_cast<binder_uintptr_t>(buffer);
- obj.length = length;
- obj.flags = BINDER_BUFFER_FLAG_HAS_PARENT;
if(!validateBufferParent(parent_buffer_handle, parent_offset))
return BAD_VALUE;
- obj.parent = parent_buffer_handle;
- obj.parent_offset = parent_offset;
+ binder_buffer_object obj = {
+ .hdr = { .type = BINDER_TYPE_PTR },
+ .buffer = reinterpret_cast<binder_uintptr_t>(buffer),
+ .length = length,
+ .flags = BINDER_BUFFER_FLAG_HAS_PARENT,
+ .parent = parent_buffer_handle,
+ .parent_offset = parent_offset,
+ };
if (handle != nullptr) {
// We use an index into mObjects as a handle
*handle = mObjectsSize;
@@ -837,11 +838,12 @@
{
LOG_BUFFER("writeBuffer(%p, %zu) -> %zu",
buffer, length, mObjectsSize);
- binder_buffer_object obj;
- obj.hdr.type = BINDER_TYPE_PTR;
- obj.buffer = reinterpret_cast<binder_uintptr_t>(buffer);
- obj.length = length;
- obj.flags = 0;
+ binder_buffer_object obj {
+ .hdr = { .type = BINDER_TYPE_PTR },
+ .buffer = reinterpret_cast<binder_uintptr_t>(buffer),
+ .length = length,
+ .flags = 0,
+ };
if (handle != nullptr) {
// We use an index into mObjects as a handle
*handle = mObjectsSize;
@@ -926,7 +928,6 @@
size_t parent_buffer_handle,
size_t parent_offset)
{
- struct binder_fd_array_object fd_array;
size_t buffer_handle;
status_t status = OK;
@@ -951,10 +952,12 @@
return status;
}
- fd_array.hdr.type = BINDER_TYPE_FDA;
- fd_array.num_fds = handle->numFds;
- fd_array.parent = buffer_handle;
- fd_array.parent_offset = offsetof(native_handle_t, data);
+ struct binder_fd_array_object fd_array {
+ .hdr = { .type = BINDER_TYPE_FDA },
+ .num_fds = static_cast<binder_size_t>(handle->numFds),
+ .parent = buffer_handle,
+ .parent_offset = offsetof(native_handle_t, data),
+ };
return writeObject(fd_array);
}