From 991927a177a991245c99e1283dd4ee76f3c1e5fb Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 7 Sep 2015 17:20:15 +0200 Subject: [PATCH] Fix crash (only on Linux) when exporting a footprint from the footprint wizard frame. Replace %zu be %d in wxString::Format (%zu format not known by wxString::Format on Windows 32 bits) --- cvpcb/class_footprints_listbox.cpp | 4 ++-- eeschema/lib_polyline.cpp | 4 ++-- eeschema/libedit.cpp | 4 ++-- eeschema/netlist.cpp | 2 +- pcbnew/footprint_wizard_frame.cpp | 22 +++++++--------------- pcbnew/footprint_wizard_frame.h | 1 - pcbnew/zones_polygons_test_connections.cpp | 2 +- 7 files changed, 15 insertions(+), 24 deletions(-) diff --git a/cvpcb/class_footprints_listbox.cpp b/cvpcb/class_footprints_listbox.cpp index 553a950afa..7db8318bd2 100644 --- a/cvpcb/class_footprints_listbox.cpp +++ b/cvpcb/class_footprints_listbox.cpp @@ -140,7 +140,7 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a { if( aFilterType == UNFILTERED ) { - msg.Printf( wxT( "%3zu %s:%s" ), newList.GetCount() + 1, + msg.Printf( wxT( "%3d %s:%s" ), int( newList.GetCount() + 1 ), GetChars( aList.GetItem( ii ).GetNickname() ), GetChars( aList.GetItem( ii ).GetFootprintName() ) ); newList.Add( msg ); @@ -159,7 +159,7 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a && aComponent->GetNetCount() != aList.GetItem( ii ).GetPadCount() ) continue; - msg.Printf( wxT( "%3zu %s:%s" ), newList.GetCount() + 1, + msg.Printf( wxT( "%3d %s:%s" ), int( newList.GetCount() + 1 ), GetChars( aList.GetItem( ii ).GetNickname() ), GetChars( aList.GetItem( ii ).GetFootprintName() ) ); newList.Add( msg ); diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index 1f5c4ffe98..2ee13602a9 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -417,10 +417,10 @@ void LIB_POLYLINE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) wxString LIB_POLYLINE::GetSelectMenuText() const { - return wxString::Format( _( "Polyline at (%s, %s) with %zu points" ), + return wxString::Format( _( "Polyline at (%s, %s) with %d points" ), GetChars( CoordinateToString( m_PolyPoints[0].x ) ), GetChars( CoordinateToString( m_PolyPoints[0].y ) ), - m_PolyPoints.size() ); + int( m_PolyPoints.size() ) ); } diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index cd11df02eb..fe2f12134f 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -546,8 +546,8 @@ void LIB_EDIT_FRAME::DeleteOnePart( wxCommandEvent& event ) return; } - msg.Printf( _( "Select one of %zu components to delete\nfrom library '%s'." ), - nameList.GetCount(), + msg.Printf( _( "Select one of %d components to delete\nfrom library '%s'." ), + int( nameList.GetCount() ), GetChars( lib->GetName() ) ); wxSingleChoiceDialog dlg( this, msg, _( "Delete Part" ), nameList ); diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index cb8bef0cb7..3a4c61fcfd 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -173,7 +173,7 @@ NETLIST_OBJECT_LIST* SCH_EDIT_FRAME::BuildNetListBase() return ret.release(); } - wxString msg = wxString::Format( _( "Net count = %zu" ), ret->size() ); + wxString msg = wxString::Format( _( "Net count = %d" ), int( ret->size() ) ); SetStatusText( msg ); diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index 4ca89c0f0b..9e2f71376f 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -218,7 +218,7 @@ FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME() void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event ) { if( m_messagesFrame ) - m_messagesFrame->CloseMessagesWindow(); + m_messagesFrame->SaveSettings(); SaveSettings( config() ); @@ -655,20 +655,6 @@ FOOTPRINT_WIZARD_MESSAGES::FOOTPRINT_WIZARD_MESSAGES( FOOTPRINT_WIZARD_FRAME* aP } -void FOOTPRINT_WIZARD_MESSAGES::CloseMessagesWindow() -{ - if( !IsIconized() ) - { - m_position = GetPosition(); - m_size = GetSize(); - } - - SaveSettings(); - - Close(); -} - - FOOTPRINT_WIZARD_MESSAGES::~FOOTPRINT_WIZARD_MESSAGES() { } @@ -692,6 +678,12 @@ void FOOTPRINT_WIZARD_MESSAGES::ClearScreen() void FOOTPRINT_WIZARD_MESSAGES::SaveSettings() { + if( !IsIconized() ) + { + m_position = GetPosition(); + m_size = GetSize(); + } + m_config->Write( MESSAGE_BOX_POSX_KEY, m_position.x ); m_config->Write( MESSAGE_BOX_POSY_KEY, m_position.y ); m_config->Write( MESSAGE_BOX_SIZEX_KEY, m_size.x ); diff --git a/pcbnew/footprint_wizard_frame.h b/pcbnew/footprint_wizard_frame.h index 4d6bfc3dbc..05ae6d4983 100644 --- a/pcbnew/footprint_wizard_frame.h +++ b/pcbnew/footprint_wizard_frame.h @@ -212,7 +212,6 @@ public: ~FOOTPRINT_WIZARD_MESSAGES(); void PrintMessage( const wxString& aMessage ); void ClearScreen(); - void CloseMessagesWindow(); void SaveSettings(); void LoadSettings(); diff --git a/pcbnew/zones_polygons_test_connections.cpp b/pcbnew/zones_polygons_test_connections.cpp index 6306260699..958c064248 100644 --- a/pcbnew/zones_polygons_test_connections.cpp +++ b/pcbnew/zones_polygons_test_connections.cpp @@ -388,7 +388,7 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ) } -/* Compare function used for sorting candidates by increasing zone zubnet +/* Compare function used for sorting candidates by increasing zone subnet */ static bool CmpZoneSubnetValue( const BOARD_CONNECTED_ITEM* a, const BOARD_CONNECTED_ITEM* b ) {