fix -Werror=strict-overflow issue in example program
authorTom Henderson <tomh@tomh.org>
Tue, 27 Jan 2015 21:52:50 -0800
changeset 11167 89730ec95897
parent 11166 96cef68fae19
child 11172 d2c2b7934927
fix -Werror=strict-overflow issue in example program
src/wave/examples/vanet-routing-compare.cc
--- a/src/wave/examples/vanet-routing-compare.cc	Tue Jan 27 21:47:30 2015 -0800
+++ b/src/wave/examples/vanet-routing-compare.cc	Tue Jan 27 21:52:50 2015 -0800
@@ -414,7 +414,7 @@
                 Ipv4InterfaceContainer & i,
                 double totalTime,
                 int protocol,
-                int nSinks,
+                uint32_t nSinks,
                 int routingTables);
 
   /**
@@ -482,7 +482,7 @@
   double m_TotalSimTime;        // seconds
   uint32_t m_protocol;       // routing protocol; 0=NONE, 1=OLSR, 2=AODV, 3=DSDV, 4=DSR
   uint32_t m_port;
-  int m_nSinks;              // number of sink nodes (< all nodes)
+  uint32_t m_nSinks;              // number of sink nodes (< all nodes)
   int m_routingTables;      // dump routing table (at t=5 sec).  0=No, 1=Yes
   RoutingStats routingStats;
   std::string m_protocolName;
@@ -520,7 +520,7 @@
                         Ipv4InterfaceContainer & i,
                         double totalTime,
                         int protocol,
-                        int nSinks,
+                        uint32_t nSinks,
                         int routingTables)
 {
   m_TotalSimTime = totalTime;
@@ -642,7 +642,7 @@
   Ptr<UniformRandomVariable> var = CreateObject<UniformRandomVariable> ();
   int64_t stream = 2;
   var->SetStream (stream);
-  for (int i = 0; i <= m_nSinks - 1; i++)
+  for (uint32_t i = 0; i < m_nSinks; i++)
     {
       // protocol == 0 means no routing data, WAVE BSM only
       // so do not set up sink
@@ -1247,7 +1247,7 @@
   uint32_t m_port;
   std::string m_CSVfileName;
   std::string m_CSVfileName2;
-  int m_nSinks;
+  uint32_t m_nSinks;
   std::string m_protocolName;
   double m_txp;
   bool m_traceMobility;