From 3765e0cf266655280d362cdf5de35c25892959b6 Mon Sep 17 00:00:00 2001 From: Darth Vader Date: Sun, 31 Oct 2021 19:41:44 +0000 Subject: [PATCH 1/2] Squashed 'phreeqcpp/' changes from 7e50e98..a377818 a377818 Merge remote-tracking branch 'usgs-coupled/master' 7c3d060 Merged remote-tracking branch 'origin/master' c6e8aea Fixed DIFF_C and SETDIFF_C. Updated RELEASE.txt 942dc22 Replace (+ with ( for dealing with Fe(+3, so that [Fe+2] is still a legitimate element name git-subtree-dir: phreeqcpp git-subtree-split: a3778180a1d258bdccda2d2e3ec1a745f4738c77 --- basicsubs.cpp | 8 ++++---- common/Parser.cxx | 2 +- tidy.cpp | 2 +- utilities.cpp | 7 ++++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/basicsubs.cpp b/basicsubs.cpp index 758112f9..a21f34d5 100644 --- a/basicsubs.cpp +++ b/basicsubs.cpp @@ -195,7 +195,7 @@ diff_c(const char *species_name) g = s_ptr->dw; if (s_ptr->dw_t) g *= exp(s_ptr->dw_t / tk_x - s_ptr->dw_t / 298.15); - g *= viscos_0_25 / viscos; + g *= viscos_0_25 / viscos * tk_x / 298.15; } else { @@ -218,7 +218,7 @@ setdiff_c(const char *species_name, double d) g = s_ptr->dw; if (s_ptr->dw_t) g *= exp(s_ptr->dw_t / tk_x - s_ptr->dw_t / 298.15); - g *= viscos_0_25 / viscos; + g *= viscos_0_25 / viscos * tk_x / 298.15;; } else { @@ -2457,7 +2457,7 @@ total(const char *total_name) return (total_o_x / mass_water_aq_x); } std::string noplus = total_name; - replace(noplus, "+", ""); + replace(noplus, "(+", "("); master_ptr = master_bsearch(noplus.c_str()); t = 0.0; if (master_ptr == NULL) @@ -2528,7 +2528,7 @@ total_mole(const char *total_name) return (total_o_x); } std::string noplus = total_name; - replace(noplus, "+", ""); + replace(noplus, "(+", "("); master_ptr = master_bsearch(noplus.c_str()); t = 0.0; if (master_ptr == NULL) diff --git a/common/Parser.cxx b/common/Parser.cxx index db7d3556..4f6665ae 100644 --- a/common/Parser.cxx +++ b/common/Parser.cxx @@ -899,7 +899,7 @@ CParser::STATUS_TYPE CParser::parse_couple(std::string & token) return PARSER_OK; } - while (Utilities::replace("+", "", token)); + while (Utilities::replace("(+", "(", token)); std::string::iterator ptr = token.begin(); std::string elt1; diff --git a/tidy.cpp b/tidy.cpp index 4c95089b..1c9c0884 100644 --- a/tidy.cpp +++ b/tidy.cpp @@ -1825,7 +1825,7 @@ tidy_punch(void) { std::pair< std::string, void *> &pair_ptr = current_selected_output->Get_totals()[i]; std::string noplus = pair_ptr.first; - replace(noplus, "+", ""); + replace(noplus, "(+", "("); pair_ptr.second = master_bsearch(noplus.c_str()); } diff --git a/utilities.cpp b/utilities.cpp index d7989864..67a030ee 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -660,7 +660,7 @@ parse_couple(char *token) str_tolower(token); return (OK); } - while (replace("+", "", token) == TRUE); + while (replace("(+", "(", token) == TRUE); cptr = token; get_elt(&cptr, elt1, &e1); if (*cptr != '(') @@ -848,9 +848,10 @@ replace(const char *str1, const char *str2, char *str) void Phreeqc:: replace(std::string &stds, const char* str1, const char* str2) { - size_t pos; + size_t pos, l; + l = strlen(str1); while ((pos = stds.find(str1)) != std::string::npos) { - stds.replace(pos, 1, str2); + stds.replace(pos, l, str2); } } /* ---------------------------------------------------------------------- */ From e26566584588855e782e2ab4cdd467984a185890 Mon Sep 17 00:00:00 2001 From: Darth Vader Date: Sun, 31 Oct 2021 19:42:50 +0000 Subject: [PATCH 2/2] Squashed 'phreeqcpp/' changes from a377818..a376a40 a376a40 Merge commit '9e3623356a6be908d7e8b120ecf07c6dceb00d92' 9e36233 Squashed 'common/' changes from 013c822..fb03f6a git-subtree-dir: phreeqcpp git-subtree-split: a376a40fa91d71c45a6cc75d6af94e5838ca5060