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

View File

@ -998,7 +998,7 @@ bool Foam::processorPolyPatch::order
// aspect ratios) we will probably also have problems with // aspect ratios) we will probably also have problems with
// reliable normals calculation // reliable normals calculation
labelList faceMap2(faceMap.size(), -1); labelList faceMap2(faceMap.size(), -1);
matchedAll = matchPoints matchPoints
( (
facePointAverages, facePointAverages,
masterFacePointAverages, masterFacePointAverages,
@ -1007,21 +1007,18 @@ bool Foam::processorPolyPatch::order
faceMap2 faceMap2
); );
forAll(faceMap, oldFacei)
{
if (faceMap[oldFacei] == -1)
{
faceMap[oldFacei] = faceMap2[oldFacei];
}
}
matchedAll = true; matchedAll = true;
forAll(faceMap, oldFacei) forAll(faceMap, oldFacei)
{ {
if (faceMap[oldFacei] == -1) 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) Foam::direction Foam::readDirection(Istream& is)
{ {
direction val; direction val(0);
is >> val; is >> val;
return val; return val;

View File

@ -76,7 +76,7 @@ bool Foam::readInt(const char* buf, int& val)
int Foam::readInt(Istream& is) int Foam::readInt(Istream& is)
{ {
int val; int val(0);
is >> val; is >> val;
return 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 Foam::readInt32(Istream& is)
{ {
int32_t val; int32_t val(0);
is >> val; is >> val;
return 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 Foam::readInt64(Istream& is)
{ {
int64_t val; int64_t val(0);
is >> val; is >> val;
return val; return val;

View File

@ -30,7 +30,7 @@ License
unsigned int Foam::readUint(Istream& is) unsigned int Foam::readUint(Istream& is)
{ {
unsigned int val; unsigned int val(0);
is >> val; is >> val;
return 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 Foam::readUint32(Istream& is)
{ {
uint32_t val; uint32_t val(0);
is >> val; is >> val;
return 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 Foam::readUint64(Istream& is)
{ {
uint64_t val; uint64_t val(0);
is >> val; is >> val;
return val; return val;

View File

@ -128,8 +128,7 @@ Foam::label Foam::isoCutFace::calcSubFace
// +1: face is fully above the isosurface // +1: face is fully above the isosurface
label faceStatus; label faceStatus;
label pl1 = pLabels[0]; scalar f1 = f[pLabels[0]];
scalar f1 = f[pl1];
// If vertex values are very close to isoValue lift them slightly to avoid // 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 // 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; f1 = f2;
} }

View File

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

View File

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

View File

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

View File

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

View File

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