De-Yodify false == conditions throughout the code-base
This commit is contained in:
parent
667dc8a02a
commit
3ab4de1436
16 changed files with 54 additions and 54 deletions
|
@ -45,7 +45,7 @@ string ATCSpeech::getSpokenNumber( string number )
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
for( string::iterator it = number.begin(); it != number.end(); ++it ) {
|
for( string::iterator it = number.begin(); it != number.end(); ++it ) {
|
||||||
if( false == result.empty() )
|
if( !result.empty() )
|
||||||
result.SPACE;
|
result.SPACE;
|
||||||
result.append( getSpokenDigit( (*it) - '0' ));
|
result.append( getSpokenDigit( (*it) - '0' ));
|
||||||
}
|
}
|
||||||
|
@ -79,8 +79,8 @@ string ATCSpeech::getSpokenNumber( int number, bool leadingZero, int digits )
|
||||||
result.append( globals->get_locale()->getLocalizedString("minus", "atc", "minus" ) );
|
result.append( globals->get_locale()->getLocalizedString("minus", "atc", "minus" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
while( false == spokenDigits.empty() ) {
|
while( !spokenDigits.empty() ) {
|
||||||
if( false == result.empty() )
|
if( !result.empty() )
|
||||||
result.SPACE;
|
result.SPACE;
|
||||||
|
|
||||||
result.append( spokenDigits.back() );
|
result.append( spokenDigits.back() );
|
||||||
|
@ -157,7 +157,7 @@ SGPropertyNode_ptr findAtisTemplate( const std::string & stationId, SGPropertyNo
|
||||||
for( PropertyList::iterator asit = schemaNodes.begin(); asit != schemaNodes.end(); ++asit ) {
|
for( PropertyList::iterator asit = schemaNodes.begin(); asit != schemaNodes.end(); ++asit ) {
|
||||||
SGPropertyNode_ptr ppp = (*asit)->getNode("station-starts-with", false );
|
SGPropertyNode_ptr ppp = (*asit)->getNode("station-starts-with", false );
|
||||||
atisTemplate = (*asit)->getNode("atis", false );
|
atisTemplate = (*asit)->getNode("atis", false );
|
||||||
if( false == atisTemplate.valid() ) continue; // no <atis> node - ignore entry
|
if( !atisTemplate.valid() ) continue; // no <atis> node - ignore entry
|
||||||
|
|
||||||
PropertyList startsWithNodes = (*asit)->getChildren("station-starts-with");
|
PropertyList startsWithNodes = (*asit)->getChildren("station-starts-with");
|
||||||
for( PropertyList::iterator swit = startsWithNodes.begin(); swit != startsWithNodes.end(); ++swit ) {
|
for( PropertyList::iterator swit = startsWithNodes.begin(); swit != startsWithNodes.end(); ++swit ) {
|
||||||
|
@ -176,10 +176,10 @@ string ATISEncoder::encodeATIS( ATISInformationProvider * atisInformation )
|
||||||
{
|
{
|
||||||
using simgear::strutils::lowercase;
|
using simgear::strutils::lowercase;
|
||||||
|
|
||||||
if( false == atisInformation->isValid() ) return NO_ATIS;
|
if( !atisInformation->isValid() ) return NO_ATIS;
|
||||||
|
|
||||||
airport = FGAirport::getByIdent( atisInformation->airportId() );
|
airport = FGAirport::getByIdent( atisInformation->airportId() );
|
||||||
if( false == airport.valid() ) {
|
if( !airport.valid() ) {
|
||||||
SG_LOG( SG_ATC, SG_WARN, "ATISEncoder: unknown airport id " << atisInformation->airportId() );
|
SG_LOG( SG_ATC, SG_WARN, "ATISEncoder: unknown airport id " << atisInformation->airportId() );
|
||||||
return NO_ATIS;
|
return NO_ATIS;
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ string ATISEncoder::encodeATIS( ATISInformationProvider * atisInformation )
|
||||||
_atis = atisInformation;
|
_atis = atisInformation;
|
||||||
|
|
||||||
// lazily load the schema file on the first call
|
// lazily load the schema file on the first call
|
||||||
if( false == atisSchemaNode.valid() ) {
|
if( !atisSchemaNode.valid() ) {
|
||||||
atisSchemaNode = new SGPropertyNode();
|
atisSchemaNode = new SGPropertyNode();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -204,7 +204,7 @@ string ATISEncoder::encodeATIS( ATISInformationProvider * atisInformation )
|
||||||
string stationId = lowercase( airport->ident() );
|
string stationId = lowercase( airport->ident() );
|
||||||
|
|
||||||
SGPropertyNode_ptr atisTemplate = findAtisTemplate( stationId, atisSchemaNode );;
|
SGPropertyNode_ptr atisTemplate = findAtisTemplate( stationId, atisSchemaNode );;
|
||||||
if( false == atisTemplate.valid() ) {
|
if( !atisTemplate.valid() ) {
|
||||||
SG_LOG(SG_ATC, SG_WARN, "no matching atis template for station " << stationId );
|
SG_LOG(SG_ATC, SG_WARN, "no matching atis template for station " << stationId );
|
||||||
return NO_ATIS; // no template for this station!?
|
return NO_ATIS; // no template for this station!?
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ string ATISEncoder::processIfToken( SGPropertyNode_ptr token )
|
||||||
bool ATISEncoder::checkEmptyCondition( SGPropertyNode_ptr node, bool isEmpty )
|
bool ATISEncoder::checkEmptyCondition( SGPropertyNode_ptr node, bool isEmpty )
|
||||||
{
|
{
|
||||||
SGPropertyNode_ptr n1 = node->getNode( "token", false );
|
SGPropertyNode_ptr n1 = node->getNode( "token", false );
|
||||||
if( false == n1.valid() ) {
|
if( !n1.valid() ) {
|
||||||
SG_LOG(SG_ATC, SG_WARN, "missing <token> node for (not)-empty" );
|
SG_LOG(SG_ATC, SG_WARN, "missing <token> node for (not)-empty" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -526,7 +526,7 @@ string ATISEncoder::getClouds( SGPropertyNode_ptr )
|
||||||
ATISInformationProvider::CloudEntries cloudEntries = _atis->getClouds();
|
ATISInformationProvider::CloudEntries cloudEntries = _atis->getClouds();
|
||||||
|
|
||||||
for( ATISInformationProvider::CloudEntries::iterator it = cloudEntries.begin(); it != cloudEntries.end(); it++ ) {
|
for( ATISInformationProvider::CloudEntries::iterator it = cloudEntries.begin(); it != cloudEntries.end(); it++ ) {
|
||||||
if( false == reply.empty() ) reply.SPACE;
|
if( !reply.empty() ) reply.SPACE;
|
||||||
reply.append( it->second ).SPACE.append( getSpokenAltitude(it->first).SPACE.append( FEET ) );
|
reply.append( it->second ).SPACE.append( getSpokenAltitude(it->first).SPACE.append( FEET ) );
|
||||||
}
|
}
|
||||||
return reply;
|
return reply;
|
||||||
|
@ -539,7 +539,7 @@ string ATISEncoder::getCloudsBrief( SGPropertyNode_ptr )
|
||||||
ATISInformationProvider::CloudEntries cloudEntries = _atis->getClouds();
|
ATISInformationProvider::CloudEntries cloudEntries = _atis->getClouds();
|
||||||
|
|
||||||
for( ATISInformationProvider::CloudEntries::iterator it = cloudEntries.begin(); it != cloudEntries.end(); it++ ) {
|
for( ATISInformationProvider::CloudEntries::iterator it = cloudEntries.begin(); it != cloudEntries.end(); it++ ) {
|
||||||
if( false == reply.empty() ) reply.append(",").SPACE;
|
if( !reply.empty() ) reply.append(",").SPACE;
|
||||||
reply.append( it->second ).SPACE.append( getSpokenAltitude(it->first) );
|
reply.append( it->second ).SPACE.append( getSpokenAltitude(it->first) );
|
||||||
}
|
}
|
||||||
return reply;
|
return reply;
|
||||||
|
|
|
@ -244,7 +244,7 @@ void MetarProperties::setMetar( SGSharedPtr<FGMetar> m )
|
||||||
|
|
||||||
const vector<string> weather = m->getWeather();
|
const vector<string> weather = m->getWeather();
|
||||||
for( vector<string>::const_iterator it = weather.begin(); it != weather.end(); ++it ) {
|
for( vector<string>::const_iterator it = weather.begin(); it != weather.end(); ++it ) {
|
||||||
if( false == _decoded.empty() ) _decoded.append(", ");
|
if( !_decoded.empty() ) _decoded.append(", ");
|
||||||
_decoded.append(*it);
|
_decoded.append(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ void MetarProperties::setMetar( SGSharedPtr<FGMetar> m )
|
||||||
|
|
||||||
// fog/mist/haze cloud layer does not work with 3d clouds yet :-(
|
// fog/mist/haze cloud layer does not work with 3d clouds yet :-(
|
||||||
bool setGroundCloudLayer = _rootNode->getBoolValue("set-ground-cloud-layer", false ) &&
|
bool setGroundCloudLayer = _rootNode->getBoolValue("set-ground-cloud-layer", false ) &&
|
||||||
false == fgGetBool("/sim/rendering/clouds3d-enable", false);
|
!fgGetBool("/sim/rendering/clouds3d-enable", false);
|
||||||
|
|
||||||
if( setGroundCloudLayer ) {
|
if( setGroundCloudLayer ) {
|
||||||
// create a cloud layer #0 starting at the ground if its fog, mist or haze
|
// create a cloud layer #0 starting at the ground if its fog, mist or haze
|
||||||
|
|
|
@ -356,7 +356,7 @@ BasicRealWxController::MetarPropertiesList::iterator BasicRealWxController::find
|
||||||
// don not compare unprocessed property path
|
// don not compare unprocessed property path
|
||||||
// /foo/bar[0]/baz equals /foo/bar/baz
|
// /foo/bar[0]/baz equals /foo/bar/baz
|
||||||
SGPropertyNode_ptr n = fgGetNode(propPath,false);
|
SGPropertyNode_ptr n = fgGetNode(propPath,false);
|
||||||
if( false == n.valid() ) // trivial: node does not exist
|
if( !n.valid() ) // trivial: node does not exist
|
||||||
return _metarProperties.end();
|
return _metarProperties.end();
|
||||||
|
|
||||||
MetarPropertiesList::iterator it = _metarProperties.begin();
|
MetarPropertiesList::iterator it = _metarProperties.begin();
|
||||||
|
|
|
@ -112,7 +112,7 @@ void FGRidgeLift::update(double dt) {
|
||||||
if( dt <= SGLimitsd::min() ) // paused, do nothing but keep current lift
|
if( dt <= SGLimitsd::min() ) // paused, do nothing but keep current lift
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( _enabled_node && false == _enabled_node->getBoolValue() ) {
|
if( _enabled_node && !_enabled_node->getBoolValue() ) {
|
||||||
// do nothing if lift has been zeroed
|
// do nothing if lift has been zeroed
|
||||||
if( strength != 0.0 ) {
|
if( strength != 0.0 ) {
|
||||||
if( strength > 0.1 ) {
|
if( strength > 0.1 ) {
|
||||||
|
|
|
@ -315,7 +315,7 @@ void MetarBridge::requestMetarForId(std::string & id)
|
||||||
_metarPropertiesNode->getNode("time-to-live", true)->setDoubleValue(0.0);
|
_metarPropertiesNode->getNode("time-to-live", true)->setDoubleValue(0.0);
|
||||||
} else {
|
} else {
|
||||||
// use the present weather to generate the ATIS.
|
// use the present weather to generate the ATIS.
|
||||||
if ( NULL != _atisNode && false == _requestedId.empty()) {
|
if ( NULL != _atisNode && !_requestedId.empty()) {
|
||||||
CurrentWeatherATISInformationProvider provider(_requestedId);
|
CurrentWeatherATISInformationProvider provider(_requestedId);
|
||||||
_atisNode->setStringValue(_atisEncoder.encodeATIS(&provider));
|
_atisNode->setStringValue(_atisEncoder.encodeATIS(&provider));
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ void MetarBridge::clearMetar()
|
||||||
void MetarBridge::valueChanged(SGPropertyNode * node)
|
void MetarBridge::valueChanged(SGPropertyNode * node)
|
||||||
{
|
{
|
||||||
// check for raising edge of valid flag
|
// check for raising edge of valid flag
|
||||||
if ( NULL == node || false == node->getBoolValue() || false == _realWxEnabledNode->getBoolValue()) return;
|
if ( NULL == node || !node->getBoolValue() || !_realWxEnabledNode->getBoolValue()) return;
|
||||||
|
|
||||||
std::string responseId = simgear::strutils::uppercase(_metarPropertiesNode->getNode("station-id", true)->getStringValue());
|
std::string responseId = simgear::strutils::uppercase(_metarPropertiesNode->getNode("station-id", true)->getStringValue());
|
||||||
|
|
||||||
|
@ -640,7 +640,7 @@ void CommRadioImpl::update(double dt)
|
||||||
_commStationForFrequency = flightgear::CommStation::findByFreq(freqKhz, position, NULL);
|
_commStationForFrequency = flightgear::CommStation::findByFreq(freqKhz, position, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false == _commStationForFrequency.valid()) {
|
if (!_commStationForFrequency.valid()) {
|
||||||
stopAudio();
|
stopAudio();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,7 @@ DME::update (double delta_time_sec)
|
||||||
|
|
||||||
if (distance_nm <= range_nm) {
|
if (distance_nm <= range_nm) {
|
||||||
double volume = _volume_node->getDoubleValue();
|
double volume = _volume_node->getDoubleValue();
|
||||||
if( false == _ident_btn_node->getBoolValue() )
|
if( !_ident_btn_node->getBoolValue() )
|
||||||
volume = 0.0;
|
volume = 0.0;
|
||||||
|
|
||||||
_audioIdent->setIdent(_navrecord->ident(), volume );
|
_audioIdent->setIdent(_navrecord->ident(), volume );
|
||||||
|
|
|
@ -30,7 +30,7 @@ MagCompass::MagCompass ( SGPropertyNode *node )
|
||||||
_deviation_table = new SGInterpTable( deviation_table_node );
|
_deviation_table = new SGInterpTable( deviation_table_node );
|
||||||
} else {
|
} else {
|
||||||
std::string deviation_node_name = n->getStringValue();
|
std::string deviation_node_name = n->getStringValue();
|
||||||
if( false == deviation_node_name.empty() )
|
if( !deviation_node_name.empty() )
|
||||||
_deviation_node = fgGetNode( deviation_node_name, true );
|
_deviation_node = fgGetNode( deviation_node_name, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ void NavRadioComponentWithIdent::update( double dt, const SGGeod & aircraftPosit
|
||||||
NavRadioComponent::update( dt, aircraftPosition );
|
NavRadioComponent::update( dt, aircraftPosition );
|
||||||
_audioIdent->update( dt );
|
_audioIdent->update( dt );
|
||||||
|
|
||||||
if( false == ( valid() && _identEnabled && _signalQuality_norm > 0.1 ) ) {
|
if( !( valid() && _identEnabled && _signalQuality_norm > 0.1 ) ) {
|
||||||
_audioIdent->setIdent("", 0.0 );
|
_audioIdent->setIdent("", 0.0 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ void NavRadioComponent::search( double frequency, const SGGeod & aircraftPositio
|
||||||
|
|
||||||
double NavRadioComponent::computeSignalQuality_norm( const SGGeod & aircraftPosition )
|
double NavRadioComponent::computeSignalQuality_norm( const SGGeod & aircraftPosition )
|
||||||
{
|
{
|
||||||
if( false == valid() ) return 0.0;
|
if( !valid() ) return 0.0;
|
||||||
|
|
||||||
double distance_nm = _slantDistance_m * SG_METER_TO_NM;
|
double distance_nm = _slantDistance_m * SG_METER_TO_NM;
|
||||||
double range_nm = _range_nm;
|
double range_nm = _range_nm;
|
||||||
|
@ -286,7 +286,7 @@ double NavRadioComponent::computeSignalQuality_norm( const SGGeod & aircraftPosi
|
||||||
|
|
||||||
void NavRadioComponent::update( double dt, const SGGeod & aircraftPosition )
|
void NavRadioComponent::update( double dt, const SGGeod & aircraftPosition )
|
||||||
{
|
{
|
||||||
if( false == valid() ) {
|
if( !valid() ) {
|
||||||
_signalQuality_norm = 0.0;
|
_signalQuality_norm = 0.0;
|
||||||
_trueBearingTo_deg = 0.0;
|
_trueBearingTo_deg = 0.0;
|
||||||
_trueBearingFrom_deg = 0.0;
|
_trueBearingFrom_deg = 0.0;
|
||||||
|
@ -426,7 +426,7 @@ void VOR::update( double dt, const SGGeod & aircraftPosition )
|
||||||
_totalTime += dt;
|
_totalTime += dt;
|
||||||
NavRadioComponentWithIdent::update( dt, aircraftPosition );
|
NavRadioComponentWithIdent::update( dt, aircraftPosition );
|
||||||
|
|
||||||
if( false == valid() ) {
|
if( !valid() ) {
|
||||||
_radial = 0.0;
|
_radial = 0.0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -448,7 +448,7 @@ void VOR::update( double dt, const SGGeod & aircraftPosition )
|
||||||
|
|
||||||
void VOR::display( NavIndicator & navIndicator )
|
void VOR::display( NavIndicator & navIndicator )
|
||||||
{
|
{
|
||||||
if( false == valid() ) return;
|
if( !valid() ) return;
|
||||||
|
|
||||||
double offset = SGMiscd::normalizePeriodic(-180.0,180.0,_radial - navIndicator.getSelectedCourse());
|
double offset = SGMiscd::normalizePeriodic(-180.0,180.0,_radial - navIndicator.getSelectedCourse());
|
||||||
bool to = fabs(offset) >= 90.0;
|
bool to = fabs(offset) >= 90.0;
|
||||||
|
@ -549,7 +549,7 @@ FGNavList::TypeFilter* LOC::getNavaidFilter()
|
||||||
void LOC::search( double frequency, const SGGeod & aircraftPosition )
|
void LOC::search( double frequency, const SGGeod & aircraftPosition )
|
||||||
{
|
{
|
||||||
NavRadioComponentWithIdent::search( frequency, aircraftPosition );
|
NavRadioComponentWithIdent::search( frequency, aircraftPosition );
|
||||||
if( false == valid() ) {
|
if( !valid() ) {
|
||||||
_localizerWidth_deg = 0.0;
|
_localizerWidth_deg = 0.0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -587,7 +587,7 @@ void LOC::update( double dt, const SGGeod & aircraftPosition )
|
||||||
{
|
{
|
||||||
NavRadioComponentWithIdent::update( dt, aircraftPosition );
|
NavRadioComponentWithIdent::update( dt, aircraftPosition );
|
||||||
|
|
||||||
if( false == valid() ) {
|
if( !valid() ) {
|
||||||
_localizerOffset_norm = 0.0;
|
_localizerOffset_norm = 0.0;
|
||||||
_localizerOffset_m = 0.0;
|
_localizerOffset_m = 0.0;
|
||||||
return;
|
return;
|
||||||
|
@ -611,7 +611,7 @@ void LOC::update( double dt, const SGGeod & aircraftPosition )
|
||||||
|
|
||||||
void LOC::display( NavIndicator & navIndicator )
|
void LOC::display( NavIndicator & navIndicator )
|
||||||
{
|
{
|
||||||
if( false == valid() )
|
if( !valid() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
navIndicator.showTo( true );
|
navIndicator.showTo( true );
|
||||||
|
@ -738,7 +738,7 @@ SGVec3d GS::tangentVector(const SGGeod& midpoint, const double heading)
|
||||||
void GS::search( double frequency, const SGGeod & aircraftPosition )
|
void GS::search( double frequency, const SGGeod & aircraftPosition )
|
||||||
{
|
{
|
||||||
NavRadioComponent::search( frequency, aircraftPosition );
|
NavRadioComponent::search( frequency, aircraftPosition );
|
||||||
if( false == valid() ) {
|
if( !valid() ) {
|
||||||
_gsAxis = SGVec3d::zeros();
|
_gsAxis = SGVec3d::zeros();
|
||||||
_gsVertical = SGVec3d::zeros();
|
_gsVertical = SGVec3d::zeros();
|
||||||
_targetGlideslope_deg = 3.0;
|
_targetGlideslope_deg = 3.0;
|
||||||
|
@ -759,7 +759,7 @@ void GS::search( double frequency, const SGGeod & aircraftPosition )
|
||||||
void GS::update( double dt, const SGGeod & aircraftPosition )
|
void GS::update( double dt, const SGGeod & aircraftPosition )
|
||||||
{
|
{
|
||||||
NavRadioComponent::update( dt, aircraftPosition );
|
NavRadioComponent::update( dt, aircraftPosition );
|
||||||
if( false == valid() ) {
|
if( !valid() ) {
|
||||||
_glideslopeOffset_norm = 0.0;
|
_glideslopeOffset_norm = 0.0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -785,7 +785,7 @@ void GS::update( double dt, const SGGeod & aircraftPosition )
|
||||||
double offset = _targetGlideslope_deg - gsDirect;
|
double offset = _targetGlideslope_deg - gsDirect;
|
||||||
if( offset < 0.0 )
|
if( offset < 0.0 )
|
||||||
offset = _targetGlideslope_deg/2 * sawtooth(2.0*offset/_targetGlideslope_deg);
|
offset = _targetGlideslope_deg/2 * sawtooth(2.0*offset/_targetGlideslope_deg);
|
||||||
assert( false == SGMisc<double>::isNaN(offset) );
|
assert( !SGMisc<double>::isNaN(offset) );
|
||||||
// GS is documented to be 1.4 degrees thick,
|
// GS is documented to be 1.4 degrees thick,
|
||||||
// i.e. plus or minus 0.7 degrees from the midline:
|
// i.e. plus or minus 0.7 degrees from the midline:
|
||||||
_glideslopeOffset_norm = SGMiscd::clip(offset/0.7, -1.0, 1.0);
|
_glideslopeOffset_norm = SGMiscd::clip(offset/0.7, -1.0, 1.0);
|
||||||
|
@ -793,7 +793,7 @@ void GS::update( double dt, const SGGeod & aircraftPosition )
|
||||||
|
|
||||||
void GS::display( NavIndicator & navIndicator )
|
void GS::display( NavIndicator & navIndicator )
|
||||||
{
|
{
|
||||||
if( false == valid() ) {
|
if( !valid() ) {
|
||||||
navIndicator.setGS( false );
|
navIndicator.setGS( false );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -913,7 +913,7 @@ void NavRadioImpl::update( double dt )
|
||||||
p->search( _frequency, position );
|
p->search( _frequency, position );
|
||||||
p->update( dt, position );
|
p->update( dt, position );
|
||||||
|
|
||||||
if( false == _cdiDisconnected )
|
if( !_cdiDisconnected )
|
||||||
p->display( _navIndicator );
|
p->display( _navIndicator );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ static string AutoUpdateResponse(const HTTPRequest & request,
|
||||||
static string FlightHistoryToKml(const SGGeodVec & history,
|
static string FlightHistoryToKml(const SGGeodVec & history,
|
||||||
const HTTPRequest & request) {
|
const HTTPRequest & request) {
|
||||||
string interval = request.RequestVariables.get("interval");
|
string interval = request.RequestVariables.get("interval");
|
||||||
if (false == interval.empty()) {
|
if (!interval.empty()) {
|
||||||
return AutoUpdateResponse(request, "/flighthistory/track.kml", interval);
|
return AutoUpdateResponse(request, "/flighthistory/track.kml", interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ bool JsonUriHandler::handleRequest( const HTTPRequest & request, HTTPResponse &
|
||||||
bool timestamp = request.RequestVariables.get("t") == "y";
|
bool timestamp = request.RequestVariables.get("t") == "y";
|
||||||
|
|
||||||
SGPropertyNode_ptr node = getRequestedNode(request );
|
SGPropertyNode_ptr node = getRequestedNode(request );
|
||||||
if( false == node.valid() ) {
|
if( !node.valid() ) {
|
||||||
response.StatusCode = 404;
|
response.StatusCode = 404;
|
||||||
response.Content = "{}";
|
response.Content = "{}";
|
||||||
return true;
|
return true;
|
||||||
|
@ -63,7 +63,7 @@ bool JsonUriHandler::handleRequest( const HTTPRequest & request, HTTPResponse &
|
||||||
|
|
||||||
if( request.Method == "POST" ) {
|
if( request.Method == "POST" ) {
|
||||||
SGPropertyNode_ptr node = getRequestedNode(request );
|
SGPropertyNode_ptr node = getRequestedNode(request );
|
||||||
if( false == node.valid() ) {
|
if( !node.valid() ) {
|
||||||
response.StatusCode = 404;
|
response.StatusCode = 404;
|
||||||
response.Content = "{}";
|
response.Content = "{}";
|
||||||
return true;
|
return true;
|
||||||
|
@ -95,11 +95,11 @@ SGPropertyNode_ptr JsonUriHandler::getRequestedNode(const HTTPRequest & request)
|
||||||
propertyPath = propertyPath.substr( getUri().size() );
|
propertyPath = propertyPath.substr( getUri().size() );
|
||||||
|
|
||||||
// skip trailing '/' - not very efficient but shouldn't happen too often
|
// skip trailing '/' - not very efficient but shouldn't happen too often
|
||||||
while( false == propertyPath.empty() && propertyPath[ propertyPath.length()-1 ] == '/' )
|
while( !propertyPath.empty() && propertyPath[ propertyPath.length()-1 ] == '/' )
|
||||||
propertyPath = propertyPath.substr(0,propertyPath.length()-1);
|
propertyPath = propertyPath.substr(0,propertyPath.length()-1);
|
||||||
|
|
||||||
SGPropertyNode_ptr reply = fgGetNode( string("/") + propertyPath );
|
SGPropertyNode_ptr reply = fgGetNode( string("/") + propertyPath );
|
||||||
if( false == reply.valid() ) {
|
if( !reply.valid() ) {
|
||||||
SG_LOG(SG_NETWORK,SG_WARN, "JsonUriHandler: requested node not found: '" << propertyPath << "'");
|
SG_LOG(SG_NETWORK,SG_WARN, "JsonUriHandler: requested node not found: '" << propertyPath << "'");
|
||||||
}
|
}
|
||||||
return reply;
|
return reply;
|
||||||
|
|
|
@ -40,13 +40,13 @@ void PropertyChangeObserver::check()
|
||||||
{
|
{
|
||||||
|
|
||||||
for (Entries_t::iterator it = _entries.begin(); it != _entries.end(); ++it) {
|
for (Entries_t::iterator it = _entries.begin(); it != _entries.end(); ++it) {
|
||||||
if (false == (*it)->_node.isShared()) {
|
if (!(*it)->_node.isShared()) {
|
||||||
// node is no longer used but by us - remove the entry
|
// node is no longer used but by us - remove the entry
|
||||||
it = _entries.erase(it);
|
it = _entries.erase(it);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( false == (*it)->_changed ) {
|
if(!(*it)->_changed ) {
|
||||||
(*it)->_changed = (*it)->_prevValue != (*it)->_node->getStringValue();
|
(*it)->_changed = (*it)->_prevValue != (*it)->_node->getStringValue();
|
||||||
if ((*it)->_changed)
|
if ((*it)->_changed)
|
||||||
(*it)->_prevValue = (*it)->_node->getStringValue();
|
(*it)->_prevValue = (*it)->_node->getStringValue();
|
||||||
|
|
|
@ -216,7 +216,7 @@ bool PropertyUriHandler::handleGetRequest( const HTTPRequest & request, HTTPResp
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip trailing '/' - not very efficient but shouldn't happen too often
|
// skip trailing '/' - not very efficient but shouldn't happen too often
|
||||||
while( false == propertyPath.empty() && propertyPath[ propertyPath.length()-1 ] == '/' )
|
while( !propertyPath.empty() && propertyPath[ propertyPath.length()-1 ] == '/' )
|
||||||
propertyPath = propertyPath.substr(0,propertyPath.length()-1);
|
propertyPath = propertyPath.substr(0,propertyPath.length()-1);
|
||||||
|
|
||||||
if( request.RequestVariables.get("submit") == "update" ) {
|
if( request.RequestVariables.get("submit") == "update" ) {
|
||||||
|
@ -273,7 +273,7 @@ bool PropertyUriHandler::handleGetRequest( const HTTPRequest & request, HTTPResp
|
||||||
catch( string & s ) {
|
catch( string & s ) {
|
||||||
SG_LOG(SG_NETWORK,SG_WARN, "httpd: reading '" << propertyPath << "' failed: " << s );
|
SG_LOG(SG_NETWORK,SG_WARN, "httpd: reading '" << propertyPath << "' failed: " << s );
|
||||||
}
|
}
|
||||||
if( false == node.valid() ) {
|
if( !node.valid() ) {
|
||||||
DOMNode * headline = new DOMNode( "h3" );
|
DOMNode * headline = new DOMNode( "h3" );
|
||||||
body->addChild( headline );
|
body->addChild( headline );
|
||||||
headline->addChild( new DOMTextElement( "Non-existent node requested!" ) );
|
headline->addChild( new DOMTextElement( "Non-existent node requested!" ) );
|
||||||
|
|
|
@ -278,7 +278,7 @@ public:
|
||||||
|
|
||||||
osgViewer::GraphicsWindow* window = NULL;
|
osgViewer::GraphicsWindow* window = NULL;
|
||||||
|
|
||||||
if (false == windowName.empty()) {
|
if (!windowName.empty()) {
|
||||||
for (osgViewer::ViewerBase::Windows::iterator itr = windows.begin(); itr != windows.end(); ++itr) {
|
for (osgViewer::ViewerBase::Windows::iterator itr = windows.begin(); itr != windows.end(); ++itr) {
|
||||||
if ((*itr)->getTraits()->windowName == windowName) {
|
if ((*itr)->getTraits()->windowName == windowName) {
|
||||||
window = *itr;
|
window = *itr;
|
||||||
|
@ -288,7 +288,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( NULL == window) {
|
if ( NULL == window) {
|
||||||
if (false == windowName.empty()) {
|
if (!windowName.empty()) {
|
||||||
SG_LOG(SG_NETWORK, SG_INFO, "requested window " << windowName << " not found, using first window");
|
SG_LOG(SG_NETWORK, SG_INFO, "requested window " << windowName << " not found, using first window");
|
||||||
}
|
}
|
||||||
window = *windows.begin();
|
window = *windows.begin();
|
||||||
|
@ -462,7 +462,7 @@ bool ScreenshotUriHandler::handleGetRequest(const HTTPRequest & request, HTTPRes
|
||||||
// string camera = request.RequestVariables.get("camera");
|
// string camera = request.RequestVariables.get("camera");
|
||||||
string window = request.RequestVariables.get("window");
|
string window = request.RequestVariables.get("window");
|
||||||
|
|
||||||
bool stream = (false == request.RequestVariables.get("stream").empty());
|
bool stream = (!request.RequestVariables.get("stream").empty());
|
||||||
|
|
||||||
int canvasindex = -1;
|
int canvasindex = -1;
|
||||||
string s_canvasindex = request.RequestVariables.get("canvasindex");
|
string s_canvasindex = request.RequestVariables.get("canvasindex");
|
||||||
|
@ -494,7 +494,7 @@ bool ScreenshotUriHandler::handleGetRequest(const HTTPRequest & request, HTTPRes
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false == stream) {
|
if (!stream) {
|
||||||
response.Header["Content-Type"] = string("image/").append(type);
|
response.Header["Content-Type"] = string("image/").append(type);
|
||||||
response.Header["Content-Disposition"] = string("inline; filename=\"fgfs-screen.").append(type).append("\"");
|
response.Header["Content-Disposition"] = string("inline; filename=\"fgfs-screen.").append(type).append("\"");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -322,7 +322,7 @@ int RegularConnection::request(struct mg_connection * connection)
|
||||||
|
|
||||||
// find a handler for the uri and remember it for possible polls on this connection
|
// find a handler for the uri and remember it for possible polls on this connection
|
||||||
_handler = _httpd->findHandler(request.Uri);
|
_handler = _httpd->findHandler(request.Uri);
|
||||||
if (false == _handler.valid()) {
|
if (!_handler.valid()) {
|
||||||
// uri not registered - pass false to indicate we have not processed the request
|
// uri not registered - pass false to indicate we have not processed the request
|
||||||
return MG_FALSE;
|
return MG_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -350,7 +350,7 @@ int RegularConnection::request(struct mg_connection * connection)
|
||||||
if (name.empty() || value.empty()) continue;
|
if (name.empty() || value.empty()) continue;
|
||||||
mg_send_header(connection, name.c_str(), value.c_str());
|
mg_send_header(connection, name.c_str(), value.c_str());
|
||||||
}
|
}
|
||||||
if (done || false == response.Content.empty()) {
|
if (done || !response.Content.empty()) {
|
||||||
SG_LOG(SG_NETWORK, SG_INFO,
|
SG_LOG(SG_NETWORK, SG_INFO,
|
||||||
"RegularConnection::request() responding " << response.Content.length() << " Bytes, done=" << done);
|
"RegularConnection::request() responding " << response.Content.length() << " Bytes, done=" << done);
|
||||||
mg_send_data(connection, response.Content.c_str(), response.Content.length());
|
mg_send_data(connection, response.Content.c_str(), response.Content.length());
|
||||||
|
@ -361,7 +361,7 @@ int RegularConnection::request(struct mg_connection * connection)
|
||||||
int RegularConnection::poll(struct mg_connection * connection)
|
int RegularConnection::poll(struct mg_connection * connection)
|
||||||
{
|
{
|
||||||
setConnection(connection);
|
setConnection(connection);
|
||||||
if (false == _handler.valid()) return MG_FALSE;
|
if (!_handler.valid()) return MG_FALSE;
|
||||||
// only return MG_TRUE if we handle this request
|
// only return MG_TRUE if we handle this request
|
||||||
return _handler->poll(this) ? MG_TRUE : MG_MORE;
|
return _handler->poll(this) ? MG_TRUE : MG_MORE;
|
||||||
}
|
}
|
||||||
|
@ -508,7 +508,7 @@ void MongooseHttpd::init()
|
||||||
}
|
}
|
||||||
string & lhs = rw_entries[0];
|
string & lhs = rw_entries[0];
|
||||||
string & rhs = rw_entries[1];
|
string & rhs = rw_entries[1];
|
||||||
if (false == rewrites.empty()) rewrites.append(1, ',');
|
if (!rewrites.empty()) rewrites.append(1, ',');
|
||||||
rewrites.append(lhs).append(1, '=');
|
rewrites.append(lhs).append(1, '=');
|
||||||
SGPath targetPath(rhs);
|
SGPath targetPath(rhs);
|
||||||
if (targetPath.isAbsolute() ) {
|
if (targetPath.isAbsolute() ) {
|
||||||
|
@ -518,7 +518,7 @@ void MongooseHttpd::init()
|
||||||
rewrites.append(fgRoot).append(1, '/').append(rhs);
|
rewrites.append(fgRoot).append(1, '/').append(rhs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (false == rewrites.empty()) mg_set_option(_server, "url_rewrites", rewrites.c_str());
|
if (!rewrites.empty()) mg_set_option(_server, "url_rewrites", rewrites.c_str());
|
||||||
}
|
}
|
||||||
mg_set_option(_server, "enable_directory_listing", n->getStringValue("enable-directory-listing", "yes"));
|
mg_set_option(_server, "enable_directory_listing", n->getStringValue("enable-directory-listing", "yes"));
|
||||||
mg_set_option(_server, "idle_timeout_ms", n->getStringValue("idle-timeout-ms", "30000"));
|
mg_set_option(_server, "idle_timeout_ms", n->getStringValue("idle-timeout-ms", "30000"));
|
||||||
|
@ -638,7 +638,7 @@ int MongooseHttpd::staticRequestHandler(struct mg_connection * connection, mg_ev
|
||||||
FGHttpd * FGHttpd::createInstance(SGPropertyNode_ptr configNode)
|
FGHttpd * FGHttpd::createInstance(SGPropertyNode_ptr configNode)
|
||||||
{
|
{
|
||||||
// only create a server if a port has been configured
|
// only create a server if a port has been configured
|
||||||
if (false == configNode.valid()) return NULL;
|
if (!configNode.valid()) return NULL;
|
||||||
string port = configNode->getStringValue("options/listening-port", "");
|
string port = configNode->getStringValue("options/listening-port", "");
|
||||||
if (port.empty()) return NULL;
|
if (port.empty()) return NULL;
|
||||||
return new MongooseHttpd(configNode);
|
return new MongooseHttpd(configNode);
|
||||||
|
|
|
@ -145,7 +145,7 @@ void JSON::toProp(cJSON * json, SGPropertyNode_ptr base)
|
||||||
|
|
||||||
//TODO: better check for valid name
|
//TODO: better check for valid name
|
||||||
string namestr = simgear::strutils::strip(string(name));
|
string namestr = simgear::strutils::strip(string(name));
|
||||||
if( false == namestr.empty() ) {
|
if( !namestr.empty() ) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
cj = cJSON_GetObjectItem(json, "index");
|
cj = cJSON_GetObjectItem(json, "index");
|
||||||
if (NULL != cj) index = cj->valueint;
|
if (NULL != cj) index = cj->valueint;
|
||||||
|
|
|
@ -63,7 +63,7 @@ void FGFLITEVoice::speak(const string & msg)
|
||||||
{
|
{
|
||||||
// this is called from voice.cxx:FGVoiceMgr::FGVoiceThread::run
|
// this is called from voice.cxx:FGVoiceMgr::FGVoiceThread::run
|
||||||
string s = simgear::strutils::strip(msg);
|
string s = simgear::strutils::strip(msg);
|
||||||
if (false == s.empty()) {
|
if (!s.empty()) {
|
||||||
_sampleQueue.push(_synthesizer->synthesize(msg, 1.0, 0.5, 0.5));
|
_sampleQueue.push(_synthesizer->synthesize(msg, 1.0, 0.5, 0.5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue