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

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
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
eeschema/cmp_library_keywords.cpp
eeschema/cmp_library_keywords.h
eeschema/template_fieldnames_keywords.cpp
eeschema/template_fieldnames_keywords.h
common/netlist_keywords.*
common/netlist_lexer.h
include/netlist_lexer.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
Makefile
CMakeFiles
+40 −50
Original line number Diff line number Diff line
@@ -322,9 +322,8 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
        {
            sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsBySheet );

            msg.Printf( _(
                            "\n#Global, Hierarchical Labels and PinSheets "
                            "( order = Sheet Number ) count = %d\n" ),
            msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets \
( order = Sheet Number ) count = %d\n" ),
                        itemCount );

            fprintf( f, "%s", CONV_TO_UTF8( msg ) );
@@ -335,9 +334,8 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
        {
            sort( listOfLabels.begin(), listOfLabels.end(), SortLabelsByValue );

            msg.Printf( _(
                            "\n#Global, Hierarchical Labels and PinSheets ( "
                            "order = Alphab. ) count = %d\n\n" ),
            msg.Printf( _( "\n#Global, Hierarchical Labels and PinSheets ( \
order = Alphab. ) count = %d\n\n" ),
                        itemCount );

            fprintf( f, "%s", CONV_TO_UTF8( msg ) );
@@ -449,8 +447,7 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
 *    if same value: by reference
 *         if same reference: by unit number
 */
bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1,
                            const OBJ_CMP_TO_LIST& obj2 )
bool SortComponentsByValue( const OBJ_CMP_TO_LIST& obj1, const OBJ_CMP_TO_LIST& obj2 )
{
    int             ii;
    const wxString* Text1, * Text2;
@@ -666,8 +663,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(

            msg = _( "Field" );

            fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8(
                         msg ), ii - FIELD1 + 1 );
            fprintf( f, "%c%s%d", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ), ii - FIELD1 + 1 );
        }

        fprintf( f, "\n" );
@@ -716,8 +712,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
        if( CompactForm )
#if defined(KICAD_GOST)
            fprintf( f, "%s%c%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol,
                    CONV_TO_UTF8( comp->GetField(
                                      VALUE )->m_Text ), s_ExportSeparatorSymbol,
                     CONV_TO_UTF8( comp->GetField( VALUE )->m_Text ), s_ExportSeparatorSymbol,
                     CONV_TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
#else
            fprintf( f, "%s%c%s", CmpName.c_str(), s_ExportSeparatorSymbol,
@@ -740,11 +735,9 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(

            if( CompactForm )
            {
                fprintf( f, "%c%s", s_ExportSeparatorSymbol,
                        CONV_TO_UTF8( msg ) );
                fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );

                msg = m_Parent->GetXYSheetReferences(
                    (BASE_SCREEN*) comp->GetParent(),
                msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) comp->GetParent(),
                                                      comp->m_Pos );

                fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
@@ -754,8 +747,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
            {
                fprintf( f, "   (Sheet %s)", CONV_TO_UTF8( msg ) );

                msg = m_Parent->GetXYSheetReferences(
                    (BASE_SCREEN*) comp->GetParent(),
                msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) comp->GetParent(),
                                                      comp->m_Pos );

                fprintf( f, "   (loc %s)", CONV_TO_UTF8( msg ) );
@@ -959,8 +951,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
        {
            msg = aList[ii].m_SheetPath.PathHumanReadable();
            fprintf( f, "   (Sheet %s)", CONV_TO_UTF8( msg ) );
            msg = m_Parent->GetXYSheetReferences(
                (BASE_SCREEN*) DrawLibItem->GetParent(), DrawLibItem->m_Pos );
            msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*) DrawLibItem->GetParent(),
                                                  DrawLibItem->m_Pos );
            fprintf( f, "   (loc %s)", CONV_TO_UTF8( msg ) );
        }

@@ -996,8 +988,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
                labeltype = wxT( "Global      " );

            sheetpath = aList[ii].m_SheetPath.PathHumanReadable();
            msg.Printf(
                _( "> %-28.28s %s        (Sheet %s) pos: %3.3f, %3.3f\n" ),
            msg.Printf( _( "> %-28.28s %s        (Sheet %s) pos: %3.3f, %3.3f\n" ),
                        GetChars( DrawTextItem->m_Text ),
                        GetChars( labeltype ),
                        GetChars( sheetpath ),
@@ -1020,8 +1011,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )

            wxString labtype = CONV_FROM_UTF8( SheetLabelType[jj] );

            msg.Printf(
                _( "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ),
            msg.Printf( _( "> %-28.28s PinSheet %-7.7s (Sheet %s) pos: %3.3f, %3.3f\n" ),
                        GetChars( DrawSheetLabel->m_Text ),
                        GetChars( labtype ),
                        GetChars( aList[ii].m_SheetPath.PathHumanReadable() ),
+4 −4
Original line number Diff line number Diff line
@@ -398,8 +398,8 @@ void LIB_COMPONENT::RemoveDrawItem( LIB_DRAW_ITEM* aItem,

        if( field->m_FieldId < MANDATORY_FIELDS )
        {
            wxLogWarning( _( "An attempt was made to remove the %s field "
                             "from component %s in library %s." ),
            wxLogWarning( _( "An attempt was made to remove the %s field \
from component %s in library %s." ),
                          GetChars( field->m_Name ), GetChars( GetName() ),
                          GetChars( GetLibraryName() ) );
            return;
@@ -854,8 +854,8 @@ bool LIB_COMPONENT::LoadDrawEntries( FILE* aFile, char* aLine,
            {
                if( GetLine( aFile, aLine, aLineNum, LINE_BUFFER_LEN_LARGE ) == NULL )
                {
                    aErrorMsg = wxT( "file ended prematurely while attempting "
                                    "to flush to end of drawing section." );
                    aErrorMsg = wxT( "file ended prematurely while attempting \
to flush to end of drawing section." );
                    return false;
                }
            } while( strncmp( aLine, "ENDDRAW", 7 ) != 0 );
+3 −0
Original line number Diff line number Diff line
@@ -298,9 +298,12 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
            msg << wxT( "\n\n" ) << _( "All old aliases will be removed. Continue ?" );
            int diag = wxMessageBox( msg, title, wxYES | wxICON_QUESTION );
            if( diag != wxYES )
            {
                delete newCmp;
                return NULL;
            }
        }
    }

    for( size_t i = 0; i < newCmp->m_AliasList.GetCount(); i++ )
    {
+2 −2
Original line number Diff line number Diff line
@@ -226,8 +226,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
        if( newvalue->CmpNoCase( m_LibEntry->m_AliasList[i] ) == 0 )
        {
            wxString msg;
            msg.Printf( _( "A new name is entered for this component\n"
                           "An alias %s already exists!\nCannot update this component" ),
            msg.Printf( _( "A new name is entered for this component\n\
An alias %s already exists!\nCannot update this component" ),
                        newvalue->GetData() );
            DisplayError( this, msg );
            return;