X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInput%2FFGEventInput.cxx;h=8bf9f304e53bb2be03e22c04bbc1182008b3e78b;hb=d0a2fbba990c07608b813fa026126fe7ce52c552;hp=31e6fc9788361ad78d313e1e13c067dd798194b9;hpb=dee0b6459e41f7c08e74321c51f3149f955262a0;p=flightgear.git diff --git a/src/Input/FGEventInput.cxx b/src/Input/FGEventInput.cxx index 31e6fc978..8bf9f304e 100644 --- a/src/Input/FGEventInput.cxx +++ b/src/Input/FGEventInput.cxx @@ -24,6 +24,7 @@ # include #endif +#include #include "FGEventInput.hxx" #include
#include @@ -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 ); } }