fpe in src/Airports/GenAirports/rwy_nonprec.cxx

Alex Romosan <[email protected]>
Newsgroups gmane.games.flightgear.terragear.devel
Message-ID <[email protected]>
this patch needs to be applied to cure an fpe in rwy_nonprec.cxx:

--- a/src/Airports/GenAirports/rwy_nonprec.cxx  7 Apr 2004 04:25:35 -0000      1.15
+++ b/src/Airports/GenAirports/rwy_nonprec.cxx  10 Apr 2004 17:54:17 -0000
@@ -373,6 +373,9 @@
     // fit the 'rest' texture in as many times as will go evenly into
     // the remaining distance so we don't end up with a super short
     // section at the end.
+    if ( end1_pct >= 1.0 ) {
+      return;
+    }
     double ideal_rest_inc = ( 200.0 / length );
     int divs = (int)((1.0 - end1_pct) / ideal_rest_inc) + 1;
     double rest1_inc = (1.0 - end1_pct) / divs;
@@ -390,6 +393,9 @@
                            rwy_polys, texparams, accum );
     }
 
+    if ( end2_pct >= 1.0 ) {
+      return;
+    }
     ideal_rest_inc = ( 200.0 / length );
     divs = (int)((1.0 - end2_pct) / ideal_rest_inc) + 1;
     double rest2_inc = (1.0 - end2_pct) / divs;

basically we need to make sure end1_pct and end2_pct are less than 1
before we go any further (divs ends up being 0).

--alex--

-- 
| I believe the moment is at hand when, by a paranoiac and active |
|  advance of the mind, it will be possible (simultaneously with  |
|  automatism and other passive states) to systematize confusion  |
|  and thus to help to discredit completely the world of reality. |
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.