Clean up compiler warnings.

This commit is contained in:
Victor Brunini 2012-11-07 21:08:56 +00:00
parent 3fec861d1f
commit 7c70568bb3
23 changed files with 49 additions and 52 deletions

View file

@ -6,7 +6,7 @@ AC_INIT([cantera], [2.1a1], [nick@ices.utexas.edu])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_AUX_DIR([build-aux])
#AX_ENABLE_BUILDDIR
AM_INIT_AUTOMAKE(-Wall -Werror)
AM_INIT_AUTOMAKE(-Wall -Werror -Wshadow)
# snarf and provide versioning numbers
AX_SPLIT_VERSION

View file

@ -19,13 +19,13 @@ public:
IdealGasMix() : m_ok(false), m_r(0) {}
IdealGasMix(const std::string& infile, std::string id="") :
IdealGasMix(const std::string& infile, std::string id_="") :
m_ok(false), m_r(0) {
m_r = get_XML_File(infile);
m_id = id;
if (id == "-") {
id = "";
m_id = id_;
if (id_ == "-") {
id_ = "";
}
m_ok = buildSolutionFromXML(*m_r,
m_id, "phase", this, this);
@ -35,8 +35,8 @@ public:
IdealGasMix(XML_Node& root,
std::string id) : m_ok(false), m_r(&root), m_id(id) {
m_ok = buildSolutionFromXML(root, id, "phase", this, this);
std::string id_) : m_ok(false), m_r(&root), m_id(id_) {
m_ok = buildSolutionFromXML(root, id_, "phase", this, this);
}
IdealGasMix(const IdealGasMix& other) : m_ok(false),

View file

@ -14,8 +14,8 @@ namespace Cantera
class XML_Writer
{
public:
XML_Writer(std::ostream& output) :
m_s(output), _indent(" "), _level(0) {}
XML_Writer(std::ostream& output_) :
m_s(output_), _indent(" "), _level(0) {}
virtual ~XML_Writer() {}
std::ostream& m_s;

View file

@ -449,8 +449,8 @@ public:
/*!
* @param name The name of the XML node
*/
void setName(const std::string& name) {
m_name = name;
void setName(const std::string& name_) {
m_name = name_;
}
//! Return the id attribute, if present

View file

@ -438,8 +438,8 @@ private:
const std::vector<grouplist_t>& p);
void updateKc();
void registerReaction(size_t rxnNumber, int type, size_t loc) {
m_index[rxnNumber] = std::pair<int, size_t>(type, loc);
void registerReaction(size_t rxnNumber, int type_, size_t loc) {
m_index[rxnNumber] = std::pair<int, size_t>(type_, loc);
}
bool m_finalized;
};

View file

@ -459,7 +459,7 @@ public:
m_rxn(npos) {
}
C_AnyN(size_t rxn, const std::vector<size_t>& ic, const vector_fp& order, const vector_fp& stoich) :
C_AnyN(size_t rxn, const std::vector<size_t>& ic, const vector_fp& order_, const vector_fp& stoich_) :
m_n(0),
m_rxn(rxn) {
m_n = ic.size();
@ -468,8 +468,8 @@ public:
m_stoich.resize(m_n);
for (size_t n = 0; n < m_n; n++) {
m_ic[n] = ic[n];
m_order[n] = order[n];
m_stoich[n] = stoich[n];
m_order[n] = order_[n];
m_stoich[n] = stoich_[n];
}
}

View file

@ -653,7 +653,7 @@ public:
* @param k Species k
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
*/
virtual void modifyOneHf298SS(const int k, const doublereal Hf298New);
virtual void modifyOneHf298SS(const size_t &k, const doublereal Hf298New);
#endif
private:

View file

@ -294,7 +294,7 @@ public:
return h;
}
virtual void modifyOneHf298(const int k, const doublereal Hf298New) {
virtual void modifyOneHf298(const size_t &k, const doublereal Hf298New) {
if (k != m_index) {
return;
}

View file

@ -542,12 +542,12 @@ public:
//! Set the internally stored density (kg/m^3) of the phase
//! Note the density of a phase is an independent variable.
//! @param[in] density density (kg/m^3).
virtual void setDensity(const doublereal density) {
if (density <= 0) {
virtual void setDensity(const doublereal density_) {
if (density_ <= 0) {
throw CanteraError("Phase::setDensity",
"density must be positive");
}
m_dens = density;
m_dens = density_;
}
//! Set the internally stored molar density (kmol/m^3) of the phase.

View file

@ -650,7 +650,7 @@ int main(int argc, char* argv[])
int* ColIsFloat1 = NULL, *ColIsFloat2 = NULL;
double* curVarValues1 = NULL, *curVarValues2 = NULL;
char** curStringValues1 = NULL, **curStringValues2 = NULL;
int i, j, ndiff, jmax, i1, i2, k;
int i, j, ndiff, jmax=0, i1, i2, k;
bool found;
double max_diff, rel_diff;
int testPassed = RT_PASSED;

View file

@ -4188,13 +4188,13 @@ void VCS_SOLVE::vcs_dfe(const int stateCalc,
{
size_t l1, l2, iph, kspec, irxn;
size_t iphase;
double* tPhMoles_ptr;
double* actCoeff_ptr;
double* tlogMoles;
double* tPhMoles_ptr=0;
double* actCoeff_ptr=0;
double* tlogMoles=0;
vcs_VolPhase* Vphase;
double* feSpecies;
double* molNum;
double* feSpecies=0;
double* molNum=0;
if (stateCalc == VCS_STATECALC_OLD) {
feSpecies = VCS_DATA_PTR(m_feSpecies_old);
tPhMoles_ptr = VCS_DATA_PTR(m_tPhaseMoles_old);
@ -5239,9 +5239,9 @@ void VCS_SOLVE::vcs_deltag_Phase(const size_t iphase, const bool doDeleted,
size_t irxn, kspec, kcomp;
double* dtmp_ptr;
double* feSpecies;
double* deltaGRxn;
double* actCoeffSpecies;
double* feSpecies=0;
double* deltaGRxn=0;
double* actCoeffSpecies=0;
if (stateCalc == VCS_STATECALC_NEW) {
feSpecies = VCS_DATA_PTR(m_feSpecies_new);
deltaGRxn = VCS_DATA_PTR(m_deltaGRxn_new);

View file

@ -3694,7 +3694,7 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f,
{
double* col_j;
int info;
doublereal ysave, ydotsave, dy;
doublereal ysave, ydotsave=0., dy;
int retn = 1;
/*

View file

@ -155,7 +155,7 @@ doublereal ConstCpPoly::reportHf298(doublereal* const h298) const
return h;
}
void ConstCpPoly::modifyOneHf298(const int k, const doublereal Hf298New)
void ConstCpPoly::modifyOneHf298(const size_t &k, const doublereal Hf298New)
{
if (k != m_index) {
return;

View file

@ -175,7 +175,7 @@ public:
virtual doublereal reportHf298(doublereal* const h298 = 0) const;
virtual void modifyOneHf298(const int k, const doublereal Hf298New);
virtual void modifyOneHf298(const size_t &k, const doublereal Hf298New);
#endif

View file

@ -1580,8 +1580,8 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN_diag() const
*/
void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN() const
{
size_t kcat, kNeut, mcat, mNeut;
doublereal fmij, mfmij;
size_t kcat = 0, kNeut = 0, mcat = 0, mNeut = 0;
doublereal fmij = 0.0, mfmij;
dlnActCoeffdlnN_.zero();
/*
* Get the activity coefficients of the neutral molecules

View file

@ -673,11 +673,11 @@ void LatticeSolidPhase::setParametersFromXML(const XML_Node& eosdata)
* @param k Species k
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
*/
void LatticeSolidPhase::modifyOneHf298SS(const int k, const doublereal Hf298New)
void LatticeSolidPhase::modifyOneHf298SS(const size_t &k, const doublereal Hf298New)
{
for (int n = 0; n < m_nlattice; n++) {
for (size_t n = 0; n < m_nlattice; n++) {
if (lkstart_[n+1] < k) {
int kk = k-lkstart_[n];
size_t kk = k-lkstart_[n];
SpeciesThermo& l_spthermo = m_lattice[n]->speciesThermo();
l_spthermo.modifyOneHf298(kk, Hf298New);
}

View file

@ -1152,7 +1152,7 @@ doublereal MixtureFugacityTP::calculatePsat(doublereal TKelvin, doublereal& mola
* First part of the calculation involves finding a pressure at which the
* gas and the liquid state coexists.
*/
doublereal presLiquid;
doublereal presLiquid = 0.;
doublereal presGas;
doublereal presBase = pres;
bool foundLiquid = false;

View file

@ -261,7 +261,7 @@ public:
return h;
}
void modifyOneHf298(const int k, const doublereal Hf298New) {
void modifyOneHf298(const size_t &k, const doublereal Hf298New) {
if (k != m_index) {
return;
}

View file

@ -1852,7 +1852,7 @@ int RedlichKwongMFTP::NicholsSolve(double TKelvin, double pres, doublereal a, do
/*
* Unfortunately, there is a heavy amount of roundoff error due to bad conditioning in this
*/
double res, dresdV;
double res, dresdV = 0.0;
for (int i = 0; i < nSolnValues; i++) {
for (int n = 0; n < 20; n++) {
res = an * Vroot[i] * Vroot[i] * Vroot[i] + bn * Vroot[i] * Vroot[i] + cn * Vroot[i] + dn;

View file

@ -665,7 +665,7 @@ public:
return h;
}
virtual void modifyOneHf298(const int k, const doublereal Hf298New) {
virtual void modifyOneHf298(const size_t &k, const doublereal Hf298New) {
if (k != m_index) {
return;
}

View file

@ -655,11 +655,9 @@ static void installStatMechThermoFromXML(const std::string& speciesName,
{
const XML_Node* fptr = tp[0];
int nRegTmp = tp.size();
int nRegions = 0;
vector_fp cPoly;
StatMech* np_ptr = 0;
std::vector<StatMech*> regionPtrs;
doublereal tmin, tmax, pref = OneAtm;
doublereal tmin, tmax = 0.0, pref = OneAtm;
// Loop over all of the possible temperature regions
for (int i = 0; i < nRegTmp; i++) {

View file

@ -191,7 +191,7 @@ int StatMech::buildmap()
SS.push_back("e");
// now place each species in a map
int ii;
size_t ii;
for (ii=0; ii < SS.size(); ii++) {
name_map[SS[ii]]=(new species);
@ -572,7 +572,6 @@ int StatMech::buildmap()
name_map["e"]->mol_weight=0.00055;
name_map["e"]->nvib=0;
int dum = 0;
for (ii=0; ii < SS.size(); ii++) {
// check nvib was initalized for all species
if (name_map[SS[ii]]->nvib == -1) {

View file

@ -276,7 +276,7 @@ void PecosTransport::getSpeciesFluxes(int ndim,
const doublereal* grad_T, int ldx, const doublereal* grad_X,
int ldf, doublereal* fluxes)
{
int n, k;
int n=0, k;
update_T();
update_C();
@ -368,9 +368,9 @@ void PecosTransport::getMixDiffCoeffsMole(doublereal* const d)
if (m_nsp == 1) {
d[0] = m_bdiff(0,0) / p;
} else {
for (size_t k = 0; k < m_nsp; k++) {
for (int k = 0; k < m_nsp; k++) {
double sum2 = 0.0;
for (size_t j = 0; j < m_nsp; j++) {
for (int j = 0; j < m_nsp; j++) {
if (j != k) {
sum2 += m_molefracs[j] / m_bdiff(j,k);
}
@ -400,10 +400,10 @@ void PecosTransport::getMixDiffCoeffsMass(doublereal* const d)
if (m_nsp == 1) {
d[0] = m_bdiff(0,0) / p;
} else {
for (size_t k=0; k<m_nsp; k++) {
for (int k=0; k<m_nsp; k++) {
double sum1 = 0.0;
double sum2 = 0.0;
for (size_t i=0; i<m_nsp; i++) {
for (int i=0; i<m_nsp; i++) {
if (i==k) {
continue;
}