Melchior FRANZ a écrit :
> * Stuart Buchanan -- Saturday 31 May 2008:
>   
>> +        if (!_filter.empty() && (strcasestr(entry.c_str(), _filter.c_str()) 
>> == NULL))
>>     
>
> quote from 'man strcasestr':
>
>   The strcasestr() function is a non-standard extension.
>
> I doubt that it's available on all supported platforms.
>   

I confirm there in no strcasestr or equivalent in MS runtime.
The patch below should be portable, although more convoluted.

-Fred

cvs -z4 -w -q diff -u -wb -- src\GUI\AirportList.cxx 
src\GUI\AirportList.hxx (in directory I:\Devel\FlightGear\)
Index: src/GUI/AirportList.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/GUI/AirportList.cxx,v
retrieving revision 1.18
diff -u -w -b -r1.18 AirportList.cxx
--- src/GUI/AirportList.cxx    11 Mar 2008 15:58:57 -0000    1.18
+++ src/GUI/AirportList.cxx    1 Jun 2008 10:21:57 -0000
@@ -2,6 +2,8 @@
 #include <Main/globals.hxx>
 #include <Airports/simple.hxx>
 
+#include <locale>
+
 #include "AirportList.hxx"
 
 
@@ -25,12 +27,15 @@
     int num_apt = _airports->size();
     char **content = new char *[num_apt + 1];
 
+    const std::ctype<char> &ct = std::use_facet<std::ctype<char> >( 
std::locale() );
     int n = 0;
     for (int i = 0; i < num_apt; i++) {
         const FGAirport *apt = _airports->getAirport(i);
-        STD::string entry(apt->getName() + "   (" + apt->getId() + ')');
+        std::string aid = apt->getId();
+        ct.toupper( (char *)aid.data(), (char *)aid.data()+aid.size() );
+        std::string entry(apt->getName() + "   (" + aid + ')');
 
-        if (!_filter.empty() && entry.find(_filter) == STD::string::npos)
+        if (!_filter.empty() && entry.find(_filter) == std::string::npos)
             continue;
 
         content[n] = new char[entry.size() + 1];
@@ -60,7 +65,8 @@
 void
 AirportList::setValue (const char *s)
 {
-    STD::string filter(s);
+    std::string filter(s);
+    std::use_facet<std::ctype<char> >( std::locale() ).toupper( (char 
*)filter.data(), (char *)filter.data()+filter.size() );
     if (filter != _filter) {
         _filter = filter;
         create_list();
Index: src/GUI/AirportList.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/GUI/AirportList.hxx,v
retrieving revision 1.7
diff -u -w -b -r1.7 AirportList.hxx
--- src/GUI/AirportList.hxx    11 Mar 2008 15:58:57 -0000    1.7
+++ src/GUI/AirportList.hxx    1 Jun 2008 10:08:17 -0000
@@ -9,10 +9,6 @@
 #include <plib/puAux.h>
 #include "dialog.hxx"
 
-
-
-SG_USING_STD(string);
-
 class FGAirportList;
 
 class AirportList : public puaList, public GUI_ID
@@ -28,7 +24,7 @@
  private:
     FGAirportList * _airports;
     char ** _content;
-    STD::string _filter;
+    std::string _filter;
 };
 
 #endif // __AIRPORTLIST_HXX

-- 
Frédéric Bouvier
http://my.fotolia.com/frfoto/   Photo gallery
http://fgsd.sourceforge.net/    FlightGear Scenery Designer


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to