Bug 1404147 Fixed Unsigned/Signed comparison in WindowsGamepad.cpp draft
authorTom Ritter <tom@mozilla.com>
Thu, 28 Sep 2017 17:00:05 -0500
changeset 672671 07d811b3d60f536ddf3d9d045edfa713ff435d60
parent 672063 ec1d6b1b9f8d52303baaddb62bca1cf1d730345c
child 672672 1ddefad2d541317dd58870e733218c0b73889ff0
push id82329
push userbmo:tom@mozilla.com
push dateFri, 29 Sep 2017 16:06:00 +0000
bugs1404147
milestone58.0a1
Bug 1404147 Fixed Unsigned/Signed comparison in WindowsGamepad.cpp MozReview-Commit-ID: 8qjkVdk6zWT
dom/gamepad/windows/WindowsGamepad.cpp
--- a/dom/gamepad/windows/WindowsGamepad.cpp
+++ b/dom/gamepad/windows/WindowsGamepad.cpp
@@ -383,17 +383,17 @@ class WindowsGamepadService
   static void DevicesChangeCallback(nsITimer *aTimer, void* aService);
 
  private:
   void ScanForDevices();
   // Look for connected raw input devices.
   void ScanForRawInputDevices();
   // Look for connected XInput devices.
   bool ScanForXInputDevices();
-  bool HaveXInputGamepad(int userIndex);
+  bool HaveXInputGamepad(unsigned int userIndex);
 
   bool mIsXInputMonitoring;
   void PollXInput();
   void CheckXInputChanges(Gamepad& gamepad, XINPUT_STATE& state);
 
   // Get information about a raw input gamepad.
   bool GetRawGamepad(HANDLE handle);
   void Cleanup();
@@ -457,17 +457,17 @@ void
 WindowsGamepadService::DevicesChangeCallback(nsITimer *aTimer, void* aService)
 {
   MOZ_ASSERT(aService);
   WindowsGamepadService* self = static_cast<WindowsGamepadService*>(aService);
   self->DevicesChanged(false);
 }
 
 bool
-WindowsGamepadService::HaveXInputGamepad(int userIndex)
+WindowsGamepadService::HaveXInputGamepad(unsigned int userIndex)
 {
   for (unsigned int i = 0; i < mGamepads.Length(); i++) {
     if (mGamepads[i].type == kXInputGamepad
         && mGamepads[i].userIndex == userIndex) {
       mGamepads[i].present = true;
       return true;
     }
   }
@@ -481,17 +481,17 @@ WindowsGamepadService::ScanForXInputDevi
 
   bool found = false;
   RefPtr<GamepadPlatformService> service =
     GamepadPlatformService::GetParentService();
   if (!service) {
     return found;
   }
 
-  for (int i = 0; i < XUSER_MAX_COUNT; i++) {
+  for (unsigned int i = 0; i < XUSER_MAX_COUNT; i++) {
     XINPUT_STATE state = {};
     if (mXInput.mXInputGetState(i, &state) != ERROR_SUCCESS) {
       continue;
     }
     found = true;
     // See if this device is already present in our list.
     if (HaveXInputGamepad(i)) {
       continue;