1
0
Fork 0

Clean up various compiler warnings that have crept into the code. This

by no means get's them all, but it's a start.
This commit is contained in:
curt 2004-04-01 15:27:53 +00:00
parent db79413b6e
commit 2acdd02879
31 changed files with 98 additions and 68 deletions

View file

@ -216,7 +216,7 @@ void FGAIAircraft::Run(double dt) {
double user_heading = manager->get_user_heading();
double user_pitch = manager->get_user_pitch();
double user_yaw = manager->get_user_yaw();
double user_speed = manager->get_user_speed();
// double user_speed = manager->get_user_speed();
// calculate range to target in feet and nautical miles
double lat_range = fabs(pos.lat() - user_latitude) * ft_per_deg_lat;

View file

@ -105,7 +105,7 @@ void FGAIStorm::Run(double dt) {
double user_heading = manager->get_user_heading();
double user_pitch = manager->get_user_pitch();
double user_yaw = manager->get_user_yaw();
double user_speed = manager->get_user_speed();
// double user_speed = manager->get_user_speed();
// calculate range to target in feet and nautical miles
double lat_range = fabs(pos.lat() - user_latitude) * ft_per_deg_lat;

View file

@ -84,7 +84,7 @@ void FGAIThermal::Run(double dt) {
ft_per_deg_lat = 366468.96 - 3717.12 * cos(pos.lat()/SG_RADIANS_TO_DEGREES);
ft_per_deg_lon = 365228.16 * cos(pos.lat() / SG_RADIANS_TO_DEGREES);
double altitude_ft = altitude * SG_METER_TO_FEET;
// double altitude_ft = altitude * SG_METER_TO_FEET;
//###########################//
// do calculations for range //
@ -93,7 +93,7 @@ void FGAIThermal::Run(double dt) {
// copy values from the AIManager
double user_latitude = manager->get_user_latitude();
double user_longitude = manager->get_user_longitude();
double user_altitude = manager->get_user_altitude();
// double user_altitude = manager->get_user_altitude();
// calculate range to target in feet and nautical miles
double lat_range = fabs(pos.lat() - user_latitude) * ft_per_deg_lat;

View file

@ -30,7 +30,7 @@ int main( int argc, char **argv ) {
double rwy_lon = atof( argv[5] );
double rwy_hdg = atof( argv[6] );
double rwy_len = atof( argv[7] ) * SG_DEGREES_TO_RADIANS;
double rwy_wid = atof( argv[8] );
// double rwy_wid = atof( argv[8] );
if ( dir == "FOR" ) {
rwy_hdg += 180.0;

View file

@ -34,6 +34,8 @@ FGPIDController::FGPIDController( SGPropertyNode *node ):
debug( false ),
y_n( 0.0 ),
r_n( 0.0 ),
y_scale( 1.0 ),
r_scale( 1.0 ),
Kp( 0.0 ),
alpha( 0.1 ),
beta( 1.0 ),
@ -45,9 +47,7 @@ FGPIDController::FGPIDController( SGPropertyNode *node ):
ep_n_1( 0.0 ),
edf_n_1( 0.0 ),
edf_n_2( 0.0 ),
u_n_1( 0.0 ),
r_scale( 1.0 ),
y_scale( 1.0 )
u_n_1( 0.0 )
{
int i;
for ( i = 0; i < node->nChildren(); ++i ) {
@ -344,10 +344,10 @@ FGPISimpleController::FGPISimpleController( SGPropertyNode *node ):
debug( false ),
y_n( 0.0 ),
r_n( 0.0 ),
u_min( 0.0 ),
u_max( 0.0 ),
y_scale( 1.0 ),
r_scale ( 1.0 )
r_scale ( 1.0 ),
u_min( 0.0 ),
u_max( 0.0 )
{
int i;
for ( i = 0; i < node->nChildren(); ++i ) {
@ -512,12 +512,12 @@ void FGPISimpleController::update( double dt ) {
FGPredictor::FGPredictor ( SGPropertyNode *node ):
debug( false ),
ivalue( 0.0 ),
last_value ( 999999999.9 ),
average ( 0.0 ),
seconds( 0.0 ),
filter_gain( 0.0 )
filter_gain( 0.0 ),
debug( false ),
ivalue( 0.0 )
{
int i;
for ( i = 0; i < node->nChildren(); ++i ) {

View file

@ -149,7 +149,7 @@ operator = (const fgTBI_instr & rhs )
else //if tsi enabled
{
float factor = My_box.right / 6.0;
// float factor = My_box.right / 6.0;
drawOneLine(cen_x-1.0, My_box.top, cen_x+1.0, My_box.top);
drawOneLine(cen_x-1.0, My_box.top, cen_x-1.0, My_box.top+10.0);

View file

@ -43,6 +43,8 @@
FGExternalPipe::FGExternalPipe( double dt, string name ) {
valid = true;
last_weight = 0.0;
last_cg_offset = -9999.9;
buf = new char[sizeof(char) + sizeof(int) + sizeof(ctrls)];
@ -168,6 +170,7 @@ void FGExternalPipe::init() {
SG_LOG( SG_IO, SG_ALERT, "Write error to named pipe: " << fifo_name_1 );
}
}
last_weight = weight;
if ( cg_offset > -5.0 || cg_offset < 5.0 ) {
sprintf( cmd, "1aircraft-cg-offset-inches=%.2f", cg_offset );
@ -176,6 +179,7 @@ void FGExternalPipe::init() {
SG_LOG( SG_IO, SG_ALERT, "Write error to named pipe: " << fifo_name_1 );
}
}
last_cg_offset = cg_offset;
SG_LOG( SG_IO, SG_INFO, "before sending reset command." );
@ -221,7 +225,6 @@ void FGExternalPipe::update( double dt ) {
last_weight = weight;
double cg_offset = fgGetDouble( "/sim/aircraft-cg-offset-inches" );
static double last_cg_offset = -9999.9;
if ( fabs( cg_offset - last_cg_offset ) > 0.01 ) {
char cmd[256];
sprintf( cmd, "1aircraft-cg-offset-inches=%.2f", cg_offset );
@ -241,18 +244,24 @@ void FGExternalPipe::update( double dt ) {
*((int *)ptr) = iterations;
ptr += sizeof(int);
memcpy( ptr, (char *)(&ctrls), length );
cout << "writing control structure to remote fdm." << endl;
result = write( pd1, buf, length + 1 );
if ( result == -1 ) {
SG_LOG( SG_IO, SG_ALERT, "Write error to named pipe: "
<< fifo_name_1 );
} else {
cout << " write successful = " << length + 1 << endl;
}
// Read fdm values
length = sizeof(fdm);
cout << "about to read fdm data from remote fdm." << endl;
result = read( pd2, (char *)(& fdm), length );
if ( result == -1 ) {
SG_LOG( SG_IO, SG_ALERT, "Read error from named pipe: "
<< fifo_name_2 );
} else {
cout << " read successful." << endl;
}
FGNetFDM2Props( &fdm, false );
#endif

View file

@ -44,6 +44,9 @@ private:
FGNetFDM fdm;
char *buf;
double last_weight;
double last_cg_offset;
public:
// Constructor

View file

@ -207,7 +207,7 @@ static SCALAR interp(SCALAR *y_table, SCALAR *x_table, int Ntable, SCALAR x)
void c172_aero( SCALAR dt, int Initialize ) {
static int init = 0;
// static int init = 0;
static int fi=0;
static SCALAR lastFlapHandle=0;
static SCALAR Ai;

View file

@ -46,8 +46,12 @@
$Header$
$Log$
Revision 1.1 2002/09/10 01:14:02 curt
Initial revision
Revision 1.2 2004/04/01 15:27:55 curt
Clean up various compiler warnings that have crept into the code. This
by no means get's them all, but it's a start.
Revision 1.1.1.1 2002/09/10 01:14:02 curt
Initial revision of FlightGear-0.9.0
Revision 1.1.1.1 1999/06/17 18:07:34 curt
Start of 0.7.x branch
@ -176,7 +180,7 @@ int nr_gaussj(double **a, int n, double **b, int m)
{
int *indxc, *indxr, *ipiv;
int i, icol, irow, j, k, l, ll;
int i, icol = 0, irow = 0, j, k, l, ll;
double big, dum, pivinv, temp;
int bexists = ((m != 0) || (b == 0));

View file

@ -55,7 +55,7 @@ void FGMagicCarpet::update( double dt ) {
if (is_suspended())
return;
int multiloop = _calc_multiloop(dt);
// int multiloop = _calc_multiloop(dt);
double time_step = dt;

View file

@ -212,7 +212,7 @@ float Airplane::getFuel(int tank)
float Airplane::setFuel(int tank, float fuel)
{
((Tank*)_tanks.get(tank))->fill = fuel;
return ((Tank*)_tanks.get(tank))->fill = fuel;
}
float Airplane::getFuelDensity(int tank)

View file

@ -515,7 +515,7 @@ Rotor* FGFDM::parseRotor(XMLAttributes* a, const char* type)
{
Rotor* w = new Rotor();
float defDihed = 0;
// float defDihed = 0;
float pos[3];
pos[0] = attrf(a, "x");

View file

@ -665,7 +665,7 @@ void Rotor::compile()
//_delta=omega*_delta;
_delta*=maxpitchforce/(_max_pitch*omega*lentocenter*2*_weight_per_blade*.453);
float phi=Math::atan2(2*omega*_delta,omega0*omega0-omega*omega);
float phi2=Math::abs(omega0-omega)<.000000001?pi/2:Math::atan(2*omega*_delta/(omega0*omega0-omega*omega));
// float phi2=Math::abs(omega0-omega)<.000000001?pi/2:Math::atan(2*omega*_delta/(omega0*omega0-omega*omega));
float relamp=omega*omega/(2*_delta*Math::sqrt(sqr(omega0*omega0-omega*omega)+4*_delta*_delta*omega*omega));
if (!_no_torque)
{
@ -699,7 +699,8 @@ void Rotor::compile()
<< " relamp: " << relamp
<< " delta: " <<_delta);
float lspeed[3],dirzentforce[3];
// float lspeed[3];
float dirzentforce[3];
float f=(!_ccw)?1:-1;
//Math::mul3(f*speed,directions[1],lspeed);

View file

@ -217,8 +217,8 @@ FGInput::makeDefault (bool status)
void
FGInput::doKey (int k, int modifiers, int x, int y)
{
static SGPropertyNode *heading_enabled
= fgGetNode("/autopilot/locks/heading", true);
// static SGPropertyNode *heading_enabled
// = fgGetNode("/autopilot/locks/heading", true);
// Sanity check.
if (k < 0 || k >= MAX_KEYS) {

View file

@ -49,8 +49,8 @@ adjust_range (double transmitter_elevation_ft, double aircraft_altitude_ft,
ADF::ADF ()
: _last_frequency_khz(-1),
_time_before_search_sec(0),
: _time_before_search_sec(0),
_last_frequency_khz(-1),
_transmitter_valid(false),
_transmitter_elevation_ft(0),
_transmitter_range_nm(0)

View file

@ -172,8 +172,9 @@ GPS::update (double delta_time_sec)
double wp_latitude_deg = _wp_latitude_node->getDoubleValue();
double wp_course_deg =
_wp_course_node->getDoubleValue();
double wp_distance, wp_bearing_deg, wp_actual_radial_deg,
wp_course_deviation_deg, wp_course_error_m, wp_TTW;
double wp_distance, wp_bearing_deg, wp_course_deviation_deg,
wp_course_error_m, wp_TTW;
// double wp_actual_radial_deg;
string wp_ID = _wp_ID_node->getStringValue();
// If the get-nearest-airport-node is true.

View file

@ -227,6 +227,11 @@ do_reinit (const SGPropertyNode * arg)
return result;
}
#if 0
//
// these routines look useful ??? but are never used in the code ???
//
/**
* Built-in command: suspend one or more subsystems.
*
@ -275,6 +280,8 @@ do_resume (const SGPropertyNode * arg)
return result;
}
#endif
/**
* Built-in command: load flight.

View file

@ -660,6 +660,11 @@ static double fgGetAirportElev( const string& id ) {
}
#if 0
//
// This function is never used, but maybe useful in the future ???
//
// Preset lon/lat given an airport id
static bool fgSetPosFromAirportID( const string& id ) {
FGAirport a;
@ -687,6 +692,7 @@ static bool fgSetPosFromAirportID( const string& id ) {
return false;
}
}
#endif
// Set current tower position lon/lat given an airport id
@ -1438,8 +1444,6 @@ bool fgInitSubsystems() {
// static const SGPropertyNode *altitude
// = fgGetNode("/sim/presets/altitude-ft");
FGLight *l = (FGLight *)(globals->get_subsystem("lighting"));
SG_LOG( SG_GENERAL, SG_INFO, "Initialize Subsystems");
SG_LOG( SG_GENERAL, SG_INFO, "========== ==========");
@ -1568,8 +1572,8 @@ bool fgInitSubsystems() {
= fgGetNode("/sim/presets/longitude-deg");
static const SGPropertyNode *latitude
= fgGetNode("/sim/presets/latitude-deg");
static const SGPropertyNode *altitude
= fgGetNode("/sim/presets/altitude-ft");
// static const SGPropertyNode *altitude
// = fgGetNode("/sim/presets/altitude-ft");
SGPath cloud_path(globals->get_fg_root());
#if 0

View file

@ -818,8 +818,8 @@ void fgUpdateTimeDepCalcs() {
= fgGetNode( "/sim/freeze/replay", true );
static SGPropertyNode *replay_time
= fgGetNode( "/sim/replay/time", true );
static const SGPropertyNode *replay_end_time
= fgGetNode( "/sim/replay/end-time", true );
// static const SGPropertyNode *replay_end_time
// = fgGetNode( "/sim/replay/end-time", true );
//SG_LOG(SG_FLIGHT,SG_INFO, "Updating time dep calcs()");
@ -902,8 +902,8 @@ static void fgMainLoop( void ) {
= fgGetNode("/sim/freeze/clock", true);
static const SGPropertyNode *cur_time_override
= fgGetNode("/sim/time/cur-time-override", true);
static const SGPropertyNode *replay_master
= fgGetNode("/sim/freeze/replay", true);
// static const SGPropertyNode *replay_master
// = fgGetNode("/sim/freeze/replay", true);
// Update the elapsed time.
static bool first_time = true;

View file

@ -874,7 +874,7 @@ fgSetupProxy( const char *arg )
{
string options = arg;
string host, port, auth;
int pos;
unsigned int pos;
host = port = auth = "";
if ((pos = options.find("@")) != string::npos)

View file

@ -51,7 +51,8 @@ FGViewMgr::init ()
bool at_model = false;
int from_model_index = 0;
int at_model_index = 0;
double damp_alt, damp_roll, damp_pitch, damp_heading;
// double damp_alt;
double damp_roll = 0.0, damp_pitch = 0.0, damp_heading = 0.0;
double x_offset_m, y_offset_m, z_offset_m, fov_deg;
double heading_offset_deg, pitch_offset_deg, roll_offset_deg;
double target_x_offset_m, target_y_offset_m, target_z_offset_m;

View file

@ -233,7 +233,7 @@ void FGMultiplayRxMgr::ProcessData(void) {
// Data received
if (iBytes > 0) {
if (iBytes >= sizeof(MsgHdr)) {
if (iBytes >= (int)sizeof(MsgHdr)) {
// Read header
MsgHdr = (T_MsgHdr *)sMsg;

View file

@ -64,7 +64,7 @@ const char sMULTIPLAYTXMGR_HID[] = MULTIPLAYTXMGR_HID;
******************************************************************/
FGMultiplayTxMgr::FGMultiplayTxMgr() {
int iPlayerCnt; // Count of players in player array
// int iPlayerCnt; // Count of players in player array
// Initialise private members
m_bInitialised = false;
@ -216,10 +216,10 @@ void FGMultiplayTxMgr::SendMyPosition(const sgMat4 PlayerPosMat4) {
******************************************************************/
void FGMultiplayTxMgr::SendTextMessage(const string &sMsgText) const {
bool bResult = false;
// bool bResult = false;
T_MsgHdr MsgHdr;
T_ChatMsg ChatMsg;
int iNextBlockPosition = 0;
unsigned int iNextBlockPosition = 0;
char sMsg[sizeof(T_MsgHdr) + sizeof(T_ChatMsg)];
if (m_bInitialised) {

View file

@ -133,8 +133,7 @@ bool FGGeneric::gen_message() {
string generic_sentence;
char tmp[255];
int v;
double d;
double val;
for (unsigned int i = 0; i < _message.size(); i++) {
@ -143,9 +142,9 @@ bool FGGeneric::gen_message() {
switch (_message[i].type) {
case FG_INT:
v = _message[i].offset +
val = _message[i].offset +
_message[i].prop->getIntValue() * _message[i].factor;
snprintf(tmp, 255, _message[i].format.c_str(), v);
snprintf(tmp, 255, _message[i].format.c_str(), (int)val);
break;
case FG_BOOL:
@ -154,9 +153,9 @@ bool FGGeneric::gen_message() {
break;
case FG_DOUBLE:
d = _message[i].offset +
val = _message[i].offset +
_message[i].prop->getDoubleValue() * _message[i].factor;
snprintf(tmp, 255, _message[i].format.c_str(), d);
snprintf(tmp, 255, _message[i].format.c_str(), val);
break;
default: // SG_STRING

View file

@ -48,15 +48,6 @@ FGOpenGC::FGOpenGC() :
wind_dir_node(fgGetNode("/environment/wind-from-heading-deg", true)),
wind_speed_node(fgGetNode("/environment/wind-speed-kt", true)),
mag_var_node(fgGetNode("/environment/magnetic-variation-deg", true)),
p_left_aileron(fgGetNode("surface-positions/left-aileron-pos-norm", true)),
p_right_aileron(fgGetNode("surface-positions/right-aileron-pos-norm", true)),
p_elevator(fgGetNode("surface-positions/elevator-pos-norm", true)),
p_elevator_trim(fgGetNode("surface-positions/elevator_trim-pos-norm", true)),
p_rudder(fgGetNode("surface-positions/rudder-pos-norm", true)),
p_flaps(fgGetNode("surface-positions/flap-pos-norm", true)),
p_flaps_cmd(fgGetNode("/controls/flaps", true)),
p_alphadot(fgGetNode("/fdm/jsbsim/aero/alphadot-radsec", true)),
p_betadot(fgGetNode("/fdm/jsbsim/aero/betadot-radsec", true)),
p_latitude(fgGetNode("/position/latitude-deg", true)),
p_longitude(fgGetNode("/position/longitude-deg", true)),
p_alt_node(fgGetNode("/position/altitude-ft", true)),
@ -65,7 +56,16 @@ FGOpenGC::FGOpenGC() :
egt0_node(fgGetNode("/engines/engine/egt-degf", true)),
egt1_node(fgGetNode("/engines/engine[1]/egt-degf", true)),
egt2_node(fgGetNode("/engines/engine[2]/egt-degf", true)),
egt3_node(fgGetNode("/engines/engine[3]/egt-degf", true))
egt3_node(fgGetNode("/engines/engine[3]/egt-degf", true)),
p_left_aileron(fgGetNode("surface-positions/left-aileron-pos-norm", true)),
p_right_aileron(fgGetNode("surface-positions/right-aileron-pos-norm", true)),
p_elevator(fgGetNode("surface-positions/elevator-pos-norm", true)),
p_elevator_trim(fgGetNode("surface-positions/elevator_trim-pos-norm", true)),
p_rudder(fgGetNode("surface-positions/rudder-pos-norm", true)),
p_flaps(fgGetNode("surface-positions/flap-pos-norm", true)),
p_flaps_cmd(fgGetNode("/controls/flaps", true)),
p_alphadot(fgGetNode("/fdm/jsbsim/aero/alphadot-radsec", true)),
p_betadot(fgGetNode("/fdm/jsbsim/aero/betadot-radsec", true))
{
}

View file

@ -102,7 +102,8 @@ void FGReplay::unbind() {
*/
void FGReplay::update( double dt ) {
static SGPropertyNode *replay_master = fgGetNode( "/sim/freeze/replay" );
static SGPropertyNode *replay_master
= fgGetNode( "/sim/freeze/replay", true );
if ( replay_master->getBoolValue() ) {
// don't record the replay session

View file

@ -507,7 +507,7 @@ void FGHitList::Intersect( ssgBranch *scene, sgdMat4 m, sgdVec3 orig, sgdVec3 di
// Determine scenery altitude via ssg.
// returned results are in meters
static double hitlist1_time = 0.0;
// static double hitlist1_time = 0.0;
bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m,
sgdVec3 scenery_center,
@ -590,7 +590,7 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m,
}
static double hitlist2_time = 0.0;
// static double hitlist2_time = 0.0;
// Determine scenery altitude via ssg.
// returned results are in meters

View file

@ -177,7 +177,7 @@ static naRef f_getChildren(naContext c, naRef args)
if(!naIsString(name)) return naNil();
vector<SGPropertyNode_ptr> children
= (*node)->getChildren(naStr_data(name));
for(int i=0; i<children.size(); i++)
for(unsigned int i=0; i<children.size(); i++)
naVec_append(result, propNodeGhostCreate(c, children[i]));
}
return result;

View file

@ -41,7 +41,7 @@ StaticSystem::update (double dt)
double target = _pressure_in_node->getDoubleValue();
double current = _pressure_out_node->getDoubleValue();
double delta = target - current;
// double delta = target - current;
_pressure_out_node->setDoubleValue(fgGetLowPass(current, target, dt));
}
}

View file

@ -70,8 +70,8 @@ FGLight::FGLight ()
_diffuse_tbl( NULL ),
_specular_tbl( NULL ),
_sky_tbl( NULL ),
_sun_rotation( 0.0 ),
_prev_sun_angle(-9999.0),
_sun_rotation( 0.0 ),
_dt_total( 0.0 )
{
}
@ -163,7 +163,7 @@ void FGLight::update( double dt ) {
void FGLight::update_sky_color () {
// if the 4th field is 0.0, this specifies a direction ...
const GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
// const GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
const GLfloat base_sky_color[4] = { 0.31, 0.43, 0.69, 1.0 };
const GLfloat base_fog_color[4] = { 0.84, 0.87, 1.0, 1.0 };