1
0
Fork 0

Fix new Clang compielr warnings

* returning bool from main
* set-but-unused variables
* mismatch of bitwise and logical 'or'
This commit is contained in:
James Turner 2023-09-12 21:34:55 +01:00
parent e10d827918
commit da70e43d3d
6 changed files with 13 additions and 24 deletions

View file

@ -136,10 +136,10 @@ void HUD::Runway::draw()
glEnable(GL_LINE_STIPPLE); glEnable(GL_LINE_STIPPLE);
glLineStipple(1, _stipple_out); glLineStipple(1, _stipple_out);
anyLines = anyLines =
drawLine(_points3d[0], _points3d[1], _points2d[0], _points2d[1]) | //draw top drawLine(_points3d[0], _points3d[1], _points2d[0], _points2d[1]) || //draw top
drawLine(_points3d[2], _points3d[1], _points2d[2], _points2d[1]) | //draw right drawLine(_points3d[2], _points3d[1], _points2d[2], _points2d[1]) || //draw right
drawLine(_points3d[2], _points3d[3], _points2d[2], _points2d[3]) | //draw bottom drawLine(_points3d[2], _points3d[3], _points2d[2], _points2d[3]) || //draw bottom
drawLine(_points3d[3], _points3d[0], _points2d[3], _points2d[0]); //draw left drawLine(_points3d[3], _points3d[0], _points2d[3], _points2d[0]); //draw left
glLineStipple(1, _stipple_center); glLineStipple(1, _stipple_center);
anyLines |= drawLine(_points3d[5], _points3d[4], _points2d[5], _points2d[4]); //draw center anyLines |= drawLine(_points3d[5], _points3d[4], _points2d[5], _points2d[4]); //draw center

View file

@ -15,13 +15,6 @@
#include <simgear/structure/commands.hxx> #include <simgear/structure/commands.hxx>
#include <thread> #include <thread>
namespace {
inline std::string fgswiftbusServiceName()
{
return "org.swift-project.fgswiftbus";
}
} // namespace
namespace FGSwiftBus { namespace FGSwiftBus {
CPlugin::CPlugin() CPlugin::CPlugin()
{ {

View file

@ -50,7 +50,6 @@ private:
std::unique_ptr<CTraffic> m_traffic; std::unique_ptr<CTraffic> m_traffic;
std::thread m_dbusThread; std::thread m_dbusThread;
bool m_isRunning = false;
bool m_shouldStop = false; bool m_shouldStop = false;
}; };
} // namespace FGSwiftBus } // namespace FGSwiftBus

View file

@ -583,16 +583,13 @@ FGScheduledFlight* FGAISchedule::findAvailableFlight(const string& currentDestin
if (fltBegin == fltEnd) { if (fltBegin == fltEnd) {
SG_LOG(SG_AI, SG_BULK, "No Flights Scheduled for " << req); SG_LOG(SG_AI, SG_BULK, "No Flights Scheduled for " << req);
} }
int counter = 0;
for (FGScheduledFlightVecIterator i = fltBegin; i != fltEnd; ++i) { for (FGScheduledFlightVecIterator i = fltBegin; i != fltEnd; ++i) {
(*i)->adjustTime(now); (*i)->adjustTime(now);
//sort(fltBegin, fltEnd, compareScheduledFlights);
//cerr << counter++ << endl;
} }
std::sort(fltBegin, fltEnd, FGScheduledFlight::compareScheduledFlights); std::sort(fltBegin, fltEnd, FGScheduledFlight::compareScheduledFlights);
for (FGScheduledFlightVecIterator i = fltBegin; i != fltEnd; ++i) { for (FGScheduledFlightVecIterator i = fltBegin; i != fltEnd; ++i) {
//bool valid = true; //bool valid = true;
counter++;
if (!(*i)->isAvailable()) { if (!(*i)->isAvailable()) {
SG_LOG(SG_AI, SG_BULK, "" << (*i)->getCallSign() << "is no longer available"); SG_LOG(SG_AI, SG_BULK, "" << (*i)->getCallSign() << "is no longer available");

View file

@ -8,6 +8,7 @@
# include <netinet/in.h> // htonl() ntohl() # include <netinet/in.h> // htonl() ntohl()
#endif #endif
#include <cstdlib>
#include <iostream> #include <iostream>
#include <string> #include <string>
@ -574,19 +575,19 @@ int main( int argc, char **argv ) {
SGSerialPort input( serialdev, 115200 ); SGSerialPort input( serialdev, 115200 );
if ( !input.is_enabled() ) { if ( !input.is_enabled() ) {
cout << "Cannot open: " << serialdev << endl; cout << "Cannot open: " << serialdev << endl;
return false; return EXIT_FAILURE;
} }
// open up the data log file if requested // open up the data log file if requested
if ( !outfile.length() ) { if ( !outfile.length() ) {
cout << "no --outfile <name> specified, cannot capture data!" cout << "no --outfile <name> specified, cannot capture data!"
<< endl; << endl;
return false; return EXIT_FAILURE;
} }
SGFile output( outfile ); SGFile output( outfile );
if ( !output.open( SG_IO_OUT ) ) { if ( !output.open( SG_IO_OUT ) ) {
cout << "Cannot open: " << outfile << endl; cout << "Cannot open: " << outfile << endl;
return false; return EXIT_FAILURE;
} }
while ( input.is_enabled() ) { while ( input.is_enabled() ) {

View file

@ -8,6 +8,7 @@
# include <netinet/in.h> // htonl() ntohl() # include <netinet/in.h> // htonl() ntohl()
#endif #endif
#include <cstdlib>
#include <iostream> #include <iostream>
#include <string> #include <string>
@ -990,7 +991,6 @@ int main( int argc, char **argv ) {
} else if ( serialdev.length() ) { } else if ( serialdev.length() ) {
// process incoming data from the serial port // process incoming data from the serial port
int count = 0;
double current_time = 0.0; double current_time = 0.0;
double last_time = 0.0; double last_time = 0.0;
@ -1012,19 +1012,19 @@ int main( int argc, char **argv ) {
SGSerialPort uavcom( serialdev, 115200 ); SGSerialPort uavcom( serialdev, 115200 );
if ( !uavcom.is_enabled() ) { if ( !uavcom.is_enabled() ) {
cout << "Cannot open: " << serialdev << endl; cout << "Cannot open: " << serialdev << endl;
return false; return EXIT_FAILURE;
} }
// open up the data log file if requested // open up the data log file if requested
if ( !outfile.length() ) { if ( !outfile.length() ) {
cout << "no --outfile <name> specified, cannot capture data!" cout << "no --outfile <name> specified, cannot capture data!"
<< endl; << endl;
return false; return EXIT_FAILURE;
} }
SGFile log( outfile ); SGFile log( outfile );
if ( !log.open( SG_IO_OUT ) ) { if ( !log.open( SG_IO_OUT ) ) {
cout << "Cannot open: " << outfile << endl; cout << "Cannot open: " << outfile << endl;
return false; return EXIT_FAILURE;
} }
// add some test commands // add some test commands
@ -1039,7 +1039,6 @@ int main( int argc, char **argv ) {
&imupacket, &navpacket, &servopacket, &imupacket, &navpacket, &servopacket,
&healthpacket, ignore_checksum ); &healthpacket, ignore_checksum );
// cout << "message id = " << id << endl; // cout << "message id = " << id << endl;
count++;
telnet.process(); telnet.process();