Fix a few Coverity warnings.

This commit is contained in:
jean-pierre charras 2023-11-25 11:44:01 +01:00
parent 1cf9da4b69
commit d4ce2c8982
5 changed files with 16 additions and 11 deletions

View File

@ -625,7 +625,7 @@ int COMMON_TOOLS::TogglePolarCoords( const TOOL_EVENT& aEvent )
int COMMON_TOOLS::ResetLocalCoords( const TOOL_EVENT& aEvent )
{
auto vcSettings = m_toolMgr->GetCurrentToolVC();
const KIGFX::VC_SETTINGS& vcSettings = m_toolMgr->GetCurrentToolVC();
// Use either the active tool forced cursor position or the general settings
if( vcSettings.m_forceCursorPosition )

View File

@ -32,6 +32,17 @@
#include <gal/painter.h>
#include <zoom_defines.h>
SCH_PRINTOUT::SCH_PRINTOUT( SCH_EDIT_FRAME* aParent, const wxString& aTitle, bool aUseCairo ) :
wxPrintout( aTitle )
{
wxASSERT( aParent != nullptr );
m_parent = aParent;
m_useCairo = aUseCairo;
m_view = nullptr;
}
void SCH_PRINTOUT::GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo )
{
*minPage = *selPageFrom = 1;

View File

@ -38,13 +38,7 @@ class PAINTER;
class SCH_PRINTOUT : public wxPrintout
{
public:
SCH_PRINTOUT( SCH_EDIT_FRAME* aParent, const wxString& aTitle, bool aUseCairo ) :
wxPrintout( aTitle )
{
//wxASSERT( aParent != nullptr );
m_parent = aParent;
m_useCairo = aUseCairo;
}
SCH_PRINTOUT( SCH_EDIT_FRAME* aParent, const wxString& aTitle, bool aUseCairo );
bool OnPrintPage( int page ) override;
bool HasPage( int page ) override;

View File

@ -185,8 +185,8 @@ void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
continue;
// Fields are of the format "(field (name "name") "12345")
auto fieldName = field.second.get_child_optional( "name" );
auto fieldValue = field.second.back().first;
const auto fieldName = field.second.get_child_optional( "name" );
const auto fieldValue = field.second.back().first;
if( !fieldName )
continue;

View File

@ -82,7 +82,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
void PCB_EDIT_FRAME::SwitchLayer( PCB_LAYER_ID layer )
{
PCB_LAYER_ID curLayer = GetActiveLayer();
auto displ_opts = GetDisplayOptions();
const PCB_DISPLAY_OPTIONS& displ_opts = GetDisplayOptions();
// Check if the specified layer matches the present layer
if( layer == curLayer )