summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Manoj Gupta <manojgupta@google.com> 2017-07-12 10:29:15 -0700
committer Manoj Gupta <manojgupta@google.com> 2017-07-12 10:29:15 -0700
commit6eb62056acdee1861dbead8a6daedf5a042bce4d (patch)
treeec70b2a1b74b4e6ff978cc5ae653c6c108d4a71e
parent38bcc110b84e04c00793632c043526a8c86f4463 (diff)
Fix clang static anaylzer warnings.
Initialize the values in readBool, readChar and readByte functions. Silences the following warnings: frameworks/native/libs/binder/Parcel.cpp:1856:18: warning: The left operand of '!=' is a garbage value. frameworks/native/libs/binder/Parcel.cpp:1869:11: warning: Assigned value is garbage or undefined. frameworks/native/libs/binder/Parcel.cpp:1882:11: warning: Assigned value is garbage or undefined. Bug: b/27101951 Test:Warnings are gone. Change-Id: Iba8d242d4d9b1b48f7cafb901023133e21d9d732
-rw-r--r--libs/binder/Parcel.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index d753eb5fa8..1769bec795 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1711,7 +1711,7 @@ intptr_t Parcel::readIntPtr() const
status_t Parcel::readBool(bool *pArg) const
{
- int32_t tmp;
+ int32_t tmp = 0;
status_t ret = readInt32(&tmp);
*pArg = (tmp != 0);
return ret;
@@ -1724,7 +1724,7 @@ bool Parcel::readBool() const
status_t Parcel::readChar(char16_t *pArg) const
{
- int32_t tmp;
+ int32_t tmp = 0;
status_t ret = readInt32(&tmp);
*pArg = char16_t(tmp);
return ret;
@@ -1737,7 +1737,7 @@ char16_t Parcel::readChar() const
status_t Parcel::readByte(int8_t *pArg) const
{
- int32_t tmp;
+ int32_t tmp = 0;
status_t ret = readInt32(&tmp);
*pArg = int8_t(tmp);
return ret;