diff --git a/Cantera/src/converters/Reaction.cpp b/Cantera/src/converters/Reaction.cpp index f6bf047b7..35913f83e 100755 --- a/Cantera/src/converters/Reaction.cpp +++ b/Cantera/src/converters/Reaction.cpp @@ -64,7 +64,7 @@ namespace ckr { } void Reaction::write(ostream& s) const { - int nl = lines.size(); + int nl = static_cast(lines.size()); for (int nn = 0; nn < nl; nn++) { s << lines[nn] << endl; } @@ -111,10 +111,10 @@ namespace ckr { double Reaction::stoichCoefficient(const string& s) const { int k; - int nr = reactants.size(); + int nr = static_cast(reactants.size()); for (k = 0; k < nr; k++) if (reactants[k].name == s) return -reactants[k].number; - int np = products.size(); + int np = static_cast(products.size()); for (k = 0; k < np; k++) if (products[k].name == s) return products[k].number; return 0.0; @@ -125,8 +125,8 @@ double Reaction::stoichCoefficient(const string& s) const { * @todo could be made faster */ bool Reaction::operator==(const Reaction& r) const { - int nr = reactants.size(); - int np = products.size(); + int nr = static_cast(reactants.size()); + int np = static_cast(products.size()); if (int(r.reactants.size()) != nr || int(r.products.size()) != np || r.thirdBody != thirdBody) return false; @@ -148,7 +148,7 @@ bool Reaction::operator==(const Reaction& r) const { if (coeffs[nm] == 0.0) return false; coeffs[nm] /= products[jp].number; } - int nc = coeffs.size(); + int nc = static_cast(coeffs.size()); vector ratios; getMapValues(coeffs, ratios); diff --git a/Cantera/src/converters/ckr_utils.cpp b/Cantera/src/converters/ckr_utils.cpp index d89bb508c..03f0b3487 100755 --- a/Cantera/src/converters/ckr_utils.cpp +++ b/Cantera/src/converters/ckr_utils.cpp @@ -32,7 +32,7 @@ bool match(const string& s1, const string& s2) /// remove all white space from string s. void removeWhiteSpace(string& s) { string r; - int ssize = s.size(); + int ssize = static_cast(s.size()); for (int n = 0; n < ssize; n++) if (s[n] != ' ' && s[n] != '\t' && s[n] != '\n') r += s[n]; s = r; @@ -76,7 +76,7 @@ void getTokens(string& s, int n, vector& toks, char delim) { } toks.clear(); - int nt = tokk.size(); + int nt = static_cast(tokk.size()); string t = ""; for (int i = 0; i < nt; i++) { if (tokk[i][0] == '/') t += tokk[i]; @@ -97,25 +97,25 @@ void getTokens(string& s, int n, vector& toks, char delim) { * false otherwise. */ bool extractSlashData(string& s, string& name, string& data) { - int slen = s.size(); - int n = s.find_first_of("/"); - if (n >= 0 && n < slen) { - int m; - for (m = n+1; m < slen; m++) if (s[m] == '/') break; - if (m < slen) { + int slen = static_cast(s.size()); + string::size_type n = s.find_first_of("/"); + if (n != string::npos && (static_cast(n) < slen)) { + int m; + for (m = static_cast(n)+1; m < slen; m++) if (s[m] == '/') break; + if (m < slen) { data = s.substr(n+1,m-n-1); name = s.substr(0,n); removeWhiteSpace(name); s = s.substr(m+1,1000); return true; - } - else { + } + else { name = s; removeWhiteSpace(name); data = ""; s = ""; return false; - } + } } else { name = s; @@ -133,7 +133,7 @@ bool extractSlashData(string& s, string& name, string& data) { */ string capitalize(const string& word) { string cap = word; - int n = word.size(); + int n = static_cast(word.size()); if (n > 0) { cap[0] = toupper(word[0]); for (int m = 1; m < n; m++) { diff --git a/Cantera/src/converters/filter.cpp b/Cantera/src/converters/filter.cpp index 8603400d8..eab97b2da 100755 --- a/Cantera/src/converters/filter.cpp +++ b/Cantera/src/converters/filter.cpp @@ -67,7 +67,7 @@ namespace ckr { cerr << "could not open " << outfile << endl; return false; } - int nel = ck.elements.size(); + int nel = static_cast(ck.elements.size()); int n; // write header information @@ -83,7 +83,7 @@ namespace ckr { for (n = 0; n < nel; n++) fout << ck.elements[n]; fout << "END" << endl; - int nsp = species.size(); + int nsp = static_cast(species.size()); fout << "SPECIES" << endl; for (n = 0; n < nsp; n++) { fout << ck.species[ species[n] ].name << " "; @@ -91,10 +91,10 @@ namespace ckr { } fout << "END" << endl; fout << "REACTIONS" << endl; - int nrxns = reactions.size(); + int nrxns = static_cast(reactions.size()); for (n = 0; n < nrxns; n++) { vector& lines = ck.reactions[reactions[n]].lines; - int nl = lines.size(); + int nl = static_cast(lines.size()); for (int j = 0; j < nl; j++) fout << lines[j] << endl; } fout.close(); diff --git a/Cantera/src/converters/writelog.cpp b/Cantera/src/converters/writelog.cpp index 73064523b..cf7dded5a 100755 --- a/Cantera/src/converters/writelog.cpp +++ b/Cantera/src/converters/writelog.cpp @@ -50,7 +50,9 @@ namespace ckr { << ", " << c[2] << ", " << c[3] << ")" << endl; } else { - for (size_t n = 0; n < c.size(); n++) log << c[n] << ", "; log << endl; + for (ct::ctvector_fp::size_t n = 0; n < c.size(); n++) { + log << c[n] << ", "; log << endl; + } log << "###### ERROR ##### incorrect number of parameters" << endl; return false; } @@ -68,7 +70,9 @@ namespace ckr { << ")" << endl; } else { - for (size_t n = 0; n < c.size(); n++) log << c[n] << ", "; log << endl; + for (ct::ctvector_fp::size_t n = 0; n < c.size(); n++) { + log << c[n] << ", "; log << endl; + } log << "##### ERROR ##### incorrect number of parameters" << endl; return false; } @@ -150,8 +154,8 @@ namespace ckr { */ string reactionEquation(const Reaction& r) { string s = ""; - int nr = r.reactants.size(); - int np = r.products.size(); + int nr = static_cast(r.reactants.size()); + int np = static_cast(r.products.size()); int k; double m; char buf[20];