summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJoshua Vandaƫle <joshua@vandaele.software>2025-06-09 15:30:26 +0200
committerJoshua Vandaƫle <joshua@vandaele.software>2025-07-12 12:47:30 +0200
commit06882bd2dca4ea92d0608077c45cff6cb7e41583 (patch)
treec20781479b42392bea8ba2169d0e123e9a98d0c3 /Source/Core
parentf76ab863266d012281e52bceda355bc72f36edb8 (diff)
Fix various warnings
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/FilesystemWatcher.cpp12
-rw-r--r--Source/Core/Core/ARDecrypt.cpp2
-rw-r--r--Source/Core/Core/HW/WiimoteEmu/Speaker.cpp2
-rw-r--r--Source/Core/Core/IOS/Network/IP/Top.cpp7
-rw-r--r--Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.cpp5
-rw-r--r--Source/Core/Core/State.h2
-rw-r--r--Source/Core/DolphinQt/CheatSearchWidget.cpp21
-rw-r--r--Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp11
-rw-r--r--Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.cpp2
-rw-r--r--Source/Core/VideoBackends/Metal/MRCHelpers.h2
-rw-r--r--Source/Core/VideoBackends/Metal/MTLStateTracker.mm2
11 files changed, 38 insertions, 30 deletions
diff --git a/Source/Core/Common/FilesystemWatcher.cpp b/Source/Core/Common/FilesystemWatcher.cpp
index 646e2467ed..94970232b2 100644
--- a/Source/Core/Common/FilesystemWatcher.cpp
+++ b/Source/Core/Common/FilesystemWatcher.cpp
@@ -31,13 +31,13 @@ void FilesystemWatcher::Watch(const std::string& path)
if (e.effect_type == wtr::event::effect_type::create)
{
- const auto path = WithUnifiedPathSeparators(watched_path);
- PathAdded(path);
+ const auto unified_path = WithUnifiedPathSeparators(watched_path);
+ PathAdded(unified_path);
}
else if (e.effect_type == wtr::event::effect_type::modify)
{
- const auto path = WithUnifiedPathSeparators(watched_path);
- PathModified(path);
+ const auto unified_path = WithUnifiedPathSeparators(watched_path);
+ PathModified(unified_path);
}
else if (e.effect_type == wtr::event::effect_type::rename)
{
@@ -53,8 +53,8 @@ void FilesystemWatcher::Watch(const std::string& path)
}
else if (e.effect_type == wtr::event::effect_type::destroy)
{
- const auto path = WithUnifiedPathSeparators(watched_path);
- PathDeleted(path);
+ const auto unified_path = WithUnifiedPathSeparators(watched_path);
+ PathDeleted(unified_path);
}
});
}
diff --git a/Source/Core/Core/ARDecrypt.cpp b/Source/Core/Core/ARDecrypt.cpp
index 46ca74d159..98f49cfc41 100644
--- a/Source/Core/Core/ARDecrypt.cpp
+++ b/Source/Core/Core/ARDecrypt.cpp
@@ -459,7 +459,7 @@ static int alphatobin(u32* dst, const std::vector<std::string>& alpha, int size)
void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry>* ops)
{
- std::array<u32, 1200> uCodes;
+ std::array<u32, 1200> uCodes{};
for (std::string& s : vCodes)
{
diff --git a/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp b/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp
index 3b308891c6..0394ae9236 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp
@@ -67,7 +67,7 @@ void SpeakerLogic::SpeakerData(const u8* data, int length, float speaker_pan)
// Potentially 40 resulting samples.
std::array<s16, WiimoteCommon::OutputReportSpeakerData::DATA_SIZE * 2> samples;
- assert(length * 2 <= samples.size());
+ assert(length * 2 <= static_cast<int>(samples.size()));
unsigned int sample_rate_dividend, sample_length;
u8 volume_divisor;
diff --git a/Source/Core/Core/IOS/Network/IP/Top.cpp b/Source/Core/Core/IOS/Network/IP/Top.cpp
index 08008f97b7..c99f3d0511 100644
--- a/Source/Core/Core/IOS/Network/IP/Top.cpp
+++ b/Source/Core/Core/IOS/Network/IP/Top.cpp
@@ -256,7 +256,7 @@ static std::vector<InterfaceRouting> GetSystemInterfaceRouting()
}
// read response
- int msg_len = 0;
+ unsigned int msg_len = 0;
msg_buffer.fill(0);
do
@@ -270,9 +270,10 @@ static std::vector<InterfaceRouting> GetSystemInterfaceRouting()
}
nl_msg = reinterpret_cast<nlmsghdr*>(buf_ptr);
- if (NLMSG_OK(nl_msg, read_len) == 0)
+ if (NLMSG_OK(nl_msg, static_cast<unsigned int>(read_len)) == 0)
{
- ERROR_LOG_FMT(IOS_NET, "Received netlink error response ({})", NLMSG_OK(nl_msg, read_len));
+ ERROR_LOG_FMT(IOS_NET, "Received netlink error response ({})",
+ NLMSG_OK(nl_msg, static_cast<unsigned int>(read_len)));
return {};
}
diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.cpp
index 465d0257af..20a86c0389 100644
--- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.cpp
+++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.cpp
@@ -176,7 +176,10 @@ Arm64GPRCache::GuestRegInfo Arm64GPRCache::GetGuestCR(size_t preg)
Arm64GPRCache::GuestRegInfo Arm64GPRCache::GetGuestByIndex(size_t index)
{
- if (index >= GUEST_GPR_OFFSET && index < GUEST_GPR_OFFSET + GUEST_GPR_COUNT)
+ // We do not need to test for `index >= GUEST_GPR_OFFSET` because
+ // GUEST_GPR_OFFSET is always 0. This otherwise raises a warning.
+ static_assert(GUEST_GPR_OFFSET == 0);
+ if (index < GUEST_GPR_OFFSET + GUEST_GPR_COUNT)
return GetGuestGPR(index - GUEST_GPR_OFFSET);
if (index >= GUEST_CR_OFFSET && index < GUEST_CR_OFFSET + GUEST_CR_COUNT)
return GetGuestCR(index - GUEST_CR_OFFSET);
diff --git a/Source/Core/Core/State.h b/Source/Core/Core/State.h
index 1e4ba0029b..4b100b214c 100644
--- a/Source/Core/Core/State.h
+++ b/Source/Core/Core/State.h
@@ -107,7 +107,7 @@ void SaveAs(Core::System& system, const std::string& filename, bool wait = false
void LoadAs(Core::System& system, const std::string& filename);
void SaveToBuffer(Core::System& system, Common::UniqueBuffer<u8>& buffer);
-void LoadFromBuffer(Core::System& system, const Common::UniqueBuffer<u8>& buffer);
+void LoadFromBuffer(Core::System& system, Common::UniqueBuffer<u8>& buffer);
void LoadLastSaved(Core::System& system, int i = 1);
void SaveFirstSaved(Core::System& system);
diff --git a/Source/Core/DolphinQt/CheatSearchWidget.cpp b/Source/Core/DolphinQt/CheatSearchWidget.cpp
index bbd8675f3e..c18e8cb6a6 100644
--- a/Source/Core/DolphinQt/CheatSearchWidget.cpp
+++ b/Source/Core/DolphinQt/CheatSearchWidget.cpp
@@ -531,7 +531,7 @@ void CheatSearchWidget::GenerateARCodes()
return;
bool had_success = false;
- bool had_error = false;
+ bool had_multiple_errors = false;
std::optional<Cheats::GenerateActionReplayCodeErrorCode> error_code;
for (auto* const item : m_address_table->selectedItems())
@@ -546,23 +546,24 @@ void CheatSearchWidget::GenerateARCodes()
else
{
const auto new_error_code = result.Error();
- if (!had_error)
+ if (!error_code.has_value())
{
error_code = new_error_code;
}
else if (error_code != new_error_code)
{
- // If we have a different error code signify multiple errors with an empty optional<>.
- error_code.reset();
+ had_multiple_errors = true;
}
-
- had_error = true;
}
}
- if (had_error)
+ if (error_code.has_value())
{
- if (error_code.has_value())
+ if (had_multiple_errors)
+ {
+ m_info_label_1->setText(tr("Multiple errors occurred while generating AR codes."));
+ }
+ else
{
switch (*error_code)
{
@@ -577,10 +578,6 @@ void CheatSearchWidget::GenerateARCodes()
break;
}
}
- else
- {
- m_info_label_1->setText(tr("Multiple errors while generating AR codes."));
- }
}
else if (had_success)
{
diff --git a/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp b/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp
index ef6989ad9b..11c98ee883 100644
--- a/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp
+++ b/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp
@@ -309,8 +309,15 @@ void WiimoteControllersWidget::OnBluetoothPassthroughDeviceChanged(int index)
return;
}
- auto device_info =
- m_bluetooth_adapters->itemData(index).value<LibUSBBluetoothAdapter::BluetoothDeviceInfo>();
+ const QVariant item_data = m_bluetooth_adapters->itemData(index);
+
+ if (!item_data.isValid() || !item_data.canConvert<LibUSBBluetoothAdapter::BluetoothDeviceInfo>())
+ {
+ ERROR_LOG_FMT(COMMON, "Invalid Bluetooth device info selected in WiimoteControllersWidget");
+ return;
+ }
+
+ const auto& device_info = item_data.value<LibUSBBluetoothAdapter::BluetoothDeviceInfo>();
Config::SetBaseOrCurrent(Config::MAIN_BLUETOOTH_PASSTHROUGH_PID, device_info.pid);
Config::SetBaseOrCurrent(Config::MAIN_BLUETOOTH_PASSTHROUGH_VID, device_info.vid);
diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.cpp
index 345bef00a3..38358999b7 100644
--- a/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.cpp
@@ -13,7 +13,7 @@
namespace ciface::SDL
{
-bool IsTriggerAxis(int index)
+static bool IsTriggerAxis(int index)
{
// First 4 axes are for the analog sticks, the rest are for the triggers
return index >= 4;
diff --git a/Source/Core/VideoBackends/Metal/MRCHelpers.h b/Source/Core/VideoBackends/Metal/MRCHelpers.h
index 1da2e0c8d1..839b24cf60 100644
--- a/Source/Core/VideoBackends/Metal/MRCHelpers.h
+++ b/Source/Core/VideoBackends/Metal/MRCHelpers.h
@@ -20,7 +20,7 @@ template <typename T>
class MRCOwned
{
T ptr;
- MRCOwned(T ptr) : ptr(ptr) {}
+ MRCOwned(T raw_ptr) : ptr(raw_ptr) {}
public:
MRCOwned() : ptr(nullptr) {}
diff --git a/Source/Core/VideoBackends/Metal/MTLStateTracker.mm b/Source/Core/VideoBackends/Metal/MTLStateTracker.mm
index c2cd685a82..755da35249 100644
--- a/Source/Core/VideoBackends/Metal/MTLStateTracker.mm
+++ b/Source/Core/VideoBackends/Metal/MTLStateTracker.mm
@@ -32,7 +32,7 @@ struct Metal::StateTracker::Backref
{
std::mutex mtx;
StateTracker* state_tracker;
- explicit Backref(StateTracker* state_tracker) : state_tracker(state_tracker) {}
+ explicit Backref(StateTracker* tracker) : state_tracker(tracker) {}
};
struct Metal::StateTracker::PerfQueryTracker