Fix some compil warnings and Debug assertions

This commit is contained in:
jean-pierre charras 2014-06-04 19:34:23 +02:00
parent 431675933a
commit f76041e956
18 changed files with 67 additions and 39 deletions

View File

@ -268,7 +268,7 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText )
// If it is a double tilda, just process the second one
}
unsigned dd = *chIt - ' ';
int dd = *chIt - ' ';
if( dd >= m_glyphBoundingBoxes.size() || dd < 0 )
dd = '?' - ' ';
@ -336,7 +336,7 @@ VECTOR2D STROKE_FONT::computeTextSize( const UTF8& aText ) const
}
// Index in the bounding boxes table
unsigned dd = *it - ' ';
int dd = *it - ' ';
if( dd >= m_glyphBoundingBoxes.size() || dd < 0 )
dd = '?' - ' ';

View File

@ -71,7 +71,7 @@ void COMPONENTS_LISTBOX::SetString( unsigned linecount, const wxString& text )
if( linecount >= m_ComponentList.Count() )
linecount = m_ComponentList.Count() - 1;
if( linecount >= 0 )
if( m_ComponentList.Count() > 0 )
m_ComponentList[linecount] = text;
}
@ -89,9 +89,9 @@ wxString COMPONENTS_LISTBOX::OnGetItemText( long item, long column ) const
}
void COMPONENTS_LISTBOX::SetSelection( unsigned index, bool State )
void COMPONENTS_LISTBOX::SetSelection( int index, bool State )
{
if( (int) index >= GetCount() )
if( index >= GetCount() )
index = GetCount() - 1;
if( (index >= 0) && (GetCount() > 0) )
@ -164,7 +164,7 @@ void COMPONENTS_LISTBOX::OnChar( wxKeyEvent& event )
if( key == start_char )
{
SetSelection( ii, true ); // Ensure visible
SetSelection( (int) ii, true ); // Ensure visible
break;
}
}

View File

