Fix miscellaneous integer sign/size warnings

This commit is contained in:
Ray Speth 2014-02-21 19:08:47 +00:00
parent 0392147540
commit dba9ddd858
6 changed files with 12 additions and 13 deletions

View file

@ -134,7 +134,7 @@ public:
* to it in the list is replaced by a pointer to the first element
* in the list.
*/
static void del(int n) {
static void del(size_t n) {
dataRef data = getData();
if (n == 0) {
return;

View file

@ -756,11 +756,11 @@ bool rxninfo::installReaction(int iRxn, const XML_Node& r, Kinetics& kin,
unsigned long int participants = 0;
for (size_t nn = 0; nn < rdata.reactants.size(); nn++) {
rdata.net_stoich[-1 - int(rdata.reactants[nn])] -= rdata.rstoich[nn];
participants += rdata.reactants[nn];
participants += static_cast<unsigned long int>(rdata.reactants[nn]);
}
for (size_t nn = 0; nn < rdata.products.size(); nn++) {
rdata.net_stoich[int(rdata.products[nn])+1] += rdata.pstoich[nn];
participants += 1000000 * rdata.products[nn];
participants += 1000000 * static_cast<unsigned long int>(rdata.products[nn]);
}
vector<size_t>& related = m_participants[participants];

View file

@ -430,7 +430,7 @@ void NasaThermo::fixDiscontinuities(doublereal Tlow, doublereal Tmid,
// First get the desired size of the work array
ct_dgelss(nRows, nCols, 1, &M(0,0), nRows, &b[0], nRows,
&sigma[0], -1, rank, &work[0], lwork, info);
work.resize(work[0]);
work.resize(static_cast<size_t>(work[0]));
lwork = static_cast<int>(work[0]);
ct_dgelss(nRows, nCols, 1, &M(0,0), nRows, &b[0], nRows,
&sigma[0], -1, rank, &work[0], lwork, info);

View file

@ -142,9 +142,8 @@ doublereal SolidTransport::electricalConductivity()
return m_electConductivity->getSpeciesTransProp();
} else {
getMobilities(&m_work[0]);
int nsp = m_thermo->nSpecies();
doublereal sum = 0.0;
for (int k = 0; k < nsp; k++) {
for (size_t k = 0; k < m_thermo->nSpecies(); k++) {
sum += m_thermo->charge(k) * m_thermo->moleFraction(k) * m_work[k];
}
return sum * m_thermo->molarDensity();

View file

@ -94,14 +94,14 @@ void Transport::setThermo(thermo_t& thermo)
m_thermo = &thermo;
m_nsp = m_thermo->nSpecies();
} else {
int newNum = thermo.nSpecies();
int oldNum = m_thermo->nSpecies();
size_t newNum = thermo.nSpecies();
size_t oldNum = m_thermo->nSpecies();
if (newNum != oldNum) {
throw CanteraError("Transport::setThermo",
"base object cannot be changed after "
"the transport manager has been constructed because num species isn't the same.");
}
for (int i = 0; i < newNum; i++) {
for (size_t i = 0; i < newNum; i++) {
std::string newS0 = thermo.speciesName(i);
std::string oldS0 = m_thermo->speciesName(i);
if (newNum != oldNum) {

View file

@ -64,7 +64,7 @@ public:
* @param linenum inputs the line number
* @param msg String message to be sent to the user
*/
TransportDBError(int linenum, const std::string& msg) :
TransportDBError(size_t linenum, const std::string& msg) :
CanteraError("getTransportData", "error reading transport data: " + msg + "\n") {
}
};
@ -580,7 +580,7 @@ void TransportFactory::setupSolidTransport(std::ostream& flog, thermo_t* thermo,
// constant mixture attributes
trParam.thermo = thermo;
trParam.nsp_ = trParam.thermo->nSpecies();
int nsp = trParam.nsp_;
size_t nsp = trParam.nsp_;
trParam.tmin = thermo->minTemp();
trParam.tmax = thermo->maxTemp();
@ -1118,8 +1118,8 @@ void TransportFactory::getSolidTransportData(const XML_Node& transportNode,
{
try {
int num = transportNode.nChildren();
for (int iChild = 0; iChild < num; iChild++) {
size_t num = transportNode.nChildren();
for (size_t iChild = 0; iChild < num; iChild++) {
//tranTypeNode is a type of transport property like viscosity
XML_Node& tranTypeNode = transportNode.child(iChild);
std::string nodeName = tranTypeNode.name();