COMP: avoid some static analysis warnings

This commit is contained in:
Mark Olesen 2019-01-02 13:49:39 +01:00
parent 7bf25dbda1
commit f67f36c63a
15 changed files with 23 additions and 29 deletions

View File

@ -2572,7 +2572,7 @@ Foam::label Foam::fileOperations::masterUncollatedFileOperation::addWatch
const fileName& fName
) const
{
label watchFd;
label watchFd = -1;
if (Pstream::master()) // comm_))
{
watchFd = monitor().addWatch(fName);
@ -2587,7 +2587,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::removeWatch
const label watchIndex
) const
{
bool ok;
bool ok = false;
if (Pstream::master()) // comm_))
{
ok = monitor().removeWatch(watchIndex);

View File

@ -998,7 +998,7 @@ bool Foam::processorPolyPatch::order
// aspect ratios) we will probably also have problems with
// reliable normals calculation
labelList faceMap2(faceMap.size(), -1);
matchedAll = matchPoints
matchPoints
(
facePointAverages,
masterFacePointAverages,
@ -1007,21 +1007,18 @@ bool Foam::processorPolyPatch::order
faceMap2
);
forAll(faceMap, oldFacei)
{
if (faceMap[oldFacei] == -1)
{
faceMap[oldFacei] = faceMap2[oldFacei];
}
}
matchedAll = true;
forAll(faceMap, oldFacei)
{
if (faceMap[oldFacei] == -1)
{
matchedAll = false;
faceMap[oldFacei] = faceMap2[oldFacei];
if (faceMap[oldFacei] == -1)
{
matchedAll = false;
}
}
}
}

View File

@ -30,7 +30,7 @@ License
Foam::direction Foam::readDirection(Istream& is)
{
direction val;
direction val(0);
is >> val;
return val;

View File

@ -76,7 +76,7 @@ bool Foam::readInt(const char* buf, int& val)
int Foam::readInt(Istream& is)
{
int val;
int val(0);
is >> val;
return val;

View File

@ -108,7 +108,7 @@ Foam::Istream& Foam::operator>>(Istream& is, int32_t& val)
int32_t Foam::readInt32(Istream& is)
{
int32_t val;
int32_t val(0);
is >> val;
return val;

View File

@ -108,7 +108,7 @@ Foam::Istream& Foam::operator>>(Istream& is, int64_t& val)
int64_t Foam::readInt64(Istream& is)
{
int64_t val;
int64_t val(0);
is >> val;
return val;

View File

@ -30,7 +30,7 @@ License
unsigned int Foam::readUint(Istream& is)
{
unsigned int val;
unsigned int val(0);
is >> val;
return val;

View File

@ -107,7 +107,7 @@ Foam::Istream& Foam::operator>>(Istream& is, uint32_t& val)
uint32_t Foam::readUint32(Istream& is)
{
uint32_t val;
uint32_t val(0);
is >> val;
return val;

View File

@ -107,7 +107,7 @@ Foam::Istream& Foam::operator>>(Istream& is, uint64_t& val)
uint64_t Foam::readUint64(Istream& is)
{
uint64_t val;
uint64_t val(0);
is >> val;
return val;

View File

@ -128,8 +128,7 @@ Foam::label Foam::isoCutFace::calcSubFace
// +1: face is fully above the isosurface
label faceStatus;
label pl1 = pLabels[0];
scalar f1 = f[pl1];
scalar f1 = f[pLabels[0]];
// If vertex values are very close to isoValue lift them slightly to avoid
// dealing with the many special cases of a face being touched either at a
@ -186,7 +185,6 @@ Foam::label Foam::isoCutFace::calcSubFace
}
}
}
pl1 = pl2;
f1 = f2;
}

View File

@ -111,7 +111,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
start = startInfo.hitPoint();
//// Uncomment below to shift slightly in:
tetIndices tet(celli, meshFacei, tetPti);
tetIndices tet(celli, tetFacei, tetPti);
start =
(1.0 - 1e-6)*startInfo.hitPoint()
+ 1e-6*tet.tet(mesh_).centre();

View File

@ -76,7 +76,7 @@ Foam::label Foam::blockMeshTools::read
const dictionary& dict
)
{
label val;
label val(0);
read(is, val, dict);
return val;
}

View File

@ -2050,7 +2050,6 @@ void Foam::snappySnapDriver::avoidDiagonalAttraction
scalar distSqr = magSqr(mid-pt);
if (distSqr < minDistSqr)
{
distSqr = minDistSqr;
minFp = fp;
}
}

View File

@ -193,7 +193,7 @@ void Foam::vtk::indirectPatchWriter::writePolysLegacy(const label pointOffset)
++iter;
}
}
off += pp_.nPoints();
// off += pp_.nPoints();
}
}
@ -259,7 +259,7 @@ void Foam::vtk::indirectPatchWriter::writePolys(const label pointOffset)
++iter;
}
}
off += pp_.nPoints();
// off += pp_.nPoints();
}
}

View File

@ -193,7 +193,7 @@ void Foam::vtk::surfaceWriter::writePolysLegacy(const label pointOffset)
++iter;
}
}
off += points_.size();
// off += points_.size();
}
}
@ -259,7 +259,7 @@ void Foam::vtk::surfaceWriter::writePolys(const label pointOffset)
++iter;
}
}
off += points_.size();
// off += points_.size();
}
}