From 1084b43e2406f20282a2297d5d25209609721e48 Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Sat, 17 Feb 2007 11:35:53 +0000 Subject: [PATCH] changes for Windows --- Cantera/src/SpeciesThermoFactory.cpp | 4 +++- Cantera/src/importCTML.cpp | 2 +- Cantera/src/stringUtils.cpp | 15 +++++++++------ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Cantera/src/SpeciesThermoFactory.cpp b/Cantera/src/SpeciesThermoFactory.cpp index 678f0aab1..780990dd8 100755 --- a/Cantera/src/SpeciesThermoFactory.cpp +++ b/Cantera/src/SpeciesThermoFactory.cpp @@ -9,9 +9,10 @@ #pragma warning(disable:4786) #endif -using namespace std; + #include "SpeciesThermoFactory.h" +using namespace std; #include "SpeciesThermo.h" #include "NasaThermo.h" @@ -28,6 +29,7 @@ using namespace std; using namespace ctml; + namespace Cantera { SpeciesThermoFactory* SpeciesThermoFactory::s_factory = 0; diff --git a/Cantera/src/importCTML.cpp b/Cantera/src/importCTML.cpp index c6506c8b7..eaf565903 100755 --- a/Cantera/src/importCTML.cpp +++ b/Cantera/src/importCTML.cpp @@ -51,7 +51,7 @@ public: //! string name std::vector eqn; //! string vector of ints - std::vector dup,; + std::vector dup; //! string vector of ints std::vector nr; //! string vector of ints diff --git a/Cantera/src/stringUtils.cpp b/Cantera/src/stringUtils.cpp index daafbe536..80a91ee8b 100755 --- a/Cantera/src/stringUtils.cpp +++ b/Cantera/src/stringUtils.cpp @@ -9,6 +9,9 @@ #ifdef WIN32 #pragma warning(disable:4786) #pragma warning(disable:4503) +#define SNPRINTF _snprintf +#else +#define SNPRINTF snprintf #endif #include "ct_defs.h" @@ -24,8 +27,8 @@ namespace Cantera { * Convert a floating point number to a std::string using sprintf. */ std::string fp2str(double x, std::string fmt) { - char buf[30]; - int n = snprintf(buf, 30, fmt.c_str(), x); + char buf[30]; + int n = SNPRINTF(buf, 30, fmt.c_str(), x); if (n > 0) { buf[29] = '\0'; return std::string(buf); @@ -34,7 +37,7 @@ namespace Cantera { } std::string fp2str(double x) { char buf[30]; - int n = snprintf(buf, 30, "%g" , x); + int n = SNPRINTF(buf, 30, "%g" , x); if (n > 0) { buf[29] = '\0'; return std::string(buf); @@ -47,8 +50,8 @@ namespace Cantera { */ std::string int2str(int n, std::string fmt) { char buf[30]; - int m = snprintf(buf, 30, fmt.c_str(), n); - sprintf(buf, fmt.c_str(), n); + int m = SNPRINTF(buf, 30, fmt.c_str(), n); + //sprintf(buf, fmt.c_str(), n); if (m > 0) { buf[29] = '\0'; return std::string(buf); @@ -59,7 +62,7 @@ namespace Cantera { std::string int2str(int n) { char buf[30]; - int m = snprintf(buf, 30, "%d", n); + int m = SNPRINTF(buf, 30, "%d", n); if (m > 0) { buf[29] = '\0'; return std::string(buf);