bug 245: build failure with gcc 4.3.x

This commit is contained in:
Mathieu Lacage
2008-07-02 03:16:36 -07:00
parent 67c5dfa611
commit b93a9aeef4
22 changed files with 45 additions and 7 deletions

View File

@@ -536,6 +536,7 @@ private:
#ifdef BUFFER_USE_INLINE
#include "ns3/assert.h"
#include <string.h>
namespace ns3 {

View File

@@ -29,7 +29,10 @@ DoParse (const std::string s, uint64_t *v)
std::string::size_type n = s.find_first_not_of("0123456789.");
if (n != std::string::npos)
{ // Found non-numeric
double r = ::atof(s.substr(0, n).c_str());
std::istringstream iss;
iss.str (s.substr(0, n));
double r;
iss >> r;
std::string trailer = s.substr(n, std::string::npos);
if (trailer == "bps")
{
@@ -117,7 +120,9 @@ DoParse (const std::string s, uint64_t *v)
}
return true;
}
*v = ::atoll(s.c_str());
std::istringstream iss;
iss.str (s);
iss >> *v;
return true;
}

View File

@@ -20,6 +20,7 @@
#include "tag-list.h"
#include "ns3/log.h"
#include <vector>
#include <string.h>
NS_LOG_COMPONENT_DEFINE ("TagList");

View File

@@ -8,6 +8,7 @@
#include <fstream>
#include <iostream>
#include <unistd.h>
#include <stdlib.h>
NS_LOG_COMPONENT_DEFINE ("ConfigStore");

View File

@@ -25,6 +25,7 @@
#include "fatal-error.h"
#include "empty.h"
#include "type-traits.h"
#include <typeinfo>
namespace ns3 {

View File

@@ -23,6 +23,7 @@
#include "attribute.h"
#include "attribute-helper.h"
#include <stdint.h>
#include <limits>
namespace ns3 {

View File

@@ -23,6 +23,7 @@
#include "attribute.h"
#include "attribute-helper.h"
#include <stdint.h>
#include <limits>
namespace ns3 {

View File

@@ -23,6 +23,7 @@
#include "attribute.h"
#include "attribute-helper.h"
#include <stdint.h>
#include <limits>
namespace ns3 {

View File

@@ -21,6 +21,7 @@
#define STATUS_CODE_H
#include <stdint.h>
#include <ostream>
#include "ns3/buffer.h"
namespace ns3 {

View File

@@ -21,6 +21,7 @@
#define SUPPORTED_RATES_H
#include <stdint.h>
#include <ostream>
#include "ns3/buffer.h"
namespace ns3 {

View File

@@ -26,6 +26,7 @@
#include "ns3/packet-socket-factory.h"
#include "ns3/config.h"
#include "ns3/simulator.h"
#include <limits>
namespace ns3 {

View File

@@ -39,7 +39,7 @@ public:
*/
void SetAgent (std::string tid,
std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
std::string n1 = "", const AttributeValue &v2 = EmptyAttributeValue (),
std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),

View File

@@ -20,8 +20,14 @@ namespace sgi = std; // GCC 3.0
namespace sgi = ::__gnu_cxx; // GCC 3.1 and later
#endif
#else // gcc 4.x and later
#if __GNUC_MINOR__ < 3
#include <ext/hash_map>
namespace sgi = ::__gnu_cxx;
namespace sgi = ::__gnu_cxx;
#else
#undef __DEPRECATED
#include <backward/hash_map>
namespace sgi = ::__gnu_cxx;
#endif
#endif
#endif
#else // ... there are other compilers, right?

View File

@@ -1,5 +1,6 @@
#include "ns3/assert.h"
#include "address.h"
#include <string.h>
#include <iostream>
#include <iomanip>

View File

@@ -22,6 +22,7 @@
#include "ns3/assert.h"
#include <iomanip>
#include <iostream>
#include <string.h>
namespace ns3 {

View File

@@ -22,6 +22,7 @@
#include "ns3/assert.h"
#include <iomanip>
#include <iostream>
#include <string.h>
namespace ns3 {

View File

@@ -25,6 +25,7 @@
#include "node.h"
#include "socket.h"
#include "socket-factory.h"
#include <limits>
NS_LOG_COMPONENT_DEFINE ("Socket");

View File

@@ -1425,6 +1425,7 @@ GlobalRouteManagerImpl::SPFVertexAddParent (SPFVertex* v)
#include "ns3/test.h"
#include "ns3/simulator.h"
#include <stdlib.h> // for rand ()
namespace ns3 {

View File

@@ -72,7 +72,10 @@ TimeUnit<1>::TimeUnit(const std::string& s)
std::string::size_type n = s.find_first_not_of("0123456789.");
if (n != std::string::npos)
{ // Found non-numeric
double r = atof(s.substr(0, n).c_str());
std::istringstream iss;
iss.str (s.substr(0, n));
double r;
iss >> r;
std::string trailer = s.substr(n, std::string::npos);
if (trailer == std::string("s"))
{
@@ -113,7 +116,11 @@ TimeUnit<1>::TimeUnit(const std::string& s)
}
//else
//they didn't provide units, assume seconds
m_data = HighPrecision (atof(s.c_str()) * TimeStepPrecision::g_tsPrecFactor);
std::istringstream iss;
iss. str (s);
double v;
iss >> v;
m_data = HighPrecision (v * TimeStepPrecision::g_tsPrecFactor);
}
double

View File

@@ -23,6 +23,7 @@
#include <iostream>
#include <sstream>
#include <string>
#include <stdlib.h> // for exit ()
using namespace ns3;
@@ -261,7 +262,9 @@ int main (int argc, char *argv[])
if (strncmp ("--n=", argv[0],strlen ("--n=")) == 0)
{
char const *nAscii = argv[0] + strlen ("--n=");
n = atoi (nAscii);
std::istringstream iss;
iss.str (nAscii);
iss >> n;
}
argc--;
argv++;

View File

@@ -23,6 +23,7 @@
#include <iostream>
#include <fstream>
#include <vector>
#include <string.h>
using namespace ns3;

View File

@@ -24,6 +24,7 @@
#include <deque>
#include <fstream>
#include <iostream>
#include <string.h>
using namespace ns3;