--- a/examples/routing/manet-routing-compare.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/examples/routing/manet-routing-compare.cc Wed Apr 30 21:32:57 2014 -0700
@@ -343,7 +343,7 @@
onoff1.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
onoff1.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));
- for (int i = 0; i <= nSinks - 1; i++)
+ for (int i = 0; i < nSinks; i++)
{
Ptr<Socket> sink = SetupPacketReceive (adhocInterfaces.GetAddress (i), adhocNodes.Get (i));
--- a/src/lte/model/cqa-ff-mac-scheduler.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/lte/model/cqa-ff-mac-scheduler.cc Wed Apr 30 21:32:57 2014 -0700
@@ -1963,7 +1963,7 @@
uldci.m_rbLen = rbPerFlow;
bool allocated = false;
NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
- while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth) && (rbPerFlow != 0))
+ while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBandwidth) < 1) && (rbPerFlow != 0))
{
// check availability
bool free = true;
--- a/src/lte/model/fdbet-ff-mac-scheduler.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/lte/model/fdbet-ff-mac-scheduler.cc Wed Apr 30 21:32:57 2014 -0700
@@ -1593,7 +1593,7 @@
uldci.m_rbLen = rbPerFlow;
bool allocated = false;
NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
- while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth) && (rbPerFlow != 0))
+ while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBandwidth) < 1) && (rbPerFlow != 0))
{
// check availability
bool free = true;
--- a/src/lte/model/fdmt-ff-mac-scheduler.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/lte/model/fdmt-ff-mac-scheduler.cc Wed Apr 30 21:32:57 2014 -0700
@@ -1571,7 +1571,7 @@
uldci.m_rbLen = rbPerFlow;
bool allocated = false;
NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
- while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth) && (rbPerFlow != 0))
+ while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBandwidth) < 1) && (rbPerFlow != 0))
{
// check availability
bool free = true;
--- a/src/lte/model/fdtbfq-ff-mac-scheduler.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/lte/model/fdtbfq-ff-mac-scheduler.cc Wed Apr 30 21:32:57 2014 -0700
@@ -1822,7 +1822,7 @@
uldci.m_rbLen = rbPerFlow;
bool allocated = false;
NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
- while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth) && (rbPerFlow != 0))
+ while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBandwidth) < 1) && (rbPerFlow != 0))
{
// check availability
bool free = true;
--- a/src/lte/model/lte-enb-rrc.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/lte/model/lte-enb-rrc.cc Wed Apr 30 21:32:57 2014 -0700
@@ -1041,7 +1041,7 @@
{
NS_LOG_FUNCTION (this);
const uint8_t MAX_DRB_ID = 32;
- for (uint8_t drbid = (m_lastAllocatedDrbid + 1) % MAX_DRB_ID;
+ for (int drbid = (m_lastAllocatedDrbid + 1) % MAX_DRB_ID;
drbid != m_lastAllocatedDrbid;
drbid = (drbid + 1) % MAX_DRB_ID)
{
--- a/src/lte/model/lte-rlc-sequence-number.h Wed Apr 30 20:54:05 2014 -0700
+++ b/src/lte/model/lte-rlc-sequence-number.h Wed Apr 30 21:32:57 2014 -0700
@@ -78,7 +78,7 @@
SequenceNumber10 operator++ (int)
{
SequenceNumber10 retval (m_value);
- m_value = (m_value + 1) % 1024;
+ m_value = ((uint32_t)m_value + 1) % 1024;
return retval;
}
--- a/src/lte/model/pf-ff-mac-scheduler.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/lte/model/pf-ff-mac-scheduler.cc Wed Apr 30 21:32:57 2014 -0700
@@ -1617,7 +1617,7 @@
uldci.m_rbLen = rbPerFlow;
bool allocated = false;
NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
- while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth) && (rbPerFlow != 0))
+ while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBandwidth) < 1) && (rbPerFlow != 0))
{
// check availability
bool free = true;
--- a/src/lte/model/pss-ff-mac-scheduler.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/lte/model/pss-ff-mac-scheduler.cc Wed Apr 30 21:32:57 2014 -0700
@@ -1922,7 +1922,7 @@
uldci.m_rbLen = rbPerFlow;
bool allocated = false;
NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
- while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth) && (rbPerFlow != 0))
+ while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBandwidth) < 1) && (rbPerFlow != 0))
{
// check availability
bool free = true;
--- a/src/lte/model/rr-ff-mac-scheduler.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/lte/model/rr-ff-mac-scheduler.cc Wed Apr 30 21:32:57 2014 -0700
@@ -1454,7 +1454,7 @@
uldci.m_rbLen = rbPerFlow;
bool allocated = false;
NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
- while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth) && (rbPerFlow != 0))
+ while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBandwidth) < 1) && (rbPerFlow != 0))
{
// check availability
bool free = true;
--- a/src/lte/model/tdbet-ff-mac-scheduler.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/lte/model/tdbet-ff-mac-scheduler.cc Wed Apr 30 21:32:57 2014 -0700
@@ -1515,7 +1515,7 @@
uldci.m_rbLen = rbPerFlow;
bool allocated = false;
NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
- while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth) && (rbPerFlow != 0))
+ while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBandwidth) < 1) && (rbPerFlow != 0))
{
// check availability
bool free = true;
--- a/src/lte/model/tdmt-ff-mac-scheduler.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/lte/model/tdmt-ff-mac-scheduler.cc Wed Apr 30 21:32:57 2014 -0700
@@ -1511,7 +1511,7 @@
uldci.m_rbLen = rbPerFlow;
bool allocated = false;
NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
- while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth) && (rbPerFlow != 0))
+ while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBandwidth) < 1) && (rbPerFlow != 0))
{
// check availability
bool free = true;
--- a/src/lte/model/tdtbfq-ff-mac-scheduler.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/lte/model/tdtbfq-ff-mac-scheduler.cc Wed Apr 30 21:32:57 2014 -0700
@@ -1609,7 +1609,7 @@
uldci.m_rbLen = rbPerFlow;
bool allocated = false;
NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
- while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth) && (rbPerFlow != 0))
+ while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBandwidth) < 1) && (rbPerFlow != 0))
{
// check availability
bool free = true;
--- a/src/lte/model/tta-ff-mac-scheduler.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/lte/model/tta-ff-mac-scheduler.cc Wed Apr 30 21:32:57 2014 -0700
@@ -1590,7 +1590,7 @@
uldci.m_rbLen = rbPerFlow;
bool allocated = false;
NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << rbPerFlow << " flows " << nflows);
- while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth) && (rbPerFlow != 0))
+ while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBandwidth) < 1) && (rbPerFlow != 0))
{
// check availability
bool free = true;
--- a/src/network/model/address.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/network/model/address.cc Wed Apr 30 21:32:57 2014 -0700
@@ -90,7 +90,7 @@
Address::CopyAllTo (uint8_t *buffer, uint8_t len) const
{
NS_LOG_FUNCTION (this << &buffer << static_cast<uint32_t> (len));
- NS_ASSERT (len >= m_len + 2);
+ NS_ASSERT (len - m_len > 1);
buffer[0] = m_type;
buffer[1] = m_len;
std::memcpy (buffer + 2, m_data, m_len);
@@ -114,7 +114,7 @@
m_type = buffer[0];
m_len = buffer[1];
- NS_ASSERT (len >= m_len + 2);
+ NS_ASSERT (len - m_len > 1);
std::memcpy (m_data, buffer + 2, m_len);
return m_len + 2;
}
--- a/src/network/utils/ipv6-address.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/network/utils/ipv6-address.cc Wed Apr 30 21:32:57 2014 -0700
@@ -154,7 +154,7 @@
static const char xdigits_u[] = "0123456789ABCDEF";
unsigned char tmp[16];
unsigned char* tp = tmp;
- unsigned char* endp = 0;
+ unsigned char* const endp = tp + 16;
unsigned char* colonp = 0;
const char* xdigits = 0;
#if 0
@@ -165,7 +165,6 @@
unsigned int val = 0;
memset (tp, 0x00, 16);
- endp = tp + 16;
/* Leading :: requires some special handling. */
if (*address == ':')
@@ -212,7 +211,7 @@
continue;
}
- if (tp + 2 > endp)
+ if (endp - tp < 2)
{
return (0);
}
@@ -226,7 +225,7 @@
/* \todo Handle IPv4 mapped address (2001::192.168.0.1) */
#if 0
- if (ch == '.' && ((tp + 4 /*NS_INADDRSZ*/) <= endp) &&
+ if (ch == '.' && (endp - tp > 3 /* NS_INADDRSZ - 1 */)) &&
inet_pton4 (curtok, tp) > 0)
{
tp += 4 /*NS_INADDRSZ*/;
@@ -239,7 +238,7 @@
if (seen_xdigits)
{
- if (tp + 2 > endp)
+ if ( endp - tp < 2)
{
return (0);
}
--- a/src/network/utils/packetbb.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/network/utils/packetbb.cc Wed Apr 30 21:32:57 2014 -0700
@@ -2516,7 +2516,7 @@
}
/* If headlen == fulllen - 1, then tail is 0 */
- if (headlen <= GetAddressLength () - 1)
+ if (GetAddressLength () - headlen > 0)
{
for (i = GetAddressLength () - 1;
GetAddressLength () - 1 - i <= taillen && i > headlen;
--- a/src/wimax/model/cid-factory.cc Wed Apr 30 20:54:05 2014 -0700
+++ b/src/wimax/model/cid-factory.cc Wed Apr 30 21:32:57 2014 -0700
@@ -98,14 +98,14 @@
bool
CidFactory::IsTransport (Cid cid) const
{
- uint16_t id = cid.m_identifier;
- return id >= 2 * m_m + 1 && id <= 0xfefe;
+ int id = cid.m_identifier;
+ return (id - 2 * m_m > 0) && (id <= 0xfefe);
}
bool
CidFactory::IsPrimary (Cid cid) const
{
- uint16_t id = cid.m_identifier;
- return id >= m_m + 1 && id <= 2 * m_m;
+ int id = cid.m_identifier;
+ return (id - m_m > 0) && (id <= 2 * m_m);
}
bool
CidFactory::IsBasic (Cid cid) const
--- a/wscript Wed Apr 30 20:54:05 2014 -0700
+++ b/wscript Wed Apr 30 21:32:57 2014 -0700
@@ -325,6 +325,8 @@
if Options.options.build_profile == 'optimized':
if conf.check_compilation_flag('-march=native'):
env.append_value('CXXFLAGS', '-march=native')
+ env.append_value('CXXFLAGS', '-fstrict-overflow')
+ env.append_value('CXXFLAGS', '-Wstrict-overflow=5')
if sys.platform == 'win32':
env.append_value("LINKFLAGS", "-Wl,--enable-runtime-pseudo-reloc")