From 133cfbfa7f4ec62ddc97bd93d4a50fec81b52362 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Wed, 2 Feb 2011 22:05:54 +0100 Subject: [PATCH] Fixed several compiler warnings uninitialized or unused variables, init sequence, ... --- src/AIModel/AIBase.cxx | 2 +- src/AIModel/AIWingman.cxx | 4 ++-- src/FDM/YASim/Gear.cpp | 6 ++++-- src/FDM/YASim/Rotorpart.cpp | 4 ++-- src/Instrumentation/dclgps.cxx | 2 +- src/Instrumentation/heading_indicator_dg.cxx | 1 - src/Instrumentation/rnav_waypt_controller.cxx | 3 +++ src/Time/sunsolver.cxx | 3 +-- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index 1e3b775d4..33cb073cb 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -59,8 +59,8 @@ FGAIBase::FGAIBase(object_type ot) : props( NULL ), model_removed( fgGetNode("/ai/models/model-removed", true) ), manager( NULL ), - fp( NULL ), _installed(false), + fp( NULL ), _impact_lat(0), _impact_lon(0), _impact_elev(0), diff --git a/src/AIModel/AIWingman.cxx b/src/AIModel/AIWingman.cxx index cef9ad737..be053c447 100644 --- a/src/AIModel/AIWingman.cxx +++ b/src/AIModel/AIWingman.cxx @@ -375,7 +375,7 @@ void FGAIWingman::Break(double dt) { void FGAIWingman::Join(double dt) { double range, bearing, az2; - double parent_hdg, parent_spd, parent_ht= 0; + double parent_hdg, parent_spd = 0; double p_hdg, p_pch, p_rll = 0; setTgtOffsets(dt, 25); @@ -425,7 +425,7 @@ void FGAIWingman::Join(double dt) { double rel_brg = calcRelBearingDeg(bearing, hdg); double recip_brg = calcRecipBearingDeg(bearing); double angle = calcAngle(distance,_offsetpos, pos); - double approx_angle = atan2(daltM, range); + //double approx_angle = atan2(daltM, range); double frm_spd = 50; // formation speed double join_rnge = 1000.0; double recip_parent_hdg = calcRecipBearingDeg(parent_hdg); diff --git a/src/FDM/YASim/Gear.cpp b/src/FDM/YASim/Gear.cpp index 886a1a989..ce2517c73 100644 --- a/src/FDM/YASim/Gear.cpp +++ b/src/FDM/YASim/Gear.cpp @@ -332,8 +332,10 @@ void Gear::calcForce(RigidBody* body, State *s, float* v, float* rot) float b = ground[3] - Math::dot3(tmp, ground)+BumpAltitude; // Calculate the point of ground _contact. - _frac = a/(a-b); - if(b < 0) _frac = 1; + if(b < 0) + _frac = 1; + else + _frac = a/(a-b); for(i=0; i<3; i++) _contact[i] = _pos[i] + _frac*_cmpr[i]; diff --git a/src/FDM/YASim/Rotorpart.cpp b/src/FDM/YASim/Rotorpart.cpp index 77520dee9..bd54f4122 100644 --- a/src/FDM/YASim/Rotorpart.cpp +++ b/src/FDM/YASim/Rotorpart.cpp @@ -99,7 +99,7 @@ void Rotorpart::inititeration(float dt,float *rot) float b; b=_rotor->getBalance(); float s =Math::sin(_phi+_direction); - float c =Math::cos(_phi+_direction); + //float c =Math::cos(_phi+_direction); if (s>0) _balance=(b>0)?(1.-s*(1.-b)):(1.-s)*(1.+b); else @@ -548,7 +548,7 @@ void Rotorpart::calcForce(float* v, float rho, float* out, float* torque, float dirblade[3]; Math::cross3(_normal,_directionofcentripetalforce,dirblade); - float vblade=Math::abs(Math::dot3(dirblade,v)); + //float vblade=Math::abs(Math::dot3(dirblade,v)); alpha=_alphaalt+(alpha-_alphaalt)*factor; _alpha=alpha; diff --git a/src/Instrumentation/dclgps.cxx b/src/Instrumentation/dclgps.cxx index 58e87dc20..ec78643aa 100644 --- a/src/Instrumentation/dclgps.cxx +++ b/src/Instrumentation/dclgps.cxx @@ -654,7 +654,7 @@ string DCLGPS::ExpandSIAPIdent(const string& ident) { Col 107-111 MSA center fix. We can ignore this. */ void DCLGPS::LoadApproachData() { - FGNPIAP* iap; + FGNPIAP* iap = NULL; GPSWaypoint* wp; GPSFlightPlan* fp; const GPSWaypoint* cwp; diff --git a/src/Instrumentation/heading_indicator_dg.cxx b/src/Instrumentation/heading_indicator_dg.cxx index 9bcd19b67..bb9c1620e 100644 --- a/src/Instrumentation/heading_indicator_dg.cxx +++ b/src/Instrumentation/heading_indicator_dg.cxx @@ -125,7 +125,6 @@ HeadingIndicatorDG::update (double dt) double yaw_rate = _yaw_rate_node->getDoubleValue(); double error = _error_node->getDoubleValue(); double g = _g_node->getDoubleValue(); - int sign = 0; if ( fabs ( yaw_rate ) > 5 ) { error += 0.033 * -yaw_rate * dt ; diff --git a/src/Instrumentation/rnav_waypt_controller.cxx b/src/Instrumentation/rnav_waypt_controller.cxx index 278484d0a..e728b88d2 100644 --- a/src/Instrumentation/rnav_waypt_controller.cxx +++ b/src/Instrumentation/rnav_waypt_controller.cxx @@ -342,6 +342,9 @@ public: case RESTRICT_NONE: assert(false); break; + case SPEED_RESTRICT_MACH: + assert(false); + break; } } diff --git a/src/Time/sunsolver.cxx b/src/Time/sunsolver.cxx index b903f5e56..b45e0bf2c 100644 --- a/src/Time/sunsolver.cxx +++ b/src/Time/sunsolver.cxx @@ -53,13 +53,12 @@ void fgSunPositionGST(double gst, double *lon, double *lat) { /* double *lat; (return) latitude */ /* double *lon; (return) longitude */ - double alpha, delta; double tmp; SGPropertyNode* sun = fgGetNode("/ephemeris/sun"); assert(sun); double xs = sun->getDoubleValue("xs"); - double ys = sun->getDoubleValue("ys"); + //double ys = sun->getDoubleValue("ys"); double ye = sun->getDoubleValue("ye"); double ze = sun->getDoubleValue("ze"); double ra = atan2(ye, xs);