Small patch fixing bugs I've encountered while getting the current CVS
to build in MSVC.
* std::lower_bound was used with the key-type of a map, but lower_bound
expects the value-type of the collection it works on, with is std::pair.
MSVC seems to be more strict about this.
* Added an missing include statement.
* Replaced an rint() call with floor() (MSVC does not offer rint).
PS: I have updated VC8 project files and a working set of 3rdParty
libraries. If there is any interest, I could make a package.
Stefan
Index: Airports/simple.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Airports/simple.cxx,v
retrieving revision 1.47
diff -u -r1.47 simple.cxx
--- Airports/simple.cxx 24 Aug 2008 09:04:24 -0000 1.47
+++ Airports/simple.cxx 30 Aug 2008 19:20:48 -0000
@@ -331,9 +331,9 @@
mOrdering(aOrder)
{ assert(aOrder); }
- bool operator()(const airport_map::value_type& aA, const std::string& aB)
const
+ bool operator()(const airport_map::value_type& aA, const
airport_map::value_type& aB) const
{
- return mOrdering->compare(aA.first,aB);
+ return mOrdering->compare(aA.first,aB.first);
}
private:
@@ -342,10 +342,11 @@
const FGAirport* FGAirportList::findFirstById(const std::string& aIdent,
FGIdentOrdering* aOrder)
{
+ FGAirport* dummy = 0;
airport_map_iterator itr;
if (aOrder) {
orderingFunctor func(aOrder);
- itr = std::lower_bound(airports_by_id.begin(),airports_by_id.end(),
aIdent, func);
+ itr = std::lower_bound(airports_by_id.begin(),airports_by_id.end(),
airport_map::value_type(aIdent, dummy), func);
} else {
itr = airports_by_id.lower_bound(aIdent);
}
Index: Main/metar_main.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Main/metar_main.cxx,v
retrieving revision 1.13
diff -u -r1.13 metar_main.cxx
--- Main/metar_main.cxx 2 Jun 2008 21:07:38 -0000 1.13
+++ Main/metar_main.cxx 30 Aug 2008 19:24:34 -0000
@@ -24,6 +24,7 @@
#include <sstream>
#include <iostream>
#include <string.h>
+#include <time.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/environment/metar.hxx>
@@ -76,7 +77,7 @@
double rnd(double r, int g = 0)
{
double f = pow(10.0, g);
- return f * rint(r / f);
+ return f * floor(r / f);
}
Index: Navaids/fixlist.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Navaids/fixlist.cxx,v
retrieving revision 1.14
diff -u -r1.14 fixlist.cxx
--- Navaids/fixlist.cxx 23 Aug 2008 13:09:24 -0000 1.14
+++ Navaids/fixlist.cxx 30 Aug 2008 19:17:22 -0000
@@ -141,9 +141,9 @@
mOrdering(aOrder)
{ assert(aOrder); }
- bool operator()(const fix_map_type::value_type& aA, const std::string& aB)
const
+ bool operator()(const fix_map_type::value_type& aA, const
fix_map_type::value_type& aB) const
{
- return mOrdering->compare(aA.first,aB);
+ return mOrdering->compare(aA.first,aB.first);
}
private:
@@ -152,10 +152,11 @@
const FGFix* FGFixList::findFirstByIdent( const string& ident,
FGIdentOrdering* aOrder)
{
+ static FGFix dummy;
fix_map_iterator itr;
if (aOrder) {
orderingFunctor func(aOrder);
- itr = std::lower_bound(fixlist.begin(),fixlist.end(), ident, func);
+ itr = std::lower_bound(fixlist.begin(),fixlist.end(),
fix_map_type::value_type(ident, dummy), func);
} else {
itr = fixlist.lower_bound(ident);
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel