From acd717ffae882f847fc9eab31c5293511232557f Mon Sep 17 00:00:00 2001 From: Ryan Meredith Date: Wed, 26 Aug 2020 16:40:22 -0400 Subject: [PATCH] GCAdapter_Android: Minor cleanup --- Source/Core/InputCommon/GCAdapter_Android.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Source/Core/InputCommon/GCAdapter_Android.cpp b/Source/Core/InputCommon/GCAdapter_Android.cpp index 90a83c20eb..77ba4be322 100644 --- a/Source/Core/InputCommon/GCAdapter_Android.cpp +++ b/Source/Core/InputCommon/GCAdapter_Android.cpp @@ -33,7 +33,7 @@ static jclass s_adapter_class; static bool s_detected = false; static int s_fd = 0; -static u8 s_controller_type[SerialInterface::MAX_SI_CHANNELS] = { +static std::array s_controller_type = { ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE}; static u8 s_controller_rumble[4]; @@ -96,7 +96,7 @@ static void Write() if (write_size) { jbyteArray jrumble_array = env->NewByteArray(5); - jbyte* jrumble = env->GetByteArrayElements(jrumble_array, NULL); + jbyte* jrumble = env->GetByteArrayElements(jrumble_array, nullptr); { std::lock_guard lk(s_write_mutex); @@ -129,7 +129,7 @@ static void Read() jfieldID payload_field = env->GetStaticFieldID(s_adapter_class, "controller_payload", "[B"); jobject payload_object = env->GetStaticObjectField(s_adapter_class, payload_field); - jbyteArray* java_controller_payload = reinterpret_cast(&payload_object); + auto* java_controller_payload = reinterpret_cast(&payload_object); // Get function pointers jmethodID getfd_func = env->GetStaticMethodID(s_adapter_class, "GetFD", "()I"); @@ -225,8 +225,7 @@ static void Reset() if (s_read_adapter_thread_running.TestAndClear()) s_read_adapter_thread.join(); - for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; i++) - s_controller_type[i] = ControllerTypes::CONTROLLER_NONE; + s_controller_type.fill(ControllerTypes::CONTROLLER_NONE); s_detected = false; s_fd = 0; @@ -260,7 +259,7 @@ GCPadStatus Input(int chan) return {}; int payload_size = 0; - std::array controller_payload_copy; + std::array controller_payload_copy{}; { std::lock_guard lk(s_read_mutex);