1
0
Fork 0

Fixed some snprintf buffer size warnings and added comments about possibly unused variables.

This commit is contained in:
Julian Smith 2021-08-06 19:19:05 +01:00
parent 18e7bfc4b0
commit 281fe6d47d
5 changed files with 10 additions and 10 deletions

View file

@ -1262,8 +1262,8 @@ void FGAIAircraft::handleATCRequests(double dt)
if (!this->getTrafficRef()) { if (!this->getTrafficRef()) {
return; return;
} }
time_t startTime = this->getTrafficRef()->getDepartureTime(); time_t startTime = this->getTrafficRef()->getDepartureTime(); /* <startTime> is unused. */
time_t now = globals->get_time_params()->get_cur_time(); time_t now = globals->get_time_params()->get_cur_time(); /* <now> is unused. */
//TODO implement NullController for having no ATC to save the conditionals //TODO implement NullController for having no ATC to save the conditionals
if (controller) { if (controller) {

View file

@ -109,8 +109,8 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
while (route.next(node, &rte)) while (route.next(node, &rte))
{ {
char buffer[10]; char buffer[20];
snprintf (buffer, 10, "pushback-%d4", (short)node->getIndex()); snprintf (buffer, sizeof(buffer), "pushback-%d4", (short)node->getIndex());
FGAIWaypoint *wpt = createOnGround(ac, string(buffer), node->geod(), dep->getElevation(), -vTaxiBackward); FGAIWaypoint *wpt = createOnGround(ac, string(buffer), node->geod(), dep->getElevation(), -vTaxiBackward);
/* /*
@ -166,8 +166,8 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
SGGeodesy::direct(parking->geod(), parkingHeading, SGGeodesy::direct(parking->geod(), parkingHeading,
(((double)i / numSegments) * distance), pushForwardPt, az2); (((double)i / numSegments) * distance), pushForwardPt, az2);
char buffer[16]; char buffer[20];
snprintf(buffer, 16, "pushforward-%d4", (short)i); snprintf(buffer, sizeof(buffer), "pushforward-%d4", (short)i);
FGAIWaypoint *wpt = createOnGround(ac, string(buffer), pushForwardPt, dep->getElevation(), vTaxiReduced); FGAIWaypoint *wpt = createOnGround(ac, string(buffer), pushForwardPt, dep->getElevation(), vTaxiReduced);
wpt->setRouteIndex(pushForwardSegment->getIndex()); wpt->setRouteIndex(pushForwardSegment->getIndex());

View file

@ -334,7 +334,7 @@ void FGEnvironmentMgr::updateClosestAirport()
auto automaticTowerActive = fgGetBool("/sim/tower/auto-position", true); auto automaticTowerActive = fgGetBool("/sim/tower/auto-position", true);
SGGeod nearestTowerPosition; SGGeod nearestTowerPosition;
bool nearestTowerPositionValid = false; bool nearestTowerPositionValid = false; /* <nearestTowerPositionValid> is set but unused. */
std::string nearestIdent; std::string nearestIdent;
const SGGeod airportGeod; const SGGeod airportGeod;
double towerDistance = numeric_limits<double>::max(); double towerDistance = numeric_limits<double>::max();

View file

@ -400,7 +400,7 @@ do_view_clone (const SGPropertyNode * arg, SGPropertyNode * root)
static bool static bool
do_view_last_pair (const SGPropertyNode * arg, SGPropertyNode * root) do_view_last_pair (const SGPropertyNode * arg, SGPropertyNode * root)
{ {
SG_LOG(SG_GENERAL, SG_ALERT, "do_view_last_pair() called"); SG_LOG(SG_GENERAL, SG_DEBUG, "do_view_last_pair() called");
globals->get_viewmgr()->clone_last_pair(arg); globals->get_viewmgr()->clone_last_pair(arg);
return true; return true;
} }

View file

@ -711,7 +711,7 @@ int fgMainInit( int argc, char **argv )
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
bool didUseLauncher = false; bool didUseLauncher = false; /* <didUseLauncher> is set but unused. */
#if defined(HAVE_QT) #if defined(HAVE_QT)
if (showLauncher) { if (showLauncher) {
flightgear::addSentryBreadcrumb("starting launcher", "info"); flightgear::addSentryBreadcrumb("starting launcher", "info");