internet: fix static analysis warnings

This commit is contained in:
Natale Patriciello
2017-02-15 22:35:11 +01:00
parent 03fea775cb
commit 39e95cdcb9

View File

@@ -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;