Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix some GCC warnings.
  • Loading branch information
f3nix authored and wwmayer committed Jul 15, 2016
1 parent 803c136 commit d7240c6
Show file tree
Hide file tree
Showing 22 changed files with 51 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/3rdParty/salomesmesh/inc/SMDS_Mesh.hxx
Expand Up @@ -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);
}

Expand Down
10 changes: 7 additions & 3 deletions src/3rdParty/salomesmesh/inc/SMDS_MeshInfo.hxx
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -359,6 +359,8 @@ SMDS_MeshInfo::NbEntities(SMDSAbs_EntityType type) const
#endif
case SMDSEntity_Quad_Polyhedra:
break;
default:
break;
}
return 0;
}
Expand Down Expand Up @@ -433,6 +435,8 @@ SMDS_MeshInfo::setNb(const SMDSAbs_EntityType geomType, const int nb)
#endif
case SMDSEntity_Quad_Polyhedra:
break;
default:
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/3rdParty/salomesmesh/inc/SMESH_Gen.hxx
Expand Up @@ -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)
Expand Down
Expand Up @@ -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();
Expand Down
Expand Up @@ -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
Expand Down Expand Up @@ -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 )
Expand Down
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp
Expand Up @@ -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();
Expand All @@ -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.;
Expand Down
2 changes: 1 addition & 1 deletion src/3rdParty/salomesmesh/src/SMESH/SMESH_Hypothesis.cpp
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/3rdParty/salomesmesh/src/SMESH/SMESH_MesherHelper.cpp
Expand Up @@ -3610,15 +3610,15 @@ 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() << " - "
<< l._mediumNode->GetID() << " - "
<< 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 )
Expand Down
12 changes: 6 additions & 6 deletions src/3rdParty/salomesmesh/src/StdMeshers/SMESH_MAT2d.cpp
Expand Up @@ -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
}
// -------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 ))
Expand Down Expand Up @@ -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 ))
Expand Down
Expand Up @@ -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 ));
Expand Down
Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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 );
Expand Down
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Expand Up @@ -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();
Expand Down
Expand Up @@ -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 )
Expand Down
Expand Up @@ -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) );
Expand Down
Expand Up @@ -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 );
Expand Down Expand Up @@ -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,
Expand Down
Expand Up @@ -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 ) );
Expand Down
Expand Up @@ -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 ));
Expand Down Expand Up @@ -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;
Expand Down
Expand Up @@ -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 )
Expand Down
8 changes: 5 additions & 3 deletions src/Mod/Part/Gui/TaskCheckGeometry.cpp
Expand Up @@ -610,13 +610,15 @@ int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, Resu
BOPCheck.MergeEdgeMode() = true;
#endif

#ifdef FC_DEBUG
Base::TimeInfo start_time;
#endif

BOPCheck.Perform();
float bopAlgoTime = Base::TimeInfo::diffTimeF(start_time,Base::TimeInfo());

#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())
Expand Down

0 comments on commit d7240c6

Please sign in to comment.