From dbfe42843774decd173810e570a427857055e4d0 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 3 Jun 2014 16:53:40 +0000 Subject: [PATCH] Fix compiler warnings These were mostly related to changes from r2957. --- src/equil/ChemEquil.cpp | 2 +- src/equil/vcs_elem_rearrange.cpp | 4 ++-- src/equil/vcs_root1d.cpp | 4 ++-- src/equil/vcs_solve_TP.cpp | 7 +++---- src/numerics/NonlinearSolver.cpp | 6 +++--- src/thermo/HMWSoln.cpp | 2 +- src/thermo/RedlichKisterVPSSTP.cpp | 6 ++---- 7 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/equil/ChemEquil.cpp b/src/equil/ChemEquil.cpp index 0a645a829..6599356c6 100644 --- a/src/equil/ChemEquil.cpp +++ b/src/equil/ChemEquil.cpp @@ -890,7 +890,7 @@ void ChemEquil::equilResidual(thermo_t& s, const vector_fp& x, if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0 && !m_doResPerturb) { writelog("Residual: ElFracGoal ElFracCurrent Resid\n"); - for (int n = 0; n < m_mm; n++) { + for (size_t n = 0; n < m_mm; n++) { writelogf(" % -14.7E % -14.7E % -10.5E\n", elmFracGoal[n], elmFrac[n], resid[n]); } diff --git a/src/equil/vcs_elem_rearrange.cpp b/src/equil/vcs_elem_rearrange.cpp index 3ad9d84c7..8174e9468 100644 --- a/src/equil/vcs_elem_rearrange.cpp +++ b/src/equil/vcs_elem_rearrange.cpp @@ -176,8 +176,8 @@ void VCS_SOLVE::vcs_switch_elem_pos(size_t ipos, size_t jpos) if (ipos == jpos) { return; } - if (DEBUG_MODE_ENABLED && ipos > (m_numElemConstraints - 1) || - jpos > (m_numElemConstraints - 1)) { + if (DEBUG_MODE_ENABLED && (ipos > (m_numElemConstraints - 1) || + jpos > (m_numElemConstraints - 1))) { plogf("vcs_switch_elem_pos: ifunc = 0: inappropriate args: %d %d\n", ipos, jpos); plogendl(); diff --git a/src/equil/vcs_root1d.cpp b/src/equil/vcs_root1d.cpp index 334604399..ceed270b8 100644 --- a/src/equil/vcs_root1d.cpp +++ b/src/equil/vcs_root1d.cpp @@ -311,7 +311,7 @@ QUAD_BAIL: if (DEBUG_MODE_ENABLED && printLvl >= 3) { fprintf(fp,"\n"); print_funcEval(fp, xnew, fnew, its); - fprintf(fp, "%-5d %-5d %-15.5E %-15.5E", its, 0, xnew, fnew); + fprintf(fp, "%-5d %-5d %-15.5E %-15.5E", (int) its, 0, xnew, fnew); } if (foundStraddle) { @@ -372,7 +372,7 @@ QUAD_BAIL: plogf("vcs_root1d success: convergence achieved\n"); } if (DEBUG_MODE_ENABLED && printLvl >= 3) { - fprintf(fp, " | vcs_root1d success in %d its, fnorm = %g\n", its, fnorm); + fprintf(fp, " | vcs_root1d success in %d its, fnorm = %g\n", (int) its, fnorm); } } else { retn = VCS_FAILED_CONVERGENCE; diff --git a/src/equil/vcs_solve_TP.cpp b/src/equil/vcs_solve_TP.cpp index e99f5f706..7f68d18ed 100644 --- a/src/equil/vcs_solve_TP.cpp +++ b/src/equil/vcs_solve_TP.cpp @@ -4388,8 +4388,8 @@ void VCS_SOLVE::vcs_switch_pos(const bool ifunc, const size_t k1, const size_t k if (k1 == k2) { return; } - if (DEBUG_MODE_ENABLED && k1 > (m_numSpeciesTot - 1) || - k2 > (m_numSpeciesTot - 1)) { + if (DEBUG_MODE_ENABLED && (k1 >= m_numSpeciesTot || + k2 >= m_numSpeciesTot)) { plogf("vcs_switch_pos: ifunc = 0: inappropriate args: %d %d\n", k1, k2); } @@ -4457,8 +4457,7 @@ void VCS_SOLVE::vcs_switch_pos(const bool ifunc, const size_t k1, const size_t k */ size_t i1 = k1 - m_numComponents; size_t i2 = k2 - m_numComponents; - if (DEBUG_MODE_ENABLED && i1 > (m_numRxnTot - 1) || - i2 > (m_numRxnTot - 1)) { + if (DEBUG_MODE_ENABLED && (i1 > m_numRxnTot || i2 >= m_numRxnTot)) { plogf("switch_pos: ifunc = 1: inappropriate noncomp values: %d %d\n", i1 , i2); } diff --git a/src/numerics/NonlinearSolver.cpp b/src/numerics/NonlinearSolver.cpp index a250ea4ab..86f338891 100644 --- a/src/numerics/NonlinearSolver.cpp +++ b/src/numerics/NonlinearSolver.cpp @@ -3287,7 +3287,7 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f, } m_nJacEval++; if (DEBUG_MODE_ENABLED) { - for (int ii = 0; ii < neq_; ii++) { + for (size_t ii = 0; ii < neq_; ii++) { checkFinite(f[ii]); } } @@ -3357,7 +3357,7 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f, if (fabs(dy) < 1.0E-300) { throw CanteraError("NonlinearSolver::beuler_jac", "dy is equal to zero"); } - for (int ii = 0; ii < neq_; ii++) { + for (size_t ii = 0; ii < neq_; ii++) { checkFinite(m_wksp[ii]); } } @@ -3437,7 +3437,7 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f, if (fabs(dy) < 1.0E-300) { throw CanteraError("NonlinearSolver::beuler_jac", "dy is equal to zero"); } - for (int ii = 0; ii < neq_; ii++) { + for (size_t ii = 0; ii < neq_; ii++) { checkFinite(m_wksp[ii]); } } diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index 7883f1e2c..6a5bf8bd6 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -5153,7 +5153,7 @@ void HMWSoln::calc_thetas(int z1, int z2, i = abs(z1); j = abs(z2); - if (DEBUG_MODE_ENABLED && i > 4 || j > 4) { + if (DEBUG_MODE_ENABLED && (i > 4 || j > 4)) { printf("we shouldn't be here\n"); exit(EXIT_FAILURE); } diff --git a/src/thermo/RedlichKisterVPSSTP.cpp b/src/thermo/RedlichKisterVPSSTP.cpp index 02c800cbf..2ccd22a03 100644 --- a/src/thermo/RedlichKisterVPSSTP.cpp +++ b/src/thermo/RedlichKisterVPSSTP.cpp @@ -753,18 +753,16 @@ void RedlichKisterVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies) #ifdef DEBUG_MODE void RedlichKisterVPSSTP::Vint(double& VintOut, double& voltsOut) { - doublereal XA, XB; + doublereal XA; doublereal T = temperature(); doublereal RT = GasConstant * T; double Volts = 0.0; lnActCoeff_Scaled_.assign(m_kk, 0.0); - for (int i = 0; i < numBinaryInteractions_; i++) { + for (size_t i = 0; i < numBinaryInteractions_; i++) { size_t iA = m_pSpecies_A_ij[i]; - size_t iB = m_pSpecies_B_ij[i]; XA = moleFractions_[iA]; - XB = moleFractions_[iB]; if (XA <= 1.0E-14) { XA = 1.0E-14; }