Fix some coverity warnings (mainly not initialized members)

This commit is contained in:
jean-pierre charras 2015-03-21 10:06:04 +01:00
parent 35c23f3135
commit 6e8a8a6b25
9 changed files with 28 additions and 4 deletions

View File

@ -36,6 +36,10 @@ using namespace KIGFX;
CAIRO_COMPOSITOR::CAIRO_COMPOSITOR( cairo_t** aMainContext ) : CAIRO_COMPOSITOR::CAIRO_COMPOSITOR( cairo_t** aMainContext ) :
m_current( 0 ), m_currentContext( aMainContext ), m_mainContext( *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;
} }

View File

@ -48,8 +48,10 @@ GAL::GAL() :
SetWorldUnitLength( 1.0 / METRIC_UNIT_LENGTH * 2.54 ); // 1 inch in nanometers SetWorldUnitLength( 1.0 / METRIC_UNIT_LENGTH * 2.54 ); // 1 inch in nanometers
SetScreenDPI( 106 ); // Display resolution setting SetScreenDPI( 106 ); // Display resolution setting
SetDepthRange( VECTOR2D( GAL::MIN_DEPTH, GAL::MAX_DEPTH ) ); SetDepthRange( VECTOR2D( GAL::MIN_DEPTH, GAL::MAX_DEPTH ) );
SetLayerDepth( 0.0 );
SetFlip( false, false ); SetFlip( false, false );
SetLineWidth( 1.0 ); SetLineWidth( 1.0 );
ComputeWorldScale();
// Set grid defaults // Set grid defaults
SetGridVisibility( true ); SetGridVisibility( true );

View File

@ -47,6 +47,11 @@ CACHED_CONTAINER::CACHED_CONTAINER( unsigned int aSize ) :
{ {
// In the beginning there is only free space // In the beginning there is only free space
m_freeChunks.insert( CHUNK( aSize, 0 ) ); m_freeChunks.insert( CHUNK( aSize, 0 ) );
// Do not have uninitialized members:
m_chunkSize = 0;
m_chunkOffset = 0;
m_itemSize = 0;
} }

View File

@ -45,7 +45,10 @@ SHADER::SHADER() :
maximumVertices( 4 ), maximumVertices( 4 ),
geomInputType( GL_LINES ), geomInputType( GL_LINES ),
geomOutputType( GL_LINES ) geomOutputType( GL_LINES )
{ {
// Do not have uninitialized members:
programNumber = 0;
} }

View File

@ -164,6 +164,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB(
{ {
m_parent = aParent; m_parent = aParent;
m_libEntry = aLibEntry; m_libEntry = aLibEntry;
m_skipCopyFromPanel = false;
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Centre(); Centre();

View File

@ -59,6 +59,14 @@ public:
{ {
m_parent = aParent; m_parent = aParent;
SetTitle( aTitle ); 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() {}; // ~DIALOG_EDIT_ONE_FIELD() {};

View File

@ -1403,7 +1403,7 @@ bool dxfRW::writeDimension( DRW_Dimension* ent )
writer->writeUtf8String( 3, ent->getStyle() ); writer->writeUtf8String( 3, ent->getStyle() );
if( ent->getTextLineFactor() != 0 ) if( ent->getDir() != 0 )
writer->writeDouble( 53, ent->getDir() ); writer->writeDouble( 53, ent->getDir() );
writer->writeDouble( 210, ent->getExtrusion().x ); writer->writeDouble( 210, ent->getExtrusion().x );

View File

@ -1030,13 +1030,12 @@ static void CreateBoardSection( FILE* aFile, BOARD* aPcb )
fputs( "$BOARD\n", aFile ); fputs( "$BOARD\n", aFile );
// Extract the board edges // Extract the board edges
for( EDA_ITEM* drawing = aPcb->m_Drawings; for( EDA_ITEM* drawing = aPcb->m_Drawings; drawing != 0;
drawing != 0;
drawing = drawing->Next() ) drawing = drawing->Next() )
{ {
if( drawing->Type() == PCB_LINE_T ) if( drawing->Type() == PCB_LINE_T )
{ {
DRAWSEGMENT* drawseg = dynamic_cast<DRAWSEGMENT*>( drawing ); DRAWSEGMENT* drawseg = static_cast<DRAWSEGMENT*>( drawing );
if( drawseg->GetLayer() == Edge_Cuts ) if( drawseg->GetLayer() == Edge_Cuts )
{ {
// XXX GenCAD supports arc boundaries but I've seen nothing that reads them // XXX GenCAD supports arc boundaries but I've seen nothing that reads them

View File

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