From df8bba1b435fab00b4e82f4186a6acda9e499267 Mon Sep 17 00:00:00 2001 From: Joe Clay <27cupsofcoffee@gmail.com> Date: Wed, 29 Jan 2020 01:20:51 +0000 Subject: [PATCH] Convert joystick instance IDs to u32s --- src/sdl2/controller.rs | 4 ++-- src/sdl2/joystick.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdl2/controller.rs b/src/sdl2/controller.rs index d890e2c1..abf72f9f 100644 --- a/src/sdl2/controller.rs +++ b/src/sdl2/controller.rs @@ -363,7 +363,7 @@ impl GameController { } /// Return the joystick instance id of this controller - pub fn instance_id(&self) -> i32 { + pub fn instance_id(&self) -> u32 { let result = unsafe { let joystick = sys::SDL_GameControllerGetJoystick(self.raw); sys::SDL_JoystickInstanceID(joystick) @@ -373,7 +373,7 @@ impl GameController { // Should only fail if the joystick is NULL. panic!(get_error()) } else { - result + result as u32 } } diff --git a/src/sdl2/joystick.rs b/src/sdl2/joystick.rs index 93d5433f..2569b239 100644 --- a/src/sdl2/joystick.rs +++ b/src/sdl2/joystick.rs @@ -152,14 +152,14 @@ impl Joystick { unsafe { sys::SDL_JoystickGetAttached(self.raw) != sys::SDL_bool::SDL_FALSE } } - pub fn instance_id(&self) -> i32 { + pub fn instance_id(&self) -> u32 { let result = unsafe { sys::SDL_JoystickInstanceID(self.raw) }; if result < 0 { // Should only fail if the joystick is NULL. panic!(get_error()) } else { - result + result as u32 } }