Bug 1404147 Fixed Unsigned/Signed comparison in WindowsGamepad.cpp r?qdot draft
authorTom Ritter <tom@mozilla.com>
Thu, 28 Sep 2017 17:00:05 -0500
changeset 674376 a37e3178aa74073e87e0aff17bcfa136043c23be
parent 674368 7f338fad9f04da2a101aa7d79e23981eb6b53e80
child 674377 39366c8bb16836167ebe64ff6279cea66c8316c9
push id82814
push userbmo:tom@mozilla.com
push dateTue, 03 Oct 2017 17:51:18 +0000
reviewersqdot
bugs1404147
milestone58.0a1
Bug 1404147 Fixed Unsigned/Signed comparison in WindowsGamepad.cpp r?qdot 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;