Fix some GCC warnings.

This commit is contained in:
Mateusz Skowroński 2016-06-26 18:12:21 +02:00 committed by wmayer
parent 803c136968
commit d7240c6b2b
22 changed files with 53 additions and 41 deletions

View File

@ -789,7 +789,7 @@ protected:
{
assert(ID >= 0);
myElementIDFactory->adjustMaxId(ID);
if (ID >= myCells.size())
if (ID >= static_cast<int>(myCells.size()))
myCells.resize(ID+SMDS_Mesh::chunkSize,0);
}

View File

@ -192,7 +192,7 @@ inline SMDS_MeshInfo::SMDS_MeshInfo():
inline SMDS_MeshInfo& // operator=
SMDS_MeshInfo::operator=(const SMDS_MeshInfo& other)
{ for ( int i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=(*other.myNb[i]);
{ for ( std::size_t i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=(*other.myNb[i]);
myNbPolygons = other.myNbPolygons;
myNbQuadPolygons = other.myNbQuadPolygons;
myNbPolyhedrons = other.myNbPolyhedrons;
@ -201,7 +201,7 @@ SMDS_MeshInfo::operator=(const SMDS_MeshInfo& other)
inline void // Clear
SMDS_MeshInfo::Clear()
{ for ( int i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=0;
{ for ( std::size_t i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=0;
myNbPolygons=myNbQuadPolygons=myNbPolyhedrons=0;
}
@ -297,7 +297,7 @@ SMDS_MeshInfo::NbElements(SMDSAbs_ElementType type) const
int nb = 0;
switch (type) {
case SMDSAbs_All:
for ( int i=1+index( SMDSAbs_Node,1 ); i<myNb.size(); ++i ) if ( myNb[i] ) nb += *myNb[i];
for ( std::size_t i=1+index( SMDSAbs_Node,1 ); i<myNb.size(); ++i ) if ( myNb[i] ) nb += *myNb[i];
nb += myNbPolygons + myNbQuadPolygons + myNbPolyhedrons;
break;
case SMDSAbs_Volume:
@ -359,6 +359,8 @@ SMDS_MeshInfo::NbEntities(SMDSAbs_EntityType type) const
#endif
case SMDSEntity_Quad_Polyhedra:
break;
default:
break;
}
return 0;
}
@ -433,6 +435,8 @@ SMDS_MeshInfo::setNb(const SMDSAbs_EntityType geomType, const int nb)
#endif
case SMDSEntity_Quad_Polyhedra:
break;
default:
break;
}
}

View File

@ -125,7 +125,7 @@ public:
int _algoDim;
bool _isGlobalAlgo;
TAlgoStateError(): _algoDim(0),_algo(0),_name(SMESH_Hypothesis::HYP_OK) {}
TAlgoStateError(): _name(SMESH_Hypothesis::HYP_OK), _algo(0), _algoDim(0) {}
void Set(TAlgoStateErrorName name, const SMESH_Algo* algo, bool isGlobal)
{ _name = name; _algo = algo; _algoDim = algo->GetDim(); _isGlobalAlgo = isGlobal; }
void Set(TAlgoStateErrorName name, const int algoDim, bool isGlobal)

View File

@ -47,7 +47,7 @@ using namespace UNV;
namespace{
typedef std::vector<size_t> TConnect;
int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter,
inline int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter,
TConnect& theConnect)
{
theConnect.clear();

View File

@ -344,8 +344,8 @@ int HashCode(const Link& aLink, int aLimit)
Standard_Boolean IsEqual(const Link& aLink1, const Link& aLink2)
{
return (aLink1.n1 == aLink2.n1 && aLink1.n2 == aLink2.n2 ||
aLink1.n1 == aLink2.n2 && aLink1.n2 == aLink2.n1);
return ((aLink1.n1 == aLink2.n1 && aLink1.n2 == aLink2.n2) ||
(aLink1.n1 == aLink2.n2 && aLink1.n2 == aLink2.n1));
}
namespace
@ -539,7 +539,7 @@ namespace
*/
//================================================================================
void makeQuadratic( const TopTools_IndexedMapOfShape& shapes,
inline void makeQuadratic( const TopTools_IndexedMapOfShape& shapes,
SMESH_Mesh* mesh )
{
for ( int i = 1; i <= shapes.Extent(); ++i )

View File

@ -187,7 +187,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::CheckHypothesis (SMESH_Mesh& aMesh,
namespace
{
void limitSize( netgen::Mesh* ngMesh,
inline void limitSize( netgen::Mesh* ngMesh,
const double maxh )
{
// get bnd box
@ -669,7 +669,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
// compute edge length
double ELen = 0;
if (_hypLengthFromEdges || !_hypLengthFromEdges && !_hypMaxElementArea) {
if (_hypLengthFromEdges || (!_hypLengthFromEdges && !_hypMaxElementArea)) {
if ( nb1d > 0 )
ELen = fullLen / nb1d;
}

View File

@ -342,7 +342,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
namespace
{
void limitVolumeSize( netgen::Mesh* ngMesh,
inline void limitVolumeSize( netgen::Mesh* ngMesh,
double maxh )
{
// get average h of faces

View File

@ -268,6 +268,7 @@ double* SMDS_MeshNode::getCoord() const
vtkUnstructuredGrid *grid;
coord2=(double *)malloc(3*sizeof(double));
if ( SMDS_Mesh::_meshList[myMeshId] != NULL )
{
if ( SMDS_Mesh::_meshList[myMeshId]->getGrid() != NULL )
{
grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
@ -278,6 +279,7 @@ double* SMDS_MeshNode::getCoord() const
return(coord2);
// return (double *)(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoints()->GetPoint(myVtkID,coord));
}
}
else
{
coord2[0]=0.;

View File

@ -160,7 +160,7 @@ void SMESH_Hypothesis::SetLibName(const char* theLibName)
SMESH_Mesh* SMESH_Hypothesis::GetMeshByPersistentID(int id)
{
StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
map<int, SMESH_Mesh*>::iterator itm = itm = myStudyContext->mapMesh.begin();
map<int, SMESH_Mesh*>::iterator itm = myStudyContext->mapMesh.begin();
for ( ; itm != myStudyContext->mapMesh.end(); itm++)
{
SMESH_Mesh* mesh = (*itm).second;

View File

@ -3610,7 +3610,7 @@ namespace { // Structures used by FixQuadraticElements()
/*!
* \brief Dump QLink and QFace
*/
ostream& operator << (ostream& out, const QLink& l)
inline ostream& operator << (ostream& out, const QLink& l)
{
out <<"QLink nodes: "
<< l.node1()->GetID() << " - "
@ -3618,7 +3618,7 @@ namespace { // Structures used by FixQuadraticElements()
<< l.node2()->GetID() << endl;
return out;
}
ostream& operator << (ostream& out, const QFace& f)
inline ostream& operator << (ostream& out, const QFace& f)
{
out <<"QFace nodes: "/*<< &f << " "*/;
for ( TIDSortedNodeSet::const_iterator n = f.begin(); n != f.end(); ++n )

View File

@ -218,9 +218,9 @@ namespace
}
}
#else
void inSegmentsToFile( vector< InSegment>& inSegments) {}
void dumpEdge( const TVDEdge* edge ) {}
void dumpCell( const TVDCell* cell ) {}
inline void inSegmentsToFile( vector< InSegment>& inSegments) {}
inline void dumpEdge( const TVDEdge* edge ) {}
inline void dumpCell( const TVDCell* cell ) {}
#endif
}
// -------------------------------------------------------------------------------------
@ -1701,7 +1701,7 @@ bool SMESH_MAT2d::Branch::getParameter(const BranchPoint & p, double & u ) const
if ( p._iEdge > _params.size()-1 )
return false;
if ( p._iEdge == _params.size()-1 )
return u = 1.;
return (u = 1.);
u = ( _params[ p._iEdge ] * ( 1 - p._edgeParam ) +
_params[ p._iEdge+1 ] * p._edgeParam );
@ -1807,7 +1807,7 @@ bool SMESH_MAT2d::Branch::addDivPntForConcaVertex( std::vector< std::size_t >&
{
// look for a VERTEX of the opposite EDGE
// iNext - next after all null-length segments
while ( maE = ++iNext )
while ( ( maE = ++iNext ))
{
iSeg2 = getBndSegment( maE );
if ( !_boundary->isConcaveSegment( ie1, iSeg2 ))
@ -1839,7 +1839,7 @@ bool SMESH_MAT2d::Branch::addDivPntForConcaVertex( std::vector< std::size_t >&
else if ( isConcaPrev )
{
// all null-length segments passed, find their beginning
while ( maE = iPrev.edgePrev() )
while ( ( maE = iPrev.edgePrev() ))
{
iSeg1 = getBndSegment( maE );
if ( _boundary->isConcaveSegment( edgeIDs1.back(), iSeg1 ))

View File

@ -535,7 +535,7 @@ namespace // internal utils
for ( int i = 0; i < 3; ++i )
{
const gp_Pnt& pn = myNodes->Value(n[i]);
if ( avoidTria = ( pn.SquareDistance( *avoidPnt ) <= tol2 ))
if ( ( avoidTria = ( pn.SquareDistance( *avoidPnt ) <= tol2 )))
break;
if ( !projectedOnly )
minD2 = Min( minD2, pn.SquareDistance( p ));

View File

@ -2731,7 +2731,7 @@ namespace
chn.back()->IsLinked( quad._eIntNodes[ iP ]->_intPoint ))
{
chn.push_back( quad._eIntNodes[ iP ]);
found = quad._eIntNodes[ iP ]->_usedInFace = &quad;
found = (quad._eIntNodes[ iP ]->_usedInFace = &quad);
break;
}
} while ( found && ! chn.back()->IsLinked( n2->_intPoint ) );
@ -2823,7 +2823,7 @@ namespace
( !avoidFace || quad._eIntNodes[ iP ]->IsOnFace( avoidFace )))
{
chn.push_back( quad._eIntNodes[ iP ]);
found = quad._eIntNodes[ iP ]->_usedInFace = &quad;
found = (quad._eIntNodes[ iP ]->_usedInFace = &quad);
break;
}
} while ( found );

View File

@ -132,7 +132,7 @@ namespace
// we expect SIGSEGV on a dead group
OCC_CATCH_SIGNALS;
SMESH_Group* okGroup = 0;
map<int, SMESH_Mesh*>::iterator itm = itm = studyContext->mapMesh.begin();
map<int, SMESH_Mesh*>::iterator itm = studyContext->mapMesh.begin();
for ( ; !okGroup && itm != studyContext->mapMesh.end(); itm++)
{
SMESH_Mesh::GroupIteratorPtr gIt = itm->second->GetGroups();
@ -174,7 +174,7 @@ namespace
{
int tgtID = resMapKey.second;
SMESH_Mesh* tgtMesh = 0;
map<int, SMESH_Mesh*>::iterator itm = itm = studyContext->mapMesh.begin();
map<int, SMESH_Mesh*>::iterator itm = studyContext->mapMesh.begin();
for ( ; !tgtMesh && itm != studyContext->mapMesh.end(); itm++)
{
tgtMesh = (*itm).second;
@ -250,7 +250,7 @@ std::vector<SMESH_Mesh*> StdMeshers_ImportSource1D::GetSourceMeshes() const
StudyContextStruct* studyContext = _gen->GetStudyContext(_studyId);
for ( set<int>::iterator id = meshIDs.begin(); id != meshIDs.end(); ++id )
{
map<int, SMESH_Mesh*>::iterator itm = itm = studyContext->mapMesh.begin();
map<int, SMESH_Mesh*>::iterator itm = studyContext->mapMesh.begin();
for ( ; itm != studyContext->mapMesh.end(); itm++)
{
SMESH_Mesh* mesh = (*itm).second;

View File

@ -800,7 +800,7 @@ void StdMeshers_Penta_3D::MakeMeshOnFxy1()
while(itf->more()) {
const SMDS_MeshElement* pE0 = itf->next();
aElementType = pE0->GetType();
if (!aElementType==SMDSAbs_Face) {
if (!(aElementType==SMDSAbs_Face)) {
continue;
}
aNbNodes = pE0->NbNodes();

View File

@ -522,7 +522,7 @@ namespace {
return nbSides;
}
void pointsToPython(const std::vector<gp_XYZ>& p)
inline void pointsToPython(const std::vector<gp_XYZ>& p)
{
#ifdef _DEBUG_
for ( int i = SMESH_Block::ID_V000; i < p.size(); ++i )

View File

@ -102,7 +102,7 @@ namespace HERE = StdMeshers_ProjectionUtils;
namespace {
static SMESHDS_Mesh* theMeshDS[2] = { 0, 0 }; // used for debug only
long shapeIndex(const TopoDS_Shape& S)
inline long shapeIndex(const TopoDS_Shape& S)
{
if ( theMeshDS[0] && theMeshDS[1] )
return max(theMeshDS[0]->ShapeToIndex(S), theMeshDS[1]->ShapeToIndex(S) );

View File

@ -431,7 +431,7 @@ namespace {
// get ordered src EDGEs
TError err;
srcWires = StdMeshers_FaceSide::GetFaceWires( srcFace, *srcMesh,/*skipMediumNodes=*/0, err);
if ( err && !err->IsOK() || srcWires.empty() )
if ( ( err && !err->IsOK() ) || srcWires.empty() )
return err;
SMESH_MesherHelper srcHelper( *srcMesh );
@ -942,7 +942,7 @@ namespace {
*/
//================================================================================
bool projectQuads(const TopoDS_Face& tgtFace,
inline bool projectQuads(const TopoDS_Face& tgtFace,
const TopoDS_Face& srcFace,
const TSideVector& tgtWires,
const TSideVector& srcWires,

View File

@ -196,7 +196,7 @@ namespace {
/*!
* \brief return PropagationMgrData found on theEdge submesh
*/
PropagationMgrData* findData(SMESH_Mesh& theMesh, const TopoDS_Shape& theEdge)
inline PropagationMgrData* findData(SMESH_Mesh& theMesh, const TopoDS_Shape& theEdge)
{
if ( theEdge.ShapeType() == TopAbs_EDGE )
return findData( theMesh.GetSubMeshContaining( theEdge ) );

View File

@ -1629,7 +1629,7 @@ bool _ViscousBuilder::findSolidsWithLayers()
list< const SMESHDS_Hypothesis *>::const_iterator hyp = allHyps.begin();
const StdMeshers_ViscousLayers* viscHyp = 0;
for ( ; hyp != allHyps.end(); ++hyp )
if ( viscHyp = dynamic_cast<const StdMeshers_ViscousLayers*>( *hyp ))
if ( ( viscHyp = dynamic_cast<const StdMeshers_ViscousLayers*>( *hyp )))
{
TopoDS_Shape hypShape;
filter.Init( filter.Is( viscHyp ));
@ -6240,7 +6240,11 @@ bool _ViscousBuilder::refine(_SolidData& data)
if ( baseShapeId != prevBaseId )
{
map< TGeomID, TNode2Edge* >::iterator s2ne = data._s2neMap.find( baseShapeId );
n2eMap = ( s2ne == data._s2neMap.end() ) ? 0 : n2eMap = s2ne->second;
if (s2ne == data._s2neMap.end())
n2eMap = 0;
else
n2eMap = s2ne->second;
//n2eMap = ( s2ne == data._s2neMap.end() ) ? 0 : n2eMap = s2ne->second;
prevBaseId = baseShapeId;
}
_LayerEdge* edgeOnSameNode = 0;

View File

@ -817,7 +817,7 @@ bool _ViscousBuilder2D::findEdgesWithLayers()
{
hasVL = false;
for ( hyp = allHyps.begin(); hyp != allHyps.end() && !hasVL; ++hyp )
if ( viscHyp = dynamic_cast<const THypVL*>( *hyp ))
if ( ( viscHyp = dynamic_cast<const THypVL*>( *hyp ) ))
hasVL = viscHyp->IsShapeWithLayers( neighbourID );
}
if ( !hasVL )

View File

@ -610,13 +610,15 @@ int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, Resu
BOPCheck.MergeEdgeMode() = true;
#endif
Base::TimeInfo start_time;
BOPCheck.Perform();
float bopAlgoTime = Base::TimeInfo::diffTimeF(start_time,Base::TimeInfo());
#ifdef FC_DEBUG
Base::TimeInfo start_time;
#endif
BOPCheck.Perform();
#ifdef FC_DEBUG
float bopAlgoTime = Base::TimeInfo::diffTimeF(start_time,Base::TimeInfo());
std::cout << std::endl << "BopAlgo check time is: " << bopAlgoTime << std::endl << std::endl;
#else
Q_UNUSED(bopAlgoTime);
#endif
if (!BOPCheck.HasFaulty())