Removed a lot of size_t/uint/int related compiler warnings. Still more to go.

p4#: 20215
This commit is contained in:
Jacob Støren 2013-01-22 11:34:47 +01:00
parent 24ac7b819e
commit b938b14b5b
14 changed files with 46 additions and 48 deletions

View File

@ -97,7 +97,7 @@ size_t RifEclipseOutputFileTools::numOccurrences(const QString& keyword)
//--------------------------------------------------------------------------------------------------
/// Get keywords found on file given by name.
/// If numDataItems > -1, get keywords with that exact number of data items only.
/// If numDataItems != cvf::UNDEFINED_SIZE_T, get keywords with that exact number of data items only.
//--------------------------------------------------------------------------------------------------
bool RifEclipseOutputFileTools::keywordsOnFile(QStringList* keywords, size_t numDataItems, size_t numSteps)
{
@ -114,16 +114,16 @@ bool RifEclipseOutputFileTools::keywordsOnFile(QStringList* keywords, size_t num
for (int i = 0; i < numKeywords; i++)
{
const char* kw = ecl_file_iget_distinct_kw(m_file , i);
size_t numKWOccurences = ecl_file_get_num_named_kw(m_file, kw);
int numKWOccurences = ecl_file_get_num_named_kw(m_file, kw);
if (numDataItems != cvf::UNDEFINED_SIZE_T)
{
bool dataTypeSupported = true;
size_t numKWValues = 0;
size_t j;
int numKWValues = 0;
int j;
for (j = 0; j < numKWOccurences; j++)
{
numKWValues += (size_t) ecl_file_iget_named_size(m_file, kw, j);
numKWValues += ecl_file_iget_named_size(m_file, kw, j);
// Check the data type - only float and double are supported
ecl_type_enum dataType = ecl_file_iget_named_type(m_file, kw, j);
@ -138,7 +138,7 @@ bool RifEclipseOutputFileTools::keywordsOnFile(QStringList* keywords, size_t num
{
if (numSteps != cvf::UNDEFINED_SIZE_T && numSteps > 0)
{
numKWValues /= numSteps;
numKWValues /= static_cast<int>(numSteps);
}
// Append keyword to the list if it has the given number of values in total
@ -265,7 +265,7 @@ bool RifEclipseOutputFileTools::keywordData(const QString& keyword, size_t index
CVF_ASSERT(m_file);
CVF_ASSERT(values);
ecl_kw_type* kwData = ecl_file_iget_named_kw(m_file, keyword.toAscii().data(), index);
ecl_kw_type* kwData = ecl_file_iget_named_kw(m_file, keyword.toAscii().data(), static_cast<int>(index));
if (kwData)
{
size_t numValues = ecl_kw_get_size(kwData);

View File

@ -43,8 +43,8 @@ bool RifEclipseRestartFilesetAccess::open(const QStringList& fileSet)
{
close();
size_t numFiles = fileSet.size();
size_t i;
int numFiles = fileSet.size();
int i;
for (i = 0; i < numFiles; i++)
{
cvf::ref<RifEclipseOutputFileTools> fileAccess = new RifEclipseOutputFileTools;

View File

@ -35,7 +35,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigReservoir* reservoir)
QList<QDateTime> dates;
for (size_t i = 0; i < m_reservoirBuilder.timeStepCount(); i++)
for (int i = 0; i < static_cast<int>(m_reservoirBuilder.timeStepCount()); i++)
{
dates.push_back(QDateTime(QDate(2012+i, 6, 1)));
}
@ -50,7 +50,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigReservoir* reservoir)
QList<QDateTime> staticDates;
staticDates.push_back(dates[0]);
for (size_t i = 0; i < m_reservoirBuilder.resultCount(); i++)
for (int i = 0; i < static_cast<int>(m_reservoirBuilder.resultCount()); i++)
{
QString varEnd;
if (i == 0) varEnd = "X";

View File

@ -130,12 +130,12 @@ void RimCellRangeFilter::setDefaultValues()
max.y() = max.y() + 1;
max.z() = max.z() + 1;
startIndexI = min.x();
startIndexJ = min.y();
startIndexK = min.z();
cellCountI = max.x() - min.x() + 1;
cellCountJ = max.y() - min.y() + 1;
cellCountK = max.z() - min.z() + 1;
startIndexI = static_cast<int>(min.x());
startIndexJ = static_cast<int>(min.y());
startIndexK = static_cast<int>(min.z());
cellCountI = static_cast<int>(max.x() - min.x() + 1);
cellCountJ = static_cast<int>(max.y() - min.y() + 1);
cellCountK = static_cast<int>(max.z() - min.z() + 1);
}
}
@ -183,17 +183,17 @@ void RimCellRangeFilter::defineEditorAttribute(const caf::PdmFieldHandle* field,
if (field == &startIndexI || field == &cellCountI)
{
myAttr->m_minimum = 1;
myAttr->m_maximum = mainGrid->cellCountI();
myAttr->m_maximum = static_cast<int>(mainGrid->cellCountI());
}
else if (field == &startIndexJ || field == &cellCountJ)
{
myAttr->m_minimum = 1;
myAttr->m_maximum = mainGrid->cellCountJ();
myAttr->m_maximum = static_cast<int>(mainGrid->cellCountJ());
}
else if (field == &startIndexK || field == &cellCountK)
{
myAttr->m_minimum = 1;
myAttr->m_maximum = mainGrid->cellCountK();
myAttr->m_maximum = static_cast<int>(mainGrid->cellCountK());
}
}
}

View File

@ -215,12 +215,12 @@ void RimInputReservoir::loadAndSyncronizeInputProperties()
size_t inputPropCount = this->m_inputPropertyCollection()->inputProperties.size();
caf::ProgressInfo progInfo(filenames.size() *( inputPropCount + knownKeywords.size()), "Reading Input properties" );
caf::ProgressInfo progInfo(static_cast<int>(filenames.size() *( inputPropCount + knownKeywords.size())), "Reading Input properties" );
int progress = 0;
for_all(filenames, i)
{
progress = i*( inputPropCount + knownKeywords.size());
progress = static_cast<int>(i*( inputPropCount + knownKeywords.size()));
// Find all the keywords present on the file
progInfo.setProgressDescription(filenames[i]);
@ -262,10 +262,10 @@ void RimInputReservoir::loadAndSyncronizeInputProperties()
fileKeywordSet.erase(kw);
}
progInfo.setProgress(progress + ipIdx );
progInfo.setProgress(static_cast<int>(progress + ipIdx) );
}
progInfo.setProgress(progress + inputPropCount);
progInfo.setProgress(static_cast<int>(progress + inputPropCount));
// Check if there are more known property keywords left on file. If it is, read them and create inputProperty objects
if (!fileKeywordSet.empty())
@ -288,7 +288,7 @@ void RimInputReservoir::loadAndSyncronizeInputProperties()
m_inputPropertyCollection->inputProperties.push_back(inputProperty);
}
}
progInfo.setProgress(progress + inputPropCount + fkIt);
progInfo.setProgress(static_cast<int>(progress + inputPropCount + fkIt));
}
}
}

View File

@ -614,8 +614,7 @@ void RimReservoirView::updateCurrentTimeStep()
geometriesToRecolor.push_back(RivReservoirViewPartMgr::ALL_WELL_CELLS);
}
size_t i;
for (i = 0; i < geometriesToRecolor.size(); ++i)
for (size_t i = 0; i < geometriesToRecolor.size(); ++i)
{
if (this->animationMode() && this->cellEdgeResult()->hasResult())
@ -640,7 +639,7 @@ void RimReservoirView::updateCurrentTimeStep()
{
cvf::String modelName = "WellPipeModel";
std::vector<cvf::Model*> models;
for (i = 0; i < frameScene->modelCount(); i++)
for (cvf::uint i = 0; i < frameScene->modelCount(); i++)
{
if (frameScene->model(i)->name() == modelName)
{
@ -648,7 +647,7 @@ void RimReservoirView::updateCurrentTimeStep()
}
}
for (i = 0; i < models.size(); i++)
for (size_t i = 0; i < models.size(); i++)
{
frameScene->removeModel(models[i]);
}
@ -862,8 +861,7 @@ void RimReservoirView::appendCellResultInfo(size_t gridIndex, size_t cellIndex,
this->cellEdgeResult()->gridScalarIndices(resultIndices);
this->cellEdgeResult()->gridScalarResultNames(&resultNames);
size_t idx;
for (idx = 0; idx < 6; idx++)
for (int idx = 0; idx < 6; idx++)
{
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue;

View File

@ -328,7 +328,7 @@ RimReservoirView* RimUiTreeModelPdm::addReservoirView(const QModelIndex& itemInd
RimReservoirView* insertedView = reservoirView->eclipseCase()->createAndAddReservoirView();
caf::PdmUiTreeItem* collectionItem = currentItem->parent();
size_t viewCount = rowCount(itemIndex.parent());
int viewCount = rowCount(itemIndex.parent());
beginInsertRows(itemIndex.parent(), viewCount, viewCount);
caf::PdmUiTreeItem* childItem = new caf::PdmUiTreeItem(collectionItem, viewCount, insertedView);

View File

@ -34,16 +34,16 @@ TEST(RigReservoirTest, BasicTest)
QDateTime wellStartTime = QDateTime::currentDateTime();
size_t wellTimeStepCount = 5;
int wellTimeStepCount = 5;
wellCellTimeHistory->m_wellCellsTimeSteps.resize(wellTimeStepCount);
size_t i;
int i;
for (i = 0; i < wellTimeStepCount; i++)
{
wellCellTimeHistory->m_wellCellsTimeSteps[i].m_timestamp = QDateTime(wellStartTime).addYears(i);
}
size_t resultTimeStepCount = 2 * wellTimeStepCount;
int resultTimeStepCount = 2 * wellTimeStepCount;
QList<QDateTime> resultTimes;
for (i = 0; i < resultTimeStepCount; i++)
{

View File

@ -313,14 +313,14 @@ void RigMainGrid::calculateActiveCellInfo(std::vector<qint32> &gridNumber,
parentGrid->ijkFromCellIndex(parentCellIdx, &pi, &pj, &pk);
}
gridNumber.push_back(grid->gridIndex());
cellI.push_back(i);
cellJ.push_back(j);
cellK.push_back(k);
parentGridNumber.push_back(parentGrid->gridIndex());
hostCellI.push_back(pi);
hostCellJ.push_back(pj);
hostCellK.push_back(pk);
gridNumber.push_back(static_cast<qint32>(grid->gridIndex()));
cellI.push_back(static_cast<qint32>(i));
cellJ.push_back(static_cast<qint32>(j));
cellK.push_back(static_cast<qint32>(k));
parentGridNumber.push_back(static_cast<qint32>(parentGrid->gridIndex()));
hostCellI.push_back(static_cast<qint32>(pi));
hostCellJ.push_back(static_cast<qint32>(pj));
hostCellK.push_back(static_cast<qint32>(pk));
}
}
}

View File

@ -665,7 +665,7 @@ bool RigReservoirCellResults::isUsingGlobalActiveIndex(size_t scalarResultIndex)
QDateTime RigReservoirCellResults::timeStepDate(size_t scalarResultIndex, size_t timeStepIndex) const
{
if (scalarResultIndex < m_resultInfos.size() && (size_t)(m_resultInfos[scalarResultIndex].m_timeStepDates.size()) > timeStepIndex)
return m_resultInfos[scalarResultIndex].m_timeStepDates[timeStepIndex];
return m_resultInfos[scalarResultIndex].m_timeStepDates[static_cast<int>(timeStepIndex)];
else
return QDateTime();
}

View File

@ -433,7 +433,7 @@ void RIViewer::paintOverlayItems(QPainter* painter)
if (showAnimBar && m_showAnimProgress)
{
m_animationProgress->setMinimum(0);
m_animationProgress->setMaximum(frameCount() - 1);
m_animationProgress->setMaximum(static_cast<int>(frameCount()) - 1);
m_animationProgress->setValue(currentFrameIndex());
m_animationProgress->resize(columnWidth, m_animationProgress->sizeHint().height());

View File

@ -486,7 +486,7 @@ ScalarMapperEffectGenerator::addAlphaAndUndefStripes(const cvf::TextureImage* te
modTexImg->allocate(texImg->width(), texImg->height() + 2);
modTexImg->fill(cvf::Color4ub(cvf::Color3ub(undefScalarColor), 255)); // Undefined color
for (size_t i = 0 ; i < texImg->width(); ++i)
for (cvf::uint i = 0 ; i < texImg->width(); ++i)
{
cvf::Color4ub legendColor = texImg->pixel(i, 0);
modTexImg->setPixel(i, 0, legendColor);

View File

@ -255,7 +255,7 @@ ref<UIntArray> StructGridGeometryGenerator::lineIndicesFromQuadVertexArray(const
CVF_ASSERT(vertexArray);
size_t numVertices = vertexArray->size();
int numQuads = numVertices/4;
int numQuads = static_cast<int>(numVertices/4);
CVF_ASSERT(numVertices%4 == 0);
ref<UIntArray> indices = new UIntArray;

View File

@ -488,7 +488,7 @@ void caf::Viewer::zoomAll()
void caf::Viewer::addFrame(cvf::Scene* scene)
{
m_frameScenes.push_back(scene);
m_animationControl->setNumFrames(m_frameScenes.size());
m_animationControl->setNumFrames(static_cast<int>(m_frameScenes.size()));
}
//--------------------------------------------------------------------------------------------------