Fix some compiler warnings

This commit is contained in:
Ray Speth 2014-05-27 02:53:35 +00:00
parent 712293e415
commit 4b9e4da822
10 changed files with 26 additions and 29 deletions

View file

@ -85,22 +85,22 @@ public:
template<class iter>
void XML_writeVector(std::ostream& s, const std::string& indent,
const std::string& name, int vsize, iter v) {
const std::string& name, size_t vsize, iter v) {
int ni;
for (ni = 0; ni < _level; ni++) {
s << _indent;
}
s << "<" << XML_filter(name) << "> ";
int n = vsize;
int n5 = n/5;
int i, j, k = 0;
size_t n = vsize;
size_t n5 = n/5;
size_t i, j, k = 0;
for (j = 0; j < n5; j++) {
for (i = 0; i < 5; i++) {
s << v[k] << (k < n - 1 ? ", " : "");
s << v[k] << (k+1 < n ? ", " : "");
k++;
}
if (j < n5-1) {
if (j+1 < n5) {
s << std::endl;
for (ni = 0; ni < _level; ni++) {
s << _indent;
@ -108,7 +108,7 @@ public:
}
}
for (i = k; i < n; i++) {
s << v[k] << (k < n - 1 ? ", " : "");
s << v[k] << (k+1 < n ? ", " : "");
k++;
}

View file

@ -171,7 +171,7 @@ void writelogf(const char* fmt,...);
//! Write an end of line character to the screen and flush output
void writelogendl();
void writeline(char repeat, int count,
void writeline(char repeat, size_t count,
bool endl_after=true, bool endl_before=false);
//! @copydoc Application::Messages::logerror

View file

@ -1366,7 +1366,7 @@ private:
void prneav() const;
#endif
void checkDelta1(double* const ds, double* const delTPhMoles, int kspec);
void checkDelta1(double* const ds, double* const delTPhMoles, size_t kspec);
//! Estimate equilibrium compositions
/*!

View file

@ -68,7 +68,7 @@ void writelogendl()
app()->writelogendl();
}
void writeline(char repeat, int count, bool endl_after, bool endl_before)
void writeline(char repeat, size_t count, bool endl_after, bool endl_before)
{
if (endl_before) {
writelogendl();

View file

@ -404,7 +404,7 @@ static void print_stringTrunc(const char* str, int space, int alignment)
***********************************************************************/
{
int i, ls=0, rs=0;
int len = strlen(str);
int len = static_cast<int>(strlen(str));
if ((len) >= space) {
for (i = 0; i < space; i++) {
writelogf("%c", str[i]);

View file

@ -292,7 +292,7 @@ int ChemEquil::estimateElementPotentials(thermo_t& s, vector_fp& lambda_RT,
if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0) {
for (size_t m = 0; m < m_nComponents; m++) {
int isp = m_component[m];
int isp = static_cast<int>(m_component[m]);
string nnn = s.speciesName(isp);
writelogf("isp = %d, %s\n", isp, nnn.c_str());
}
@ -329,7 +329,7 @@ int ChemEquil::estimateElementPotentials(thermo_t& s, vector_fp& lambda_RT,
if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0) {
writelog(" id CompSpecies ChemPot EstChemPot Diff\n");
for (size_t m = 0; m < m_nComponents; m++) {
int isp = m_component[m];
size_t isp = m_component[m];
double tmp = 0.0;
string sname = s.speciesName(isp);
for (size_t n = 0; n < m_mm; n++) {
@ -1567,8 +1567,8 @@ void ChemEquil::adjustEloc(thermo_t& s, vector_fp& elMolesGoal)
s.getMoleFractions(DATA_PTR(m_molefractions));
size_t k;
int maxPosEloc = -1;
int maxNegEloc = -1;
size_t maxPosEloc = npos;
size_t maxNegEloc = npos;
double maxPosVal = -1.0;
double maxNegVal = -1.0;
if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0) {

View file

@ -21,12 +21,11 @@ static void printProgress(const vector<string> &spName,
const vector<double> &soln,
const vector<double> &ff)
{
int nsp = soln.size();
double sum = 0.0;
plogf(" --- Summary of current progress:\n");
plogf(" --- Name Moles - SSGibbs \n");
plogf(" -------------------------------------------------------------------------------------\n");
for (int k = 0; k < nsp; k++) {
for (size_t k = 0; k < soln.size(); k++) {
plogf(" --- %20s %12.4g - %12.4g\n", spName[k].c_str(), soln[k], ff[k]);
sum += soln[k] * ff[k];
}

View file

@ -36,12 +36,12 @@ static int prnfm(void);
/*****************************************************************************/
void VCS_SOLVE::checkDelta1(double* const dsLocal,
double* const delTPhMoles, int kspec)
double* const delTPhMoles, size_t kspec)
{
std::vector<double> dchange(m_numPhases, 0.0);
for (int k = 0; k < kspec; k++) {
for (size_t k = 0; k < kspec; k++) {
if (m_speciesUnknownType[k] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
int iph = m_phaseID[k];
size_t iph = m_phaseID[k];
dchange[iph] += dsLocal[k];
}
}
@ -115,7 +115,7 @@ int VCS_SOLVE::vcs_solve_TP(int print_lvl, int printDetails, int maxit)
solveFail = false;
int ll; // only used in DEBUG_MODE
size_t ll; // only used in DEBUG_MODE
/* ****************************************************** */
/* **** Evaluate the elemental composition ****** */
/* ****************************************************** */
@ -3167,8 +3167,8 @@ L_END_LOOP:
* to conserve elements
*/
double sumMax = -1.0;
int iMax = -1;
int jMax = -1;
size_t iMax = npos;
size_t jMax = npos;
for (size_t i = 0; i < m_numRxnTot; ++i) {
k = m_indexRxnToSpecies[i];
double sum;

View file

@ -164,7 +164,6 @@ double vcsUtil_gasConstant(int mu_units)
const char* vcs_speciesType_string(int speciesStatus, int length)
{
const char* sss;
switch (speciesStatus) {
case VCS_SPECIES_COMPONENT:
return "Component Species";

View file

@ -760,7 +760,6 @@ void RedlichKisterVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
#ifdef DEBUG_MODE
void RedlichKisterVPSSTP::Vint(double& VintOut, double& voltsOut)
{
int iA, iB, m;
doublereal XA, XB;
doublereal T = temperature();
doublereal RT = GasConstant * T;
@ -769,8 +768,8 @@ void RedlichKisterVPSSTP::Vint(double& VintOut, double& voltsOut)
lnActCoeff_Scaled_.assign(m_kk, 0.0);
for (int i = 0; i < numBinaryInteractions_; i++) {
iA = m_pSpecies_A_ij[i];
iB = m_pSpecies_B_ij[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) {
@ -780,7 +779,7 @@ void RedlichKisterVPSSTP::Vint(double& VintOut, double& voltsOut)
XA = 1.0 - 1.0E-14;
}
int N = m_N_ij[i];
size_t N = m_N_ij[i];
vector_fp& he_vec = m_HE_m_ij[i];
vector_fp& se_vec = m_SE_m_ij[i];
double fac = 2.0 * XA - 1.0;
@ -790,7 +789,7 @@ void RedlichKisterVPSSTP::Vint(double& VintOut, double& voltsOut)
double polykp1 = fac;
double poly1mk = fac;
for (m = 0; m < N; m++) {
for (size_t m = 0; m < N; m++) {
doublereal A_ge = he_vec[m] - T * se_vec[m];
Volts += A_ge * (polykp1 - (2.0 * XA * m * (1.0-XA)) / poly1mk);
polykp1 *= fac;