Commit e6a10faa authored by Maciej Suminski's avatar Maciej Suminski

FIxed a few clang warnings.

parent 5d8f7ba0
......@@ -242,7 +242,6 @@ set( COMMON_SRCS
geometry/seg.cpp
geometry/shape_line_chain.cpp
geometry/shape_collisions.cpp
geometry/shape_index.cpp
)
add_library( common STATIC ${COMMON_SRCS} )
add_dependencies( common lib-dependencies )
......
......@@ -157,10 +157,10 @@ void GAL::DrawGrid()
assert( gridEndY >= gridStartY );
// Correct the index, else some lines are not correctly painted
gridStartX -= abs( gridOrigin.x / gridSize.x ) + 1;
gridStartY -= abs( gridOrigin.y / gridSize.y ) + 1;
gridEndX += abs( gridOrigin.x / gridSize.x ) + 1;
gridEndY += abs( gridOrigin.y / gridSize.y ) + 1;
gridStartX -= std::abs( gridOrigin.x / gridSize.x ) + 1;
gridStartY -= std::abs( gridOrigin.y / gridSize.y ) + 1;
gridEndX += std::abs( gridOrigin.x / gridSize.x ) + 1;
gridEndY += std::abs( gridOrigin.y / gridSize.y ) + 1;
// Draw the grid behind all other layers
SetLayerDepth( depthRange.y * 0.75 );
......
......@@ -137,12 +137,9 @@ static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_LINE_CHAIN& aB,
bool aNeedMTV, VECTOR2I& aMTV )
{
bool found = false;
VECTOR2I::extended_type clSq = (VECTOR2I::extended_type) aClearance * aClearance;
for( int s = 0; s < aB.SegmentCount(); s++ )
{
if( aA.Collide( aB.CSegment( s ), aClearance ) )
{
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 )
( (double) aEvent.GetWheelRotation() * wheelPanSpeed );
double scrollSpeed;
if( abs( scrollVec.x ) > abs( scrollVec.y ) )
if( std::abs( scrollVec.x ) > std::abs( scrollVec.y ) )
scrollSpeed = scrollVec.x;
else
scrollSpeed = scrollVec.y;
......
......@@ -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 );
return aDetermineSide ? dist : abs( dist );
return aDetermineSide ? dist : std::abs( dist );
}
inline SEG::ecoord SEG::TCoef( const VECTOR2I& aP ) const
......
......@@ -46,13 +46,6 @@ static const SHAPE* shapeFunctor( T aItem )
return aItem->Shape();
}
/**
* shapeFunctor template function: specialization for T = SHAPE*
*/
template <>
const SHAPE* shapeFunctor( SHAPE* aItem );
/**
* boundingBox template method
*
......@@ -68,7 +61,6 @@ BOX2I boundingBox( T aObject )
return shapeFunctor( aObject )->BBox();
}
/**
* acceptVisitor template method
*
......@@ -84,7 +76,6 @@ void acceptVisitor( T aObject, V aVisitor )
aVisitor( aObject );
}
/**
* collide template method
*
......
......@@ -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.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 int stagger_idx = ( ( sr ? coords.y : coords.x ) % stagger );
......
......@@ -140,7 +140,7 @@ void LENGTH_TUNER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
if( settingsDlg.ShowModal() )
{
placer->UpdateSettings ( settings );
placer->UpdateSettings( settings );
}
m_savedMeanderSettings = placer->MeanderSettings();
......@@ -149,12 +149,12 @@ void LENGTH_TUNER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
void LENGTH_TUNER_TOOL::updateStatusPopup( PNS_TUNE_STATUS_POPUP& aPopup )
{
wxPoint p = wxGetMousePosition();
wxPoint p = wxGetMousePosition();
p.x += 20;
p.y += 20;
aPopup.Update( m_router );
aPopup.UpdateStatus( m_router );
aPopup.Move( p );
}
......@@ -181,7 +181,7 @@ void LENGTH_TUNER_TOOL::performTuning()
}
PNS_MEANDER_PLACER_BASE* placer = static_cast<PNS_MEANDER_PLACER_BASE*>( m_router->Placer() );
placer->UpdateSettings( m_savedMeanderSettings );
VECTOR2I end( m_startSnapPoint );
......@@ -192,7 +192,7 @@ void LENGTH_TUNER_TOOL::performTuning()
m_router->Move( end, NULL );
updateStatusPopup( statusPopup );
while( OPT_TOOL_EVENT evt = Wait() )
{
if( evt->IsCancel() || evt->IsActivate() )
......@@ -207,7 +207,6 @@ void LENGTH_TUNER_TOOL::performTuning()
end = evt->Position();
m_router->Move( end, NULL );
updateStatusPopup( statusPopup );
}
else if( evt->IsClick( BUT_LEFT ) )
{
......
......@@ -332,7 +332,7 @@ bool PNS_DP_GATEWAYS::FitGateways( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTa
int bestScore = -1000;
DP_CANDIDATE best;
bool found;
bool found = false;
BOOST_FOREACH( DP_CANDIDATE c, candidates )
{
......
......@@ -362,9 +362,6 @@ private:
///> routing "tail": part of the track that has been already fixed due to collisions with obstacles
PNS_LINE m_tail;
///> current algorithm iteration
int m_iteration;
///> pointer to world to search colliding items
PNS_NODE* m_world;
......@@ -385,20 +382,9 @@ private:
///> Are we placing a via?
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_currentLayer;
bool m_startsOnVia;
VECTOR2I m_currentEnd, m_currentStart;
PNS_LINE m_currentTrace;
......
......@@ -72,7 +72,7 @@ PNS_PCBNEW_CLEARANCE_FUNC::PNS_PCBNEW_CLEARANCE_FUNC( PNS_ROUTER *aRouter ) :
PNS_TOPOLOGY topo( world );
m_clearanceCache.resize( brd->GetNetCount() );
for( unsigned int i = 0; i < brd->GetNetCount(); i++ )
{
NETINFO_ITEM* ni = brd->FindNet( i );
......@@ -84,11 +84,11 @@ PNS_PCBNEW_CLEARANCE_FUNC::PNS_PCBNEW_CLEARANCE_FUNC( PNS_ROUTER *aRouter ) :
wxString netClassName = ni->GetClassName();
NETCLASSPTR nc = brd->GetDesignSettings().m_NetClasses.Find( netClassName );
int clearance = nc->GetClearance();
ent.clearance = clearance;
m_clearanceCache[i] = ent;
TRACE( 1, "Add net %d netclass %s clearance %d", i % netClassName.mb_str() %
clearance );
}
......@@ -333,7 +333,6 @@ void PNS_ROUTER::SyncWorld()
m_world->SetClearanceFunctor( m_clearanceFunc );
m_world->SetMaxClearance( 4 * worstClearance );
}
PNS_ROUTER::PNS_ROUTER()
......@@ -947,7 +946,7 @@ void PNS_ROUTER::DumpLog()
bool PNS_ROUTER::IsPlacingVia() const
{
if( !m_placer )
return NULL;
return false;
return m_placer->IsPlacingVia();
}
......
......@@ -161,7 +161,6 @@ private:
int m_iter;
int m_forceClearance;
bool m_multiLineMode;
bool m_headModified;
};
#endif // __PNS_SHOVE_H
......@@ -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() );
......
......@@ -35,7 +35,7 @@ public:
PNS_TUNE_STATUS_POPUP( PCB_EDIT_FRAME* aParent );
~PNS_TUNE_STATUS_POPUP();
void Update( PNS_ROUTER* aRouter );
void UpdateStatus( PNS_ROUTER* aRouter );
private:
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