Commit d6c6b4de authored by jean-pierre charras's avatar jean-pierre charras

Fix some coverity warnings (mainly not initialized vars).

parent 30acc07e
......@@ -452,7 +452,8 @@ void PDF_PLOTTER::closePdfStream()
{
wxASSERT( workFile );
int stream_len = ftell( workFile );
long stream_len = ftell( workFile );
wxASSERT( stream_len >= 0 );
// Rewind the file, read in the page stream and DEFLATE it
fseek( workFile, 0, SEEK_SET );
......@@ -468,7 +469,7 @@ void PDF_PLOTTER::closePdfStream()
::wxRemoveFile( workFilename );
// NULL means memos owns the memory, but provide a hint on optimum size needed.
wxMemoryOutputStream memos( NULL, std::max( 2000, stream_len ) ) ;
wxMemoryOutputStream memos( NULL, std::max( 2000l, stream_len ) ) ;
{
/* Somewhat standard parameters to compress in DEFLATE. The PDF spec is
......
......@@ -208,8 +208,6 @@ void LIB_VIEW_FRAME::SelectAndViewLibraryPart( int option )
void LIB_VIEW_FRAME::ViewOneLibraryContent( PART_LIB* Lib, int Flag )
{
int NumOfParts = 0;
LIB_ALIAS* entry;
wxString CmpName;
if( Lib )
NumOfParts = Lib->GetCount();
......@@ -220,8 +218,8 @@ void LIB_VIEW_FRAME::ViewOneLibraryContent( PART_LIB* Lib, int Flag )
return;
}
if( Lib == NULL )
return;
LIB_ALIAS* entry;
wxString CmpName;
if( Flag == NEW_PART )
DisplayListComponentsInLib( Lib, CmpName, m_entryName );
......
......@@ -26,7 +26,7 @@ public:
{
int x, y;
TPos() { }
TPos() : x( 0 ), y( 0 ) { }
TPos( int _x, int _y ) : x( _x ), y( _y ) { }
bool operator ==( const TPos& p ) const { return x == p.x && y == p.y; }
......@@ -36,7 +36,7 @@ public:
{
int w, h;
TRect() { }
TRect() : w( 0 ), h( 0 ) { }
TRect( int _x, int _y, int _w, int _h ) : TPos( _x, _y ), w( _w > 0 ? _w : 0 ), h(
_h > 0 ? _h : 0 ) { }
......
......@@ -662,12 +662,12 @@ void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all )
if( !pad->IsSelected() && !force_all )
continue;
wxPoint pos = pad->GetPosition();
wxPoint pos = pad->GetPos0();
ROTATE( pos );
pad->SetPosition( pos );
pad->SetPos0( pad->GetPosition() );
pad->SetPos0( pos );
pad->SetOrientation( pad->GetOrientation() + 900 );
pad->SetDrawCoord();
}
for( EDA_ITEM* item = module->GraphicalItems(); item; item = item->Next() )
......@@ -681,15 +681,15 @@ void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all )
{
EDGE_MODULE* em = (EDGE_MODULE*) item;
wxPoint tmp = em->GetStart();
wxPoint tmp = em->GetStart0();
ROTATE( tmp );
em->SetStart( tmp );
em->SetStart0( tmp );
tmp = em->GetEnd();
tmp = em->GetEnd0();
ROTATE( tmp );
em->SetEnd( tmp );
em->SetEnd0( tmp );
em->SetDrawCoord();
}
break;
......
......@@ -233,7 +233,8 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, LSET aLayerMask, TRACK_PTRS*
* if > 1 segment:
* end of track (more than 2 segment connected at this location)
*/
segment = m_Track; candidate = NULL;
segment = m_Track;
candidate = NULL;
NbSegm = 0;
while( ( segment = ::GetTrack( segment, NULL, aPosition, aLayerMask ) ) != NULL )
......@@ -280,8 +281,6 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, LSET aLayerMask, TRACK_PTRS*
aPosition = candidate->GetStart();
}
segment = m_Track; /* restart list of tracks to analyze */
/* flag this item an push it in list of selected items */
aList->push_back( candidate );
candidate->SetState( BUSY, true );
......
......@@ -49,6 +49,7 @@ DIMENSION::DIMENSION( BOARD_ITEM* aParent ) :
m_Width( Millimeter2iu( 0.2 ) ), m_Unit( INCHES ), m_Value( 0 ), m_Height( 0 ), m_Text( this )
{
m_Layer = Dwgs_User;
m_Shape = 0;
}
......
......@@ -1055,7 +1055,7 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
for( D_PAD* pad = Pads(); pad; pad = pad->Next() )
{
pad->SetPos0( pad->GetPos0() + moveVector );
pad->SetPosition( pad->GetPos0() + footprintPos );
pad->SetDrawCoord();
}
// Update the draw element coordinates.
......@@ -1100,13 +1100,8 @@ void MODULE::SetOrientation( double newangle )
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
pt = pad->GetPos0();
pad->SetOrientation( pad->GetOrientation() + angleChange );
RotatePoint( &pt, m_Orient );
pad->SetPosition( GetPosition() + pt );
pad->SetDrawCoord();
}
// Update of the reference and value.
......
......@@ -103,6 +103,9 @@ DRC::DRC( PCB_EDIT_FRAME* aPcbWindow )
m_doPad2PadTest = true; // enable pad to pad clearance tests
m_doUnconnectedTest = true; // enable unconnected tests
m_doZonesTest = true; // enable zone to items clearance tests
m_doKeepoutTest = true; // enable keepout areas to items clearance tests
m_abortDRC = false;
m_drcInProgress = false;
m_doCreateRptFile = false;
......
......@@ -132,6 +132,7 @@ GPCB_FPL_CACHE_ITEM::GPCB_FPL_CACHE_ITEM( MODULE* aModule, const wxFileName& aFi
m_module( aModule )
{
m_file_name = aFileName;
m_writable = true; // temporary init
if( m_file_name.FileExists() )
m_mod_time = m_file_name.GetModificationTime();
......
......@@ -116,7 +116,9 @@ void DIALOG_DXF_IMPORT::OnBrowseDxfFiles( wxCommandEvent& event )
path, filename,
wxT( "dxf Files (*.dxf)|*.dxf" ),
wxFD_OPEN|wxFD_FILE_MUST_EXIST );
dlg.ShowModal();
if( dlg.ShowModal() != wxID_OK )
return;
wxString fileName = dlg.GetPath();
......
......@@ -271,9 +271,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
// only the intercept will change, segment slopes does not change
// because we are moving parallel with is initial state
if( !s_MovingSegmentVertical )
{
s_MovingSegment_Yorg = ty1 - ( s_MovingSegmentSlope * tx1 );
}
if( ( !s_EndPointVertical ) && ( !s_MovingSegmentVertical ) )
{
......@@ -283,43 +281,29 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
else
{
if( !s_EndPointVertical )
{
xi2 = tx2;
}
else
{
//P1=P2
if( !s_EndPointHorizontal )
{
xi2 = tx2 - dx;
}
else
{
update = false;
}
}
}
if( !s_MovingSegmentVertical )
{
yi2 = s_MovingSegmentSlope * ( xi2 ) + s_MovingSegment_Yorg;
}
yi2 = ( s_MovingSegmentSlope * xi2 ) + s_MovingSegment_Yorg;
else
{
if( !s_EndPointVertical )
{
yi2 = s_EndSegmentSlope * ( xi2 ) + s_EndSegment_Yorg;
}
yi2 = ( s_EndSegmentSlope * xi2 ) + s_EndSegment_Yorg;
else
{
if( !s_EndPointHorizontal )
{
update = false;
}
else
{
yi2 = s_MovingSegmentSlope * ( xi2 ) + s_MovingSegment_Yorg;
}
yi2 = ( s_MovingSegmentSlope * xi2 ) + s_MovingSegment_Yorg;
}
}
......@@ -331,46 +315,32 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
else
{
if( !s_StartPointVertical )
{
xi1 = tx1;
}
else
{
//P1=P2
if( !s_StartPointHorizontal )
{
xi1 = tx1 - dx;
}
else
{
if( !s_StartPointHorizontal )
{
update = false;
}
}
}
}
if( !s_MovingSegmentVertical )
{
yi1 = s_MovingSegmentSlope * ( xi1 ) + s_MovingSegment_Yorg;
}
yi1 = ( s_MovingSegmentSlope * xi1 ) + s_MovingSegment_Yorg;
else
{
if( !s_StartPointVertical )
{
yi1 = s_StartSegmentSlope * ( xi1 ) + s_StartSegment_Yorg;
}
yi1 = ( s_StartSegmentSlope * xi1 ) + s_StartSegment_Yorg;
else
{
if( !s_StartPointHorizontal )
{
update = false;
}
else
{
yi2 = s_MovingSegmentSlope * ( xi1 ) + s_MovingSegment_Yorg;
}
yi2 = ( s_MovingSegmentSlope * xi1 ) + s_MovingSegment_Yorg;
}
}
......@@ -703,7 +673,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
if( !track )
return;
// TODO: Use clenup functions to merge collinear segments if track
// TODO: Use cleanup functions to merge collinear segments if track
// is connected to a collinear segment.
s_StartSegmentPresent = s_EndSegmentPresent = true;
......
......@@ -985,6 +985,7 @@ void CPolyLine::Copy( const CPolyLine* src )
m_layer = src->m_layer;
m_hatchStyle = src->m_hatchStyle;
m_hatchPitch = src->m_hatchPitch;
m_flags = src->m_flags;
m_CornersList.RemoveAllContours();
m_CornersList.Append( src->m_CornersList );
}
......
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