From 39e95cdcb9008aa6f5bd5541dbf4088554c6f1af Mon Sep 17 00:00:00 2001 From: Natale Patriciello Date: Wed, 15 Feb 2017 22:35:11 +0100 Subject: [PATCH] internet: fix static analysis warnings --- src/internet/model/ipv6-address-generator.cc | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/internet/model/ipv6-address-generator.cc b/src/internet/model/ipv6-address-generator.cc index f5ae5ba85..8c7a2d1b3 100644 --- a/src/internet/model/ipv6-address-generator.cc +++ b/src/internet/model/ipv6-address-generator.cc @@ -284,7 +284,7 @@ Ipv6AddressGeneratorImpl::GetNetwork ( const Ipv6Prefix prefix) const { NS_LOG_FUNCTION (this); - uint8_t nw[16]; + uint8_t nw[16] = { 0 }; uint32_t index = PrefixToIndex (prefix); uint32_t a = m_netTable[index].shift / 8; uint32_t b = m_netTable[index].shift % 8; @@ -292,10 +292,6 @@ Ipv6AddressGeneratorImpl::GetNetwork ( { nw[j] = m_netTable[index].network[j + a]; } - for (uint32_t j = 16 - a; j < 16; ++j) - { - nw[j] = 0; - } for (uint32_t j = 0; j < 15; j++) { nw[j] = nw[j] << b; @@ -380,17 +376,13 @@ Ipv6AddressGeneratorImpl::GetAddress (const Ipv6Prefix prefix) const uint32_t index = PrefixToIndex (prefix); - uint8_t nw[16]; + uint8_t nw[16] = { 0 }; uint32_t a = m_netTable[index].shift / 8; uint32_t b = m_netTable[index].shift % 8; for (uint32_t j = 0; j < 16 - a; ++j) { nw[j] = m_netTable[index].network[j + a]; } - for (uint32_t j = 16 - a; j < 16; ++j) - { - nw[j] = 0; - } for (uint32_t j = 0; j < 15; j++) { nw[j] = nw[j] << b; @@ -412,17 +404,13 @@ Ipv6AddressGeneratorImpl::NextAddress (const Ipv6Prefix prefix) uint32_t index = PrefixToIndex (prefix); - uint8_t ad[16]; + uint8_t ad[16] = { 0 }; uint32_t a = m_netTable[index].shift / 8; uint32_t b = m_netTable[index].shift % 8; for (uint32_t j = 0; j < 16 - a; ++j) { ad[j] = m_netTable[index].network[j + a]; } - for (uint32_t j = 16 - a; j < 16; ++j) - { - ad[j] = 0; - } for (uint32_t j = 0; j < 15; j++) { ad[j] = ad[j] << b;