From c40470ed0bec9173b120cba3f2e91e021380f4d9 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Tue, 22 Sep 2020 12:29:13 +0100 Subject: [PATCH] Initialize more variables --- common/widgets/mathplot.cpp | 35 ++++++++++++++++++++++ include/widgets/mathplot.h | 2 +- kicad/kicad_settings.cpp | 4 ++- pcb_calculator/transline/c_microstrip.cpp | 30 +++++++++++++++++-- pcb_calculator/transline/microstrip.cpp | 19 +++++++++++- pcb_calculator/transline/rectwaveguide.cpp | 16 ++++++++-- utils/idftools/idf_common.cpp | 29 +++++++++--------- 7 files changed, 113 insertions(+), 22 deletions(-) diff --git a/common/widgets/mathplot.cpp b/common/widgets/mathplot.cpp index e38117d59b..82003223a6 100644 --- a/common/widgets/mathplot.cpp +++ b/common/widgets/mathplot.cpp @@ -1695,6 +1695,41 @@ EVT_MENU( mpID_ZOOM_OUT, mpWindow::OnZoomOut ) EVT_MENU( mpID_LOCKASPECT, mpWindow::OnLockAspect ) END_EVENT_TABLE() +mpWindow::mpWindow() : wxWindow(), + m_lockaspect( false ), + m_minX( 0.0 ), + m_maxX( 0.0 ), + m_minY( 0.0 ), + m_maxY( 0.0 ), + m_scaleX( 1.0 ), + m_scaleY( 1.0 ), + m_posX( 0.0 ), + m_posY( 0.0 ), + m_scrX( 64 ), + m_scrY( 64 ), + m_clickedX( 0 ), + m_clickedY( 0 ), + m_desiredXmin( 0.0 ), + m_desiredXmax( 1.0 ), + m_desiredYmin( 0.0 ), + m_desiredYmax( 1.0 ), + m_marginTop( 0 ), + m_marginRight( 0 ), + m_marginBottom( 0 ), + m_marginLeft( 0 ), + m_last_lx( 0 ), + m_last_ly( 0 ), + m_buff_bmp( nullptr ), + m_enableDoubleBuffer( false ), + m_enableMouseNavigation( true ), + m_enableMouseWheelPan( false ), + m_enableLimitedView( false ), + m_enableScrollBars( false ), + m_movingInfoLayer( nullptr ), + m_zooming( false ) +{ +} + mpWindow::mpWindow( wxWindow* parent, wxWindowID id, const wxPoint& pos, diff --git a/include/widgets/mathplot.h b/include/widgets/mathplot.h index 16bfe085fa..df8f5ca650 100644 --- a/include/widgets/mathplot.h +++ b/include/widgets/mathplot.h @@ -1047,7 +1047,7 @@ typedef std::deque wxLayerList; class WXDLLIMPEXP_MATHPLOT mpWindow : public wxWindow { public: - mpWindow() {} + mpWindow(); mpWindow( wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, diff --git a/kicad/kicad_settings.cpp b/kicad/kicad_settings.cpp index 697fbd028c..6db07324d7 100644 --- a/kicad/kicad_settings.cpp +++ b/kicad/kicad_settings.cpp @@ -26,7 +26,9 @@ const int kicadSchemaVersion = 0; -KICAD_SETTINGS::KICAD_SETTINGS() : APP_SETTINGS_BASE( "kicad", kicadSchemaVersion ) +KICAD_SETTINGS::KICAD_SETTINGS() : + APP_SETTINGS_BASE( "kicad", kicadSchemaVersion ), + m_LeftWinWidth( 200 ) { m_params.emplace_back( new PARAM( "appearance.left_frame_width", &m_LeftWinWidth, 200 ) ); diff --git a/pcb_calculator/transline/c_microstrip.cpp b/pcb_calculator/transline/c_microstrip.cpp index 4d63b60ba0..2c4c2ed742 100644 --- a/pcb_calculator/transline/c_microstrip.cpp +++ b/pcb_calculator/transline/c_microstrip.cpp @@ -36,10 +36,36 @@ #include #include -C_MICROSTRIP::C_MICROSTRIP() : TRANSLINE() +C_MICROSTRIP::C_MICROSTRIP() : TRANSLINE(), + h( 0.0 ), // height of substrate + ht( 0.0 ), // height to the top of box + t( 0.0 ), // thickness of top metal + rough( 0.0 ), // Roughness of top metal + w( 0.0 ), // width of lines + w_t_e( 0.0 ), // even-mode thickness-corrected line width + w_t_o( 0.0 ), // odd-mode thickness-corrected line width + l( 0.0 ), // length of lines + s( 0.0 ), // spacing of lines + Z0_e_0( 0.0 ), // static even-mode impedance + Z0_o_0( 0.0 ), // static odd-mode impedance + Z0e( 0.0 ), // even-mode impedance + Z0o( 0.0 ), // odd-mode impedance + c_e( 0.0 ), // even-mode capacitance + c_o( 0.0 ), // odd-mode capacitance + ang_l_e( 0.0 ), // even-mode electrical length in angle + ang_l_o( 0.0 ), // odd-mode electrical length in angle + er_eff_e( 0.0 ), // even-mode effective dielectric constant + er_eff_o( 0.0 ), // odd-mode effective dielectric constant + er_eff_e_0( 0.0 ), // static even-mode effective dielectric constant + er_eff_o_0( 0.0 ), // static odd-mode effective dielectric constant + 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 dielectric losses (dB) + atten_cond_o( 0.0 ), // odd-mode conductors losses (dB) + aux_ms( nullptr ) { m_Name = "Coupled_MicroStrip"; - aux_ms = NULL; Init(); } diff --git a/pcb_calculator/transline/microstrip.cpp b/pcb_calculator/transline/microstrip.cpp index bea22ee14a..95329b2ba1 100644 --- a/pcb_calculator/transline/microstrip.cpp +++ b/pcb_calculator/transline/microstrip.cpp @@ -39,7 +39,24 @@ #include -MICROSTRIP::MICROSTRIP() : TRANSLINE() +MICROSTRIP::MICROSTRIP() : TRANSLINE(), + h( 0.0 ), // height of substrate + ht( 0.0 ), // height to the top of box + t( 0.0 ), // thickness of top metal + rough( 0.0 ), // Roughness of top metal + mur( 0.0 ), // magnetic permeability of substrate + w( 0.0 ), // width of line + l( 0.0 ), // length of line + Z0_0( 0.0 ), // static characteristic impedance + Z0( 0.0 ), // characteristic impedance + ang_l( 0.0 ), // Electrical length in angle + er_eff_0( 0.0 ), // Static effective dielectric constant + er_eff( 0.0 ), // Effective dielectric constant + 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 { m_Name = "MicroStrip"; Init(); diff --git a/pcb_calculator/transline/rectwaveguide.cpp b/pcb_calculator/transline/rectwaveguide.cpp index 85c8f4bb9f..48b0c5c366 100644 --- a/pcb_calculator/transline/rectwaveguide.cpp +++ b/pcb_calculator/transline/rectwaveguide.cpp @@ -28,11 +28,21 @@ #include #include -RECTWAVEGUIDE::RECTWAVEGUIDE() : TRANSLINE() +RECTWAVEGUIDE::RECTWAVEGUIDE() : TRANSLINE(), + mur( 0.0 ), // magnetic permeability of substrate + a( 0.0 ), // width of waveguide + b( 0.0 ), // height of waveguide + l( 0.0 ), // length of waveguide + Z0( 0.0 ), // characteristic impedance + Z0EH( 0.0 ), // characteristic impedance of field quantities*/ + ang_l( 0.0 ), // Electrical length in angle + 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( 1.0 ) // Cutoff frequency for TE10 mode { m_Name = "RectWaveGuide"; - fc10 = 1.0; // Cutoff frequency for TE10 mode - Init(); } diff --git a/utils/idftools/idf_common.cpp b/utils/idftools/idf_common.cpp index bc7dc1ac46..7f83f1e714 100644 --- a/utils/idftools/idf_common.cpp +++ b/utils/idftools/idf_common.cpp @@ -1029,28 +1029,29 @@ void IDF3::GetOutline( std::list& aLines, } -IDF_SEGMENT::IDF_SEGMENT() +IDF_SEGMENT::IDF_SEGMENT() : + angle( 0.0 ), + offsetAngle( 0.0 ), + radius( 0.0 ) { - angle = 0.0; - offsetAngle = 0.0; - radius = 0.0; } -IDF_SEGMENT::IDF_SEGMENT( const IDF_POINT& aStartPoint, const IDF_POINT& aEndPoint ) +IDF_SEGMENT::IDF_SEGMENT( const IDF_POINT& aStartPoint, const IDF_POINT& aEndPoint ) : + startPoint( aStartPoint ), + endPoint( aEndPoint ), + angle( 0.0 ), + offsetAngle( 0.0), + radius( 0.0 ) { - angle = 0.0; - offsetAngle = 0.0; - radius = 0.0; - startPoint = aStartPoint; - endPoint = aEndPoint; } -IDF_SEGMENT::IDF_SEGMENT( const IDF_POINT& aStartPoint, - const IDF_POINT& aEndPoint, - double aAngle, - bool aFromKicad ) +IDF_SEGMENT::IDF_SEGMENT( const IDF_POINT& aStartPoint, const IDF_POINT& aEndPoint, double aAngle, + bool aFromKicad ) : + angle( 0.0 ), + offsetAngle( 0.0 ), + radius( 0.0 ) { double diff = abs( aAngle ) - 360.0;