1
0
Fork 0

apt.dat parser: remove useless code

Remove useless code before parsing the "row code" (terminology from the
apt.dat v1000 spec). The row code is parsed with atoi(), which will
automatically stop at the first space found if it saw at least one
digit, thus there is no need to replace it with '\0', AFAICS.

One could replace the existing atoi() call with things that do better
checking, but my tests showed that would be a bit slower, so I let it
this way (tried with std::istringstream and strtol()).
This commit is contained in:
Florent Rougon 2016-04-24 18:05:15 +02:00
parent a43786f8dd
commit 85653f04d4

View file

@ -118,12 +118,6 @@ public:
cache->setRebuildPhaseProgress(NavDataCache::REBUILD_AIRPORTS, percent); cache->setRebuildPhaseProgress(NavDataCache::REBUILD_AIRPORTS, percent);
} }
if (line.size() >= 3) {
char *p = (char *)memchr(tmp, ' ', 3);
if ( p )
*p = 0;
}
line_id = atoi(tmp); line_id = atoi(tmp);
if ( tmp[0] == 'I' || tmp[0] == 'A' ) { if ( tmp[0] == 'I' || tmp[0] == 'A' ) {
// First line, indicates IBM ("I") or Macintosh ("A") // First line, indicates IBM ("I") or Macintosh ("A")