]> git.mxchange.org Git - flightgear.git/blobdiff - src/Input/FGEventInput.cxx
Revert joystick patch. One would have to provide a better one
[flightgear.git] / src / Input / FGEventInput.cxx
index 31e6fc9788361ad78d313e1e13c067dd798194b9..8bf9f304e53bb2be03e22c04bbc1182008b3e78b 100644 (file)
@@ -24,6 +24,7 @@
 #  include <config.h>
 #endif
 
+#include <cstring>
 #include "FGEventInput.hxx"
 #include <Main/fg_props.hxx>
 #include <simgear/io/sg_file.hxx>
@@ -66,7 +67,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 +224,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 +254,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 );
     }
   }