diff --git a/Phreeqc.h b/Phreeqc.h index 072834822..01a49e457 100644 --- a/Phreeqc.h +++ b/Phreeqc.h @@ -6,6 +6,7 @@ # define WINVER 0x0400 # endif # include +// # define nullptr NULL # endif # include # if defined(PHREEQCI_GUI) @@ -2095,12 +2096,22 @@ char* _string_duplicate(const char* token, const char* szFileName, int nLine); // https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010 #if defined(_MSC_VER) && (_MSC_VER < 1900) - +#if (_MSC_VER == 1400) // VS2005 +namespace std { + __inline bool isnan(double num) { + return _isnan(num) != 0; + } +} +#endif #include #define snprintf c99_snprintf #define vsnprintf c99_vsnprintf +#pragma warning( push ) +// warning C4793: 'vararg' : causes native code generation +#pragma warning( disable : 4793 ) + __inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) { int count = -1; @@ -2124,6 +2135,7 @@ __inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...) return count; } +#pragma warning( pop ) #endif // defined(_MSC_VER) && (_MSC_VER < 1900) #endif //_INC_MISSING_SNPRINTF_H diff --git a/common/Utils.cxx b/common/Utils.cxx index 1eafd4399..0e8d461ae 100644 --- a/common/Utils.cxx +++ b/common/Utils.cxx @@ -12,6 +12,10 @@ #include "float.h" #include +#if defined(_MSC_VER) && (_MSC_VER <= 1400) // VS2005 +# define nullptr NULL +#endif + #if defined(PHREEQCI_GUI) #ifdef _DEBUG #define new DEBUG_NEW diff --git a/global_structures.h b/global_structures.h index 98f16eefd..020770f77 100644 --- a/global_structures.h +++ b/global_structures.h @@ -6,9 +6,14 @@ * #define DEFINITIONS * ---------------------------------------------------------------------- */ #if !defined(NAN) -#define NAN nan("1") +# if defined(_MSC_VER) && (_MSC_VER <= 1400) // VS2005 +# include +# define NAN std::numeric_limits::signaling_NaN() +# else +# define NAN nan("1") +# endif #endif -#define MISSING -9999.999 +#define MISSING -9999.999 #include "NA.h" /* NA = not available */ #define F_C_MOL 96493.5 /* C/mol or joule/volt-eq */ diff --git a/integrate.cpp b/integrate.cpp index 03e1c3049..8f20cd277 100644 --- a/integrate.cpp +++ b/integrate.cpp @@ -1074,7 +1074,7 @@ calc_psi_avg(cxxSurfaceCharge *charge_ptr, LDBLE surf_chrg_eq, LDBLE nDbl, std:: cgc[10] = { 0.36, 0.1721, 0.798, 0.287, 0.1457, 1.2, 0.285, 0.372 }; if (!surf_p->Donnan_factors.empty()) - std::copy(std::begin(surf_p->Donnan_factors), std::end(surf_p->Donnan_factors), cgc); + std::copy(surf_p->Donnan_factors.begin(), surf_p->Donnan_factors.end(), cgc); cgc[1] *= pow(nDbl, cgc[2]) * pow(Gamma, cgc[3]) * pow(mu_x, cgc[4]);