From: Florent Rougon Date: Sun, 24 Apr 2016 18:10:10 +0000 (+0200) Subject: apt.dat parser: indentation fixes; add a comment X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2b8937c2c2cd7db772b72646243b62cbf33ad949;p=flightgear.git apt.dat parser: indentation fixes; add a comment - The first place where indentation is fixed was really misleading, at least. - The added comment "'line' may end with an \r character [...]" just clarifies something that has been there for ages, to avoid people falling into the trap. --- diff --git a/src/Airports/apt_loader.cxx b/src/Airports/apt_loader.cxx index 9fe89a42a..0dd3512b4 100644 --- a/src/Airports/apt_loader.cxx +++ b/src/Airports/apt_loader.cxx @@ -129,23 +129,24 @@ public: throwExceptionIfStreamError(in, "apt.dat", apt_dat); while ( std::getline(in, line) ) { + // 'line' may end with an \r character, see above line_num++; if ( isBlankOrCommentLine(line) ) continue; - if ((line_num % 100) == 0) { - // every 100 lines - unsigned int percent = (line_num * 100) / LINES_IN_APT_DAT; - cache->setRebuildPhaseProgress(NavDataCache::REBUILD_AIRPORTS, percent); - } + if ((line_num % 100) == 0) { + // every 100 lines + unsigned int percent = (line_num * 100) / LINES_IN_APT_DAT; + cache->setRebuildPhaseProgress(NavDataCache::REBUILD_AIRPORTS, percent); + } // Extract the first field into 'line_id' line_id = atoi(line.c_str()); if ( line_id == 1 /* Airport */ || - line_id == 16 /* Seaplane base */ || - line_id == 17 /* Heliport */ ) { + line_id == 16 /* Seaplane base */ || + line_id == 17 /* Heliport */ ) { parseAirportLine(simgear::strutils::split(line)); } else if ( line_id == 10 ) { // Runway v810 parseRunwayLine810(simgear::strutils::split(line));