Fix some coverity and cppcheck warnings (most are very minor issues: not initialized members and initialized but not used variables)

This commit is contained in:
jean-pierre charras 2015-03-04 10:26:00 +01:00
parent 5f1c9060ac
commit a550ff84db
15 changed files with 76 additions and 9 deletions

View File

@ -30,7 +30,7 @@
#endif
#ifndef KICAD_BUILD_VERSION
# define KICAD_BUILD_VERSION "(after 2015-jan-16 BZR unknown)"
# define KICAD_BUILD_VERSION "(after 2015-mar-04 BZR unknown)"
#endif
/**

View File

@ -90,9 +90,9 @@ bool LIB_BEZIER::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
return false;
}
p = strtok( line + 2, " \t\n" );
p = strtok( NULL, " \t\n" );
p = strtok( NULL, " \t\n" );
strtok( line + 2, " \t\n" ); // Skip field
strtok( NULL, " \t\n" ); // Skip field
strtok( NULL, " \t\n" ); // Skip field
p = strtok( NULL, " \t\n" );
for( i = 0; i < ccount; i++ )

View File

@ -95,9 +95,9 @@ bool LIB_POLYLINE::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
return false;
}
p = strtok( line + 2, " \t\n" );
p = strtok( NULL, " \t\n" );
p = strtok( NULL, " \t\n" );
strtok( line + 2, " \t\n" ); // Skip field
strtok( NULL, " \t\n" ); // Skip field
strtok( NULL, " \t\n" ); // Skip field
p = strtok( NULL, " \t\n" );
for( i = 0; i < ccount; i++ )

View File

@ -58,7 +58,7 @@ class WORKSHEET_LAYOUT_IO
protected:
OUTPUTFORMATTER* m_out;
WORKSHEET_LAYOUT_IO() {}
WORKSHEET_LAYOUT_IO() { m_out = NULL; }
virtual ~WORKSHEET_LAYOUT_IO() {}
public:

View File

@ -37,6 +37,12 @@ ATTENUATOR::ATTENUATOR( ATTENUATORS_TYPE aTopology )
m_MinimumATT = 0.0; // dB
m_SchBitMap = NULL;
m_FormulaBitMap = NULL;
// Initialize these variables mainly to avoid warnings from a static analyzer
m_R1 = 0.0;
m_R2 = 0.0;
m_R3 = 0.0;
Lmin = L = A = 0.0; // internal variable for temporary use
}

View File

@ -40,6 +40,14 @@ C_MICROSTRIP::C_MICROSTRIP() : TRANSLINE()
{
m_name = "Coupled_MicroStrip";
aux_ms = NULL;
// Initialize these variables mainly to avoid warnings from a static analyzer
er_eff = 0.0; // dummy
w_eff = 0.0; // Effective width of line
atten_dielectric_e = 0.0; // even-mode dielectric losses (dB)
atten_cond_e = 0.0; // even-mode conductors losses (dB)
atten_dielectric_o = 0.0; // odd-mode conductors losses (dB)
atten_cond_o = 0.0; // odd-mode conductors losses (dB)
}

View File

@ -41,6 +41,13 @@
COAX::COAX() : TRANSLINE()
{
m_name = "Coax";
// Initialize these variables mainly to avoid warnings from a static analyzer
Z0 = 0.0; // characteristic impedance
ang_l = 0.0; // Electrical length in angle
atten_dielectric = 0.0; // Loss in dielectric (dB)
atten_cond = 0.0; // Loss in conductors (dB)
fc = 0.0; // Cutoff frequency for higher order modes
}

View File

@ -36,6 +36,13 @@ COPLANAR::COPLANAR() : TRANSLINE()
{
m_name = "CoPlanar";
backMetal = false;
// Initialize these variables mainly to avoid warnings from a static analyzer
Z0 = 0.0; // characteristic impedance
ang_l = 0.0; // Electrical length in angle
atten_dielectric = 0.0; // Loss in dielectric (dB)
atten_cond = 0.0; // Loss in conductors (dB)
er_eff = 1.0; // Effective dielectric constant
}

View File

@ -41,6 +41,13 @@
MICROSTRIP::MICROSTRIP() : TRANSLINE()
{
m_name = "MicroStrip";
// Initialize these variables mainly to avoid warnings from a static analyzer
mur_eff = 0.0; // Effective mag. permeability
w_eff = 0.0; // Effective width of line
atten_dielectric = 0.0; // Loss in dielectric (dB)
atten_cond = 0.0; // Loss in conductors (dB)
Z0_h_1 = 0.0; // homogeneous stripline impedance
}

View File

@ -32,6 +32,13 @@
RECTWAVEGUIDE::RECTWAVEGUIDE() : TRANSLINE()
{
m_name = "RectWaveGuide";
// Initialize these here variables mainly to avoid warnings from a static analyzer
er_eff = 0.0; // Effective dielectric constant
mur_eff = 0.0; // Effective mag. permeability
atten_dielectric = 0.0; // Loss in dielectric (dB)
atten_cond = 0.0; // Loss in conductors (dB)
fc10 = 0.0; // Cutoff frequency for TE10 mode
}

View File

@ -34,6 +34,13 @@
STRIPLINE::STRIPLINE() : TRANSLINE()
{
m_name = "StripLine";
// Initialize these variables mainly to avoid warnings from a static analyzer
Z0 = 0.0; // characteristic impedance
ang_l = 0.0; // Electrical length in angle
er_eff = 0.0; // effective dielectric constant
atten_dielectric = 0.0; // Loss in dielectric (dB)
atten_cond = 0.0; // Loss in conductors (dB)
}

View File

@ -62,6 +62,13 @@ TRANSLINE::TRANSLINE()
{
murC = 1.0;
m_name = (const char*) 0;
// Initialize these variables mainly to avoid warnings from a static analyzer
f = 0.0; // Frequency of operation
er = 0.0; // dielectric constant
tand = 0.0; // Dielectric Loss Tangent
sigma = 0.0; // Conductivity of the metal
skindepth = 0.0; // Skin depth
}

View File

@ -34,6 +34,13 @@
TWISTEDPAIR::TWISTEDPAIR() : TRANSLINE()
{
m_name = "TwistedPair";
// Initialize these variables mainly to avoid warnings from a static analyzer
Z0 = 0.0; // characteristic impedance
ang_l = 0.0; // Electrical length in angle
atten_dielectric = 0.0; // Loss in dielectric (dB)
atten_cond = 0.0; // Loss in conductors (dB)
er_eff = 1.0; // Effective dielectric constant
}

View File

@ -72,6 +72,7 @@ TRANSLINE_PRM::TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId,
m_ValueCtrl = NULL;
m_UnitCtrl = NULL;
m_UnitSelection = 0;
m_NormalizedValue = 0;
}

View File

@ -690,7 +690,10 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD
if( aFrame->GetCanvas()->GetAbortRequest() )
{
if( IsOK( aFrame, _( "OK to abort?" ) ) )
{
displ_opts->m_Show_Module_Ratsnest = showRats;
return ESC;
}
else
aFrame->GetCanvas()->SetAbortRequest( false );
}