]> git.mxchange.org Git - flightgear.git/commitdiff
Compile again, replace clib strXXX with std::string
authorTorsten Dreyer <Torsten@t3r.de>
Mon, 25 Oct 2010 12:48:56 +0000 (14:48 +0200)
committerTorsten Dreyer <Torsten@t3r.de>
Mon, 25 Oct 2010 12:48:56 +0000 (14:48 +0200)
src/Input/FGEventInput.cxx
src/Input/FGLinuxEventInput.cxx

index 31e6fc9788361ad78d313e1e13c067dd798194b9..29ee0977c9db50ab3f7724aa1999460d23248bc3 100644 (file)
@@ -66,7 +66,7 @@ bool FGEventSetting::Test()
 
 static inline bool StartsWith( string & s, const char * cp )
 {
-  return s.compare( 0, strlen(cp), cp ) == 0;
+  return s.find( cp ) == 0;
 }
 
 FGInputEvent * FGInputEvent::NewObject( FGInputDevice * device, SGPropertyNode_ptr node )
@@ -223,8 +223,8 @@ FGInputDevice::~FGInputDevice()
     if( nasal ) {
       SGPropertyNode_ptr nasalClose = nasal->getNode("close");
       if (nasalClose) {
-        const char *s = nasalClose->getStringValue();
-        nas->createModule(nasalModule.c_str(), nasalModule.c_str(), s, strlen(s), deviceNode );
+        const string s = nasalClose->getStringValue();
+        nas->createModule(nasalModule.c_str(), nasalModule.c_str(), s.c_str(), s.length(), deviceNode );
       }
     }
     nas->deleteModule(nasalModule.c_str());
@@ -253,10 +253,10 @@ void FGInputDevice::Configure( SGPropertyNode_ptr aDeviceNode )
   if (nasal) {
     SGPropertyNode_ptr open = nasal->getNode("open");
     if (open) {
-      const char *s = open->getStringValue();
+      const string s = open->getStringValue();
       FGNasalSys *nas = (FGNasalSys *)globals->get_subsystem("nasal");
       if (nas)
-        nas->createModule(nasalModule.c_str(), nasalModule.c_str(), s, strlen(s), deviceNode );
+        nas->createModule(nasalModule.c_str(), nasalModule.c_str(), s.c_str(), s.length(), deviceNode );
     }
   }
 
index 183c7b3ab805c319b84bee27b0c3de372d611ac6..621e15fd8b41a9d5994ab96139385a160f5c2ff8 100644 (file)
@@ -29,6 +29,8 @@
 #include <poll.h>
 #include <linux/input.h>
 #include <dbus/dbus.h>
+#include <fcntl.h>
+
 
 struct TypeCode {
   unsigned type;
@@ -238,7 +240,7 @@ static EventNameByType EVENT_NAME_BY_TYPE;
 
 struct ltstr {
   bool operator()(const char * s1, const char * s2 ) const {
-    return strcmp( s1, s2 ) < 0;
+    return string(s1).compare( s2 ) < 0;
   }
 };