Merge "Zero-initialize HIDL structs before passing" into oc-dev
diff --git a/media/libstagefright/omx/1.0/WGraphicBufferProducer.cpp b/media/libstagefright/omx/1.0/WGraphicBufferProducer.cpp
index 650db8e..631f52e 100644
--- a/media/libstagefright/omx/1.0/WGraphicBufferProducer.cpp
+++ b/media/libstagefright/omx/1.0/WGraphicBufferProducer.cpp
@@ -39,7 +39,7 @@
int32_t slot, requestBuffer_cb _hidl_cb) {
sp<GraphicBuffer> buf;
status_t status = mBase->requestBuffer(slot, &buf);
- AnwBuffer anwBuffer;
+ AnwBuffer anwBuffer{};
wrapAs(&anwBuffer, *buf);
_hidl_cb(static_cast<int32_t>(status), anwBuffer);
return Void();
@@ -59,7 +59,7 @@
uint32_t width, uint32_t height,
PixelFormat format, uint32_t usage,
bool getFrameTimestamps, dequeueBuffer_cb _hidl_cb) {
- int slot;
+ int slot{};
sp<Fence> fence;
::android::FrameEventHistoryDelta outTimestamps;
status_t status = mBase->dequeueBuffer(
@@ -67,8 +67,8 @@
width, height,
static_cast<::android::PixelFormat>(format), usage,
getFrameTimestamps ? &outTimestamps : nullptr);
- hidl_handle tFence;
- FrameEventHistoryDelta tOutTimestamps;
+ hidl_handle tFence{};
+ FrameEventHistoryDelta tOutTimestamps{};
native_handle_t* nh = nullptr;
if ((fence == nullptr) || !wrapAs(&tFence, &nh, *fence)) {
@@ -116,8 +116,8 @@
sp<GraphicBuffer> outBuffer;
sp<Fence> outFence;
status_t status = mBase->detachNextBuffer(&outBuffer, &outFence);
- AnwBuffer tBuffer;
- hidl_handle tFence;
+ AnwBuffer tBuffer{};
+ hidl_handle tFence{};
if (outBuffer == nullptr) {
LOG(ERROR) << "TWGraphicBufferProducer::detachNextBuffer - "
@@ -159,7 +159,7 @@
Return<void> TWGraphicBufferProducer::queueBuffer(
int32_t slot, const QueueBufferInput& input,
queueBuffer_cb _hidl_cb) {
- QueueBufferOutput tOutput;
+ QueueBufferOutput tOutput{};
BGraphicBufferProducer::QueueBufferInput lInput(
0, false, HAL_DATASPACE_UNKNOWN,
::android::Rect(0, 0, 1, 1),
@@ -221,7 +221,7 @@
producerControlledByApp,
&lOutput);
- QueueBufferOutput tOutput;
+ QueueBufferOutput tOutput{};
std::vector<std::vector<native_handle_t*> > nhAA;
if (!wrapAs(&tOutput, &nhAA, lOutput)) {
LOG(ERROR) << "TWGraphicBufferProducer::connect - "
@@ -293,11 +293,11 @@
status_t status = mBase->getLastQueuedBuffer(
&lOutBuffer, &lOutFence, lOutTransformMatrix);
- AnwBuffer tOutBuffer;
+ AnwBuffer tOutBuffer{};
if (lOutBuffer != nullptr) {
wrapAs(&tOutBuffer, *lOutBuffer);
}
- hidl_handle tOutFence;
+ hidl_handle tOutFence{};
native_handle_t* nh = nullptr;
if ((lOutFence == nullptr) || !wrapAs(&tOutFence, &nh, *lOutFence)) {
LOG(ERROR) << "TWGraphicBufferProducer::getLastQueuedBuffer - "
@@ -320,7 +320,7 @@
::android::FrameEventHistoryDelta lDelta;
mBase->getFrameTimestamps(&lDelta);
- FrameEventHistoryDelta tDelta;
+ FrameEventHistoryDelta tDelta{};
std::vector<std::vector<native_handle_t*> > nhAA;
if (!wrapAs(&tDelta, &nhAA, lDelta)) {
LOG(ERROR) << "TWGraphicBufferProducer::getFrameTimestamps - "
@@ -339,7 +339,7 @@
}
Return<void> TWGraphicBufferProducer::getUniqueId(getUniqueId_cb _hidl_cb) {
- uint64_t outId;
+ uint64_t outId{};
status_t status = mBase->getUniqueId(&outId);
_hidl_cb(static_cast<int32_t>(status), outId);
return Void();