Commit a550ff84 authored by jean-pierre charras's avatar jean-pierre charras

Fix some coverity and cppcheck warnings (most are very minor issues: not...

Fix some coverity and cppcheck warnings (most are very minor issues: not initialized members and initialized but not used variables)
parent 5f1c9060
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#endif #endif
#ifndef KICAD_BUILD_VERSION #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 #endif
/** /**
......
...@@ -90,9 +90,9 @@ bool LIB_BEZIER::Load( LINE_READER& aLineReader, wxString& aErrorMsg ) ...@@ -90,9 +90,9 @@ bool LIB_BEZIER::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
return false; return false;
} }
p = strtok( line + 2, " \t\n" ); strtok( line + 2, " \t\n" ); // Skip field
p = strtok( NULL, " \t\n" ); strtok( NULL, " \t\n" ); // Skip field
p = strtok( NULL, " \t\n" ); strtok( NULL, " \t\n" ); // Skip field
p = strtok( NULL, " \t\n" ); p = strtok( NULL, " \t\n" );
for( i = 0; i < ccount; i++ ) for( i = 0; i < ccount; i++ )
......
...@@ -95,9 +95,9 @@ bool LIB_POLYLINE::Load( LINE_READER& aLineReader, wxString& aErrorMsg ) ...@@ -95,9 +95,9 @@ bool LIB_POLYLINE::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
return false; return false;
} }
p = strtok( line + 2, " \t\n" ); strtok( line + 2, " \t\n" ); // Skip field
p = strtok( NULL, " \t\n" ); strtok( NULL, " \t\n" ); // Skip field
p = strtok( NULL, " \t\n" ); strtok( NULL, " \t\n" ); // Skip field
p = strtok( NULL, " \t\n" ); p = strtok( NULL, " \t\n" );
for( i = 0; i < ccount; i++ ) for( i = 0; i < ccount; i++ )
......
...@@ -58,7 +58,7 @@ class WORKSHEET_LAYOUT_IO ...@@ -58,7 +58,7 @@ class WORKSHEET_LAYOUT_IO
protected: protected:
OUTPUTFORMATTER* m_out; OUTPUTFORMATTER* m_out;
WORKSHEET_LAYOUT_IO() {} WORKSHEET_LAYOUT_IO() { m_out = NULL; }
virtual ~WORKSHEET_LAYOUT_IO() {} virtual ~WORKSHEET_LAYOUT_IO() {}
public: public:
......
...@@ -37,6 +37,12 @@ ATTENUATOR::ATTENUATOR( ATTENUATORS_TYPE aTopology ) ...@@ -37,6 +37,12 @@ ATTENUATOR::ATTENUATOR( ATTENUATORS_TYPE aTopology )
m_MinimumATT = 0.0; // dB m_MinimumATT = 0.0; // dB
m_SchBitMap = NULL; m_SchBitMap = NULL;
m_FormulaBitMap = 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
} }
......
...@@ -40,6 +40,14 @@ C_MICROSTRIP::C_MICROSTRIP() : TRANSLINE() ...@@ -40,6 +40,14 @@ C_MICROSTRIP::C_MICROSTRIP() : TRANSLINE()
{ {
m_name = "Coupled_MicroStrip"; m_name = "Coupled_MicroStrip";
aux_ms = NULL; 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)
} }
......
...@@ -41,6 +41,13 @@ ...@@ -41,6 +41,13 @@
COAX::COAX() : TRANSLINE() COAX::COAX() : TRANSLINE()
{ {
m_name = "Coax"; 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
} }
......
...@@ -36,6 +36,13 @@ COPLANAR::COPLANAR() : TRANSLINE() ...@@ -36,6 +36,13 @@ COPLANAR::COPLANAR() : TRANSLINE()
{ {
m_name = "CoPlanar"; m_name = "CoPlanar";
backMetal = false; 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
} }
......
...@@ -41,6 +41,13 @@ ...@@ -41,6 +41,13 @@
MICROSTRIP::MICROSTRIP() : TRANSLINE() MICROSTRIP::MICROSTRIP() : TRANSLINE()
{ {
m_name = "MicroStrip"; 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
} }
......
...@@ -32,6 +32,13 @@ ...@@ -32,6 +32,13 @@
RECTWAVEGUIDE::RECTWAVEGUIDE() : TRANSLINE() RECTWAVEGUIDE::RECTWAVEGUIDE() : TRANSLINE()
{ {
m_name = "RectWaveGuide"; 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
} }
......
...@@ -34,6 +34,13 @@ ...@@ -34,6 +34,13 @@
STRIPLINE::STRIPLINE() : TRANSLINE() STRIPLINE::STRIPLINE() : TRANSLINE()
{ {
m_name = "StripLine"; 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)
} }
......
...@@ -62,6 +62,13 @@ TRANSLINE::TRANSLINE() ...@@ -62,6 +62,13 @@ TRANSLINE::TRANSLINE()
{ {
murC = 1.0; murC = 1.0;
m_name = (const char*) 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
} }
......
...@@ -34,6 +34,13 @@ ...@@ -34,6 +34,13 @@
TWISTEDPAIR::TWISTEDPAIR() : TRANSLINE() TWISTEDPAIR::TWISTEDPAIR() : TRANSLINE()
{ {
m_name = "TwistedPair"; 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
} }
......
...@@ -72,7 +72,8 @@ TRANSLINE_PRM::TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId, ...@@ -72,7 +72,8 @@ TRANSLINE_PRM::TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId,
m_ValueCtrl = NULL; m_ValueCtrl = NULL;
m_UnitCtrl = NULL; m_UnitCtrl = NULL;
m_UnitSelection = 0; m_UnitSelection = 0;
} m_NormalizedValue = 0;
}
#define TRANSLINE_PRM_KEY wxT( "translineprm%d" ) #define TRANSLINE_PRM_KEY wxT( "translineprm%d" )
......
...@@ -690,7 +690,10 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD ...@@ -690,7 +690,10 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD
if( aFrame->GetCanvas()->GetAbortRequest() ) if( aFrame->GetCanvas()->GetAbortRequest() )
{ {
if( IsOK( aFrame, _( "OK to abort?" ) ) ) if( IsOK( aFrame, _( "OK to abort?" ) ) )
{
displ_opts->m_Show_Module_Ratsnest = showRats;
return ESC; return ESC;
}
else else
aFrame->GetCanvas()->SetAbortRequest( false ); aFrame->GetCanvas()->SetAbortRequest( false );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment