From 2ebfd198f9181bb58a9a7d39043d22911c2b4831 Mon Sep 17 00:00:00 2001 From: Raffaello Bertini Date: Mon, 16 Oct 2023 21:16:32 +0100 Subject: [PATCH] sonarcloud code rev --- .../src/HyperSonicDrivers/devices/MT32.cpp | 7 ++++++- .../HyperSonicDrivers/drivers/midi/mt32/MT32Driver.cpp | 1 - .../HyperSonicDrivers/hardware/mt32/MT32ReportHandler.cpp | 8 +++++--- .../HyperSonicDrivers/hardware/mt32/MT32ReportHandler.hpp | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/devices/MT32.cpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/devices/MT32.cpp index 92d008a8..cb8cf80f 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/devices/MT32.cpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/devices/MT32.cpp @@ -34,6 +34,11 @@ namespace HyperSonicDrivers::devices void MT32::lcd_message(const std::string& msg) noexcept { - m_mt32->sysEx(hardware::mt32::mt32_LCD_addr, reinterpret_cast(msg.c_str()), msg.size()); + m_mt32->sysEx( + hardware::mt32::mt32_LCD_addr, + std::bit_cast(msg.c_str()), + //reinterpret_cast(msg.c_str()), + static_cast(msg.size()) + ); } } diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/mt32/MT32Driver.cpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/mt32/MT32Driver.cpp index 77ad3b26..ff775700 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/mt32/MT32Driver.cpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/mt32/MT32Driver.cpp @@ -15,7 +15,6 @@ namespace HyperSonicDrivers::drivers::midi::mt32 utils::throwLogC("MT32 device is null"); m_mt32 = mt32->getMt32(); - mt32->lcd_message("test lcd"); } MT32Driver::~MT32Driver() diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/mt32/MT32ReportHandler.cpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/mt32/MT32ReportHandler.cpp index 6ce16ff4..1cc5371c 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/mt32/MT32ReportHandler.cpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/mt32/MT32ReportHandler.cpp @@ -12,9 +12,11 @@ namespace HyperSonicDrivers::hardware::mt32 void MT32ReportHandler::printDebug(const char* fmt, va_list list) { constexpr const int buf_size = 1024; - char buf[buf_size]; - vsnprintf(buf, buf_size, fmt, list); - logD(std::format("{}", buf)); + std::string buf; + buf.resize(buf_size); + + vsnprintf(buf.data(), buf_size, fmt, list); + logD(buf); } void MT32ReportHandler::onErrorControlROM() diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/mt32/MT32ReportHandler.hpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/mt32/MT32ReportHandler.hpp index 755d196e..bc60505b 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/mt32/MT32ReportHandler.hpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/hardware/mt32/MT32ReportHandler.hpp @@ -10,6 +10,7 @@ namespace HyperSonicDrivers::hardware::mt32 { public: MT32ReportHandler() = default; + ~MT32ReportHandler() = default; void printDebug(const char* fmt, va_list list) override; void onErrorControlROM() override;