System : Introduce compiler warning C4457 with fixes

This commit is contained in:
Magne Sjaastad
2018-09-24 21:20:35 +02:00
parent 5a9a5ba803
commit 4009d4d63b
7 changed files with 30 additions and 31 deletions

View File

@@ -284,7 +284,6 @@ if (MSVC)
# warning C4245: 'return': conversion from 'int' to 'size_t', signed/unsigned mismatch
# warning C4456: declaration of 'sourceInfo' hides previous local declaration
# warning C4458: declaration of 'name' hides class member
# warning C4457: declaration of 'min' hides function parameter
# The following warning is generated over 800 times from a qwt header only using VS2015
# Disabling temporarily
@@ -293,7 +292,7 @@ if (MSVC)
# If possible, the following command is supposed to be the final target
# set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "/W4 /wd4190 /wd4100 /wd4127")
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "/W4 /wd4190 /wd4100 /wd4127 /wd4505 /wd4245 /wd4456 /wd4458 /wd4457")
set_target_properties(ResInsight PROPERTIES COMPILE_FLAGS "/W4 /wd4190 /wd4100 /wd4127 /wd4505 /wd4245 /wd4456 /wd4458")
endif()
#############################################################################

View File

@@ -1218,15 +1218,15 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspecsToFile(RimEclipse
// Export
for (const auto wellPath : wellPathSet)
{
auto completions = wellPath->completions();
cvf::Vec2i ijIntersection = wellPathUpperGridIntersectionIJ(gridCase, wellPath);
auto rimCcompletions = wellPath->completions();
cvf::Vec2i ijIntersection = wellPathUpperGridIntersectionIJ(gridCase, wellPath);
formatter.add(completions->wellNameForExport())
.add(completions->wellGroupNameForExport())
formatter.add(rimCcompletions->wellNameForExport())
.add(rimCcompletions->wellGroupNameForExport())
.addOneBasedCellIndex(ijIntersection.x())
.addOneBasedCellIndex(ijIntersection.y())
.add(completions->referenceDepthForExport())
.add(completions->wellTypeNameForExport())
.add(rimCcompletions->referenceDepthForExport())
.add(rimCcompletions->wellTypeNameForExport())
.rowCompleted();
}
@@ -1281,16 +1281,16 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile(
// Export
for (const auto wellPath : wellPathsForLgr.second)
{
auto completions = wellPath->completions();
auto rimCompletions = wellPath->completions();
cvf::Vec2i ijIntersection = wellPathUpperGridIntersectionIJ(gridCase, wellPath, lgrName);
formatter.add(completions->wellNameForExport())
.add(completions->wellGroupNameForExport())
formatter.add(rimCompletions->wellNameForExport())
.add(rimCompletions->wellGroupNameForExport())
.add(lgrName)
.addOneBasedCellIndex(ijIntersection.x())
.addOneBasedCellIndex(ijIntersection.y())
.add(completions->referenceDepthForExport())
.add(completions->wellTypeNameForExport())
.add(rimCompletions->referenceDepthForExport())
.add(rimCompletions->wellTypeNameForExport())
.rowCompleted();
}
}

View File

@@ -541,12 +541,12 @@ bool RifEclipseUserDataParserTools::hasCompleteDataForAllHeaderColumns(const std
bool headerDataComplete = true;
{
auto lines = RifEclipseUserDataParserTools::findValidHeaderLines(streamData);
if (lines.size() > 0)
auto headerLines = RifEclipseUserDataParserTools::findValidHeaderLines(streamData);
if (headerLines.size() > 0)
{
size_t wordsFirstLine = lines[0].size();
size_t wordsFirstLine = headerLines[0].size();
for (auto line : lines)
for (auto line : headerLines)
{
if (wordsFirstLine != line.size())
{

View File

@@ -511,16 +511,16 @@ void RivFaultPartMgr::createLabelWithAnchorLine(const cvf::Part* part)
drawableText->addText(cvfString, textCoord);
cvf::ref<cvf::Part> part = new cvf::Part;
part->setName("RivFaultPart : text " + cvfString);
part->setDrawable(drawableText.p());
cvf::ref<cvf::Part> labelPart = new cvf::Part;
labelPart->setName("RivFaultPart : text " + cvfString);
labelPart->setDrawable(drawableText.p());
cvf::ref<cvf::Effect> eff = new cvf::Effect;
part->setEffect(eff.p());
part->setPriority(RivPartPriority::PartType::Text);
labelPart->setEffect(eff.p());
labelPart->setPriority(RivPartPriority::PartType::Text);
m_faultLabelPart = part;
m_faultLabelPart = labelPart;
}
// Line from fault geometry to label

View File

@@ -83,10 +83,10 @@ void RigReservoirBuilderMock::appendNodes(const cvf::Vec3d& min, const cvf::Vec3
size_t i;
for (i = 0; i < cubeDimension.x(); i++)
{
cvf::Vec3d min(xPos, yPos, zPos);
cvf::Vec3d max(xPos + dx, yPos + dy, zPos + dz);
cvf::Vec3d cornerA(xPos, yPos, zPos);
cvf::Vec3d cornerB(xPos + dx, yPos + dy, zPos + dz);
appendCubeNodes(min, max, nodes);
appendCubeNodes(cornerA, cornerB, nodes);
xPos += dx;
}

View File

@@ -208,10 +208,10 @@ void RigWellPath::twoClosestPoints(const cvf::Vec3d& position, cvf::Vec3d* p1, c
for ( size_t i = 1; i < m_wellPathPoints.size(); i++ )
{
cvf::Vec3d p1 = m_wellPathPoints[i - 1];
cvf::Vec3d p2 = m_wellPathPoints[i - 0];
cvf::Vec3d point1 = m_wellPathPoints[i - 1];
cvf::Vec3d point2 = m_wellPathPoints[i - 0];
double candidateDistance = cvf::GeometryTools::linePointSquareDist(p1, p2, position);
double candidateDistance = cvf::GeometryTools::linePointSquareDist(point1, point2, position);
if ( candidateDistance < closestDistance )
{
closestDistance = candidateDistance;

View File

@@ -230,9 +230,9 @@ void RiuMultiCaseImportDialog::appendEGRIDFilesRecursively(const QString& folder
for (int i = 0; i < subFolders.size(); ++i)
{
QString folderName = subFolders[i];
QString subFolderName = subFolders[i];
QString absoluteFolderName = baseDir.absoluteFilePath(folderName);
QString absoluteFolderName = baseDir.absoluteFilePath(subFolderName);
appendEGRIDFilesRecursively(absoluteFolderName, gridFileNames);
}
}