From bb188d1feecb82152b73a9c9154f824effdc27f1 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Mon, 31 Mar 2008 21:34:04 +0000 Subject: [PATCH] Minor changes to beat down spurious warning messages about uninitialized variables, that were in fact properly initialized. --- Cantera/src/equil/vcs_MultiPhaseEquil.cpp | 7 +++++-- Cantera/src/equil/vcs_inest.cpp | 4 +++- Cantera/src/equil/vcs_rearrange.cpp | 3 ++- Cantera/src/equil/vcs_root1d.cpp | 9 ++++++--- Cantera/src/equil/vcs_rxnadj.cpp | 4 +++- Cantera/src/equil/vcs_solve.cpp | 8 ++++---- Cantera/src/equil/vcs_solve_TP.cpp | 3 ++- 7 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Cantera/src/equil/vcs_MultiPhaseEquil.cpp b/Cantera/src/equil/vcs_MultiPhaseEquil.cpp index c31ed38b0..4fb3bce4d 100644 --- a/Cantera/src/equil/vcs_MultiPhaseEquil.cpp +++ b/Cantera/src/equil/vcs_MultiPhaseEquil.cpp @@ -104,7 +104,7 @@ namespace VCSnonideal { "Wrong XY flag:" + int2str(XY)); } int maxiter = 100; - int iSuccess; + int iSuccess = 0; int innerXY; double Pnow; if (XY == TV) { @@ -112,7 +112,10 @@ namespace VCSnonideal { } double Pnew; bool strt = estimateEquil; - double P1, V1, V2, P2; + double P1 = 0.0; + double V1 = 0.0; + double V2 = 0.0; + double P2 = 0.0; doublereal Tlow = 0.5 * m_mix->minTemp();; doublereal Thigh = 2.0 * m_mix->maxTemp(); doublereal Vnow, Verr; diff --git a/Cantera/src/equil/vcs_inest.cpp b/Cantera/src/equil/vcs_inest.cpp index 83ee7570e..273e07cf5 100644 --- a/Cantera/src/equil/vcs_inest.cpp +++ b/Cantera/src/equil/vcs_inest.cpp @@ -44,7 +44,9 @@ namespace VCSnonideal { ***************************************************************************/ { int conv, k, lt, ikl, kspec, iph, irxn; - double s, s1, xl, par; + double s; + double s1 = 0.0; + double xl, par; int finished; int nspecies = m_numSpeciesTot; int nrxn = m_numRxnTot; diff --git a/Cantera/src/equil/vcs_rearrange.cpp b/Cantera/src/equil/vcs_rearrange.cpp index ab56cab7e..314fc308c 100644 --- a/Cantera/src/equil/vcs_rearrange.cpp +++ b/Cantera/src/equil/vcs_rearrange.cpp @@ -29,7 +29,8 @@ int VCS_SOLVE::vcs_rearrange(void) * the data based on reaction ordering. **************************************************************************/ { - int i, l, j, k1; + int i, l, j; + int k1 = 0; /* ********************************************************* */ /* **** RE-ARRANGE INPUT DATA ****************************** */ /* ********************************************************* */ diff --git a/Cantera/src/equil/vcs_root1d.cpp b/Cantera/src/equil/vcs_root1d.cpp index 3f190d9c3..90a7f615f 100644 --- a/Cantera/src/equil/vcs_root1d.cpp +++ b/Cantera/src/equil/vcs_root1d.cpp @@ -128,14 +128,17 @@ static void print_funcEval(FILE *fp, double xval, double fval, int its) int converged = FALSE, err = FALSE; #ifdef DEBUG_MODE char fileName[80]; - FILE *fp; + FILE *fp = 0; #endif double x1, x2, xnew, f1, f2, fnew, slope; - int its = 0, posStraddle, retn = VCS_SUCCESS; + int its = 0; + int posStraddle = 0; + int retn = VCS_SUCCESS; int foundPosF = FALSE; int foundNegF = FALSE; int foundStraddle = FALSE; - double xPosF, xNegF; + double xPosF = 0.0; + double xNegF = 0.0; double fnorm; /* A valid norm for the making the function value * dimensionless */ double c[9], f[3], xn1, xn2, x0 = 0.0, f0 = 0.0, root, theta, xquad; diff --git a/Cantera/src/equil/vcs_rxnadj.cpp b/Cantera/src/equil/vcs_rxnadj.cpp index 4066ee3ce..3038eccf9 100644 --- a/Cantera/src/equil/vcs_rxnadj.cpp +++ b/Cantera/src/equil/vcs_rxnadj.cpp @@ -52,7 +52,9 @@ int VCS_SOLVE::vcs_rxn_adj_cg(void) * attribute of the regular vcs algorithm. We don't want to violate this ***************************************************************************/ { - int irxn, j, k, kspec, soldel = 0; + int irxn, j; + int k = 0; + int kspec, soldel = 0; double s, xx, dss; double *dnPhase_irxn; #ifdef DEBUG_MODE diff --git a/Cantera/src/equil/vcs_solve.cpp b/Cantera/src/equil/vcs_solve.cpp index 3c05881f8..725f3087f 100644 --- a/Cantera/src/equil/vcs_solve.cpp +++ b/Cantera/src/equil/vcs_solve.cpp @@ -897,8 +897,8 @@ namespace VCSnonideal { * equilibrium calculation transfered to it. */ int VCS_SOLVE::vcs_prob_update(VCS_PROB *pub) { - int i, j, k1, l; - + int i, j, l; + int k1 = 0; vcs_tmoles(); Vol = vcs_VolTotal(T, Pres, VCS_DATA_PTR(soln), VCS_DATA_PTR(VolPM)); @@ -917,12 +917,12 @@ namespace VCSnonideal { * - Switch the species data back from K1 into I */ if (pub->SpeciesUnknownType[i] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { - pub->w[i] = soln[k1]; + pub->w[i] = soln[k1]; } else { pub->w[i] = 0.0; plogf("voltage species = %g\n", soln[k1]); } - pub->mf[i] = wt[k1]; + pub->mf[i] = wt[k1]; pub->m_gibbsSpecies[i] = m_gibbsSpecies[k1]; pub->VolPM[i] = VolPM[k1]; } diff --git a/Cantera/src/equil/vcs_solve_TP.cpp b/Cantera/src/equil/vcs_solve_TP.cpp index 70f954eb6..464ab401c 100644 --- a/Cantera/src/equil/vcs_solve_TP.cpp +++ b/Cantera/src/equil/vcs_solve_TP.cpp @@ -2746,8 +2746,9 @@ namespace VCSnonideal { * 2 : Same as one but, the zeroed species is a component. */ int VCS_SOLVE::vcs_RxnStepSizes() { - int j, k, irxn, kspec, soldel = 0, iph; + int j, irxn, kspec, soldel = 0, iph; double s, xx, dss; + int k = 0; vcs_VolPhase *Vphase = 0; double *dnPhase_irxn; #ifdef DEBUG_MODE