From 25f2472130c22c1a63e15f0fa58f1021c83a7b4a Mon Sep 17 00:00:00 2001 From: David Parkhurst Date: Mon, 3 Apr 2023 03:27:21 -0600 Subject: [PATCH] fixed compiler warnings except NAN --- phreeqcpp/gases.cpp | 2 -- phreeqcpp/model.cpp | 5 ----- phreeqcpp/pitzer.cpp | 20 ++++++++++---------- phreeqcpp/prep.cpp | 7 ++----- phreeqcpp/spread.cpp | 4 +--- phreeqcpp/tally.cpp | 7 ------- 6 files changed, 13 insertions(+), 32 deletions(-) diff --git a/phreeqcpp/gases.cpp b/phreeqcpp/gases.cpp index d64d2c97..b373068a 100644 --- a/phreeqcpp/gases.cpp +++ b/phreeqcpp/gases.cpp @@ -624,7 +624,6 @@ int Phreeqc:: calc_fixed_volume_gas_pressures(void) /* ---------------------------------------------------------------------- */ { - int n_g = 0; LDBLE lp; class rxn_token *rxn_ptr; class phase *phase_ptr; @@ -645,7 +644,6 @@ calc_fixed_volume_gas_pressures(void) { if (!PR && phase_ptr->t_c > 0 && phase_ptr->p_c > 0) PR = true; - n_g++; } gas_phase_ptr->Set_total_moles(gas_phase_ptr->Get_total_moles() + gas_unknowns[i]->moles); } diff --git a/phreeqcpp/model.cpp b/phreeqcpp/model.cpp index 9bebfc87..bf8d8fd7 100644 --- a/phreeqcpp/model.cpp +++ b/phreeqcpp/model.cpp @@ -2543,7 +2543,6 @@ int Phreeqc:: calc_gas_pressures(void) /* ---------------------------------------------------------------------- */ { - int n_g = 0; LDBLE lp, V_m = 0; class rxn_token *rxn_ptr; std::vector phase_ptrs; @@ -2576,7 +2575,6 @@ calc_gas_pressures(void) phase_ptrs.push_back(phase_ptr); if (!PR && phase_ptr->t_c > 0 && phase_ptr->p_c > 0) PR = true; - n_g++; } if (iterations > 2 && gas_phase_ptr->Get_type() == cxxGasPhase::GP_VOLUME) { @@ -3778,7 +3776,6 @@ residuals(void) int converge; LDBLE l_toler; - LDBLE sum_residual; LDBLE sinh_constant; LDBLE sum, sum1; class master *master_ptr, *master_ptr1, *master_ptr2; @@ -3786,7 +3783,6 @@ residuals(void) int print_fail; std::vector cd_psi; print_fail = FALSE; - sum_residual = 0.0; sigmaddl = 0; sum = 0; /* @@ -4530,7 +4526,6 @@ residuals(void) * Store residuals in array */ my_array[((size_t)i + 1) * (count_unknowns + 1) - 1] = residual[i]; - sum_residual += fabs(residual[i]); } /* * Return diff --git a/phreeqcpp/pitzer.cpp b/phreeqcpp/pitzer.cpp index 77de08e5..b71f24d3 100644 --- a/phreeqcpp/pitzer.cpp +++ b/phreeqcpp/pitzer.cpp @@ -52,7 +52,7 @@ pitzer_tidy(void) const char *string1, *string2; int i, j, order; int i0, i1, i2; - int count_pos, count_neg, count_neut, count[3], jj; + int count_neut, count[3], jj; LDBLE z0, z1; class pitz_param *pzp_ptr; class theta_param *theta_param_ptr; @@ -339,21 +339,21 @@ pitzer_tidy(void) i0 = pitz_params[i]->ispec[0]; i1 = pitz_params[i]->ispec[1]; i2 = pitz_params[i]->ispec[2]; - count_pos = count_neg = count_neut = 0; + count_neut = 0; for (j = 0; j <= 2; j++) { - if (spec[pitz_params[i]->ispec[j]]->z > 0) - { - count_pos++; - } + //if (spec[pitz_params[i]->ispec[j]]->z > 0) + //{ + // count_pos++; + //} if (spec[pitz_params[i]->ispec[j]]->z == 0) { count_neut++; } - if (spec[pitz_params[i]->ispec[j]]->z < 0) - { - count_neg++; - } + //if (spec[pitz_params[i]->ispec[j]]->z < 0) + //{ + // count_neg++; + //} } /* All neutral */ if (count_neut == 3) diff --git a/phreeqcpp/prep.cpp b/phreeqcpp/prep.cpp index 82b3125c..0d26ba98 100644 --- a/phreeqcpp/prep.cpp +++ b/phreeqcpp/prep.cpp @@ -1980,14 +1980,13 @@ get_list_master_ptrs(const char* cptr, class master *master_ptr) * Output: space is allocated and a list of master species pointers is * returned. */ - int j, l, count_list; + int j, l; char token[MAX_LENGTH]; std::vector master_ptr_list; class master *master_ptr0; /* * Make list of master species pointers */ - count_list = 0; //master_ptr_list = unknown_alloc_master(); master_ptr0 = master_ptr; if (master_ptr0 == master_ptr->s->primary) @@ -2147,7 +2146,7 @@ mb_for_species_aq(int n) * by coef, usually moles. * mb_unknowns.coef - coefficient of s[n] in equation or relation */ - int i, j; + int i; class master *master_ptr; class unknown *unknown_ptr; @@ -2223,7 +2222,6 @@ mb_for_species_aq(int n) */ if (use.Get_surface_ptr() != NULL && s[n]->type < H2O && dl_type_x != cxxSurface::NO_DL) { - j = 0; for (i = 0; i < count_unknowns; i++) { if (x[i]->type == SURFACE_CB) @@ -2235,7 +2233,6 @@ mb_for_species_aq(int n) store_mb_unknowns(unknown_ptr, s_diff_layer[n][charge_ptr->Get_name()].Get_g_moles_address(), s[n]->z, s_diff_layer[n][charge_ptr->Get_name()].Get_dg_g_moles_address()); - j++; } } } diff --git a/phreeqcpp/spread.cpp b/phreeqcpp/spread.cpp index 77ada3e7..5d7137b5 100644 --- a/phreeqcpp/spread.cpp +++ b/phreeqcpp/spread.cpp @@ -1141,7 +1141,7 @@ copy_token_tab(std::string& token, const char **cptr) * EOL, * UNKNOWN. */ - int i, return_value; + int return_value; char c; /* * Strip leading spaces @@ -1180,7 +1180,6 @@ copy_token_tab(std::string& token, const char **cptr) /* * Begin copying to token */ - i = 0; for (;;) { c = **cptr; @@ -1197,7 +1196,6 @@ copy_token_tab(std::string& token, const char **cptr) { token.push_back(c); (*cptr)++; - i++; } } return (return_value); diff --git a/phreeqcpp/tally.cpp b/phreeqcpp/tally.cpp index 969b165d..131411e1 100644 --- a/phreeqcpp/tally.cpp +++ b/phreeqcpp/tally.cpp @@ -798,7 +798,6 @@ build_tally_table(void) */ int j, k, l, p, save_print_use; size_t n; - int count_tt_pure_phase, count_tt_ss_phase, count_tt_kinetics; class phase *phase_ptr; char token[MAX_LENGTH]; const char* cptr; @@ -871,7 +870,6 @@ build_tally_table(void) /* * Count pure phases */ - count_tt_pure_phase = 0; if (Rxn_pp_assemblage_map.size() > 0) { /* @@ -904,7 +902,6 @@ build_tally_table(void) /* * Add to table */ - count_tt_pure_phase++; n = count_tally_table_columns; extend_tally_table(); tally_table[n].name = phase_ptr->name; @@ -931,7 +928,6 @@ build_tally_table(void) /* * Add solid-solution pure phases */ - count_tt_ss_phase = 0; if (Rxn_ss_assemblage_map.size() > 0) { /* @@ -964,7 +960,6 @@ build_tally_table(void) /* * Add to table */ - count_tt_ss_phase++; n = count_tally_table_columns; extend_tally_table(); tally_table[n].name = phase_ptr->name; @@ -982,7 +977,6 @@ build_tally_table(void) /* * Add kinetic reactants */ - count_tt_kinetics = 0; if (Rxn_kinetics_map.size() > 0) { std::map::iterator it; @@ -1006,7 +1000,6 @@ build_tally_table(void) /* * Add to table */ - count_tt_kinetics++; n = count_tally_table_columns; extend_tally_table(); tally_table[n].name = string_hsave(kinetics_comp_ptr->Get_rate_name().c_str());