]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/core/hid.cpp
Suppress gcc warnings about double to int conversion.
[wxWidgets.git] / src / osx / core / hid.cpp
index fb9a4d051d21b7b7cb95c5d71a1b0994f3dc07c2..3bc287cb1738a2b15707e45eb44a202e718b3ae4 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/mac/corefoundation/hid.cpp
+// Name:        src/osx/corefoundation/hid.cpp
 // Purpose:     DARWIN HID layer for WX Implementation
 // Author:      Ryan Norton
 // Modified by:
@@ -27,7 +27,7 @@
 //DARWIN _ONLY_
 #ifdef __DARWIN__
 
-#include "wx/mac/corefoundation/hid.h"
+#include "wx/osx/core/hid.h"
 
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
@@ -37,7 +37,7 @@
     #include "wx/module.h"
 #endif
 
-#include "wx/mac/corefoundation/cfstring.h"
+#include "wx/osx/core/cfstring.h"
 
 // ============================================================================
 // implementation
@@ -78,7 +78,7 @@ bool wxHIDDevice::Create (int nClass, int nType, int nDev)
     CFMutableDictionaryRef pDictionary = IOServiceMatching(kIOHIDDeviceKey);
     if(pDictionary == NULL)
     {
-        wxLogSysError( _T("IOServiceMatching(kIOHIDDeviceKey) failed") );
+        wxLogSysError( wxT("IOServiceMatching(kIOHIDDeviceKey) failed") );
         return false;
     }
 
@@ -103,7 +103,7 @@ bool wxHIDDevice::Create (int nClass, int nType, int nDev)
     if( IOServiceGetMatchingServices(m_pPort,
                         pDictionary, &pIterator) != kIOReturnSuccess )
     {
-        wxLogSysError(_T("No Matching HID Services"));
+        wxLogSysError(wxT("No Matching HID Services"));
         return false;
     }
 
@@ -129,7 +129,7 @@ bool wxHIDDevice::Create (int nClass, int nType, int nDev)
                 kNilOptions
              ) != KERN_SUCCESS )
         {
-            wxLogDebug(_T("IORegistryEntryCreateCFProperties failed"));
+            wxLogDebug(wxT("IORegistryEntryCreateCFProperties failed"));
         }
 
         //
@@ -193,7 +193,9 @@ bool wxHIDDevice::Create (int nClass, int nType, int nDev)
 
         //open the HID interface...
         if ( (*m_ppDevice)->open(m_ppDevice, 0) != S_OK )
-            wxLogDebug(_T("HID device: open failed"));
+        {
+            wxLogDebug(wxT("HID device: open failed"));
+        }
 
         //
         //Now the hard part - in order to scan things we need "cookies"
@@ -240,7 +242,7 @@ size_t wxHIDDevice::GetCount (int nClass, int nType)
     CFMutableDictionaryRef pDictionary = IOServiceMatching(kIOHIDDeviceKey);
     if(pDictionary == NULL)
     {
-        wxLogSysError( _T("IOServiceMatching(kIOHIDDeviceKey) failed") );
+        wxLogSysError( wxT("IOServiceMatching(kIOHIDDeviceKey) failed") );
         return false;
     }
 
@@ -265,7 +267,7 @@ size_t wxHIDDevice::GetCount (int nClass, int nType)
     if( IOServiceGetMatchingServices(pPort,
                                      pDictionary, &pIterator) != kIOReturnSuccess )
     {
-        wxLogSysError(_T("No Matching HID Services"));
+        wxLogSysError(wxT("No Matching HID Services"));
         return false;
     }
 
@@ -316,7 +318,9 @@ void wxHIDDevice::AddCookieInQueue(CFTypeRef Data, int i)
     //3rd Param flags (none yet)
     AddCookie(Data, i);
     if ( (*m_ppQueue)->addElement(m_ppQueue, m_pCookies[i], 0) != S_OK )
-        wxLogDebug(_T("HID device: adding element failed"));
+    {
+        wxLogDebug(wxT("HID device: adding element failed"));
+    }
 }
 
 // ----------------------------------------------------------------------------
@@ -333,14 +337,14 @@ void wxHIDDevice::InitCookies(size_t dwSize, bool bQueue)
         m_ppQueue = (*m_ppDevice)->allocQueue(m_ppDevice);
         if ( !m_ppQueue )
         {
-            wxLogDebug(_T("HID device: allocQueue failed"));
+            wxLogDebug(wxT("HID device: allocQueue failed"));
             return;
         }
 
         //Param 2, flags, none yet
         if ( (*m_ppQueue)->create(m_ppQueue, 0, 512) != S_OK )
         {
-            wxLogDebug(_T("HID device: create failed"));
+            wxLogDebug(wxT("HID device: create failed"));
         }
     }
 
@@ -376,7 +380,7 @@ bool wxHIDDevice::IsActive(int nIndex)
 // ----------------------------------------------------------------------------
 bool wxHIDDevice::HasElement(int nIndex)
 {
-    return m_pCookies[nIndex] != NULL;
+    return (void*) m_pCookies[nIndex] != NULL;
 }
 
 // ----------------------------------------------------------------------------
@@ -474,8 +478,8 @@ void wxHIDKeyboard::BuildCookies(CFArrayRef Array)
 void wxHIDKeyboard::DoBuildCookies(CFArrayRef Array)
 {
     //Now go through each possible cookie
-    int i,
-        nUsage;
+    int i;
+    long nUsage;
 //    bool bEOTriggered = false;
     for (i = 0; i < CFArrayGetCount(Array); ++i)
     {
@@ -651,6 +655,7 @@ class wxHIDModule : public wxModule
         {
             for(size_t i = 0; i < sm_keyboards.GetCount(); ++i)
                 delete (wxHIDKeyboard*) sm_keyboards[i];
+            sm_keyboards.Clear();
         }
 };