From 5729ee7ea55d00f9678157d10f23f745205cf31d Mon Sep 17 00:00:00 2001 From: Camille Date: Sat, 15 Nov 2014 08:43:23 -0500 Subject: [PATCH] Compile warning fixes and minor code policy fixes. --- 3d-viewer/vrml_v1_modelparser.cpp | 6 +- 3d-viewer/vrml_v2_modelparser.cpp | 18 +++--- 3d-viewer/x3dmodelparser.cpp | 4 +- include/kiway.h | 2 +- include/wxPcbStruct.h | 2 +- pcbnew/router/direction.h | 2 +- pcbnew/router/pns_shove.cpp | 96 ++++++++++++++--------------- pcbnew/tools/selection_conditions.h | 2 +- utils/idftools/vrml_layer.cpp | 2 +- utils/idftools/vrml_layer.h | 1 - 10 files changed, 67 insertions(+), 68 deletions(-) diff --git a/3d-viewer/vrml_v1_modelparser.cpp b/3d-viewer/vrml_v1_modelparser.cpp index 28579fcb9e..5ada319024 100644 --- a/3d-viewer/vrml_v1_modelparser.cpp +++ b/3d-viewer/vrml_v1_modelparser.cpp @@ -192,7 +192,7 @@ int VRML1_MODEL_PARSER::readMaterial() continue; } - if( ( *text == '}' ) ) + if( *text == '}' ) { return 0; } @@ -240,7 +240,7 @@ int VRML1_MODEL_PARSER::readCoordinate3() continue; } - if( ( *text == '}' ) ) + if( *text == '}' ) { return 0; } @@ -268,7 +268,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet() continue; } - if( ( *text == '}' ) ) + if( *text == '}' ) { return 0; } diff --git a/3d-viewer/vrml_v2_modelparser.cpp b/3d-viewer/vrml_v2_modelparser.cpp index 2589c593df..2c21f9bdf3 100644 --- a/3d-viewer/vrml_v2_modelparser.cpp +++ b/3d-viewer/vrml_v2_modelparser.cpp @@ -145,7 +145,7 @@ int VRML2_MODEL_PARSER::read_Transform() continue; } - if( ( *text == '}' ) ) + if( *text == '}' ) { // DBG( printf( " } Exit Transform\n" ) ); break; @@ -265,7 +265,7 @@ int VRML2_MODEL_PARSER::read_DEF() continue; } - if( ( *text == '}' ) ) + if( *text == '}' ) { // DBG( printf( " } Exit DEF\n") ); return 0; @@ -321,7 +321,7 @@ int VRML2_MODEL_PARSER::read_Shape() continue; } - if( ( *text == '}' ) ) + if( *text == '}' ) { // DBG( printf( " } Exit Shape\n") ); return 0; @@ -368,7 +368,7 @@ int VRML2_MODEL_PARSER::read_Appearance() continue; } - if( ( *text == '}' ) ) + if( *text == '}' ) { return 0; } @@ -473,7 +473,7 @@ int VRML2_MODEL_PARSER::read_Material() continue; } - if( ( *text == '}' ) ) + if( *text == '}' ) { return 0; } @@ -566,7 +566,7 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet() continue; } - if( ( *text == '}' ) ) + if( *text == '}' ) { // DBG( printf( " } Exit IndexedFaceSet\n") ); return 0; @@ -749,7 +749,7 @@ int VRML2_MODEL_PARSER::read_Color() continue; } - if( ( *text == '}' ) ) + if( *text == '}' ) { // DBG( printf( " m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) ); return 0; @@ -779,7 +779,7 @@ int VRML2_MODEL_PARSER::read_Normal() continue; } - if( ( *text == '}' ) ) + if( *text == '}' ) { // DBG( printf( " m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) ); return 0; @@ -817,7 +817,7 @@ int VRML2_MODEL_PARSER::read_Coordinate() continue; } - if( ( *text == '}' ) ) + if( *text == '}' ) { // DBG( printf( " m_Point.size: %lu\n", m_model->m_Point.size() ) ); return 0; diff --git a/3d-viewer/x3dmodelparser.cpp b/3d-viewer/x3dmodelparser.cpp index 176d942c12..d6a1d106f7 100644 --- a/3d-viewer/x3dmodelparser.cpp +++ b/3d-viewer/x3dmodelparser.cpp @@ -384,7 +384,9 @@ bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData, { wxStringTokenizer tokens( aData ); - double x, y, z; + double x = 0; + double y = 0; + double z = 0; bool ret = tokens.GetNextToken().ToDouble( &x ) && tokens.GetNextToken().ToDouble( &y ) diff --git a/include/kiway.h b/include/kiway.h index 380f300352..cb37c663b4 100644 --- a/include/kiway.h +++ b/include/kiway.h @@ -250,7 +250,7 @@ struct KIFACE */ class KIWAY : public wxEvtHandler { - friend class PGM_SINGLE_TOP; // can use set_kiface() + friend struct PGM_SINGLE_TOP; // can use set_kiface() public: /// Known KIFACE implementations diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 5194cca753..d44bfd89e5 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -75,7 +75,7 @@ namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp */ class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME { - friend class PCB::IFACE; + friend struct PCB::IFACE; friend class PCB_LAYER_WIDGET; void updateTraceWidthSelectBox(); diff --git a/pcbnew/router/direction.h b/pcbnew/router/direction.h index 90edd1be56..eb37a14988 100644 --- a/pcbnew/router/direction.h +++ b/pcbnew/router/direction.h @@ -65,7 +65,7 @@ public: ANG_UNDEFINED = 0x20 }; - DIRECTION_45( Directions aDir = UNDEFINED ) : m_dir( aDir ) {}; + DIRECTION_45( Directions aDir = UNDEFINED ) : m_dir( aDir ) {} /** * Constructor diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index 5c6853a0f8..1338557f1a 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -104,7 +104,7 @@ bool PNS_SHOVE::checkBumpDirection( PNS_LINE* aCurrent, PNS_LINE* aShoved ) cons PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::walkaroundLoneVia( PNS_LINE* aCurrent, PNS_LINE* aObstacle, - PNS_LINE* aShoved ) + PNS_LINE* aShoved ) { int clearance = m_currentNode->GetClearance( aCurrent, aObstacle ); const SHAPE_LINE_CHAIN hull = aCurrent->Via().Hull( clearance, aObstacle->Width() ); @@ -313,11 +313,11 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE* aCurrent, PNS_S } #ifdef DEBUG - m_logger.NewGroup ("on-colliding-segment", m_iter); - m_logger.Log ( aObstacleSeg, 0, "obstacle-segment"); - m_logger.Log ( aCurrent, 1, "current-line"); - m_logger.Log ( obstacleLine, 2, "obstacle-line"); - m_logger.Log ( shovedLine, 3, "shoved-line"); + m_logger.NewGroup( "on-colliding-segment", m_iter ); + m_logger.Log( aObstacleSeg, 0, "obstacle-segment" ); + m_logger.Log( aCurrent, 1, "current-line" ); + m_logger.Log( obstacleLine, 2, "obstacle-line" ); + m_logger.Log( shovedLine, 3, "shoved-line" ); #endif return rv; @@ -365,7 +365,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL { PNS_VIA vh = aCurrent->Via(); PNS_VIA* via = NULL; - PNS_JOINT* jtStart = m_currentNode->FindJoint ( vh.Pos(), aCurrent ); + PNS_JOINT* jtStart = m_currentNode->FindJoint( vh.Pos(), aCurrent ); if( !jtStart ) return SH_INCOMPLETE; @@ -417,7 +417,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL } m_currentNode->Replace( aCurrent, walkaroundLine ); - walkaroundLine->SetRank ( nextRank ); + walkaroundLine->SetRank( nextRank ); #ifdef DEBUG m_logger.NewGroup( "on-colliding-solid", m_iter ); @@ -523,8 +523,8 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc pushedVia->SetRank( aCurrentRank - 1 ); #ifdef DEBUG - m_logger.Log ( aVia, 0, "obstacle-via"); - m_logger.Log ( pushedVia, 1, "pushed-via"); + m_logger.Log( aVia, 0, "obstacle-via" ); + m_logger.Log( pushedVia, 1, "pushed-via" ); #endif BOOST_FOREACH( LINE_PAIR lp, draggedLines ) @@ -628,7 +628,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN head->AppendVia( *aObstacleVia ); - SHOVE_STATUS st = processSingleLine ( head, cur, shoved ); + SHOVE_STATUS st = processSingleLine( head, cur, shoved ); if( st != SH_OK ) { @@ -665,7 +665,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN if( st != SH_OK ) return st; - cur->SetShape ( shoved->CLine() ); + cur->SetShape( shoved->CLine() ); } if( aCurrent->EndsWithVia() ) @@ -678,7 +678,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN m_logger.Log( shoved, 3, "shoved-line" ); #endif int currentRank = aCurrent->Rank(); - m_currentNode->Replace ( aCurrent, shoved ); + m_currentNode->Replace( aCurrent, shoved ); pushLine( shoved ); shoved->SetRank( currentRank ); @@ -691,7 +691,7 @@ void PNS_SHOVE::unwindStack( PNS_SEGMENT *aSeg ) { for( std::vector::iterator i = m_lineStack.begin(); i != m_lineStack.end(); ) { - if( (*i)->ContainsSegment ( aSeg ) ) + if( (*i)->ContainsSegment( aSeg ) ) i = m_lineStack.erase( i ); else i++; @@ -756,7 +756,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) { PNS_LINE* currentLine = m_lineStack.back(); PNS_NODE::OPT_OBSTACLE nearest; - SHOVE_STATUS st; + SHOVE_STATUS st = SH_NULL; PNS_ITEM::PnsKind search_order[] = { PNS_ITEM::SOLID, PNS_ITEM::VIA, PNS_ITEM::SEGMENT }; @@ -819,23 +819,23 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) { // "forward" collisoins switch( ni->Kind() ) { - case PNS_ITEM::SEGMENT: - TRACE( 2, "iter %d: collide-segment ", aIter ); - st = onCollidingSegment( currentLine, (PNS_SEGMENT*) ni ); - break; + case PNS_ITEM::SEGMENT: + TRACE( 2, "iter %d: collide-segment ", aIter ); + st = onCollidingSegment( currentLine, (PNS_SEGMENT*) ni ); + break; - case PNS_ITEM::VIA: - TRACE( 2, "iter %d: shove-via ", aIter ); - st = onCollidingVia( currentLine, (PNS_VIA*) ni ); - break; + case PNS_ITEM::VIA: + TRACE( 2, "iter %d: shove-via ", aIter ); + st = onCollidingVia( currentLine, (PNS_VIA*) ni ); + break; - case PNS_ITEM::SOLID: - TRACE( 2, "iter %d: walk-solid ", aIter ); - st = onCollidingSolid( currentLine, (PNS_SOLID*) ni ); - break; + case PNS_ITEM::SOLID: + TRACE( 2, "iter %d: walk-solid ", aIter ); + st = onCollidingSolid( currentLine, (PNS_SOLID*) ni ); + break; - default: - break; + default: + break; } } @@ -996,25 +996,25 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead ) switch( effort ) { - case OE_LOW: - optFlags = PNS_OPTIMIZER::MERGE_OBTUSE; - n_passes = 1; - extend = 0; - break; + case OE_LOW: + optFlags = PNS_OPTIMIZER::MERGE_OBTUSE; + n_passes = 1; + extend = 0; + break; - case OE_MEDIUM: - optFlags = PNS_OPTIMIZER::MERGE_OBTUSE; - n_passes = 2; - extend = 1; - break; + case OE_MEDIUM: + optFlags = PNS_OPTIMIZER::MERGE_OBTUSE; + n_passes = 2; + extend = 1; + break; - case OE_FULL: - optFlags = PNS_OPTIMIZER::MERGE_SEGMENTS; - n_passes = 2; - break; + case OE_FULL: + optFlags = PNS_OPTIMIZER::MERGE_SEGMENTS; + n_passes = 2; + break; - default: - break; + default: + break; } if( Settings().SmartPads() ) @@ -1028,7 +1028,7 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead ) std::reverse( m_optimizerQueue.begin(), m_optimizerQueue.end() ); for( std::vector::iterator i = m_optimizerQueue.begin(); - i != m_optimizerQueue.end(); ++i) + i != m_optimizerQueue.end(); ++i ) { PNS_LINE* line = *i; @@ -1057,8 +1057,6 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead ) } } } - - } @@ -1120,5 +1118,5 @@ const PNS_LINE PNS_SHOVE::NewHead() const void PNS_SHOVE::SetInitialLine( PNS_LINE* aInitial ) { m_root = m_root->Branch(); - m_root->Remove ( aInitial ); + m_root->Remove( aInitial ); } diff --git a/pcbnew/tools/selection_conditions.h b/pcbnew/tools/selection_conditions.h index 39827b3bd0..99364b5f6e 100644 --- a/pcbnew/tools/selection_conditions.h +++ b/pcbnew/tools/selection_conditions.h @@ -28,7 +28,7 @@ #include #include -class SELECTION; +struct SELECTION; ///> Functor type that checks a specific condition for selected items. typedef boost::function SELECTION_CONDITION; diff --git a/utils/idftools/vrml_layer.cpp b/utils/idftools/vrml_layer.cpp index 65188249f7..54e8cedd90 100644 --- a/utils/idftools/vrml_layer.cpp +++ b/utils/idftools/vrml_layer.cpp @@ -848,7 +848,7 @@ bool VRML_LAYER::Tesselate( VRML_LAYER* holes, bool aHolesOnly ) std::ostringstream ostr; ostr << "Tesselate():FAILED: " << holes->GetError(); error = ostr.str(); - return NULL; + return false; } if( Fault ) diff --git a/utils/idftools/vrml_layer.h b/utils/idftools/vrml_layer.h index 01e4f343cb..2c7511da71 100644 --- a/utils/idftools/vrml_layer.h +++ b/utils/idftools/vrml_layer.h @@ -62,7 +62,6 @@ #define M_PI4 ( M_PI / 4.0 ) #endif -struct GLUtesselator; struct VERTEX_3D {