Fix bugs detected by Cppcheck.

This commit is contained in:
jean-pierre charras 2015-01-19 20:03:50 +01:00
parent 79e2a41469
commit d4e04dcc97
4 changed files with 5 additions and 3 deletions

View File

@ -812,11 +812,12 @@ void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd
VECTOR2D startEndVector = aEndPoint - aStartPoint;
double lineLength = startEndVector.EuclideanNorm();
double scale = 0.5 * lineWidth / lineLength;
if( lineLength <= 0.0 )
return;
double scale = 0.5 * lineWidth / lineLength;
// The perpendicular vector also needs transformations
glm::vec4 vector = currentManager->GetTransformation() *
glm::vec4( -startEndVector.y * scale, startEndVector.x * scale, 0.0, 0.0 );

View File

@ -218,7 +218,7 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event )
bool equ_is_unique = true;
unsigned next = idx+1;
unsigned previous = idx-1;
int previous = idx-1;
if( next < equiv_List.size() &&
equivItem.m_ComponentValue == equiv_List[next].m_ComponentValue )

View File

@ -74,7 +74,7 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source )
m_Bold = source->m_Bold;
m_HJustify = source->m_HJustify;
m_VJustify = source->m_VJustify;
m_MultilineAllowed = m_MultilineAllowed;
m_MultilineAllowed = source->m_MultilineAllowed;
m_Text = source->m_Text;
}

View File

@ -45,6 +45,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
wxPoint pos;
strncpy( line, cmdline, sizeof(line) - 1 );
line[sizeof(line) - 1] = 0;
idcmd = strtok( line, " \n\r" );
text = strtok( NULL, " \n\r" );