From e5b81a8bb62957e741f79d4a3e4fe5244ca8c26d Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Tue, 25 Sep 2012 22:09:26 +0200 Subject: [PATCH] Minor pointer safety and compiler warning issues. --- src/Aircraft/controls.cxx | 8 ++++++++ src/Airports/dynamicloader.cxx | 10 +++++----- src/Airports/gnnode.cxx | 2 +- src/Scenery/scenery.cxx | 7 ++++++- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/Aircraft/controls.cxx b/src/Aircraft/controls.cxx index 8ff11133c..50134d196 100644 --- a/src/Aircraft/controls.cxx +++ b/src/Aircraft/controls.cxx @@ -74,6 +74,8 @@ FGControls::FGControls() : mode( 0 ), dump( false ), outflow_valve( 0.0 ), + landing_lights( false ), + turn_off_lights( false ), taxi_light( false ), logo_lights( false ), nav_lights( false ), @@ -87,6 +89,7 @@ FGControls::FGControls() : release_ALL( false ), vertical_adjust( 0.0 ), fore_aft_adjust( 0.0 ), + cmd_selector_valve( 0 ), off_start_run( 0 ), APU_fire_switch( false ), autothrottle_arm( false ), @@ -166,6 +169,8 @@ void FGControls::reset_all() // Destructor FGControls::~FGControls() { + if (globals) + globals->set_controls( NULL ); } @@ -651,6 +656,9 @@ void FGControls::update (double dt) { SG_UNUSED(dt); + + // nothing here, don't call again + suspend(); } //////////////////////////////////////////////////////////////////////// diff --git a/src/Airports/dynamicloader.cxx b/src/Airports/dynamicloader.cxx index c7b74a58f..79fa1f36e 100644 --- a/src/Airports/dynamicloader.cxx +++ b/src/Airports/dynamicloader.cxx @@ -60,7 +60,7 @@ void FGAirportDynamicsXMLLoader::endXML () { void FGAirportDynamicsXMLLoader::startParking(const XMLAttributes &atts) { string type; - int index; + int index = 0; string gateName, gateNumber; string lat, lon; double heading = 0.0; @@ -108,10 +108,10 @@ void FGAirportDynamicsXMLLoader::startParking(const XMLAttributes &atts) void FGAirportDynamicsXMLLoader::startNode(const XMLAttributes &atts) { - int index; + int index = 0; string lat, lon; - bool onRunway; - int holdPointType; + bool onRunway = false; + int holdPointType = 0; for (int i = 0; i < atts.size() ; i++) { @@ -147,7 +147,7 @@ void FGAirportDynamicsXMLLoader::startNode(const XMLAttributes &atts) void FGAirportDynamicsXMLLoader::startArc(const XMLAttributes &atts) { - int begin, end; + int begin = 0, end = 0; bool isPushBackRoute = false; for (int i = 0; i < atts.size() ; i++) diff --git a/src/Airports/gnnode.cxx b/src/Airports/gnnode.cxx index 41e746305..85fc93022 100644 --- a/src/Airports/gnnode.cxx +++ b/src/Airports/gnnode.cxx @@ -31,8 +31,8 @@ void FGTaxiNode::setElevation(double val) double FGTaxiNode::getElevationFt(double refelev) { - double elevF = elevation(); #if 0 + double elevF = elevation(); double elevationEnd = 0; if ((elevF == 0) || (elevF == refelev)) { SGGeod center2 = mPosition; diff --git a/src/Scenery/scenery.cxx b/src/Scenery/scenery.cxx index 4b787ddb3..5ed687e83 100644 --- a/src/Scenery/scenery.cxx +++ b/src/Scenery/scenery.cxx @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -249,7 +250,11 @@ void FGScenery::init() { } -void FGScenery::update(double dt) { +void FGScenery::update(double dt) +{ + SG_UNUSED(dt); + // nothing here, don't call again + suspend(); } -- 2.39.5