Commit 3c878aec authored by Wayne Stambaugh's avatar Wayne Stambaugh

MSVC compile error and memory leak fixes.

* Fixed multiple line strings causing MSVC compile errors.
* Fixed memory leak when attempting to add duplicate library component.
* Added recent cmake generated files to bazaar ignore list.
* Minor code cleaning.
parent 772a1e0f
eeschema/cmp_library_keywords.cpp common/netlist_keywords.*
eeschema/cmp_library_keywords.h common/netlist_lexer.h
eeschema/template_fieldnames_keywords.cpp include/netlist_lexer.h
eeschema/template_fieldnames_keywords.h eeschema/cmp_library_lexer.h
eeschema/cmp_library_keywords.*
eeschema/template_fieldnames_keywords.*
eeschema/template_fieldnames_lexer.h
pcbnew/dialog_freeroute_exchange_help_html.h pcbnew/dialog_freeroute_exchange_help_html.h
Makefile Makefile
CMakeFiles CMakeFiles
......
...@@ -322,9 +322,8 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName, ...@@ -322,9 +322,8 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
{ {
sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsBySheet ); sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsBySheet );
msg.Printf( _( msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets \
"\n#Global, Hierarchical Labels and PinSheets " ( order = Sheet Number ) count = %d\n" ),
"( order = Sheet Number ) count = %d\n" ),
itemCount ); itemCount );
fprintf( f, "%s", CONV_TO_UTF8( msg ) ); fprintf( f, "%s", CONV_TO_UTF8( msg ) );
...@@ -335,9 +334,8 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName, ...@@ -335,9 +334,8 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
{ {
sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsByValue ); sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsByValue );
msg.Printf( _( msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets ( \
"\n#Global, Hierarchical Labels and PinSheets ( " order = Alphab. ) count = %d\n\n" ),
"order = Alphab. ) count = %d\n\n" ),
itemCount ); itemCount );
fprintf( f, "%s", CONV_TO_UTF8( msg ) ); fprintf( f, "%s", CONV_TO_UTF8( msg ) );
...@@ -449,8 +447,7 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList ) ...@@ -449,8 +447,7 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
* if same value: by reference * if same value: by reference
* if same reference: by unit number * if same reference: by unit number
*/ */
bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1, bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 )
const OBJ_CMP_TO_LIST& obj2 )
{ {
int ii; int ii;
const wxString* Text1, * Text2; const wxString* Text1, * Text2;
...@@ -607,12 +604,12 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem, ...@@ -607,12 +604,12 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
if( CompactForm ) if( CompactForm )
{ {
fprintf( f, "%c%s", s_ExportSeparatorSymbol, fprintf( f, "%c%s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) ); CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
} }
else else
{ {
fprintf( f, "; %-12s", fprintf( f, "; %-12s",
CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) ); CONV_TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
} }
} }
...@@ -623,10 +620,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem, ...@@ -623,10 +620,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
if( CompactForm ) if( CompactForm )
fprintf( f, "%c%s", s_ExportSeparatorSymbol, fprintf( f, "%c%s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) ); CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
else else
fprintf( f, "; %-12s", fprintf( f, "; %-12s",
CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) ); CONV_TO_UTF8( DrawLibItem->GetField( ii )->m_Text ) );
} }
} }
...@@ -666,8 +663,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( ...@@ -666,8 +663,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
msg = _( "Field" ); msg = _( "Field" );
fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8( fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ), ii - FIELD1 + 1 );
msg ), ii - FIELD1 + 1 );
} }
fprintf( f, "\n" ); fprintf( f, "\n" );
...@@ -716,22 +712,21 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( ...@@ -716,22 +712,21 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
if( CompactForm ) if( CompactForm )
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
fprintf( f, "%s%c%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol, fprintf( f, "%s%c%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol,
CONV_TO_UTF8( comp->GetField( CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ), s_ExportSeparatorSymbol,
VALUE )->m_Text ), s_ExportSeparatorSymbol, CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
#else #else
fprintf( f, "%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol, fprintf( f, "%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol,
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) ); CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) );
#endif #endif
else else
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
fprintf( f, "| %-10s %-12s %-20s", CmpName.c_str(), fprintf( f, "| %-10s %-12s %-20s", CmpName.c_str(),
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ), CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ),
CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) ); CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
#else #else
fprintf( f, "| %-10s %-12s", CmpName.c_str(), fprintf( f, "| %-10s %-12s", CmpName.c_str(),
CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) ); CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ) );
#endif #endif
if( aIncludeSubComponents ) if( aIncludeSubComponents )
...@@ -740,23 +735,20 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( ...@@ -740,23 +735,20 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
if( CompactForm ) if( CompactForm )
{ {
fprintf( f, "%c%s", s_ExportSeparatorSymbol, fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) comp->GetParent(),
(BASE_SCREEN*) comp->GetParent(), comp->m_Pos );
comp->m_Pos );
fprintf( f, "%c%s)", s_ExportSeparatorSymbol, fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
CONV_TO_UTF8( msg ) ); CONV_TO_UTF8( msg ) );
} }
else else
{ {
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) ); fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) comp->GetParent(),
(BASE_SCREEN*) comp->GetParent(), comp->m_Pos );
comp->m_Pos );
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) ); fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
} }
...@@ -866,16 +858,16 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( ...@@ -866,16 +858,16 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart(
if( IsFieldChecked(FOOTPRINT ) ) if( IsFieldChecked(FOOTPRINT ) )
fprintf( f, "%c%15s", s_ExportSeparatorSymbol, fprintf( f, "%c%15s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( currCmp->GetField( FOOTPRINT )->m_Text ) ); CONV_TO_UTF8( currCmp->GetField( FOOTPRINT )->m_Text ) );
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
fprintf( f, "%c%20s", s_ExportSeparatorSymbol, fprintf( f, "%c%20s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( currCmp->GetField( DATASHEET )->m_Text ) ); CONV_TO_UTF8( currCmp->GetField( DATASHEET )->m_Text ) );
#endif #endif
// wrap the field in quotes, since it has commas in it. // wrap the field in quotes, since it has commas in it.
fprintf( f, "%c\"%s\"", s_ExportSeparatorSymbol, fprintf( f, "%c\"%s\"", s_ExportSeparatorSymbol,
CONV_TO_UTF8( refNames ) ); CONV_TO_UTF8( refNames ) );
// print fields, on demand // print fields, on demand
int last_nonempty_field_idx = 0; int last_nonempty_field_idx = 0;
...@@ -888,7 +880,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart( ...@@ -888,7 +880,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByPart(
{ {
if ( IsFieldChecked( jj ) ) if ( IsFieldChecked( jj ) )
fprintf( f, "%c%4s", s_ExportSeparatorSymbol, fprintf( f, "%c%4s", s_ExportSeparatorSymbol,
CONV_TO_UTF8( dummyCmp.GetField( jj )->m_Text ) ); CONV_TO_UTF8( dummyCmp.GetField( jj )->m_Text ) );
} }
fprintf( f, "\n" ); fprintf( f, "\n" );
...@@ -959,8 +951,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( ...@@ -959,8 +951,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
{ {
msg = aList[ii].m_SheetPath.PathHumanReadable(); msg = aList[ii].m_SheetPath.PathHumanReadable();
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) ); fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) DrawLibItem->GetParent(),
(BASE_SCREEN*) DrawLibItem->GetParent(), DrawLibItem->m_Pos ); DrawLibItem->m_Pos );
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) ); fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
} }
...@@ -996,13 +988,12 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList ) ...@@ -996,13 +988,12 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
labeltype = wxT( "Global " ); labeltype = wxT( "Global " );
sheetpath = aList[ii].m_SheetPath.PathHumanReadable(); sheetpath = aList[ii].m_SheetPath.PathHumanReadable();
msg.Printf( msg.Printf( _( "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n" ),
_( "> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f\n" ), GetChars( DrawTextItem->m_Text ),
GetChars( DrawTextItem->m_Text ), GetChars( labeltype ),
GetChars( labeltype ), GetChars( sheetpath ),
GetChars( sheetpath ), (float) DrawTextItem->m_Pos.x / 1000,
(float) DrawTextItem->m_Pos.x / 1000, (float) DrawTextItem->m_Pos.y / 1000 );
(float) DrawTextItem->m_Pos.y / 1000 );
fputs( CONV_TO_UTF8( msg ), f ); fputs( CONV_TO_UTF8( msg ), f );
break; break;
...@@ -1020,13 +1011,12 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList ) ...@@ -1020,13 +1011,12 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
wxString labtype = CONV_FROM_UTF8( SheetLabelType[jj] ); wxString labtype = CONV_FROM_UTF8( SheetLabelType[jj] );
msg.Printf( msg.Printf( _( "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ),
_( "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ), GetChars( DrawSheetLabel->m_Text ),
GetChars( DrawSheetLabel->m_Text ), GetChars( labtype ),
GetChars( labtype ), GetChars( aList[ii].m_SheetPath.PathHumanReadable() ),
GetChars( aList[ii].m_SheetPath.PathHumanReadable()), (float) DrawSheetLabel->m_Pos.x / 1000,
(float) DrawSheetLabel->m_Pos.x / 1000, (float) DrawSheetLabel->m_Pos.y / 1000 );
(float) DrawSheetLabel->m_Pos.y / 1000 );
fputs( CONV_TO_UTF8( msg ), f ); fputs( CONV_TO_UTF8( msg ), f );
} }
......
...@@ -398,8 +398,8 @@ void LIB_COMPONENT::RemoveDrawItem( LIB_DRAW_ITEM* aItem, ...@@ -398,8 +398,8 @@ void LIB_COMPONENT::RemoveDrawItem( LIB_DRAW_ITEM* aItem,
if( field->m_FieldId < MANDATORY_FIELDS ) if( field->m_FieldId < MANDATORY_FIELDS )
{ {
wxLogWarning( _( "An attempt was made to remove the %s field " wxLogWarning( _( "An attempt was made to remove the %s field \
"from component %s in library %s." ), from component %s in library %s." ),
GetChars( field->m_Name ), GetChars( GetName() ), GetChars( field->m_Name ), GetChars( GetName() ),
GetChars( GetLibraryName() ) ); GetChars( GetLibraryName() ) );
return; return;
...@@ -854,8 +854,8 @@ bool LIB_COMPONENT::LoadDrawEntries( FILE* aFile, char* aLine, ...@@ -854,8 +854,8 @@ bool LIB_COMPONENT::LoadDrawEntries( FILE* aFile, char* aLine,
{ {
if( GetLine( aFile, aLine, aLineNum, LINE_BUFFER_LEN_LARGE ) == NULL ) if( GetLine( aFile, aLine, aLineNum, LINE_BUFFER_LEN_LARGE ) == NULL )
{ {
aErrorMsg = wxT( "file ended prematurely while attempting " aErrorMsg = wxT( "file ended prematurely while attempting \
"to flush to end of drawing section." ); to flush to end of drawing section." );
return false; return false;
} }
} while( strncmp( aLine, "ENDDRAW", 7 ) != 0 ); } while( strncmp( aLine, "ENDDRAW", 7 ) != 0 );
......
...@@ -298,7 +298,10 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent ) ...@@ -298,7 +298,10 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
msg << wxT( "\n\n" ) << _( "All old aliases will be removed. Continue ?" ); msg << wxT( "\n\n" ) << _( "All old aliases will be removed. Continue ?" );
int diag = wxMessageBox( msg, title, wxYES | wxICON_QUESTION ); int diag = wxMessageBox( msg, title, wxYES | wxICON_QUESTION );
if( diag != wxYES ) if( diag != wxYES )
{
delete newCmp;
return NULL; return NULL;
}
} }
} }
......
...@@ -226,8 +226,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event ...@@ -226,8 +226,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
if( newvalue->CmpNoCase( m_LibEntry->m_AliasList[i] ) == 0 ) if( newvalue->CmpNoCase( m_LibEntry->m_AliasList[i] ) == 0 )
{ {
wxString msg; wxString msg;
msg.Printf( _( "A new name is entered for this component\n" msg.Printf( _( "A new name is entered for this component\n\
"An alias %s already exists!\nCannot update this component" ), An alias %s already exists!\nCannot update this component" ),
newvalue->GetData() ); newvalue->GetData() );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
......
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