Fix conversion warnings
This commit is contained in:
parent
12ecccd0f3
commit
a28a0e14ba
|
@ -1428,8 +1428,8 @@ void C3D_RENDER_OGL_LEGACY::generate_new_3DGrid( GRID3D_TYPE aGridType )
|
|||
|
||||
// Color of grid lines every 5 lines
|
||||
const SFVEC3F gridColor_marker = m_boardAdapter.GetColor( LIGHTGRAY );
|
||||
const double scale = m_boardAdapter.BiuTo3Dunits();
|
||||
const double transparency = 0.35;
|
||||
const double scale = m_boardAdapter.BiuTo3Dunits();
|
||||
const GLfloat transparency = 0.35f;
|
||||
|
||||
double griSizeMM = 0.0;
|
||||
|
||||
|
|
|
@ -35,10 +35,10 @@
|
|||
inline void normalise2PI( float& aAngle )
|
||||
{
|
||||
while( aAngle > 0.0 )
|
||||
aAngle -= M_PI*2;
|
||||
aAngle -= static_cast<float>( M_PI * 2.0f );
|
||||
|
||||
while( aAngle < 0.0 )
|
||||
aAngle += M_PI*2;
|
||||
aAngle += static_cast<float>( M_PI * 2.0f );
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,14 +112,13 @@ void CCAMERA::Reset_T1()
|
|||
// one to where we currently are. That ensures that we rotate
|
||||
// the board around the smallest distance getting there.
|
||||
if( m_rotate_aux_t0.x > M_PI )
|
||||
m_rotate_aux_t1.x = 2*M_PI;
|
||||
m_rotate_aux_t1.x = static_cast<float>( 2.0f * M_PI );
|
||||
|
||||
if( m_rotate_aux_t0.y > M_PI )
|
||||
m_rotate_aux_t1.y = 2*M_PI;
|
||||
m_rotate_aux_t1.y = static_cast<float>( 2.0f * M_PI );
|
||||
|
||||
if( m_rotate_aux_t0.z > M_PI )
|
||||
m_rotate_aux_t1.z = 2*M_PI;
|
||||
|
||||
m_rotate_aux_t1.z = static_cast<float>( 2.0f * M_PI );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -546,10 +546,10 @@ bool EDA_RECT::IntersectsCircle( const wxPoint& aCenter, const int aRadius ) con
|
|||
|
||||
wxPoint closest = ClosestPointTo( aCenter );
|
||||
|
||||
double dx = aCenter.x - closest.x;
|
||||
double dy = aCenter.y - closest.y;
|
||||
double dx = static_cast<double>( aCenter.x ) - closest.x;
|
||||
double dy = static_cast<double>( aCenter.y ) - closest.y;
|
||||
|
||||
double r = (double) aRadius;
|
||||
double r = static_cast<double>( aRadius );
|
||||
|
||||
return ( dx * dx + dy * dy ) <= ( r * r );
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ ORIGIN_TRANSFORMS::~ORIGIN_TRANSFORMS()
|
|||
int ORIGIN_TRANSFORMS::ToDisplay( int aValue,
|
||||
COORD_TYPES_T aCoordType )
|
||||
{
|
||||
return ToDisplay( static_cast<long long int>(aValue), aCoordType );
|
||||
return static_cast<int>( ToDisplay( static_cast<long long int>( aValue ), aCoordType ) );
|
||||
}
|
||||
|
||||
long long int ORIGIN_TRANSFORMS::ToDisplay( long long int aValue,
|
||||
|
@ -53,7 +53,7 @@ double ORIGIN_TRANSFORMS::ToDisplay( double aValue,
|
|||
int ORIGIN_TRANSFORMS::FromDisplay( int aValue,
|
||||
COORD_TYPES_T aCoordType )
|
||||
{
|
||||
return FromDisplay( static_cast<long long int>(aValue), aCoordType );
|
||||
return static_cast<int>( FromDisplay( static_cast<long long int>( aValue ), aCoordType ) );
|
||||
}
|
||||
|
||||
long long int ORIGIN_TRANSFORMS::FromDisplay( long long int aValue,
|
||||
|
|
|
@ -204,7 +204,7 @@ private:
|
|||
std::vector<VECTOR2I> m_wireIntersections;
|
||||
|
||||
///> Wires and labels of a single connection (segment in Eagle nomenclature)
|
||||
typedef struct {
|
||||
typedef struct SEG_DESC_STRUCT {
|
||||
///> Tests if a particular label is attached to any of the stored segments
|
||||
const SEG* LabelAttached( const SCH_TEXT* aLabel ) const;
|
||||
|
||||
|
|
|
@ -293,13 +293,13 @@ public:
|
|||
|
||||
GAL_SET& set( GAL_LAYER_ID aPos, bool aVal = true )
|
||||
{
|
||||
GAL_BASE_SET::set( static_cast<int>( aPos ) - start, aVal );
|
||||
GAL_BASE_SET::set( static_cast<std::size_t>( aPos ) - start, aVal );
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool Contains( GAL_LAYER_ID aPos )
|
||||
{
|
||||
return test( static_cast<int>( aPos ) - start );
|
||||
return test( static_cast<std::size_t>( aPos ) - start );
|
||||
}
|
||||
|
||||
std::vector<GAL_LAYER_ID> Seq() const;
|
||||
|
|
|
@ -228,8 +228,8 @@ public:
|
|||
|
||||
void CanonicalCoefs( ecoord& qA, ecoord& qB, ecoord& qC ) const
|
||||
{
|
||||
qA = A.y - B.y;
|
||||
qB = B.x - A.x;
|
||||
qA = ecoord{ A.y } - B.y;
|
||||
qB = ecoord{ B.x } - A.x;
|
||||
qC = -qA * A.x - qB * A.y;
|
||||
}
|
||||
|
||||
|
@ -369,16 +369,16 @@ inline VECTOR2I SEG::LineProject( const VECTOR2I& aP ) const
|
|||
|
||||
ecoord t = d.Dot( aP - A );
|
||||
|
||||
int xp = rescale( t, (ecoord)d.x, l_squared );
|
||||
int yp = rescale( t, (ecoord)d.y, l_squared );
|
||||
int xp = rescale( t, ecoord{ d.x }, l_squared );
|
||||
int yp = rescale( t, ecoord{ d.y }, l_squared );
|
||||
|
||||
return A + VECTOR2I( xp, yp );
|
||||
}
|
||||
|
||||
inline int SEG::LineDistance( const VECTOR2I& aP, bool aDetermineSide ) const
|
||||
{
|
||||
ecoord p = A.y - B.y;
|
||||
ecoord q = B.x - A.x;
|
||||
ecoord p = ecoord{ A.y } - B.y;
|
||||
ecoord q = ecoord{ B.x } - A.x;
|
||||
ecoord r = -p * A.x - q * A.y;
|
||||
|
||||
ecoord dist = ( p * aP.x + q * aP.y + r ) / sqrt( p * p + q * q );
|
||||
|
|
|
@ -132,8 +132,8 @@ private:
|
|||
|
||||
bool ccw( const VECTOR2I& aA, const VECTOR2I& aB, const VECTOR2I& aC ) const
|
||||
{
|
||||
return (ecoord) ( aC.y - aA.y ) * ( aB.x - aA.x ) >
|
||||
(ecoord) ( aB.y - aA.y ) * ( aC.x - aA.x );
|
||||
return ( ecoord{ aC.y } - aA.y ) * ( ecoord{ aB.x } - aA.x ) >
|
||||
( ecoord{ aB.y } - aA.y ) * ( ecoord{ aC.x } - aA.x );
|
||||
}
|
||||
|
||||
void update_bbox();
|
||||
|
|
|
@ -156,10 +156,10 @@ inline double DistanceLinePoint( const wxPoint &linePointA,
|
|||
// the division (EuclideanNorm gives a double so from int it would
|
||||
// be promoted); that means that the whole expression were
|
||||
// vulnerable to overflow during int multiplications
|
||||
return fabs( ( double(linePointB.x - linePointA.x) *
|
||||
double(linePointA.y - referencePoint.y) -
|
||||
double(linePointA.x - referencePoint.x ) *
|
||||
double(linePointB.y - linePointA.y) )
|
||||
return fabs( ( static_cast<double>( linePointB.x - linePointA.x ) *
|
||||
static_cast<double>( linePointA.y - referencePoint.y ) -
|
||||
static_cast<double>( linePointA.x - referencePoint.x ) *
|
||||
static_cast<double>( linePointB.y - linePointA.y) )
|
||||
/ EuclideanNorm( linePointB - linePointA ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ bool SegmentIntersectsSegment( const wxPoint &a_p1_l1, const wxPoint &a_p2_l1,
|
|||
//We are forced to use 64bit ints because the internal units can overflow 32bit ints when
|
||||
// multiplied with each other, the alternative would be to scale the units down (i.e. divide
|
||||
// by a fixed number).
|
||||
long long dX_a, dY_a, dX_b, dY_b, dX_ab, dY_ab;
|
||||
long long num_a, num_b, den;
|
||||
int64_t dX_a, dY_a, dX_b, dY_b, dX_ab, dY_ab;
|
||||
int64_t num_a, num_b, den;
|
||||
|
||||
//Test for intersection within the bounds of both line segments using line equations of the
|
||||
// form:
|
||||
|
@ -75,12 +75,12 @@ bool SegmentIntersectsSegment( const wxPoint &a_p1_l1, const wxPoint &a_p2_l1,
|
|||
// y_k(u_k) = u_k * dY_k + y_k(0)
|
||||
// with 0 <= u_k <= 1 and k = [ a, b ]
|
||||
|
||||
dX_a = a_p2_l1.x - a_p1_l1.x;
|
||||
dY_a = a_p2_l1.y - a_p1_l1.y;
|
||||
dX_b = a_p2_l2.x - a_p1_l2.x;
|
||||
dY_b = a_p2_l2.y - a_p1_l2.y;
|
||||
dX_ab = a_p1_l2.x - a_p1_l1.x;
|
||||
dY_ab = a_p1_l2.y - a_p1_l1.y;
|
||||
dX_a = int64_t{ a_p2_l1.x } - a_p1_l1.x;
|
||||
dY_a = int64_t{ a_p2_l1.y } - a_p1_l1.y;
|
||||
dX_b = int64_t{ a_p2_l2.x } - a_p1_l2.x;
|
||||
dY_b = int64_t{ a_p2_l2.y } - a_p1_l2.y;
|
||||
dX_ab = int64_t{ a_p1_l2.x } - a_p1_l1.x;
|
||||
dY_ab = int64_t{ a_p1_l2.y } - a_p1_l1.y;
|
||||
|
||||
den = dY_a * dX_b - dY_b * dX_a ;
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ bool CRectPlacement::AddAtEmptySpotAutoGrow( TRect* pRect, int maxW, int maxH )
|
|||
{
|
||||
double growing_factor = 1.2; // Must be > 1.0, and event > 1.1 for fast optimization
|
||||
|
||||
#define GROW(x) ((x * growing_factor) + 1)
|
||||
#define GROW(x) static_cast<int>( (x * growing_factor) + 1 )
|
||||
|
||||
if( pRect->w <= 0 )
|
||||
return true;
|
||||
|
|
|
@ -558,8 +558,8 @@ void MODULE::CalculateBoundingBox()
|
|||
|
||||
double MODULE::GetArea( int aPadding ) const
|
||||
{
|
||||
double w = std::abs( m_BoundaryBox.GetWidth() ) + aPadding;
|
||||
double h = std::abs( m_BoundaryBox.GetHeight() ) + aPadding;
|
||||
double w = std::abs( static_cast<double>( m_BoundaryBox.GetWidth() ) ) + aPadding;
|
||||
double h = std::abs( static_cast<double>( m_BoundaryBox.GetHeight() ) ) + aPadding;
|
||||
return w * h;
|
||||
}
|
||||
|
||||
|
|
|
@ -585,10 +585,10 @@ public:
|
|||
RELEASER& operator=( RELEASER& aOther ) { return *this; }
|
||||
|
||||
// private copy constructor so it's illegal
|
||||
RELEASER( const RELEASER& aOther ) {}
|
||||
RELEASER( const RELEASER& aOther ) : plugin( nullptr ) {}
|
||||
|
||||
public:
|
||||
RELEASER( PLUGIN* aPlugin = NULL ) :
|
||||
RELEASER( PLUGIN* aPlugin = nullptr ) :
|
||||
plugin( aPlugin )
|
||||
{
|
||||
}
|
||||
|
@ -602,7 +602,7 @@ public:
|
|||
void release()
|
||||
{
|
||||
IO_MGR::PluginRelease( plugin );
|
||||
plugin = NULL;
|
||||
plugin = nullptr;
|
||||
}
|
||||
|
||||
void set( PLUGIN* aPlugin )
|
||||
|
|
|
@ -130,7 +130,7 @@ void PCB_PARSER::pushValueIntoMap( int aIndex, int aValue )
|
|||
// ensure there is room in m_netCodes for that, and add room if needed.
|
||||
|
||||
if( (int)m_netCodes.size() <= aIndex )
|
||||
m_netCodes.resize( aIndex+1 );
|
||||
m_netCodes.resize( static_cast<std::size_t>( aIndex ) + 1 );
|
||||
|
||||
m_netCodes[aIndex] = aValue;
|
||||
}
|
||||
|
|
|
@ -353,8 +353,10 @@ static bool pointInside2( const SHAPE_LINE_CHAIN& aL, const VECTOR2I& aP )
|
|||
result = 1 - result;
|
||||
else
|
||||
{
|
||||
double d = (double) (ip.x -aP.x) * (ipNext.y -aP.y) -
|
||||
(double) (ipNext.x -aP.x) * (ip.y -aP.y);
|
||||
double d = static_cast<double>( ip.x - aP.x ) *
|
||||
static_cast<double>( ipNext.y - aP.y ) -
|
||||
static_cast<double>( ipNext.x - aP.x ) *
|
||||
static_cast<double>( ip.y - aP.y );
|
||||
|
||||
if( !d )
|
||||
return -1;
|
||||
|
@ -367,8 +369,8 @@ static bool pointInside2( const SHAPE_LINE_CHAIN& aL, const VECTOR2I& aP )
|
|||
{
|
||||
if( ipNext.x >aP.x )
|
||||
{
|
||||
double d = (double) (ip.x -aP.x) * (ipNext.y -aP.y) -
|
||||
(double) (ipNext.x -aP.x) * (ip.y -aP.y);
|
||||
double d = ((double)ip.x -aP.x) * ((double)ipNext.y -aP.y) -
|
||||
((double)ipNext.x -aP.x) * ((double)ip.y -aP.y);
|
||||
|
||||
if( !d )
|
||||
return -1;
|
||||
|
@ -635,7 +637,7 @@ bool OPTIMIZER::mergeStep( LINE* aLine, SHAPE_LINE_CHAIN& aCurrentPath, int step
|
|||
for( int n = 0; n < n_segs - step; n++ )
|
||||
{
|
||||
// Do not attempt to merge false segments that are part of an arc
|
||||
if( aCurrentPath.isArc( n ) || aCurrentPath.isArc( n + step ) )
|
||||
if( aCurrentPath.isArc( n ) || aCurrentPath.isArc( static_cast<std::size_t>( n ) + step ) )
|
||||
continue;
|
||||
|
||||
const SEG s1 = aCurrentPath.CSegment( n );
|
||||
|
@ -1089,7 +1091,7 @@ int findCoupledVertices( const VECTOR2I& aVertex, const SEG& aOrigSeg, const SHA
|
|||
|
||||
if( s.ApproxParallel ( aOrigSeg ) )
|
||||
{
|
||||
int64_t dist = ( projOverCoupled - aVertex ).EuclideanNorm() - aPair->Width();
|
||||
int64_t dist = int64_t{(( projOverCoupled - aVertex ).EuclideanNorm())} - aPair->Width();
|
||||
|
||||
if( aPair->GapConstraint().Matches( dist ) )
|
||||
{
|
||||
|
|
|
@ -231,10 +231,10 @@ struct DATA
|
|||
return defaultColor;
|
||||
|
||||
IFSG_APPEARANCE app( true );
|
||||
app.SetShininess( 0.05 );
|
||||
app.SetSpecular( 0.04, 0.04, 0.04 );
|
||||
app.SetAmbient( 0.1, 0.1, 0.1 );
|
||||
app.SetDiffuse( 0.6,0.6, 0.6 );
|
||||
app.SetShininess( 0.05f );
|
||||
app.SetSpecular( 0.04f, 0.04f, 0.04f );
|
||||
app.SetAmbient( 0.1f, 0.1f, 0.1f );
|
||||
app.SetDiffuse( 0.6f, 0.6f, 0.6f );
|
||||
|
||||
defaultColor = app.GetRawPtr();
|
||||
return defaultColor;
|
||||
|
@ -248,9 +248,9 @@ struct DATA
|
|||
return item->second;
|
||||
|
||||
IFSG_APPEARANCE app( true );
|
||||
app.SetShininess( 0.1 );
|
||||
app.SetSpecular( 0.12, 0.12, 0.12 );
|
||||
app.SetAmbient( 0.1, 0.1, 0.1 );
|
||||
app.SetShininess( 0.1f );
|
||||
app.SetSpecular( 0.12f, 0.12f, 0.12f );
|
||||
app.SetAmbient( 0.1f, 0.1f, 0.1f );
|
||||
app.SetDiffuse( colorObj->Red(), colorObj->Green(), colorObj->Blue() );
|
||||
colors.insert( std::pair< Standard_Real, SGNODE* >( id, app.GetRawPtr() ) );
|
||||
|
||||
|
|
|
@ -40,23 +40,23 @@ static bool VDegenerate( glm::vec3* pts )
|
|||
|
||||
double dx, dy, dz;
|
||||
|
||||
dx = pts[1].x - pts[0].x;
|
||||
dy = pts[1].y - pts[0].y;
|
||||
dz = pts[1].z - pts[0].z;
|
||||
dx = double{ pts[1].x } - pts[0].x;
|
||||
dy = double{ pts[1].y } - pts[0].y;
|
||||
dz = double{ pts[1].z } - pts[0].z;
|
||||
|
||||
if( ( dx*dx + dy*dy + dz*dz ) < LOWER_LIMIT )
|
||||
return true;
|
||||
|
||||
dx = pts[2].x - pts[0].x;
|
||||
dy = pts[2].y - pts[0].y;
|
||||
dz = pts[2].z - pts[0].z;
|
||||
dx = double{ pts[2].x } - pts[0].x;
|
||||
dy = double{ pts[2].y } - pts[0].y;
|
||||
dz = double{ pts[2].z } - pts[0].z;
|
||||
|
||||
if( ( dx*dx + dy*dy + dz*dz ) < LOWER_LIMIT )
|
||||
return true;
|
||||
|
||||
dx = pts[2].x - pts[1].x;
|
||||
dy = pts[2].y - pts[1].y;
|
||||
dz = pts[2].z - pts[1].z;
|
||||
dx = double{ pts[2].x } - pts[1].x;
|
||||
dy = double{ pts[2].y } - pts[1].y;
|
||||
dz = double{ pts[2].z } - pts[1].z;
|
||||
|
||||
if( ( dx*dx + dy*dy + dz*dz ) < LOWER_LIMIT )
|
||||
return true;
|
||||
|
@ -118,28 +118,28 @@ static float VCalcCosAngle( const WRLVEC3F& p1, const WRLVEC3F& p2, const WRLVEC
|
|||
float p13 = dx*dx + dy*dy + dz*dz;
|
||||
l13 = sqrtf( p13 );
|
||||
|
||||
float dn = 2.0 * l12 * l13;
|
||||
float dn = 2.0f * l12 * l13;
|
||||
|
||||
// place a limit to prevent calculations from blowing up
|
||||
if( dn < LOWER_LIMIT )
|
||||
{
|
||||
if( (p12 + p13 - p23) < FLT_EPSILON )
|
||||
return -1.0;
|
||||
return -1.0f;
|
||||
|
||||
if( (p12 + p13 - p23) > FLT_EPSILON )
|
||||
return 1.0;
|
||||
return 1.0f;
|
||||
|
||||
return 0.0;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float cosAngle = (p12 + p13 - p23) / dn;
|
||||
|
||||
// check the domain; errors in the cosAngle calculation
|
||||
// can result in domain errors
|
||||
if( cosAngle > 1.0 )
|
||||
cosAngle = 1.0;
|
||||
else if( cosAngle < -1.0 )
|
||||
cosAngle = -1.0;
|
||||
if( cosAngle > 1.0f )
|
||||
cosAngle = 1.0f;
|
||||
else if( cosAngle < -1.0f )
|
||||
cosAngle = -1.0f;
|
||||
|
||||
// note: we are guaranteed that acosf() is never negative
|
||||
return cosAngle;
|
||||
|
@ -653,7 +653,7 @@ void FACET::CollectVertices( std::vector< std::list< FACET* > >& aFacetList )
|
|||
|
||||
// note: in principle this should never be invoked
|
||||
if( (maxIdx + 1) >= (int)aFacetList.size() )
|
||||
aFacetList.resize( maxIdx + 1 );
|
||||
aFacetList.resize( static_cast<std::size_t>( maxIdx ) + 1 );
|
||||
|
||||
std::vector< int >::iterator sI = indices.begin();
|
||||
std::vector< int >::iterator eI = indices.end();
|
||||
|
@ -729,8 +729,8 @@ SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrd
|
|||
|
||||
while( sF != eF )
|
||||
{
|
||||
tV = (*sF)->CalcFaceNormal();
|
||||
tmi = (*sF)->GetMaxIndex();
|
||||
tV = ( *sF )->CalcFaceNormal();
|
||||
tmi = ( *sF )->GetMaxIndex();
|
||||
|
||||
if( tmi > maxIdx )
|
||||
maxIdx = tmi;
|
||||
|
@ -753,8 +753,8 @@ SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrd
|
|||
|
||||
while( sF != eF )
|
||||
{
|
||||
(*sF)->Renormalize( tV );
|
||||
(*sF)->CollectVertices( flist );
|
||||
( *sF )->Renormalize( tV );
|
||||
( *sF )->CollectVertices( flist );
|
||||
++sF;
|
||||
}
|
||||
|
||||
|
@ -768,7 +768,7 @@ SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrd
|
|||
|
||||
while( sF != eF )
|
||||
{
|
||||
(*sF)->CalcVertexNormal( i, flist[i], aCreaseLimit );
|
||||
( *sF )->CalcVertexNormal( static_cast<int>( i ), flist[i], aCreaseLimit );
|
||||
++sF;
|
||||
}
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrd
|
|||
|
||||
while( sF != eF )
|
||||
{
|
||||
(*sF)->GetData( vertices, normals, colors, aVertexOrder );
|
||||
( *sF )->GetData( vertices, normals, colors, aVertexOrder );
|
||||
++sF;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue