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;
...@@ -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,8 +712,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( ...@@ -716,8 +712,7 @@ 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,
...@@ -740,11 +735,9 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( ...@@ -740,11 +735,9 @@ 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,
...@@ -754,8 +747,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( ...@@ -754,8 +747,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
{ {
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 ) );
...@@ -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,8 +988,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList ) ...@@ -996,8 +988,7 @@ 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 ),
...@@ -1020,11 +1011,10 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList ) ...@@ -1020,11 +1011,10 @@ 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 );
......
...@@ -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,9 +298,12 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent ) ...@@ -298,9 +298,12 @@ 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;
} }
} }
}
for( size_t i = 0; i < newCmp->m_AliasList.GetCount(); i++ ) for( size_t i = 0; i < newCmp->m_AliasList.GetCount(); i++ )
{ {
......
...@@ -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