@ -101,9 +101,9 @@ wxString FOOTPRINTS_LISTBOX::OnGetItemText( long item, long column ) const
}
void FOOTPRINTS_LISTBOX::SetSelection( unsigned index, bool State )
void FOOTPRINTS_LISTBOX::SetSelection( int index, bool State )
{
if( (int) index >= GetCount() )
if( index >= GetCount() )
index = GetCount() - 1;
if( (index >= 0) && (GetCount() > 0) )

View File

@ -95,9 +95,9 @@ wxString LIBRARY_LISTBOX::OnGetItemText( long item, long column ) const
}
void LIBRARY_LISTBOX::SetSelection( unsigned index, bool State )
void LIBRARY_LISTBOX::SetSelection( int index, bool State )
{
if( (int) index >= GetCount() )
if( index >= GetCount() )
index = GetCount() - 1;
if( (index >= 0) && (GetCount() > 0) )

View File

@ -78,7 +78,7 @@ public:
~FOOTPRINTS_LISTBOX();
int GetCount();
void SetSelection( unsigned index, bool State = true );
void SetSelection( int index, bool State = true );
void SetString( unsigned linecount, const wxString& text );
void AppendLine( const wxString& text );
@ -127,7 +127,7 @@ public:
~LIBRARY_LISTBOX();
int GetCount();
void SetSelection( unsigned index, bool State = true );
void SetSelection( int index, bool State = true );
void SetString( unsigned linecount, const wxString& text );
void AppendLine( const wxString& text );
void SetLibraryList( const wxArrayString& aList );
@ -187,7 +187,7 @@ public:
/*
* Enable or disable an item
*/
void SetSelection( unsigned index, bool State = true );
void SetSelection( int index, bool State = true );
void SetString( unsigned linecount, const wxString& text );
void AppendLine( const wxString& text );

View File

@ -1,8 +1,25 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_erc.h
// Author: jean-pierre Charras
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef DIALOG_ERC_LISTBOX_H
#define DIALOG_ERC_LISTBOX_H
@ -76,7 +93,7 @@ public:
*/
wxString OnGetItem( size_t n ) const
{
if( m_MarkerList.size() > n && n >= 0 )
if( m_MarkerList.size() > n )
{
const SCH_MARKER* item = m_MarkerList[ n ];
if( item )

View File

@ -77,7 +77,7 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
sOptionsSizer->Add( m_Invisible, 0, wxALL, 5 );
bBottomtBoxSizer->Add( sOptionsSizer, 1, wxALL|wxEXPAND, 5 );
bBottomtBoxSizer->Add( sOptionsSizer, 0, wxALL|wxEXPAND, 5 );
wxString m_TextShapeOptChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int m_TextShapeOptNChoices = sizeof( m_TextShapeOptChoices ) / sizeof( wxString );

View File

@ -495,7 +495,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Options</property>

View File

@ -1,10 +1,12 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_drclistbox.h"
#include "dialog_drc_base.h"
///////////////////////////////////////////////////////////////////////////
@ -36,6 +38,7 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
fgMinValuesSizer->Add( m_ClearanceTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_SetClearance = new wxTextCtrl( this, wxID_ANY, _("By Netclass"), wxDefaultPosition, wxDefaultSize, 0 );
m_SetClearance->SetMaxLength( 0 );
m_SetClearance->Enable( false );
fgMinValuesSizer->Add( m_SetClearance, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
@ -47,6 +50,7 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
fgMinValuesSizer->Add( m_TrackMinWidthTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_SetTrackMinWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetTrackMinWidthCtrl->SetMaxLength( 0 );
fgMinValuesSizer->Add( m_SetTrackMinWidthCtrl, 0, wxALL|wxEXPAND, 5 );
m_ViaMinTitle = new wxStaticText( this, wxID_ANY, _("Min via size"), wxDefaultPosition, wxDefaultSize, 0 );
@ -56,6 +60,7 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
fgMinValuesSizer->Add( m_ViaMinTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_SetViaMinSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetViaMinSizeCtrl->SetMaxLength( 0 );
fgMinValuesSizer->Add( m_SetViaMinSizeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
m_MicroViaMinTitle = new wxStaticText( this, wxID_ANY, _("Min uVia size"), wxDefaultPosition, wxDefaultSize, 0 );
@ -65,6 +70,7 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
fgMinValuesSizer->Add( m_MicroViaMinTitle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_SetMicroViakMinSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SetMicroViakMinSizeCtrl->SetMaxLength( 0 );
fgMinValuesSizer->Add( m_SetMicroViakMinSizeCtrl, 0, wxALL|wxEXPAND, 5 );
@ -79,6 +85,7 @@ DIALOG_DRC_CONTROL_BASE::DIALOG_DRC_CONTROL_BASE( wxWindow* parent, wxWindowID i
ReportFileSizer->Add( m_CreateRptCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_RptFilenameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_RptFilenameCtrl->SetMaxLength( 0 );
m_RptFilenameCtrl->SetToolTip( _("Enter the report filename") );
m_RptFilenameCtrl->SetMinSize( wxSize( 180,-1 ) );

View File

@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -1247,7 +1249,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">220,-1</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -11,7 +11,9 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_drclistbox.h"
class DIALOG_SHIM;
class DRCLISTBOX;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Feb 26 2014)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -190,7 +190,6 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
bmsgSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxVERTICAL );
m_messagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_messagesBox->SetMaxLength( 0 );
m_messagesBox->SetMinSize( wxSize( -1,90 ) );
bmsgSizer->Add( m_messagesBox, 1, wxALL|wxEXPAND, 5 );

View File

@ -2133,7 +2133,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,90</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Feb 26 2014)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -173,7 +173,6 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w
bLowerSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MessageWindow = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CHARWRAP|wxTE_MULTILINE|wxTE_READONLY|wxTE_WORDWRAP );
m_MessageWindow->SetMaxLength( 0 );
m_MessageWindow->SetMinSize( wxSize( 300,150 ) );
bLowerSizer->Add( m_MessageWindow, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );

View File

@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -1974,7 +1976,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">300,150</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1488,8 +1488,8 @@ bool IDF3_BOARD::setUnit( IDF3::IDF_UNIT aUnit, bool convert )
do
{
std::map<std::string, GROUP_OUTLINE*>::iterator its = olnGroup.begin();
std::map<std::string, GROUP_OUTLINE*>::iterator ite = olnGroup.end();
std::multimap<std::string, GROUP_OUTLINE*>::iterator its = olnGroup.begin();
std::multimap<std::string, GROUP_OUTLINE*>::iterator ite = olnGroup.end();
while( its != ite )
{
@ -2905,8 +2905,8 @@ void IDF3_BOARD::writeBoardFile( const std::string& aFileName )
// PLACEMENT GROUP outlines
do
{
std::map<std::string, GROUP_OUTLINE*>::iterator its = olnGroup.begin();
std::map<std::string, GROUP_OUTLINE*>::iterator ite = olnGroup.end();
std::multimap<std::string, GROUP_OUTLINE*>::iterator its = olnGroup.begin();
std::multimap<std::string, GROUP_OUTLINE*>::iterator ite = olnGroup.end();
while( its != ite )
{
@ -4102,8 +4102,8 @@ void IDF3_BOARD::Clear( void )
// delete PLACEMENT GROUP outlines
do
{
std::map<std::string, GROUP_OUTLINE*>::iterator os = olnGroup.begin();
std::map<std::string, GROUP_OUTLINE*>::iterator oe = olnGroup.end();
std::multimap<std::string, GROUP_OUTLINE*>::iterator os = olnGroup.begin();
std::multimap<std::string, GROUP_OUTLINE*>::iterator oe = olnGroup.end();
while( os != oe )
{