1
0
Fork 0

fix warnings in Instrumentation

Mostly signed comparisons and order of initializers in constructors
This commit is contained in:
Tim Moore 2009-08-24 18:02:15 +02:00
parent 8238bcddbd
commit 67c7d8642a
8 changed files with 41 additions and 43 deletions

View file

@ -642,7 +642,7 @@ void KLN89::DrawMap(bool draw_avs) {
vector<int> xvec, yvec, qvec; // qvec stores the quadrant that each waypoint label should
// be drawn in (relative to the waypoint).
// 1 = NE, 2 = SE, 3 = SW, 4 = NW.
double save_h; // Each pass, save a heading from the previous one for label quadrant determination.
double save_h = 0.0; // Each pass, save a heading from the previous one for label quadrant determination.
bool drawTrack = true;
for(unsigned int i=1; i<_activeFP->waypoints.size(); ++i) {
GPSWaypoint* wp0 = _activeFP->waypoints[i-1];

View file

@ -182,7 +182,6 @@ void KLN89AptPage::Update(double dt) {
2, 0, 0, _to_flag, (_kln89->_mode == KLN89_MODE_CRSR && _uLinePos == 5 ? true : false));
} else if(_subPage == 2) {
// Try and calculate a realistic difference from UTC based on longitude
float degLonPerHr = 360.0 / 24.0; // 15 degrees per hour difference.
// Since 0 longitude is the middle of UTC, the boundaries will be at 7.5, 22.5, 37.5 etc.
int hrDiff = ((int)((fabs(ap->getLongitude())) + 7.5)) / 15;
_kln89->DrawText("UTC", 2, 0, 2);
@ -358,7 +357,7 @@ void KLN89AptPage::Update(double dt) {
_kln89->DrawText(_iaps[_curIap]->_rwyStr, 2, 7, 3);
_kln89->DrawText(_iaps[_curIap]->_id, 2, 12, 3);
_kln89->DrawText("IAF", 2, 2, 2);
int line = 0;
unsigned int line = 0;
for(unsigned int i=_iafStart; i<_IAF.size(); ++i) {
if(line == 2) {
i = _IAF.size() - 1;

View file

@ -626,7 +626,7 @@ void KLN89FplPage::ClrPressed() {
} else if(fencePos) {
//cout << "FENP\n";
// no-op
} else if(n >= _kln89->_flightPlans[_subPage]->waypoints.size()) {
} else if(n >= static_cast<int>(_kln89->_flightPlans[_subPage]->waypoints.size())) {
// no-op - off the end of the list on the entry field
} else if(_kln89->_flightPlans[_subPage]->waypoints[n]->appType == GPS_APP_NONE) {
//cout << "DELFP\n";
@ -684,7 +684,7 @@ void KLN89FplPage::EntPressed() {
} else if(_delWp) {
int pos = _uLinePos - 4 + _fplPos;
// Sanity check - the calculated wp position should never be off the end of the waypoint list.
if(pos > _kln89->_flightPlans[_subPage]->waypoints.size() - 1) {
if(pos > static_cast<int>(_kln89->_flightPlans[_subPage]->waypoints.size()) - 1) {
cout << "ERROR - _uLinePos too big in KLN89FplPage::EntPressed!\n";
return;
}
@ -816,7 +816,7 @@ void KLN89FplPage::Knob1Left1() {
int ix = _fplPos + (_uLinePos - 4);
if(_fencePos >= 0 && ix >= _fencePos) ix--;
if(_hdrPos >= 0 && ix >= _hdrPos) ix--;
if(ix >= _kln89->_activeFP->waypoints.size()) {
if(ix >= static_cast<int>(_kln89->_activeFP->waypoints.size())) {
_fp0SelWpId.clear();
} else {
_fp0SelWpId = _kln89->_activeFP->waypoints[ix]->id;
@ -877,7 +877,7 @@ void KLN89FplPage::Knob1Right1() {
_uLinePos++;
} else {
// Must be the last line - either _uLinePos 6 or 7 depending on _subPage
int thresh = (_subPage == 0 ? 3 : 2);
const unsigned thresh = (_subPage == 0 ? 3 : 2);
if(_kln89->_flightPlans[_subPage]->waypoints.size() == thresh || _fplPos == _kln89->_flightPlans[_subPage]->waypoints.size() - thresh) {
// Don't move
} else {
@ -889,7 +889,7 @@ void KLN89FplPage::Knob1Right1() {
int ix = _fplPos + (_uLinePos - 4);
if(_fencePos >= 0 && ix >= _fencePos) ix--;
if(_hdrPos >= 0 && ix >= _hdrPos) ix--;
if(ix >= _kln89->_activeFP->waypoints.size()) {
if(ix >= static_cast<int>(_kln89->_activeFP->waypoints.size())) {
_fp0SelWpId.clear();
} else {
_fp0SelWpId = _kln89->_activeFP->waypoints[ix]->id;
@ -932,7 +932,7 @@ void KLN89FplPage::Knob2Left1() {
if(_fencePos >= 0 && n >= _fencePos) --n; // This one needs to be >= since n is already decremented by 1 in the line above!
//cout << "New n = " << n << '\n';
if(n < _kln89->_flightPlans[_subPage]->waypoints.size()) {
if(n < static_cast<int>(_kln89->_flightPlans[_subPage]->waypoints.size())) {
if(_kln89->_flightPlans[_subPage]->waypoints[n]->appType != GPS_APP_NONE) {
appWp = true;
}
@ -1005,7 +1005,7 @@ void KLN89FplPage::Knob2Right1() {
if(_fencePos >= 0 && n >= _fencePos) --n; // This one needs to be >= since n is already decremented by 1 in the line above!
//cout << "New n = " << n << '\n';
if(n < _kln89->_flightPlans[_subPage]->waypoints.size()) {
if(n < static_cast<int>(_kln89->_flightPlans[_subPage]->waypoints.size())) {
if(_kln89->_flightPlans[_subPage]->waypoints[n]->appType != GPS_APP_NONE) {
appWp = true;
}

View file

@ -41,6 +41,7 @@ KLN89NavPage::KLN89NavPage(KLN89* parent)
_menuPos = 0;
_suspendAVS = false;
_scanWpSet = false;
_scanWpIndex = -1;
}
KLN89NavPage::~KLN89NavPage() {
@ -546,7 +547,7 @@ void KLN89NavPage::Knob2Right1() {
_scanWpSet = true;
} else {
_scanWpIndex++;
if(_scanWpIndex > _kln89->_activeFP->waypoints.size() - 1) {
if(_scanWpIndex > static_cast<int>(_kln89->_activeFP->waypoints.size()) - 1) {
_scanWpIndex = 0;
}
}

View file

@ -38,7 +38,7 @@ KLN89UsrPage::~KLN89UsrPage() {
}
void KLN89UsrPage::Update(double dt) {
bool actPage = (_kln89->_activePage->GetName() == "ACT" ? true : false);
// bool actPage = (_kln89->_activePage->GetName() == "ACT" ? true : false);
bool crsr = (_kln89->_mode == KLN89_MODE_CRSR);
bool blink = _kln89->_blink;

View file

@ -189,7 +189,6 @@ agRadar::setUserVec(double az, double el)
float yaw = _user_hdg_deg_node->getDoubleValue();
float pitch = _user_pitch_deg_node->getDoubleValue();
float roll = _user_roll_deg_node->getDoubleValue();
int mode = _radar_mode_control_node->getIntValue();
double tilt = _Instrument->getDoubleValue("tilt");
double trk = _Instrument->getDoubleValue("trk");
bool roll_stab = _Instrument->getBoolValue("stabilisation/roll");

View file

@ -549,7 +549,7 @@ MK_VIII::ConfigurationModule::read_aircraft_mode_type_select (int value)
{ 255, &m1_t1, &m2_t1, &m3_t1, &m4_t1, m6_t2, &f_fast, 2000 }
};
for (int i = 0; i < n_elements(aircraft_types); i++)
for (size_t i = 0; i < n_elements(aircraft_types); i++)
if (aircraft_types[i].type == value)
{
mk->mode1_handler.conf.envelopes = aircraft_types[i].m1;
@ -625,7 +625,7 @@ MK_VIII::ConfigurationModule::read_altitude_callouts (int value)
{ 101, { FIELD_500_ABOVE, 0 } }
};
int i;
unsigned i;
mk->mode6_handler.conf.minimums_enabled = false;
mk->mode6_handler.conf.smart_500_enabled = false;
@ -656,7 +656,7 @@ MK_VIII::ConfigurationModule::read_altitude_callouts (int value)
break;
default:
for (int k = 0; k < n_altitude_callouts; k++)
for (unsigned k = 0; k < n_altitude_callouts; k++)
if (mk->mode6_handler.altitude_callout_definitions[k] == values[i].callouts[j])
mk->mode6_handler.conf.altitude_callouts_enabled[k] = true;
break;
@ -773,7 +773,7 @@ MK_VIII::ConfigurationModule::read_input_output_discrete_type_select (int value)
{ 255, { false, false }, true, false, true }
};
for (int i = 0; i < n_elements(io_types); i++)
for (size_t i = 0; i < n_elements(io_types); i++)
if (io_types[i].type == value)
{
mk->io_handler.conf.lamp = &io_types[i].lamp_conf;
@ -801,7 +801,7 @@ MK_VIII::ConfigurationModule::read_audio_output_level (int value)
{ 4, -24 }
};
for (int i = 0; i < n_elements(values); i++)
for (size_t i = 0; i < n_elements(values); i++)
if (values[i].id == value)
{
mk->voice_player.set_volume(mk->voice_player.conf.volume = modify_amplitude(1.0, values[i].relative_dB));
@ -1550,7 +1550,7 @@ MK_VIII::IOHandler::update_egpws_alert_discrete_1 ()
{ 19, mk_voice(minimums_minimums) }
};
for (int i = 0; i < n_elements(voices); i++)
for (size_t i = 0; i < n_elements(voices); i++)
if (voices[i].voice == mk->voice_player.voice)
{
mk_aoutput(egpws_alert_discrete_1) = 1 << voices[i].bit;
@ -1584,7 +1584,7 @@ MK_VIII::IOHandler::update_egpwc_logic_discretes ()
{ 25, mk_alert(MODE5_SOFT) | mk_alert(MODE5_HARD) }
};
for (int i = 0; i < n_elements(logic); i++)
for (size_t i = 0; i < n_elements(logic); i++)
if (mk_test_alerts(logic[i].alerts))
mk_aoutput(egpwc_logic_discretes) |= 1 << logic[i].bit;
}
@ -1610,7 +1610,7 @@ MK_VIII::IOHandler::update_mode6_callouts_discrete_1 ()
{ 25, mk_altitude_voice(Mode6Handler::ALTITUDE_CALLOUT_300) }
};
for (int i = 0; i < n_elements(voices); i++)
for (size_t i = 0; i < n_elements(voices); i++)
if (voices[i].voice == mk->voice_player.voice)
{
mk_aoutput(mode6_callouts_discrete_1) = 1 << voices[i].bit;
@ -1639,7 +1639,7 @@ MK_VIII::IOHandler::update_mode6_callouts_discrete_2 ()
{ 23, mk_voice(five_hundred_above) }
};
for (int i = 0; i < n_elements(voices); i++)
for (size_t i = 0; i < n_elements(voices); i++)
if (voices[i].voice == mk->voice_player.voice)
{
mk_aoutput(mode6_callouts_discrete_2) = 1 << voices[i].bit;
@ -2049,7 +2049,7 @@ MK_VIII::IOHandler::present_status ()
"TCF INPUTS INVALID"
};
for (int i = 0; i < n_elements(fault_names); i++)
for (size_t i = 0; i < n_elements(fault_names); i++)
if (mk->fault_handler.faults[i])
present_status_subitem(fault_names[i]);
}
@ -2075,7 +2075,7 @@ MK_VIII::IOHandler::present_status ()
"VOLUME SELECT"
};
for (int i = 0; i < n_elements(category_names); i++)
for (size_t i = 0; i < n_elements(category_names); i++)
{
std::ostringstream value;
value << "= " << mk->configuration_module.effective_categories[i];
@ -2254,7 +2254,7 @@ MK_VIII::VoicePlayer::init ()
make_voice(&voices.too_low_gear, "too-low-gear");
make_voice(&voices.too_low_terrain, "too-low-terrain");
for (int i = 0; i < n_altitude_callouts; i++)
for (unsigned i = 0; i < n_altitude_callouts; i++)
{
std::ostringstream name;
name << "altitude-" << mk->mode6_handler.altitude_callout_definitions[i];
@ -2587,7 +2587,7 @@ MK_VIII::SelfTestHandler::run ()
if (mk->mode6_handler.conf.above_field_voice)
return play(mk->mode6_handler.conf.above_field_voice);
}
for (int i = 0; i < n_altitude_callouts; i++)
for (unsigned i = 0; i < n_altitude_callouts; i++)
if (! was_here_offset(i))
{
if (mk->mode6_handler.conf.altitude_callouts_enabled[i])
@ -4011,14 +4011,14 @@ MK_VIII::Mode6Handler::reset_minimums ()
void
MK_VIII::Mode6Handler::reset_altitude_callouts ()
{
for (int i = 0; i < n_altitude_callouts; i++)
for (unsigned i = 0; i < n_altitude_callouts; i++)
altitude_callouts_issued[i] = false;
}
bool
MK_VIII::Mode6Handler::is_playing_altitude_callout ()
{
for (int i = 0; i < n_altitude_callouts; i++)
for (unsigned i = 0; i < n_altitude_callouts; i++)
if (mk->voice_player.voice == mk_altitude_voice(i)
|| mk->voice_player.next_voice == mk_altitude_voice(i))
return true;
@ -4092,7 +4092,7 @@ MK_VIII::Mode6Handler::boot ()
last_radio_altitude.set(&mk_data(radio_altitude));
// [SPEC] 6.4.2
for (int i = 0; i < n_altitude_callouts; i++)
for (unsigned i = 0; i < n_altitude_callouts; i++)
altitude_callouts_issued[i] = ! mk_data(radio_altitude).ncd
&& mk_data(radio_altitude).get() <= altitude_callout_definitions[i];
@ -4134,7 +4134,7 @@ MK_VIII::Mode6Handler::set_volume (double volume)
{
mk_voice(minimums_minimums)->set_volume(volume);
mk_voice(five_hundred_above)->set_volume(volume);
for (int i = 0; i < n_altitude_callouts; i++)
for (unsigned i = 0; i < n_altitude_callouts; i++)
mk_altitude_voice(i)->set_volume(volume);
}
@ -4144,7 +4144,7 @@ MK_VIII::Mode6Handler::altitude_callouts_enabled ()
if (conf.minimums_enabled || conf.smart_500_enabled || conf.above_field_voice)
return true;
for (int i = 0; i < n_altitude_callouts; i++)
for (unsigned i = 0; i < n_altitude_callouts; i++)
if (conf.altitude_callouts_enabled[i])
return true;
@ -4197,7 +4197,7 @@ MK_VIII::Mode6Handler::update_altitude_callouts ()
if (! mk->io_handler.gpws_inhibit()
&& ! mk->state_handler.ground // [1]
&& ! mk_data(radio_altitude).ncd)
for (int i = 0; i < n_altitude_callouts && mk_data(radio_altitude).get() <= altitude_callout_definitions[i]; i++)
for (unsigned i = 0; i < n_altitude_callouts && mk_data(radio_altitude).get() <= altitude_callout_definitions[i]; i++)
if ((conf.altitude_callouts_enabled[i]
|| (altitude_callout_definitions[i] == 500
&& conf.smart_500_enabled))
@ -4206,7 +4206,7 @@ MK_VIII::Mode6Handler::update_altitude_callouts ()
|| last_radio_altitude.get() > altitude_callout_definitions[i]))
{
// lock out all callouts superior or equal to this one
for (int j = 0; j <= i; j++)
for (unsigned j = 0; j <= i; j++)
altitude_callouts_issued[j] = true;
altitude_callouts_issued[i] = true;
@ -4587,7 +4587,7 @@ MK_VIII::TCFHandler::get_bias_area_edges (Position *edge,
Position *bias_edge2)
{
double half_bias_width_m = k * SG_NM_TO_METER + half_width_m;
double tmp_latitude, tmp_longitude, az;
double tmp_latitude = 0.0, tmp_longitude = 0.0, az = 0.0;
geo_direct_wgs_84(0,
edge->latitude,
@ -4840,10 +4840,9 @@ MK_VIII::TCFHandler::update ()
///////////////////////////////////////////////////////////////////////////////
MK_VIII::MK_VIII (SGPropertyNode *node)
: name("mk-viii"),
: properties_handler(this),
name("mk-viii"),
num(0),
properties_handler(this),
power_handler(this),
system_handler(this),
configuration_module(this),

View file

@ -52,7 +52,7 @@ using std::map;
class MK_VIII : public SGSubsystem
{
// keep in sync with Mode6Handler::altitude_callout_definitions[]
static const int n_altitude_callouts = 11;
static const unsigned n_altitude_callouts = 11;
/////////////////////////////////////////////////////////////////////////////
// MK_VIII::RawValueMethodsData /////////////////////////////////////////////
@ -782,7 +782,7 @@ public:
Element *element;
inline Voice (VoicePlayer *_player)
: player(_player), volume(1.0), element(NULL) {}
: element(NULL), player(_player), volume(1.0) {}
~Voice ();
@ -852,7 +852,7 @@ public:
} voices;
inline VoicePlayer (MK_VIII *device)
: mk(device), speaker(this), voice(NULL), next_voice(NULL) {}
: voice(NULL), next_voice(NULL), mk(device), speaker(this) {}
~VoicePlayer ();
@ -917,13 +917,13 @@ public:
inline Speaker (VoicePlayer *_player)
: player(_player),
volume(1),
pitch(1),
inner_cone(360),
outer_cone(360),
outer_gain(0),
reference_dist(3),
max_dist(10)
max_dist(10),
volume(1)
{
position[0] = 0; position[1] = 0; position[2] = 0;
orientation[0] = 0; orientation[1] = 0; orientation[2] = 0;
@ -1031,7 +1031,7 @@ private:
State state;
inline SelfTestHandler (MK_VIII *device)
: mk(device), state(STATE_NONE), button_pressed(false) {}
: mk(device), button_pressed(false), state(STATE_NONE) {}
inline void power_off () { stop(); }
inline void set_inop () { stop(); }