append before modify

This commit is contained in:
dickelbeck 2008-11-14 18:26:56 +00:00
parent 2d76ea591c
commit 39ba89451e
1 changed files with 10 additions and 9 deletions

View File

@ -536,7 +536,7 @@ bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file )
bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file ) bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file )
/*******************************************************************/ /*******************************************************************/
{ {
APERTURE_MACRO am; APERTURE_MACRO am;
// read macro name // read macro name
while( *text ) while( *text )
@ -555,7 +555,9 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerbe
for(;;) for(;;)
{ {
AM_PRIMITIVE prim; am.primitives.push_back( AM_PRIMITIVE() );
AM_PRIMITIVE& prim = am.primitives.back();
if( *text == '*' ) if( *text == '*' )
++text; ++text;
@ -613,7 +615,9 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerbe
for( int i=0; i<paramCount && *text && *text!='*'; ++i ) for( int i=0; i<paramCount && *text && *text!='*'; ++i )
{ {
DCODE_PARAM param; // construct it on each loop iteration prim.params.push_back( DCODE_PARAM() );
DCODE_PARAM& param = prim.params.back();
if( *text == '$' ) if( *text == '$' )
{ {
@ -622,8 +626,6 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerbe
} }
else else
param.SetValue( ReadDouble( text ) ); param.SetValue( ReadDouble( text ) );
prim.params.push_back( param );
} }
// there are more parameters to read if this is an AMP_OUTLINE // there are more parameters to read if this is an AMP_OUTLINE
@ -637,7 +639,9 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerbe
for( int i=0; i<paramCount && *text && *text!='*'; ++i ) for( int i=0; i<paramCount && *text && *text!='*'; ++i )
{ {
DCODE_PARAM param; // construct it on each loop prim.params.push_back( DCODE_PARAM() );
DCODE_PARAM& param = prim.params.back();
if( *text == '$' ) if( *text == '$' )
{ {
@ -647,11 +651,8 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ], char*& text, FILE* gerbe
else else
param.SetValue( ReadDouble( text ) ); param.SetValue( ReadDouble( text ) );
prim.params.push_back( param );
} }
} }
am.primitives.push_back( prim );
} }
m_aperture_macros.insert( am ); m_aperture_macros.insert( am );