From c536364f050be4a1db88863e7185f96fe6c1d00e Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 2 Nov 2017 18:18:57 +0100 Subject: [PATCH] Fix a few coverity warnings. very minor other changes. --- gerbview/gerbview_painter.cpp | 6 +++--- pcbnew/dialogs/dialog_keepout_area_properties.cpp | 2 +- pcbnew/exporters/gen_modules_placefile.cpp | 4 ++-- pcbnew/specctra.cpp | 1 + pcbnew/specctra.h | 3 +++ 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gerbview/gerbview_painter.cpp b/gerbview/gerbview_painter.cpp index bede8b7ee8..7199adedb0 100644 --- a/gerbview/gerbview_painter.cpp +++ b/gerbview/gerbview_painter.cpp @@ -103,15 +103,15 @@ const COLOR4D& GERBVIEW_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int a return m_layerColorsSel[aLayer]; } - if( !m_netHighlightString.IsEmpty() && + if( !m_netHighlightString.IsEmpty() && item && m_netHighlightString == item->GetNetAttributes().m_Netname ) return m_layerColorsHi[aLayer]; - if( !m_componentHighlightString.IsEmpty() && + if( !m_componentHighlightString.IsEmpty() && item && m_componentHighlightString == item->GetNetAttributes().m_Cmpref ) return m_layerColorsHi[aLayer]; - if( !m_attributeHighlightString.IsEmpty() && item->GetDcodeDescr() && + if( !m_attributeHighlightString.IsEmpty() && item && item->GetDcodeDescr() && m_attributeHighlightString == item->GetDcodeDescr()->m_AperFunction ) return m_layerColorsHi[aLayer]; diff --git a/pcbnew/dialogs/dialog_keepout_area_properties.cpp b/pcbnew/dialogs/dialog_keepout_area_properties.cpp index 60e109320d..a29be6fd99 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties.cpp @@ -221,7 +221,7 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::OnLayerSelection( wxDataViewEvent& event ) BOARD* board = m_parent->GetBoard(); LSEQ cu_stack = LSET::AllCuMask( board->GetCopperLayerCount() ).UIOrder(); - if( row < (int)cu_stack.size() ) + if( row >= 0 && row < (int)cu_stack.size() ) { m_zonesettings.m_Layers.set( cu_stack[ row ], selected ); } diff --git a/pcbnew/exporters/gen_modules_placefile.cpp b/pcbnew/exporters/gen_modules_placefile.cpp index 3ef2783211..a2e3fd7332 100644 --- a/pcbnew/exporters/gen_modules_placefile.cpp +++ b/pcbnew/exporters/gen_modules_placefile.cpp @@ -4,7 +4,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2015-2016 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2015-2016 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 @@ -184,7 +184,7 @@ void DIALOG_GEN_MODULE_POSITION::OnOutputDirectoryBrowseClicked( wxCommandEvent& wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() ); - wxMessageDialog dialog( this, _( "Use a relative path? "), + wxMessageDialog dialog( this, _( "Use a relative path?"), _( "Plot Output Directory" ), wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT ); diff --git a/pcbnew/specctra.cpp b/pcbnew/specctra.cpp index 0040a25dd2..ff193f753e 100644 --- a/pcbnew/specctra.cpp +++ b/pcbnew/specctra.cpp @@ -2799,6 +2799,7 @@ void SPECCTRA_DB::doWIRE( WIRE* growth ) case T_polyline_path: tok = T_path; + // Fall through case T_path: case T_polygon: if( growth->shape ) diff --git a/pcbnew/specctra.h b/pcbnew/specctra.h index 9b0340a2d7..ac6fb94beb 100644 --- a/pcbnew/specctra.h +++ b/pcbnew/specctra.h @@ -958,8 +958,11 @@ public: const char* quote = out->GetQuoteChar( name.c_str() ); out->Print( 0, " %s%s%s", quote, name.c_str(), quote ); } + // Could be not needed: +#if 1 else out->Print( 0, " \"\"" ); // the zone with no name or net_code == 0 +#endif if( sequence_number != -1 ) out->Print( 0, " (sequence_number %d)", sequence_number );