1
0
Fork 0

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.

This commit is contained in:
ehofman 2005-05-27 18:49:45 +00:00
parent e4bce63391
commit a383d6285b

View file

@ -30,6 +30,7 @@
#include <stdlib.h> // atof(), atoi() #include <stdlib.h> // atof(), atoi()
#include <strings.h> // memchr() #include <strings.h> // memchr()
#include <ctype.h> // isspace()
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
@ -80,7 +81,7 @@ bool fgAirportDBLoad( FGAirportList *airports, FGRunwayList *runways,
line = tmp; line = tmp;
SG_LOG( SG_GENERAL, SG_BULK, "-> '" << line << "'" ); SG_LOG( SG_GENERAL, SG_BULK, "-> '" << line << "'" );
if ( !line.size() ) if ( !line.size() || isspace(tmp[0]))
continue; continue;
if (line.size() > 3) { if (line.size() > 3) {
@ -100,7 +101,7 @@ bool fgAirportDBLoad( FGAirportList *airports, FGRunwayList *runways,
// which is the version and copyright information // which is the version and copyright information
in.getline(tmp, 2048); in.getline(tmp, 2048);
// vector<string> vers_token = simgear::strutils::split( tmp ); // vector<string> vers_token = simgear::strutils::split( tmp );
if ( strnlen(tmp, 2048) > 4 ) { if ( strlen(tmp) > 4 ) {
char *p = (char *)memchr(tmp, ' ', 4); char *p = (char *)memchr(tmp, ' ', 4);
if ( p ) if ( p )
*p = 0; *p = 0;