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()) {
return;
}
time_t startTime = this->getTrafficRef()->getDepartureTime();
time_t now = globals->get_time_params()->get_cur_time();
time_t startTime = this->getTrafficRef()->getDepartureTime(); /* <startTime> is unused. */
time_t now = globals->get_time_params()->get_cur_time(); /* <now> is unused. */
//TODO implement NullController for having no ATC to save the conditionals
if (controller) {
@ -1587,4 +1587,4 @@ std::string FGAIAircraft::getTimeString(int timeOffset)
tm* timeinfo = gmtime(&rawtime);
strftime(ret, 11, "%w/%H:%M:%S", timeinfo);
return ret;
}
}

View file

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

View file

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

View file

@ -400,7 +400,7 @@ do_view_clone (const SGPropertyNode * arg, SGPropertyNode * root)
static bool
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);
return true;
}

View file

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