Commit e6a10faa authored by Maciej Suminski's avatar Maciej Suminski

FIxed a few clang warnings.

parent 5d8f7ba0
...@@ -242,7 +242,6 @@ set( COMMON_SRCS ...@@ -242,7 +242,6 @@ set( COMMON_SRCS
geometry/seg.cpp geometry/seg.cpp
geometry/shape_line_chain.cpp geometry/shape_line_chain.cpp
geometry/shape_collisions.cpp geometry/shape_collisions.cpp
geometry/shape_index.cpp
) )
add_library( common STATIC ${COMMON_SRCS} ) add_library( common STATIC ${COMMON_SRCS} )
add_dependencies( common lib-dependencies ) add_dependencies( common lib-dependencies )
......
...@@ -157,10 +157,10 @@ void GAL::DrawGrid() ...@@ -157,10 +157,10 @@ void GAL::DrawGrid()
assert( gridEndY >= gridStartY ); assert( gridEndY >= gridStartY );
// Correct the index, else some lines are not correctly painted // Correct the index, else some lines are not correctly painted
gridStartX -= abs( gridOrigin.x / gridSize.x ) + 1; gridStartX -= std::abs( gridOrigin.x / gridSize.x ) + 1;
gridStartY -= abs( gridOrigin.y / gridSize.y ) + 1; gridStartY -= std::abs( gridOrigin.y / gridSize.y ) + 1;
gridEndX += abs( gridOrigin.x / gridSize.x ) + 1; gridEndX += std::abs( gridOrigin.x / gridSize.x ) + 1;
gridEndY += abs( gridOrigin.y / gridSize.y ) + 1; gridEndY += std::abs( gridOrigin.y / gridSize.y ) + 1;
// Draw the grid behind all other layers // Draw the grid behind all other layers
SetLayerDepth( depthRange.y * 0.75 ); SetLayerDepth( depthRange.y * 0.75 );
......
...@@ -137,12 +137,9 @@ static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_LINE_CHAIN& aB, ...@@ -137,12 +137,9 @@ static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_LINE_CHAIN& aB,
bool aNeedMTV, VECTOR2I& aMTV ) bool aNeedMTV, VECTOR2I& aMTV )
{ {
bool found = false; bool found = false;
VECTOR2I::extended_type clSq = (VECTOR2I::extended_type) aClearance * aClearance;
for( int s = 0; s < aB.SegmentCount(); s++ ) for( int s = 0; s < aB.SegmentCount(); s++ )
{ {
if( aA.Collide( aB.CSegment( s ), aClearance ) ) if( aA.Collide( aB.CSegment( s ), aClearance ) )
{ {
found = true; found = true;
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* @author Jacobo Aragunde Pérez
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <geometry/shape_index.h>
template <>
const SHAPE* shapeFunctor( SHAPE* aItem )
{
return aItem;
}
...@@ -138,7 +138,7 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent ) ...@@ -138,7 +138,7 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
( (double) aEvent.GetWheelRotation() * wheelPanSpeed ); ( (double) aEvent.GetWheelRotation() * wheelPanSpeed );
double scrollSpeed; double scrollSpeed;
if( abs( scrollVec.x ) > abs( scrollVec.y ) ) if( std::abs( scrollVec.x ) > std::abs( scrollVec.y ) )
scrollSpeed = scrollVec.x; scrollSpeed = scrollVec.x;
else else
scrollSpeed = scrollVec.y; scrollSpeed = scrollVec.y;
......
...@@ -344,7 +344,7 @@ inline int SEG::LineDistance( const VECTOR2I& aP, bool aDetermineSide ) const ...@@ -344,7 +344,7 @@ inline int SEG::LineDistance( const VECTOR2I& aP, bool aDetermineSide ) const
ecoord dist = ( p * aP.x + q * aP.y + r ) / sqrt( p * p + q * q ); ecoord dist = ( p * aP.x + q * aP.y + r ) / sqrt( p * p + q * q );
return aDetermineSide ? dist : abs( dist ); return aDetermineSide ? dist : std::abs( dist );
} }
inline SEG::ecoord SEG::TCoef( const VECTOR2I& aP ) const inline SEG::ecoord SEG::TCoef( const VECTOR2I& aP ) const
......
...@@ -46,13 +46,6 @@ static const SHAPE* shapeFunctor( T aItem ) ...@@ -46,13 +46,6 @@ static const SHAPE* shapeFunctor( T aItem )
return aItem->Shape(); return aItem->Shape();
} }
/**
* shapeFunctor template function: specialization for T = SHAPE*
*/
template <>
const SHAPE* shapeFunctor( SHAPE* aItem );
/** /**
* boundingBox template method * boundingBox template method
* *
...@@ -68,7 +61,6 @@ BOX2I boundingBox( T aObject ) ...@@ -68,7 +61,6 @@ BOX2I boundingBox( T aObject )
return shapeFunctor( aObject )->BBox(); return shapeFunctor( aObject )->BBox();
} }
/** /**
* acceptVisitor template method * acceptVisitor template method
* *
...@@ -84,7 +76,6 @@ void acceptVisitor( T aObject, V aVisitor ) ...@@ -84,7 +76,6 @@ void acceptVisitor( T aObject, V aVisitor )
aVisitor( aObject ); aVisitor( aObject );
} }
/** /**
* collide template method * collide template method
* *
......
...@@ -446,9 +446,9 @@ void DIALOG_CREATE_ARRAY::ARRAY_GRID_OPTIONS::TransformItem( int n, BOARD_ITEM* ...@@ -446,9 +446,9 @@ void DIALOG_CREATE_ARRAY::ARRAY_GRID_OPTIONS::TransformItem( int n, BOARD_ITEM*
point.x = coords.x * m_delta.x + coords.y * m_offset.x; point.x = coords.x * m_delta.x + coords.y * m_offset.x;
point.y = coords.y * m_delta.y + coords.x * m_offset.y; point.y = coords.y * m_delta.y + coords.x * m_offset.y;
if( abs( m_stagger ) > 1 ) if( std::abs( m_stagger ) > 1 )
{ {
const int stagger = abs( m_stagger ); const int stagger = std::abs( m_stagger );
const bool sr = m_stagger_rows; const bool sr = m_stagger_rows;
const int stagger_idx = ( ( sr ? coords.y : coords.x ) % stagger ); const int stagger_idx = ( ( sr ? coords.y : coords.x ) % stagger );
......
...@@ -140,7 +140,7 @@ void LENGTH_TUNER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent ) ...@@ -140,7 +140,7 @@ void LENGTH_TUNER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
if( settingsDlg.ShowModal() ) if( settingsDlg.ShowModal() )
{ {
placer->UpdateSettings ( settings ); placer->UpdateSettings( settings );
} }
m_savedMeanderSettings = placer->MeanderSettings(); m_savedMeanderSettings = placer->MeanderSettings();
...@@ -149,12 +149,12 @@ void LENGTH_TUNER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent ) ...@@ -149,12 +149,12 @@ void LENGTH_TUNER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
void LENGTH_TUNER_TOOL::updateStatusPopup( PNS_TUNE_STATUS_POPUP& aPopup ) void LENGTH_TUNER_TOOL::updateStatusPopup( PNS_TUNE_STATUS_POPUP& aPopup )
{ {
wxPoint p = wxGetMousePosition(); wxPoint p = wxGetMousePosition();
p.x += 20; p.x += 20;
p.y += 20; p.y += 20;
aPopup.Update( m_router ); aPopup.UpdateStatus( m_router );
aPopup.Move( p ); aPopup.Move( p );
} }
...@@ -181,7 +181,7 @@ void LENGTH_TUNER_TOOL::performTuning() ...@@ -181,7 +181,7 @@ void LENGTH_TUNER_TOOL::performTuning()
} }
PNS_MEANDER_PLACER_BASE* placer = static_cast<PNS_MEANDER_PLACER_BASE*>( m_router->Placer() ); PNS_MEANDER_PLACER_BASE* placer = static_cast<PNS_MEANDER_PLACER_BASE*>( m_router->Placer() );
placer->UpdateSettings( m_savedMeanderSettings ); placer->UpdateSettings( m_savedMeanderSettings );
VECTOR2I end( m_startSnapPoint ); VECTOR2I end( m_startSnapPoint );
...@@ -192,7 +192,7 @@ void LENGTH_TUNER_TOOL::performTuning() ...@@ -192,7 +192,7 @@ void LENGTH_TUNER_TOOL::performTuning()
m_router->Move( end, NULL ); m_router->Move( end, NULL );
updateStatusPopup( statusPopup ); updateStatusPopup( statusPopup );
while( OPT_TOOL_EVENT evt = Wait() ) while( OPT_TOOL_EVENT evt = Wait() )
{ {
if( evt->IsCancel() || evt->IsActivate() ) if( evt->IsCancel() || evt->IsActivate() )
...@@ -207,7 +207,6 @@ void LENGTH_TUNER_TOOL::performTuning() ...@@ -207,7 +207,6 @@ void LENGTH_TUNER_TOOL::performTuning()
end = evt->Position(); end = evt->Position();
m_router->Move( end, NULL ); m_router->Move( end, NULL );
updateStatusPopup( statusPopup ); updateStatusPopup( statusPopup );
} }
else if( evt->IsClick( BUT_LEFT ) ) else if( evt->IsClick( BUT_LEFT ) )
{ {
......
...@@ -332,7 +332,7 @@ bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTa ...@@ -332,7 +332,7 @@ bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTa
int bestScore = -1000; int bestScore = -1000;
DP_CANDIDATE best; DP_CANDIDATE best;
bool found; bool found = false;
BOOST_FOREACH( DP_CANDIDATE c, candidates ) BOOST_FOREACH( DP_CANDIDATE c, candidates )
{ {
......
...@@ -362,9 +362,6 @@ private: ...@@ -362,9 +362,6 @@ private:
///> routing "tail": part of the track that has been already fixed due to collisions with obstacles ///> routing "tail": part of the track that has been already fixed due to collisions with obstacles
PNS_LINE m_tail; PNS_LINE m_tail;
///> current algorithm iteration
int m_iteration;
///> pointer to world to search colliding items ///> pointer to world to search colliding items
PNS_NODE* m_world; PNS_NODE* m_world;
...@@ -385,20 +382,9 @@ private: ...@@ -385,20 +382,9 @@ private:
///> Are we placing a via? ///> Are we placing a via?
bool m_placingVia; bool m_placingVia;
///> current via diameter
int m_viaDiameter;
///> current via drill
int m_viaDrill;
///> current track width
int m_currentWidth;
int m_currentNet; int m_currentNet;
int m_currentLayer; int m_currentLayer;
bool m_startsOnVia;
VECTOR2I m_currentEnd, m_currentStart; VECTOR2I m_currentEnd, m_currentStart;
PNS_LINE m_currentTrace; PNS_LINE m_currentTrace;
......
...@@ -72,7 +72,7 @@ PNS_PCBNEW_CLEARANCE_FUNC::PNS_PCBNEW_CLEARANCE_FUNC( PNS_ROUTER *aRouter ) : ...@@ -72,7 +72,7 @@ PNS_PCBNEW_CLEARANCE_FUNC::PNS_PCBNEW_CLEARANCE_FUNC( PNS_ROUTER *aRouter ) :
PNS_TOPOLOGY topo( world ); PNS_TOPOLOGY topo( world );
m_clearanceCache.resize( brd->GetNetCount() ); m_clearanceCache.resize( brd->GetNetCount() );
for( unsigned int i = 0; i < brd->GetNetCount(); i++ ) for( unsigned int i = 0; i < brd->GetNetCount(); i++ )
{ {
NETINFO_ITEM* ni = brd->FindNet( i ); NETINFO_ITEM* ni = brd->FindNet( i );
...@@ -84,11 +84,11 @@ PNS_PCBNEW_CLEARANCE_FUNC::PNS_PCBNEW_CLEARANCE_FUNC( PNS_ROUTER *aRouter ) : ...@@ -84,11 +84,11 @@ PNS_PCBNEW_CLEARANCE_FUNC::PNS_PCBNEW_CLEARANCE_FUNC( PNS_ROUTER *aRouter ) :
wxString netClassName = ni->GetClassName(); wxString netClassName = ni->GetClassName();
NETCLASSPTR nc = brd->GetDesignSettings().m_NetClasses.Find( netClassName ); NETCLASSPTR nc = brd->GetDesignSettings().m_NetClasses.Find( netClassName );
int clearance = nc->GetClearance(); int clearance = nc->GetClearance();
ent.clearance = clearance; ent.clearance = clearance;
m_clearanceCache[i] = ent; m_clearanceCache[i] = ent;
TRACE( 1, "Add net %d netclass %s clearance %d", i % netClassName.mb_str() % TRACE( 1, "Add net %d netclass %s clearance %d", i % netClassName.mb_str() %
clearance ); clearance );
} }
...@@ -333,7 +333,6 @@ void PNS_ROUTER::SyncWorld() ...@@ -333,7 +333,6 @@ void PNS_ROUTER::SyncWorld()
m_world->SetClearanceFunctor( m_clearanceFunc ); m_world->SetClearanceFunctor( m_clearanceFunc );
m_world->SetMaxClearance( 4 * worstClearance ); m_world->SetMaxClearance( 4 * worstClearance );
} }
PNS_ROUTER::PNS_ROUTER() PNS_ROUTER::PNS_ROUTER()
...@@ -947,7 +946,7 @@ void PNS_ROUTER::DumpLog() ...@@ -947,7 +946,7 @@ void PNS_ROUTER::DumpLog()
bool PNS_ROUTER::IsPlacingVia() const bool PNS_ROUTER::IsPlacingVia() const
{ {
if( !m_placer ) if( !m_placer )
return NULL; return false;
return m_placer->IsPlacingVia(); return m_placer->IsPlacingVia();
} }
......
...@@ -161,7 +161,6 @@ private: ...@@ -161,7 +161,6 @@ private:
int m_iter; int m_iter;
int m_forceClearance; int m_forceClearance;
bool m_multiLineMode; bool m_multiLineMode;
bool m_headModified;
}; };
#endif // __PNS_SHOVE_H #endif // __PNS_SHOVE_H
...@@ -36,7 +36,7 @@ PNS_TUNE_STATUS_POPUP::~PNS_TUNE_STATUS_POPUP() ...@@ -36,7 +36,7 @@ PNS_TUNE_STATUS_POPUP::~PNS_TUNE_STATUS_POPUP()
} }
void PNS_TUNE_STATUS_POPUP::Update( PNS_ROUTER* aRouter ) void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS_ROUTER* aRouter )
{ {
PNS_MEANDER_PLACER_BASE* placer = dynamic_cast<PNS_MEANDER_PLACER_BASE*>( aRouter->Placer() ); PNS_MEANDER_PLACER_BASE* placer = dynamic_cast<PNS_MEANDER_PLACER_BASE*>( aRouter->Placer() );
......
...@@ -35,7 +35,7 @@ public: ...@@ -35,7 +35,7 @@ public:
PNS_TUNE_STATUS_POPUP( PCB_EDIT_FRAME* aParent ); PNS_TUNE_STATUS_POPUP( PCB_EDIT_FRAME* aParent );
~PNS_TUNE_STATUS_POPUP(); ~PNS_TUNE_STATUS_POPUP();
void Update( PNS_ROUTER* aRouter ); void UpdateStatus( PNS_ROUTER* aRouter );
private: private:
wxStaticText* m_statusLine; wxStaticText* m_statusLine;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment