]> git.mxchange.org Git - flightgear.git/commitdiff
apt_loader.cxx: update version parsing to 4-digit versions,
authorChristian Schmitt <chris@ilovelinux.de>
Sun, 24 Feb 2013 21:03:29 +0000 (22:03 +0100)
committerChristian Schmitt <chris@ilovelinux.de>
Sun, 24 Feb 2013 21:03:29 +0000 (22:03 +0100)
some tweaks according to the spec.

src/Airports/apt_loader.cxx

index f4ad7793a8bf8b48122055598b85398d57ae9752..f03a253fa04df49131a35543d9bde29946621cfe 100644 (file)
@@ -105,10 +105,10 @@ public:
       line = tmp; // string copy, ack
       line_num++;
 
-      if ( !line.size() || isspace(tmp[0])) {
+      if ( line.empty() || isspace(tmp[0]) || tmp[0] == '#' ) {
         continue;
       }
-      
+
       if (line.size() >= 3) {
           char *p = (char *)memchr(tmp, ' ', 3);
           if ( p )
@@ -116,16 +116,16 @@ public:
       }
 
       line_id = atoi(tmp);
-      if ( tmp[0] == 'I' ) {
-        // First line, indicates IBM (i.e. DOS line endings I
-        // believe.)
+      if ( tmp[0] == 'I' || tmp[0] == 'A' ) {
+        // First line, indicates IBM ("I") or Macintosh ("A")
+        // line endings.
 
         // move past this line and read and discard the next line
         // which is the version and copyright information
         in.getline(tmp, 2048);
-        // vector<string> vers_token = simgear::strutils::split( tmp );
-        if ( strlen(tmp) > 4 ) {
-           char *p = (char *)memchr(tmp, ' ', 4);
+
+        if ( strlen(tmp) > 5 ) {
+           char *p = (char *)memchr(tmp, ' ', 5);
            if ( p )
               *p = 0;
         }