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,9 +136,9 @@ void HUD::Runway::draw()
glEnable(GL_LINE_STIPPLE);
glLineStipple(1, _stipple_out);
anyLines =
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[3], _points2d[2], _points2d[3]) | //draw bottom
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[3], _points2d[2], _points2d[3]) || //draw bottom
drawLine(_points3d[3], _points3d[0], _points2d[3], _points2d[0]); //draw left
glLineStipple(1, _stipple_center);

View file

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

View file

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

View file

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

View file

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

View file

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