altium: Correctly parse advanced pad shapes. Don't rely on magic number to much

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4385
This commit is contained in:
Thomas Pointhuber 2020-05-10 13:41:11 +02:00 committed by Jon Evans
parent bc24d8e957
commit ba409c95b9
1 changed files with 7 additions and 2 deletions

View File

@ -728,8 +728,8 @@ APAD6::APAD6( ALTIUM_PARSER& aReader )
// Subrecord 6
size_t subrecord6 = aReader.ReadAndSetSubrecordLength();
if( subrecord6 == 651
|| subrecord6 == 628 ) // TODO: better detection mechanism (Altium 14 = 628)
// Known lengths: 596, 628, 651
if( subrecord6 >= 596 )
{ // TODO: detect type from something else than the size?
sizeAndShape = std::make_unique<APAD6_SIZE_AND_SHAPE>();
@ -762,6 +762,11 @@ APAD6::APAD6( ALTIUM_PARSER& aReader )
for( uint8_t& radius : sizeAndShape->cornerradius )
radius = aReader.Read<uint8_t>();
}
else if( subrecord6 != 0 )
{
wxLogError( wxString::Format(
"Pads6 stream has unexpected length for subrecord 6: %d", subrecord6 ) );
}
aReader.SkipSubrecord();