From ff5c068a5a7d04282c50a9aa5d5960c88ea4313a Mon Sep 17 00:00:00 2001 From: Buke Po Date: Wed, 10 May 2017 10:33:16 +0800 Subject: [PATCH] Fix warnings of found by scan-build (#1746) * fix warnings of found by scan * revert the implementation of ChildTableEntry --- src/core/common/tlvs.hpp | 8 ++++++++ src/core/net/ip6_headers.hpp | 8 ++++++++ src/core/thread/network_diagnostic_tlvs.hpp | 22 ++++++++++++++++----- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/core/common/tlvs.hpp b/src/core/common/tlvs.hpp index bbcc5f547..f661aa3b5 100644 --- a/src/core/common/tlvs.hpp +++ b/src/core/common/tlvs.hpp @@ -54,6 +54,14 @@ OT_TOOL_PACKED_BEGIN class Tlv { public: + /** + * Default constructor. + * + */ + Tlv(void): + mType(0), + mLength(0) {} + /** * This method returns the Type value. * diff --git a/src/core/net/ip6_headers.hpp b/src/core/net/ip6_headers.hpp index 57dc41983..3892c3619 100644 --- a/src/core/net/ip6_headers.hpp +++ b/src/core/net/ip6_headers.hpp @@ -337,6 +337,14 @@ OT_TOOL_PACKED_BEGIN class OptionHeader { public: + /** + * Default constructor. + * + */ + OptionHeader(void): + mType(0), + mLength(0) {} + /** * This method returns the IPv6 Option Type value. * diff --git a/src/core/thread/network_diagnostic_tlvs.hpp b/src/core/thread/network_diagnostic_tlvs.hpp index 21d9b4d95..4516d58c5 100644 --- a/src/core/thread/network_diagnostic_tlvs.hpp +++ b/src/core/thread/network_diagnostic_tlvs.hpp @@ -1156,6 +1156,14 @@ OT_TOOL_PACKED_BEGIN class ChildTableEntry { public: + /** + * Default constructor. + * + */ + ChildTableEntry(void): + mTimeoutRsvChildId(0), + mMode(0) {} + /** * This method returns the Timeout value. * @@ -1230,17 +1238,21 @@ public: } private: + /** + * Masks for fields. + * + */ enum { - kTimeoutMask = 0xF800, - kTimeoutOffset = 11, - kReservedMask = 0x0600, + kTimeoutMask = 0xf800, + kTimeoutOffset = 11, + kReservedMask = 0x0600, kReservedOffset = 9, - kChildIdMask = 0x1ff + kChildIdMask = 0x1ff }; uint16_t mTimeoutRsvChildId; - uint8_t mMode; + uint8_t mMode; } OT_TOOL_PACKED_END; /**