Eeschema: sch_legacy_plugin.cpp: fix incorrect parsing of pin position.

The issue is in:
wxPoint( parseInt( aReader, line, &line ), parseInt( aReader, line, &line ) )
that calls parseInt() twice, but parseInt changes parameters at each call.
(Does not return the same value at each call).
However, due to some side effect or compil optimization, the value returned is incorrect.
It can be dependent of the compiler, and optimization level.

This kind of code must be avoided.
This commit is contained in:
jean-pierre charras 2018-08-08 10:15:44 +02:00
parent a9fa66bb41
commit 21195a751d
1 changed files with 5 additions and 1 deletions

View File

@ -3192,7 +3192,11 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr< LIB_PART >& aPart,
parseUnquotedString( pin->m_name, aReader, line, &line );
parseUnquotedString( pin->m_number, aReader, line, &line );
pin->m_position = wxPoint( parseInt( aReader, line, &line ), parseInt( aReader, line, &line ) );
wxPoint pos;
pos.x = parseInt( aReader, line, &line );
pos.y = parseInt( aReader, line, &line );
pin->m_position = pos;
pin->m_length = parseInt( aReader, line, &line );
pin->m_orientation = parseChar( aReader, line, &line );
pin->m_numTextSize = parseInt( aReader, line, &line );