Commit c4c58e12 authored by Dick Hollenbeck's avatar Dick Hollenbeck

copyright and formatting

parent 8bafc54c
...@@ -623,7 +623,7 @@ bool LIB_COMPONENT::Save( OUTPUTFORMATTER& aFormatter ) ...@@ -623,7 +623,7 @@ bool LIB_COMPONENT::Save( OUTPUTFORMATTER& aFormatter )
LIB_FIELDS fields; LIB_FIELDS fields;
GetFields( fields ); GetFields( fields );
// Fixed fields: // Mandatory fields:
// may have their own save policy so there is a separate loop for them. // may have their own save policy so there is a separate loop for them.
// Empty fields are saved, because the user may have set visibility, // Empty fields are saved, because the user may have set visibility,
// size and orientation // size and orientation
......
...@@ -686,7 +686,7 @@ lost!\n\nClear the current component from the screen?" ) ) ) ...@@ -686,7 +686,7 @@ lost!\n\nClear the current component from the screen?" ) ) )
void LIB_EDIT_FRAME::SaveOnePartInMemory() void LIB_EDIT_FRAME::SaveOnePartInMemory()
{ {
LIB_COMPONENT* oldComponent; LIB_COMPONENT* oldComponent;
LIB_COMPONENT* Component; LIB_COMPONENT* component;
wxString msg; wxString msg;
if( m_component == NULL ) if( m_component == NULL )
...@@ -720,15 +720,15 @@ void LIB_EDIT_FRAME::SaveOnePartInMemory() ...@@ -720,15 +720,15 @@ void LIB_EDIT_FRAME::SaveOnePartInMemory()
m_drawItem = m_lastDrawItem = NULL; m_drawItem = m_lastDrawItem = NULL;
if( oldComponent != NULL ) if( oldComponent != NULL )
Component = m_library->ReplaceComponent( oldComponent, m_component ); component = m_library->ReplaceComponent( oldComponent, m_component );
else else
Component = m_library->AddComponent( m_component ); component = m_library->AddComponent( m_component );
if( Component == NULL ) if( component == NULL )
return; return;
msg.Printf( _( "Component %s saved in library %s" ), msg.Printf( _( "Component %s saved in library %s" ),
GetChars( Component->GetName() ), GetChars( component->GetName() ),
GetChars( m_library->GetName() ) ); GetChars( m_library->GetName() ) );
SetStatusText( msg ); SetStatusText( msg );
} }
...@@ -62,7 +62,7 @@ static LIB_COMPONENT* DummyCmp; ...@@ -62,7 +62,7 @@ static LIB_COMPONENT* DummyCmp;
* convert a wxString to UTF8 and replace any control characters with a ~, * convert a wxString to UTF8 and replace any control characters with a ~,
* where a control character is one of the first ASCII values up to ' ' 32d. * where a control character is one of the first ASCII values up to ' ' 32d.
*/ */
std::string toUTFTildaText( const wxString& txt ) static std::string toUTFTildaText( const wxString& txt )
{ {
std::string ret = TO_UTF8( txt ); std::string ret = TO_UTF8( txt );
...@@ -957,8 +957,8 @@ bool SCH_COMPONENT::Save( FILE* f ) const ...@@ -957,8 +957,8 @@ bool SCH_COMPONENT::Save( FILE* f ) const
static wxString delimiters( wxT( " " ) ); static wxString delimiters( wxT( " " ) );
//this is redundant with the AR entries below, but it makes the // this is redundant with the AR entries below, but it makes the
//files backwards-compatible. // files backwards-compatible.
if( m_PathsAndReferences.GetCount() > 0 ) if( m_PathsAndReferences.GetCount() > 0 )
{ {
reference_fields = wxStringTokenize( m_PathsAndReferences[0], delimiters ); reference_fields = wxStringTokenize( m_PathsAndReferences[0], delimiters );
...@@ -1031,9 +1031,8 @@ bool SCH_COMPONENT::Save( FILE* f ) const ...@@ -1031,9 +1031,8 @@ bool SCH_COMPONENT::Save( FILE* f ) const
} }
// Fixed fields: // Fixed fields:
// Save fixed fields even they are non blank, // Save mandatory fields even if they are blank,
// because the visibility, size and orientation are set from libaries // because the visibility, size and orientation are set from libary editor.
// mainly for footprint names, for those who do not use CvPcb
for( unsigned i = 0; i<MANDATORY_FIELDS; ++i ) for( unsigned i = 0; i<MANDATORY_FIELDS; ++i )
{ {
SCH_FIELD* fld = GetField( i ); SCH_FIELD* fld = GetField( i );
...@@ -1085,10 +1084,8 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -1085,10 +1084,8 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
newfmt = 1; newfmt = 1;
if( !aLine.ReadLine() ) if( !(line = aLine.ReadLine()) )
return true; return true;
line = aLine.Line();
} }
if( sscanf( &line[1], "%s %s", name1, name2 ) != 2 ) if( sscanf( &line[1], "%s %s", name1, name2 ) != 2 )
...@@ -1178,11 +1175,9 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -1178,11 +1175,9 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
*/ */
for( ; ; ) for( ; ; )
{ {
if( !aLine.ReadLine() ) if( !(line = aLine.ReadLine()) )
return false; return false;
line = aLine.Line();
if( line[0] == 'U' ) if( line[0] == 'U' )
{ {
sscanf( line + 1, "%d %d %lX", &m_unit, &m_convert, &m_TimeStamp ); sscanf( line + 1, "%d %d %lX", &m_unit, &m_convert, &m_TimeStamp );
...@@ -1354,8 +1349,8 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -1354,8 +1349,8 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
return false; return false;
} }
if( !aLine.ReadLine() || if( !(line = aLine.ReadLine()) ||
sscanf( ((char*)aLine), "%d %d %d %d", sscanf( line, "%d %d %d %d",
&m_transform.x1, &m_transform.x1,
&m_transform.y1, &m_transform.y1,
&m_transform.x2, &m_transform.x2,
...@@ -1368,11 +1363,9 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -1368,11 +1363,9 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
if( newfmt ) if( newfmt )
{ {
if( !aLine.ReadLine() ) if( !(line = aLine.ReadLine()) )
return false; return false;
line = aLine.Line();
if( strnicmp( "$End", line, 4 ) != 0 ) if( strnicmp( "$End", line, 4 ) != 0 )
{ {
aErrorMsg.Printf( wxT( "Component End expected at line %d, aborted" ), aErrorMsg.Printf( wxT( "Component End expected at line %d, aborted" ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment