From 2b8937c2c2cd7db772b72646243b62cbf33ad949 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Sun, 24 Apr 2016 20:10:10 +0200 Subject: [PATCH] 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. --- src/Airports/apt_loader.cxx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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)); -- 2.39.5