From a383d6285bc008bc43e472236692e8f8f472e3b9 Mon Sep 17 00:00:00 2001 From: ehofman Date: Fri, 27 May 2005 18:49:45 +0000 Subject: [PATCH] Fix a number of build issues; Not all compilers support strnlen(), some platforms use more than one lend-ending character and capture lines starting with a whitespace also. --- src/Airports/apt_loader.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Airports/apt_loader.cxx b/src/Airports/apt_loader.cxx index ff9f9305c..7ae69b7a6 100644 --- a/src/Airports/apt_loader.cxx +++ b/src/Airports/apt_loader.cxx @@ -30,6 +30,7 @@ #include // atof(), atoi() #include // memchr() +#include // isspace() #include #include @@ -80,7 +81,7 @@ bool fgAirportDBLoad( FGAirportList *airports, FGRunwayList *runways, line = tmp; SG_LOG( SG_GENERAL, SG_BULK, "-> '" << line << "'" ); - if ( !line.size() ) + if ( !line.size() || isspace(tmp[0])) continue; if (line.size() > 3) { @@ -100,7 +101,7 @@ bool fgAirportDBLoad( FGAirportList *airports, FGRunwayList *runways, // which is the version and copyright information in.getline(tmp, 2048); // vector vers_token = simgear::strutils::split( tmp ); - if ( strnlen(tmp, 2048) > 4 ) { + if ( strlen(tmp) > 4 ) { char *p = (char *)memchr(tmp, ' ', 4); if ( p ) *p = 0; -- 2.39.5