Fix some warnings (looking like potential bugs) detected by cppcheck, (a few from a patch from Julien Nabet <serval2412@yahoo.fr>), remove not used vars and a few coding style fixes.
This commit is contained in:
parent
415c72262a
commit
c4ea4dc0df
|
@ -725,8 +725,9 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
|
||||||
org.y += KiROUND( gridSize.y );
|
org.y += KiROUND( gridSize.y );
|
||||||
|
|
||||||
// Use a pixel based draw to display grid. There are a lot of calls, so the cost is
|
// Use a pixel based draw to display grid. There are a lot of calls, so the cost is
|
||||||
// high and grid is slowly drawn on some platforms. Please note that this should
|
// high and grid is slowly drawn on some platforms. An other way using blit transfert was used,
|
||||||
// always be enabled until the bitmap based solution below is fixed.
|
// a long time ago, but it did not give very good results.
|
||||||
|
// The better way is highly dependent on the platform and the graphic card.
|
||||||
#ifndef __WXMAC__
|
#ifndef __WXMAC__
|
||||||
GRSetColorPen( aDC, GetParent()->GetGridColor() );
|
GRSetColorPen( aDC, GetParent()->GetGridColor() );
|
||||||
#else
|
#else
|
||||||
|
@ -996,7 +997,7 @@ void EDA_DRAW_PANEL::OnMagnify( wxMouseEvent& event )
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
int localrealbutt = 0, localbutt = 0;
|
int localbutt = 0;
|
||||||
BASE_SCREEN* screen = GetScreen();
|
BASE_SCREEN* screen = GetScreen();
|
||||||
|
|
||||||
if( !screen )
|
if( !screen )
|
||||||
|
@ -1030,12 +1031,6 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
if( m_ignoreMouseEvents )
|
if( m_ignoreMouseEvents )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( event.LeftIsDown() )
|
|
||||||
localrealbutt |= GR_M_LEFT_DOWN;
|
|
||||||
|
|
||||||
if( event.MiddleIsDown() )
|
|
||||||
localrealbutt |= GR_M_MIDDLE_DOWN;
|
|
||||||
|
|
||||||
if( event.LeftDown() )
|
if( event.LeftDown() )
|
||||||
localbutt = GR_M_LEFT_DOWN;
|
localbutt = GR_M_LEFT_DOWN;
|
||||||
|
|
||||||
|
@ -1045,8 +1040,6 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
if( event.MiddleDown() )
|
if( event.MiddleDown() )
|
||||||
localbutt = GR_M_MIDDLE_DOWN;
|
localbutt = GR_M_MIDDLE_DOWN;
|
||||||
|
|
||||||
localrealbutt |= localbutt; // compensation default wxGTK
|
|
||||||
|
|
||||||
INSTALL_UNBUFFERED_DC( DC, this );
|
INSTALL_UNBUFFERED_DC( DC, this );
|
||||||
DC.SetBackground( *wxBLACK_BRUSH );
|
DC.SetBackground( *wxBLACK_BRUSH );
|
||||||
|
|
||||||
|
|
|
@ -498,7 +498,7 @@ void SCH_SHEET::CleanupSheet()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( HLabel == NULL ) // Hlabel not found: delete sheet label.
|
if( HLabel == NULL ) // Hlabel not found: delete sheet label.
|
||||||
m_pins.erase( i );
|
i = m_pins.erase( i );
|
||||||
else
|
else
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -882,7 +882,7 @@ SCH_SHEET* SCH_SHEET_LIST::FindSheetByName( const wxString& aSheetName )
|
||||||
|
|
||||||
for( int i = 0; i < m_count; i++ )
|
for( int i = 0; i < m_count; i++ )
|
||||||
{
|
{
|
||||||
sheet = m_list[i].FindSheetByName( aSheetName );
|
SCH_SHEET* sheet = m_list[i].FindSheetByName( aSheetName );
|
||||||
|
|
||||||
if( sheet )
|
if( sheet )
|
||||||
return sheet;
|
return sheet;
|
||||||
|
|
|
@ -105,7 +105,7 @@ void PL_EDITOR_FRAME::GetLayoutFromRedoList( wxCommandEvent& event )
|
||||||
lastcmd = GetScreen()->PopCommandFromRedoList();
|
lastcmd = GetScreen()->PopCommandFromRedoList();
|
||||||
|
|
||||||
wrapper = lastcmd->PopItem();
|
wrapper = lastcmd->PopItem();
|
||||||
copyItem = (PL_ITEM_LAYOUT*)wrapper.GetItem();
|
copyItem = static_cast<PL_ITEM_LAYOUT*>( wrapper.GetItem() );
|
||||||
pglayout.SetPageLayout( TO_UTF8(copyItem->m_Layout) );
|
pglayout.SetPageLayout( TO_UTF8(copyItem->m_Layout) );
|
||||||
delete copyItem;
|
delete copyItem;
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ void PL_EDITOR_FRAME::GetLayoutFromUndoList( wxCommandEvent& event )
|
||||||
lastcmd = GetScreen()->PopCommandFromUndoList();
|
lastcmd = GetScreen()->PopCommandFromUndoList();
|
||||||
|
|
||||||
wrapper = lastcmd->PopItem();
|
wrapper = lastcmd->PopItem();
|
||||||
copyItem = (PL_ITEM_LAYOUT*)wrapper.GetItem();
|
copyItem = static_cast<PL_ITEM_LAYOUT*>( wrapper.GetItem() );
|
||||||
pglayout.SetPageLayout( TO_UTF8(copyItem->m_Layout) );
|
pglayout.SetPageLayout( TO_UTF8(copyItem->m_Layout) );
|
||||||
delete copyItem;
|
delete copyItem;
|
||||||
|
|
||||||
|
@ -156,6 +156,6 @@ void PL_EDITOR_FRAME::RemoveLastCommandInUndoList()
|
||||||
PICKED_ITEMS_LIST* lastcmd = GetScreen()->PopCommandFromUndoList();
|
PICKED_ITEMS_LIST* lastcmd = GetScreen()->PopCommandFromUndoList();
|
||||||
|
|
||||||
ITEM_PICKER wrapper = lastcmd->PopItem();
|
ITEM_PICKER wrapper = lastcmd->PopItem();
|
||||||
PL_ITEM_LAYOUT* copyItem = (PL_ITEM_LAYOUT*)wrapper.GetItem();
|
PL_ITEM_LAYOUT* copyItem = static_cast<PL_ITEM_LAYOUT*>( wrapper.GetItem() );
|
||||||
delete copyItem;
|
delete copyItem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -578,7 +578,7 @@ void make_hcyl( bool inch, bool axial, double dia, double length,
|
||||||
|
|
||||||
fprintf( fp, ".END_ELECTRICAL\n" );
|
fprintf( fp, ".END_ELECTRICAL\n" );
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
return;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,8 @@ bool IDF3::GetIDFString( const std::string& aLine, std::string& aIDFString,
|
||||||
if( idx < 0 || idx >= len )
|
if( idx < 0 || idx >= len )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while( isspace( aLine[idx] ) && idx < len ) ++idx;
|
while( idx < len && isspace( aLine[idx] ) )
|
||||||
|
++idx;
|
||||||
|
|
||||||
if( idx == len )
|
if( idx == len )
|
||||||
{
|
{
|
||||||
|
@ -95,7 +96,7 @@ bool IDF3::GetIDFString( const std::string& aLine, std::string& aIDFString,
|
||||||
{
|
{
|
||||||
hasQuotes = true;
|
hasQuotes = true;
|
||||||
++idx;
|
++idx;
|
||||||
while( aLine[idx] != '"' && idx < len )
|
while( idx < len && aLine[idx] != '"' )
|
||||||
ostr << aLine[idx++];
|
ostr << aLine[idx++];
|
||||||
|
|
||||||
if( idx == len )
|
if( idx == len )
|
||||||
|
@ -112,7 +113,7 @@ bool IDF3::GetIDFString( const std::string& aLine, std::string& aIDFString,
|
||||||
{
|
{
|
||||||
hasQuotes = false;
|
hasQuotes = false;
|
||||||
|
|
||||||
while( !isspace( aLine[idx] ) && idx < len )
|
while( idx < len && !isspace( aLine[idx] ) )
|
||||||
ostr << aLine[idx++];
|
ostr << aLine[idx++];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2720,8 +2720,6 @@ bool IDF3_BOARD::ReadFile( const wxString& aFullFileName, bool aNoSubstituteOutl
|
||||||
// 2. Check if a file with extension 'emp' exists and read it
|
// 2. Check if a file with extension 'emp' exists and read it
|
||||||
// 3. Open the specified filename and read it
|
// 3. Open the specified filename and read it
|
||||||
|
|
||||||
std::string fname = TO_UTF8( aFullFileName );
|
|
||||||
|
|
||||||
wxFileName brdname( aFullFileName );
|
wxFileName brdname( aFullFileName );
|
||||||
wxFileName libname( aFullFileName );
|
wxFileName libname( aFullFileName );
|
||||||
|
|
||||||
|
@ -3125,8 +3123,6 @@ bool IDF3_BOARD::WriteFile( const wxString& aFullFileName, bool aUnitMM, bool aF
|
||||||
// 2. Write the *.emn file according to the IDFv3 spec
|
// 2. Write the *.emn file according to the IDFv3 spec
|
||||||
// 3. Write the *.emp file according to the IDFv3 spec
|
// 3. Write the *.emp file according to the IDFv3 spec
|
||||||
|
|
||||||
std::string fname = TO_UTF8( aFullFileName );
|
|
||||||
|
|
||||||
wxFileName brdname( aFullFileName );
|
wxFileName brdname( aFullFileName );
|
||||||
wxFileName libname( aFullFileName );
|
wxFileName libname( aFullFileName );
|
||||||
|
|
||||||
|
|
|
@ -1592,9 +1592,6 @@ int VRML_LAYER::checkNContours( bool holes )
|
||||||
if( contours.empty() )
|
if( contours.empty() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
std::list<int>::const_iterator begin;
|
|
||||||
std::list<int>::const_iterator end;
|
|
||||||
|
|
||||||
for( size_t i = 0; i < contours.size(); ++i )
|
for( size_t i = 0; i < contours.size(); ++i )
|
||||||
{
|
{
|
||||||
if( contours[i]->size() < 3 )
|
if( contours[i]->size() < 3 )
|
||||||
|
|
Loading…
Reference in New Issue