fix a few compil warnings and a Coverity warning.

This commit is contained in:
jean-pierre charras 2020-08-10 17:49:30 +02:00
parent 0a1d8c1aaa
commit 23a5b0ca5f
3 changed files with 18 additions and 21 deletions

View File

@ -72,6 +72,8 @@ TRANSLINE::TRANSLINE()
m_parameters[MURC_PRM] = 1.0;
m_Name = nullptr;
ang_l = 0.0; // Electrical length in angle
len = 0.0; // length of line
er_eff = 1.0; // effective dielectric constant
Init();
}

View File

@ -674,8 +674,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
int errorcount = 0;
unsigned int backstartrefdes;
size_t firstnum, changearraysize;
size_t firstnum = 0;
m_FrontModules.clear();
m_BackModules.clear();
@ -798,7 +797,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
LogChangePlan();
changearraysize = m_ChangeArray.size();
size_t changearraysize = m_ChangeArray.size();
for( size_t i = 0; i < changearraysize; i++ ) //Scan through for duplicates if update or skip
{

View File

@ -607,16 +607,13 @@ void POINT_EDITOR::updateItem() const
}
else
{
double tan = mid.y / static_cast<double>( mid.x );
double tmp = mid.x;
// Circle : x^2 + y^2 = R ^ 2
// In this coordinate system, the angular position of the cursor is (r, theta)
// The line coming from the center of the circle is y = start.y / start.x * x
// The intersection fulfills : x^2 = R^2 / ( 1 + ( start.y / start.x ) ^ 2 )
tmp = sqrt( sqRadius
/ ( ( 1.0
+ mid.y / static_cast<double>( mid.x ) * mid.y
/ static_cast<double>( mid.x ) ) ) );
double tmp = sqrt( sqRadius /
( ( 1.0 + mid.y / static_cast<double>( mid.x ) * mid.y
/ static_cast<double>( mid.x ) ) ) );
// Move to the correct quadrant
tmp = mid.x > 0 ? tmp : -tmp;
mid.y = mid.y / static_cast<double>( mid.x ) * tmp;
@ -691,31 +688,30 @@ void POINT_EDITOR::updateItem() const
double R = v1.EuclideanNorm();
bool transformCircle = false;
bool invertY = ( v2.y < 0 );
/* p2
* X***
* X***
* ** <---- This is the arc
* y ^ **
* | R *
* | <-----------> *
* x------x------>--------x p1
* | <-----------> *
* x------x------>--------x p1
* C' <----> C x
* delta
*
* p1 does not move, and the tangent at p1 remains the same.
*
* p1 does not move, and the tangent at p1 remains the same.
* => The new center, C', will be on the C-p1 axis.
* p2 moves
*
*
* The radius of the new circle is delta + R
*
* || C' p2 || = || C' P1 ||
*
* || C' p2 || = || C' P1 ||
* is the same as :
* ( delta + p2.x ) ^ 2 + p2.y ^ 2 = ( R + delta ) ^ 2
*
*
* delta = ( R^2 - p2.x ^ 2 - p2.y ^2 ) / ( 2 * p2.x - 2 * R )
*
* We can use this equation for any point p2 with p2.x < R
*
* We can use this equation for any point p2 with p2.x < R
*/
if( v2.x == R )