simplify case-insensitive substring search
authorAndreas Oberritter <obi@opendreambox.org>
Tue, 29 Sep 2009 23:23:42 +0000 (01:23 +0200)
committerAndreas Oberritter <obi@opendreambox.org>
Mon, 26 Apr 2010 10:28:24 +0000 (12:28 +0200)
lib/driver/rcinput.cpp

index 2bfeefa1992e53c2a07d55b346f30f91670e15c1..f30ba8cbe7f85010d76d8f25df36f276988181fd 100644 (file)
@@ -73,16 +73,8 @@ void eRCDeviceInputDev::handleCode(long rccode)
 eRCDeviceInputDev::eRCDeviceInputDev(eRCInputEventDriver *driver)
        :eRCDevice(driver->getDeviceName(), driver), iskeyboard(false)
 {
 eRCDeviceInputDev::eRCDeviceInputDev(eRCInputEventDriver *driver)
        :eRCDevice(driver->getDeviceName(), driver), iskeyboard(false)
 {
-       int len=id.length();
-       int idx=0;
-       while(idx <= len-8)
-       {
-               if (!strncasecmp(&id[idx++], "KEYBOARD", 8))
-               {
-                       iskeyboard=true;
-                       break;
-               }
-       }
+       if (strcasestr(id.c_str(), "keyboard") != NULL)
+               iskeyboard = true;
        setExclusive(true);
        eDebug("Input device \"%s\" is %sa keyboard.", id.c_str(), iskeyboard ? "" : "not ");
 }
        setExclusive(true);
        eDebug("Input device \"%s\" is %sa keyboard.", id.c_str(), iskeyboard ? "" : "not ");
 }