Skip to content

Commit

Permalink
Squashed 'src/' changes from 3e6c2e94..f975e17c
Browse files Browse the repository at this point in the history
f975e17c Merge commit 'f82d3a73538ba56c8ed81977b0d26d46ebcb7f98'
f82d3a73 Squashed 'common/' changes from 740bdd5..11183a1
ff1cc7aa [phreeqci] Updated to compile on vs2005

git-subtree-dir: src
git-subtree-split: f975e17ccce7eca010a391898d91c25e6e10990b
  • Loading branch information
Darth Vader committed Nov 18, 2023
1 parent cbb5296 commit 4496cb9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
14 changes: 13 additions & 1 deletion Phreeqc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# define WINVER 0x0400
# endif
# include <afx.h>
// # define nullptr NULL
# endif
# include <windows.h>
# if defined(PHREEQCI_GUI)
Expand Down Expand Up @@ -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 <stdarg.h>

#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;
Expand All @@ -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
4 changes: 4 additions & 0 deletions common/Utils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#include "float.h"
#include <cmath>

#if defined(_MSC_VER) && (_MSC_VER <= 1400) // VS2005
# define nullptr NULL
#endif

#if defined(PHREEQCI_GUI)
#ifdef _DEBUG
#define new DEBUG_NEW
Expand Down
9 changes: 7 additions & 2 deletions global_structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
* #define DEFINITIONS
* ---------------------------------------------------------------------- */
#if !defined(NAN)
#define NAN nan("1")
# if defined(_MSC_VER) && (_MSC_VER <= 1400) // VS2005
# include <limits>
# define NAN std::numeric_limits<double>::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 */
Expand Down
2 changes: 1 addition & 1 deletion integrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down

0 comments on commit 4496cb9

Please # to comment.