From c56864f05a0608228b91f80d97fad4ab105d2280 Mon Sep 17 00:00:00 2001 From: Daosheng Mu Date: Tue, 7 Apr 2020 09:13:50 +0000 Subject: [PATCH] Bug 1627753 - Using signed long for index attribute in Gamepad. r=baku Differential Revision: https://phabricator.services.mozilla.com/D69854 --HG-- extra : moz-landing-system : lando --- dom/gamepad/Gamepad.cpp | 4 ++-- dom/gamepad/Gamepad.h | 8 ++++---- dom/webidl/Gamepad.webidl | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dom/gamepad/Gamepad.cpp b/dom/gamepad/Gamepad.cpp index 863666240d35..d49a9792a049 100644 --- a/dom/gamepad/Gamepad.cpp +++ b/dom/gamepad/Gamepad.cpp @@ -36,7 +36,7 @@ void Gamepad::UpdateTimestamp() { } } -Gamepad::Gamepad(nsISupports* aParent, const nsAString& aID, uint32_t aIndex, +Gamepad::Gamepad(nsISupports* aParent, const nsAString& aID, int32_t aIndex, uint32_t aHashKey, GamepadMappingType aMapping, GamepadHand aHand, uint32_t aDisplayID, uint32_t aNumButtons, uint32_t aNumAxes, uint32_t aNumHaptics, @@ -76,7 +76,7 @@ Gamepad::Gamepad(nsISupports* aParent, const nsAString& aID, uint32_t aIndex, UpdateTimestamp(); } -void Gamepad::SetIndex(uint32_t aIndex) { mIndex = aIndex; } +void Gamepad::SetIndex(int32_t aIndex) { mIndex = aIndex; } void Gamepad::SetConnected(bool aConnected) { mConnected = aConnected; } diff --git a/dom/gamepad/Gamepad.h b/dom/gamepad/Gamepad.h index 85898c5d7ee2..c595aa02f860 100644 --- a/dom/gamepad/Gamepad.h +++ b/dom/gamepad/Gamepad.h @@ -39,7 +39,7 @@ const int kRightStickYAxis = 3; class Gamepad final : public nsISupports, public nsWrapperCache { public: - Gamepad(nsISupports* aParent, const nsAString& aID, uint32_t aIndex, + Gamepad(nsISupports* aParent, const nsAString& aID, int32_t aIndex, uint32_t aHashKey, GamepadMappingType aMapping, GamepadHand aHand, uint32_t aDisplayID, uint32_t aNumButtons, uint32_t aNumAxes, uint32_t aNumHaptics, uint32_t aNumLightIndicator, @@ -51,7 +51,7 @@ class Gamepad final : public nsISupports, public nsWrapperCache { void SetConnected(bool aConnected); void SetButton(uint32_t aButton, bool aPressed, bool aTouched, double aValue); void SetAxis(uint32_t aAxis, double aValue); - void SetIndex(uint32_t aIndex); + void SetIndex(int32_t aIndex); void SetPose(const GamepadPoseState& aPose); void SetLightIndicatorType(uint32_t aLightIndex, GamepadLightIndicatorType aType); @@ -82,7 +82,7 @@ class Gamepad final : public nsISupports, public nsWrapperCache { bool Connected() const { return mConnected; } - uint32_t Index() const { return mIndex; } + int32_t Index() const { return mIndex; } uint32_t HashKey() const { return mHashKey; } @@ -115,7 +115,7 @@ class Gamepad final : public nsISupports, public nsWrapperCache { protected: nsCOMPtr mParent; nsString mID; - uint32_t mIndex; + int32_t mIndex; // the gamepad hash key in GamepadManager uint32_t mHashKey; uint32_t mDisplayId; diff --git a/dom/webidl/Gamepad.webidl b/dom/webidl/Gamepad.webidl index 65055575ee37..e730d070ee1c 100644 --- a/dom/webidl/Gamepad.webidl +++ b/dom/webidl/Gamepad.webidl @@ -45,7 +45,7 @@ interface Gamepad { * The game port index for the device. Unique per device * attached to this system. */ - readonly attribute unsigned long index; + readonly attribute long index; /** * The mapping in use for this device. The empty string