Skip to content

Commit

Permalink
Fix some coverity warnings (mainly not initialized members)
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-charras committed Mar 21, 2015
1 parent 35c23f3 commit 6e8a8a6
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 4 deletions.
4 changes: 4 additions & 0 deletions common/gal/cairo/cairo_compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ using namespace KIGFX;
CAIRO_COMPOSITOR::CAIRO_COMPOSITOR( cairo_t** aMainContext ) :
m_current( 0 ), m_currentContext( aMainContext ), m_mainContext( *aMainContext )
{
// Do not have uninitialized members:
cairo_matrix_init_identity( &m_matrix );
m_stride = 0;
m_bufferSize = 0;
}


Expand Down
2 changes: 2 additions & 0 deletions common/gal/graphics_abstraction_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ GAL::GAL() :
SetWorldUnitLength( 1.0 / METRIC_UNIT_LENGTH * 2.54 ); // 1 inch in nanometers
SetScreenDPI( 106 ); // Display resolution setting
SetDepthRange( VECTOR2D( GAL::MIN_DEPTH, GAL::MAX_DEPTH ) );
SetLayerDepth( 0.0 );
SetFlip( false, false );
SetLineWidth( 1.0 );
ComputeWorldScale();

// Set grid defaults
SetGridVisibility( true );
Expand Down
5 changes: 5 additions & 0 deletions common/gal/opengl/cached_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ CACHED_CONTAINER::CACHED_CONTAINER( unsigned int aSize ) :
{
// In the beginning there is only free space
m_freeChunks.insert( CHUNK( aSize, 0 ) );

// Do not have uninitialized members:
m_chunkSize = 0;
m_chunkOffset = 0;
m_itemSize = 0;
}


Expand Down
3 changes: 3 additions & 0 deletions common/gal/opengl/shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ SHADER::SHADER() :
maximumVertices( 4 ),
geomInputType( GL_LINES ),
geomOutputType( GL_LINES )

{
// Do not have uninitialized members:
programNumber = 0;
}


Expand Down
1 change: 1 addition & 0 deletions eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB(
{
m_parent = aParent;
m_libEntry = aLibEntry;
m_skipCopyFromPanel = false;

GetSizer()->SetSizeHints( this );
Centre();
Expand Down
8 changes: 8 additions & 0 deletions eeschema/dialogs/dialog_edit_one_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ class DIALOG_EDIT_ONE_FIELD : public DIALOG_LIB_EDIT_TEXT_BASE
{
m_parent = aParent;
SetTitle( aTitle );

// Avoid not initialized members:
m_textshape = 0;
m_textsize = 0;
m_textorient = 0;
m_textHjustify = GR_TEXT_HJUSTIFY_CENTER;
m_textVjustify = GR_TEXT_VJUSTIFY_CENTER;
m_text_invisible = false;
}

// ~DIALOG_EDIT_ONE_FIELD() {};
Expand Down
2 changes: 1 addition & 1 deletion lib_dxf/libdxfrw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ bool dxfRW::writeDimension( DRW_Dimension* ent )

writer->writeUtf8String( 3, ent->getStyle() );

if( ent->getTextLineFactor() != 0 )
if( ent->getDir() != 0 )
writer->writeDouble( 53, ent->getDir() );

writer->writeDouble( 210, ent->getExtrusion().x );
Expand Down
5 changes: 2 additions & 3 deletions pcbnew/exporters/export_gencad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1030,13 +1030,12 @@ static void CreateBoardSection( FILE* aFile, BOARD* aPcb )
fputs( "$BOARD\n", aFile );

// Extract the board edges
for( EDA_ITEM* drawing = aPcb->m_Drawings;
drawing != 0;
for( EDA_ITEM* drawing = aPcb->m_Drawings; drawing != 0;
drawing = drawing->Next() )
{
if( drawing->Type() == PCB_LINE_T )
{
DRAWSEGMENT* drawseg = dynamic_cast<DRAWSEGMENT*>( drawing );
DRAWSEGMENT* drawseg = static_cast<DRAWSEGMENT*>( drawing );
if( drawseg->GetLayer() == Edge_Cuts )
{
// XXX GenCAD supports arc boundaries but I've seen nothing that reads them
Expand Down
2 changes: 2 additions & 0 deletions pcbnew/gpcb_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@ GPCB_PLUGIN::GPCB_PLUGIN() :
m_cache( 0 ),
m_ctl( 0 )
{
m_reader = NULL;
init( 0 );
}

Expand All @@ -863,6 +864,7 @@ GPCB_PLUGIN::GPCB_PLUGIN( int aControlFlags ) :
m_cache( 0 ),
m_ctl( aControlFlags )
{
m_reader = NULL;
init( 0 );
}

Expand Down

0 comments on commit 6e8a8a6

Please sign in to comment.