From e9819b61a640de540560511c4e87e53646bfd2ce Mon Sep 17 00:00:00 2001 From: Mat M Date: Mon, 4 May 2020 06:22:33 -0400 Subject: [PATCH] service: Mark variables as [[maybe_unused]] where applicable (#5318) Quite a few service functions are stubbed but still pop all their arguments, which can lead to unused variable warnings. We can mark the unused arguments with [[maybe_unused]] to silence these warnings until a full implementation of these functions are made. --- src/core/hle/service/ac/ac.cpp | 2 +- src/core/hle/service/am/am.cpp | 16 ++++----- src/core/hle/service/apt/apt.cpp | 38 ++++++++++---------- src/core/hle/service/boss/boss.cpp | 6 ++-- src/core/hle/service/cecd/cecd.cpp | 8 ++--- src/core/hle/service/cfg/cfg.cpp | 22 ++++++------ src/core/hle/service/fs/fs_user.cpp | 54 ++++++++++++++-------------- src/core/hle/service/http_c.cpp | 4 +-- src/core/hle/service/nwm/nwm_uds.cpp | 8 ++--- src/core/hle/service/ps/ps_ps.cpp | 4 +-- src/core/hle/service/sm/srv.cpp | 6 ++-- src/core/hle/service/soc_u.cpp | 37 +++++++++---------- 12 files changed, 103 insertions(+), 102 deletions(-) diff --git a/src/core/hle/service/ac/ac.cpp b/src/core/hle/service/ac/ac.cpp index d9f1085c8..22f36a455 100644 --- a/src/core/hle/service/ac/ac.cpp +++ b/src/core/hle/service/ac/ac.cpp @@ -103,7 +103,7 @@ void Module::Interface::GetWifiStatus(Kernel::HLERequestContext& ctx) { void Module::Interface::GetInfraPriority(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x27, 0, 2); - const std::vector& ac_config = rp.PopStaticBuffer(); + [[maybe_unused]] const std::vector& ac_config = rp.PopStaticBuffer(); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); rb.Push(RESULT_SUCCESS); diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index e5d874663..55f9f513e 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -1093,7 +1093,7 @@ void Module::Interface::BeginImportProgramTemporarily(Kernel::HLERequestContext& void Module::Interface::EndImportProgram(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x0405, 0, 2); // 0x04050002 - auto cia = rp.PopObject(); + [[maybe_unused]] const auto cia = rp.PopObject(); am->ScanForAllTitles(); @@ -1104,7 +1104,7 @@ void Module::Interface::EndImportProgram(Kernel::HLERequestContext& ctx) { void Module::Interface::EndImportProgramWithoutCommit(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x0406, 0, 2); // 0x04060002 - auto cia = rp.PopObject(); + [[maybe_unused]] const auto cia = rp.PopObject(); // Note: This function is basically a no-op for us since we don't use title.db or ticket.db // files to keep track of installed titles. @@ -1117,10 +1117,10 @@ void Module::Interface::EndImportProgramWithoutCommit(Kernel::HLERequestContext& void Module::Interface::CommitImportPrograms(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x0407, 3, 2); // 0x040700C2 - auto media_type = static_cast(rp.Pop()); - u32 title_count = rp.Pop(); - u8 database = rp.Pop(); - auto buffer = rp.PopMappedBuffer(); + [[maybe_unused]] const auto media_type = static_cast(rp.Pop()); + [[maybe_unused]] const u32 title_count = rp.Pop(); + [[maybe_unused]] const u8 database = rp.Pop(); + const auto buffer = rp.PopMappedBuffer(); // Note: This function is basically a no-op for us since we don't use title.db or ticket.db // files to keep track of installed titles. @@ -1204,7 +1204,7 @@ ResultVal> GetFileFromSession( void Module::Interface::GetProgramInfoFromCia(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x0408, 1, 2); // 0x04080042 - auto media_type = static_cast(rp.Pop()); + [[maybe_unused]] const auto media_type = static_cast(rp.Pop()); auto cia = rp.PopObject(); auto file_res = GetFileFromSession(cia); @@ -1360,7 +1360,7 @@ void Module::Interface::GetCoreVersionFromCia(Kernel::HLERequestContext& ctx) { void Module::Interface::GetRequiredSizeFromCia(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x040D, 1, 2); // 0x040D0042 - auto media_type = static_cast(rp.Pop()); + [[maybe_unused]] const auto media_type = static_cast(rp.Pop()); auto cia = rp.PopObject(); auto file_res = GetFileFromSession(cia); diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 8ce9a0ca1..b91f38144 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -449,11 +449,11 @@ void Module::APTInterface::PrepareToDoApplicationJump(Kernel::HLERequestContext& void Module::APTInterface::DoApplicationJump(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x32, 2, 4); // 0x00320084 - u32 param_size = rp.Pop(); - u32 hmac_size = rp.Pop(); + const auto param_size = rp.Pop(); + const auto hmac_size = rp.Pop(); - auto param = rp.PopStaticBuffer(); - auto hmac = rp.PopStaticBuffer(); + [[maybe_unused]] const auto param = rp.PopStaticBuffer(); + [[maybe_unused]] const auto hmac = rp.PopStaticBuffer(); LOG_WARNING(Service_APT, "(STUBBED) called param_size={:08X}, hmac_size={:08X}", param_size, hmac_size); @@ -502,11 +502,11 @@ void Module::APTInterface::PrepareToStartApplication(Kernel::HLERequestContext& void Module::APTInterface::StartApplication(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x1B, 3, 4); // 0x001B00C4 - u32 buffer1_size = rp.Pop(); - u32 buffer2_size = rp.Pop(); - u32 flag = rp.Pop(); - std::vector buffer1 = rp.PopStaticBuffer(); - std::vector buffer2 = rp.PopStaticBuffer(); + const auto buffer1_size = rp.Pop(); + const auto buffer2_size = rp.Pop(); + const auto flag = rp.Pop(); + [[maybe_unused]] const std::vector buffer1 = rp.PopStaticBuffer(); + [[maybe_unused]] const std::vector buffer2 = rp.PopStaticBuffer(); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(RESULT_SUCCESS); // No error @@ -520,10 +520,10 @@ void Module::APTInterface::AppletUtility(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x4B, 3, 2); // 0x004B00C2 // These are from 3dbrew - I'm not really sure what they're used for. - u32 utility_command = rp.Pop(); - u32 input_size = rp.Pop(); - u32 output_size = rp.Pop(); - std::vector input = rp.PopStaticBuffer(); + const auto utility_command = rp.Pop(); + const auto input_size = rp.Pop(); + const auto output_size = rp.Pop(); + [[maybe_unused]] const std::vector input = rp.PopStaticBuffer(); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(RESULT_SUCCESS); // No error @@ -611,21 +611,21 @@ void Module::APTInterface::StartLibraryApplet(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x1E, 2, 4); // 0x1E0084 AppletId applet_id = rp.PopEnum(); - std::size_t buffer_size = rp.Pop(); + [[maybe_unused]] const std::size_t buffer_size = rp.Pop(); std::shared_ptr object = rp.PopGenericObject(); - std::vector buffer = rp.PopStaticBuffer(); + const std::vector buffer = rp.PopStaticBuffer(); LOG_DEBUG(Service_APT, "called, applet_id={:08X}", static_cast(applet_id)); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); - rb.Push(apt->applet_manager->StartLibraryApplet(applet_id, object, buffer)); + rb.Push(apt->applet_manager->StartLibraryApplet(applet_id, std::move(object), buffer)); } void Module::APTInterface::CloseApplication(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x27, 1, 4); - u32 parameters_size = rp.Pop(); - std::shared_ptr object = rp.PopGenericObject(); - std::vector buffer = rp.PopStaticBuffer(); + [[maybe_unused]] const u32 parameters_size = rp.Pop(); + [[maybe_unused]] const std::shared_ptr object = rp.PopGenericObject(); + [[maybe_unused]] const std::vector buffer = rp.PopStaticBuffer(); LOG_DEBUG(Service_APT, "called"); diff --git a/src/core/hle/service/boss/boss.cpp b/src/core/hle/service/boss/boss.cpp index d22e94cf1..f9b96caab 100644 --- a/src/core/hle/service/boss/boss.cpp +++ b/src/core/hle/service/boss/boss.cpp @@ -58,7 +58,7 @@ void Module::Interface::GetStorageInfo(Kernel::HLERequestContext& ctx) { void Module::Interface::RegisterPrivateRootCa(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x05, 1, 2); - const u32 size = rp.Pop(); + [[maybe_unused]] const u32 size = rp.Pop(); auto& buffer = rp.PopMappedBuffer(); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); @@ -96,7 +96,7 @@ void Module::Interface::GetNewArrivalFlag(Kernel::HLERequestContext& ctx) { void Module::Interface::RegisterNewArrivalEvent(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x08, 0, 2); - const auto event = rp.PopObject(); + [[maybe_unused]] const auto event = rp.PopObject(); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(RESULT_SUCCESS); @@ -282,7 +282,7 @@ void Module::Interface::SendProperty(Kernel::HLERequestContext& ctx) { void Module::Interface::SendPropertyHandle(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x15, 1, 2); const u16 property_id = rp.Pop(); - const std::shared_ptr object = rp.PopGenericObject(); + [[maybe_unused]] const std::shared_ptr object = rp.PopGenericObject(); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(RESULT_SUCCESS); diff --git a/src/core/hle/service/cecd/cecd.cpp b/src/core/hle/service/cecd/cecd.cpp index 9c3cfa0ab..55146c9bf 100644 --- a/src/core/hle/service/cecd/cecd.cpp +++ b/src/core/hle/service/cecd/cecd.cpp @@ -371,7 +371,7 @@ void Module::Interface::Write(Kernel::HLERequestContext& ctx) { buffer); } - const u32 bytes_written = static_cast( + [[maybe_unused]] const u32 bytes_written = static_cast( session_data->file->Write(0, buffer.size(), true, buffer.data()).Unwrap()); session_data->file->Close(); @@ -433,7 +433,7 @@ void Module::Interface::WriteMessage(Kernel::HLERequestContext& ctx) { msg_header.sender_id, msg_header.sender_id2, msg_header.send_count, msg_header.forward_count, msg_header.user_data); - const u32 bytes_written = + [[maybe_unused]] const u32 bytes_written = static_cast(message->Write(0, buffer_size, true, buffer.data()).Unwrap()); message->Close(); @@ -520,7 +520,7 @@ void Module::Interface::WriteMessageWithHMAC(Kernel::HLERequestContext& ctx) { hmac.CalculateDigest(hmac_digest.data(), message_body.data(), msg_header.body_size); std::memcpy(buffer.data() + hmac_offset, hmac_digest.data(), hmac_size); - const u32 bytes_written = + [[maybe_unused]] const u32 bytes_written = static_cast(message->Write(0, buffer_size, true, buffer.data()).Unwrap()); message->Close(); @@ -763,7 +763,7 @@ void Module::Interface::OpenAndWrite(Kernel::HLERequestContext& ctx) { cecd->CheckAndUpdateFile(path_type, ncch_program_id, buffer); } - const u32 bytes_written = + [[maybe_unused]] const u32 bytes_written = static_cast(file->Write(0, buffer.size(), true, buffer.data()).Unwrap()); file->Close(); diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index 924c28395..2b1113b92 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp @@ -41,7 +41,7 @@ void Module::serialize(Archive& ar, const unsigned int) { SERIALIZE_IMPL(Module) /// The maximum number of block entries that can exist in the config file -static const u32 CONFIG_FILE_MAX_BLOCK_ENTRIES = 1479; +constexpr u32 CONFIG_FILE_MAX_BLOCK_ENTRIES = 1479; namespace { @@ -104,23 +104,23 @@ struct ConsoleCountryInfo { static_assert(sizeof(ConsoleCountryInfo) == 4, "ConsoleCountryInfo must be exactly 4 bytes"); } // namespace -static const EULAVersion MAX_EULA_VERSION = {0x7F, 0x7F}; -static const ConsoleModelInfo CONSOLE_MODEL_OLD = {NINTENDO_3DS_XL, {0, 0, 0}}; -static const ConsoleModelInfo CONSOLE_MODEL_NEW = {NEW_NINTENDO_3DS_XL, {0, 0, 0}}; -static const u8 CONSOLE_LANGUAGE = LANGUAGE_EN; -static const UsernameBlock CONSOLE_USERNAME_BLOCK = {u"CITRA", 0, 0}; -static const BirthdayBlock PROFILE_BIRTHDAY = {3, 25}; // March 25th, 2014 -static const u8 SOUND_OUTPUT_MODE = SOUND_SURROUND; -static const u8 UNITED_STATES_COUNTRY_ID = 49; +constexpr EULAVersion MAX_EULA_VERSION{0x7F, 0x7F}; +constexpr ConsoleModelInfo CONSOLE_MODEL_OLD{NINTENDO_3DS_XL, {0, 0, 0}}; +constexpr ConsoleModelInfo CONSOLE_MODEL_NEW{NEW_NINTENDO_3DS_XL, {0, 0, 0}}; +constexpr u8 CONSOLE_LANGUAGE = LANGUAGE_EN; +constexpr UsernameBlock CONSOLE_USERNAME_BLOCK{u"CITRA", 0, 0}; +constexpr BirthdayBlock PROFILE_BIRTHDAY{3, 25}; // March 25th, 2014 +constexpr u8 SOUND_OUTPUT_MODE = SOUND_SURROUND; +constexpr u8 UNITED_STATES_COUNTRY_ID = 49; /// TODO(Subv): Find what the other bytes are -static const ConsoleCountryInfo COUNTRY_INFO = {{0, 0, 0}, UNITED_STATES_COUNTRY_ID}; +constexpr ConsoleCountryInfo COUNTRY_INFO{{0, 0, 0}, UNITED_STATES_COUNTRY_ID}; /** * TODO(Subv): Find out what this actually is, these values fix some NaN uniforms in some games, * for example Nintendo Zone * Thanks Normmatt for providing this information */ -static const std::array STEREO_CAMERA_SETTINGS = { +constexpr std::array STEREO_CAMERA_SETTINGS = { 62.0f, 289.0f, 76.80000305175781f, 46.08000183105469f, 10.0f, 5.0f, 55.58000183105469f, 21.56999969482422f, }; diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp index 8fea8a3eb..80cb16cfa 100644 --- a/src/core/hle/service/fs/fs_user.cpp +++ b/src/core/hle/service/fs/fs_user.cpp @@ -220,15 +220,15 @@ void FS_USER::CreateFile(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x808, 8, 2); rp.Skip(1, false); // TransactionId - ArchiveHandle archive_handle = rp.PopRaw(); - auto filename_type = rp.PopEnum(); - u32 filename_size = rp.Pop(); - u32 attributes = rp.Pop(); - u64 file_size = rp.Pop(); + const auto archive_handle = rp.PopRaw(); + const auto filename_type = rp.PopEnum(); + const auto filename_size = rp.Pop(); + const auto attributes = rp.Pop(); + const auto file_size = rp.Pop(); std::vector filename = rp.PopStaticBuffer(); ASSERT(filename.size() == filename_size); - FileSys::Path file_path(filename_type, filename); + const FileSys::Path file_path(filename_type, std::move(filename)); LOG_DEBUG(Service_FS, "type={} attributes={} size={:x} data={}", static_cast(filename_type), attributes, file_size, file_path.DebugStr()); @@ -240,13 +240,13 @@ void FS_USER::CreateFile(Kernel::HLERequestContext& ctx) { void FS_USER::CreateDirectory(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x809, 6, 2); rp.Skip(1, false); // TransactionId - ArchiveHandle archive_handle = rp.PopRaw(); - auto dirname_type = rp.PopEnum(); - u32 dirname_size = rp.Pop(); - u32 attributes = rp.Pop(); + const auto archive_handle = rp.PopRaw(); + const auto dirname_type = rp.PopEnum(); + const auto dirname_size = rp.Pop(); + [[maybe_unused]] const auto attributes = rp.Pop(); std::vector dirname = rp.PopStaticBuffer(); ASSERT(dirname.size() == dirname_size); - FileSys::Path dir_path(dirname_type, dirname); + const FileSys::Path dir_path(dirname_type, std::move(dirname)); LOG_DEBUG(Service_FS, "type={} size={} data={}", static_cast(dirname_type), dirname_size, dir_path.DebugStr()); @@ -366,18 +366,18 @@ void FS_USER::FormatSaveData(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_FS, "(STUBBED)"); IPC::RequestParser rp(ctx, 0x84C, 9, 2); - auto archive_id = rp.PopEnum(); - auto archivename_type = rp.PopEnum(); - u32 archivename_size = rp.Pop(); - u32 block_size = rp.Pop(); - u32 number_directories = rp.Pop(); - u32 number_files = rp.Pop(); - u32 directory_buckets = rp.Pop(); - u32 file_buckets = rp.Pop(); - bool duplicate_data = rp.Pop(); + const auto archive_id = rp.PopEnum(); + const auto archivename_type = rp.PopEnum(); + const auto archivename_size = rp.Pop(); + const auto block_size = rp.Pop(); + const auto number_directories = rp.Pop(); + const auto number_files = rp.Pop(); + [[maybe_unused]] const auto directory_buckets = rp.Pop(); + [[maybe_unused]] const auto file_buckets = rp.Pop(); + const bool duplicate_data = rp.Pop(); std::vector archivename = rp.PopStaticBuffer(); ASSERT(archivename.size() == archivename_size); - FileSys::Path archive_path(archivename_type, archivename); + const FileSys::Path archive_path(archivename_type, std::move(archivename)); LOG_DEBUG(Service_FS, "archive_path={}", archive_path.DebugStr()); @@ -409,12 +409,12 @@ void FS_USER::FormatSaveData(Kernel::HLERequestContext& ctx) { void FS_USER::FormatThisUserSaveData(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x80F, 6, 0); - u32 block_size = rp.Pop(); - u32 number_directories = rp.Pop(); - u32 number_files = rp.Pop(); - u32 directory_buckets = rp.Pop(); - u32 file_buckets = rp.Pop(); - bool duplicate_data = rp.Pop(); + const auto block_size = rp.Pop(); + const auto number_directories = rp.Pop(); + const auto number_files = rp.Pop(); + [[maybe_unused]] const auto directory_buckets = rp.Pop(); + [[maybe_unused]] const auto file_buckets = rp.Pop(); + const auto duplicate_data = rp.Pop(); FileSys::ArchiveFormatInfo format_info; format_info.duplicate_data = duplicate_data; diff --git a/src/core/hle/service/http_c.cpp b/src/core/hle/service/http_c.cpp index 4879ab371..2e861ce02 100644 --- a/src/core/hle/service/http_c.cpp +++ b/src/core/hle/service/http_c.cpp @@ -421,7 +421,7 @@ void HTTP_C::CloseContext(Kernel::HLERequestContext& ctx) { void HTTP_C::AddRequestHeader(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x11, 3, 4); const u32 context_handle = rp.Pop(); - const u32 name_size = rp.Pop(); + [[maybe_unused]] const u32 name_size = rp.Pop(); const u32 value_size = rp.Pop(); const std::vector name_buffer = rp.PopStaticBuffer(); Kernel::MappedBuffer& value_buffer = rp.PopMappedBuffer(); @@ -497,7 +497,7 @@ void HTTP_C::AddRequestHeader(Kernel::HLERequestContext& ctx) { void HTTP_C::AddPostDataAscii(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x12, 3, 4); const u32 context_handle = rp.Pop(); - const u32 name_size = rp.Pop(); + [[maybe_unused]] const u32 name_size = rp.Pop(); const u32 value_size = rp.Pop(); const std::vector name_buffer = rp.PopStaticBuffer(); Kernel::MappedBuffer& value_buffer = rp.PopMappedBuffer(); diff --git a/src/core/hle/service/nwm/nwm_uds.cpp b/src/core/hle/service/nwm/nwm_uds.cpp index 11ac59042..831f6c87e 100644 --- a/src/core/hle/service/nwm/nwm_uds.cpp +++ b/src/core/hle/service/nwm/nwm_uds.cpp @@ -1219,8 +1219,8 @@ void NWM_UDS::ConnectToNetwork(Kernel::HLERequestContext& ctx, u16 command_id, void NWM_UDS::ConnectToNetwork(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x1E, 2, 4); - u8 connection_type = rp.Pop(); - u32 passphrase_size = rp.Pop(); + const auto connection_type = rp.Pop(); + [[maybe_unused]] const auto passphrase_size = rp.Pop(); const std::vector network_info_buffer = rp.PopStaticBuffer(); ASSERT(network_info_buffer.size() == sizeof(NetworkInfo)); @@ -1240,8 +1240,8 @@ void NWM_UDS::ConnectToNetworkDeprecated(Kernel::HLERequestContext& ctx) { // info const auto network_info_buffer = rp.PopRaw>(); - u8 connection_type = rp.Pop(); - u32 passphrase_size = rp.Pop(); + const auto connection_type = rp.Pop(); + [[maybe_unused]] const auto passphrase_size = rp.Pop(); std::vector passphrase = rp.PopStaticBuffer(); diff --git a/src/core/hle/service/ps/ps_ps.cpp b/src/core/hle/service/ps/ps_ps.cpp index 1ba4d7f4c..c99308ba2 100644 --- a/src/core/hle/service/ps/ps_ps.cpp +++ b/src/core/hle/service/ps/ps_ps.cpp @@ -42,8 +42,8 @@ constexpr std::array KeyTypes{{ void PS_PS::EncryptDecryptAes(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x4, 8, 4); - u32 src_size = rp.Pop(); - u32 dest_size = rp.Pop(); + auto src_size = rp.Pop(); + [[maybe_unused]] const auto dest_size = rp.Pop(); using CryptoPP::AES; std::array iv; diff --git a/src/core/hle/service/sm/srv.cpp b/src/core/hle/service/sm/srv.cpp index da6d57df7..87a084dbb 100644 --- a/src/core/hle/service/sm/srv.cpp +++ b/src/core/hle/service/sm/srv.cpp @@ -50,17 +50,17 @@ constexpr int MAX_PENDING_NOTIFICATIONS = 16; void SRV::RegisterClient(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x1, 0, 2); - u32 pid_descriptor = rp.Pop(); + const auto pid_descriptor = rp.Pop(); if (pid_descriptor != IPC::CallingPidDesc()) { IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(IPC::ERR_INVALID_BUFFER_DESCRIPTOR); return; } - u32 caller_pid = rp.Pop(); + const auto caller_pid = rp.Pop(); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(RESULT_SUCCESS); - LOG_WARNING(Service_SRV, "(STUBBED) called"); + LOG_WARNING(Service_SRV, "(STUBBED) called. Caller PID={}", caller_pid); } /** diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index 3620b458c..0353a9668 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp @@ -504,8 +504,8 @@ void SOC_U::Accept(Kernel::HLERequestContext& ctx) { // preventing graceful shutdown when closing the emulator, this can be fixed by always // performing nonblocking operations and spinlock until the data is available IPC::RequestParser rp(ctx, 0x04, 2, 2); - u32 socket_handle = rp.Pop(); - socklen_t max_addr_len = static_cast(rp.Pop()); + const auto socket_handle = rp.Pop(); + [[maybe_unused]] const auto max_addr_len = static_cast(rp.Pop()); rp.PopPID(); sockaddr addr; socklen_t addr_len = sizeof(addr); @@ -724,8 +724,8 @@ void SOC_U::Poll(Kernel::HLERequestContext& ctx) { void SOC_U::GetSockName(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x17, 2, 2); - u32 socket_handle = rp.Pop(); - u32 max_addr_len = rp.Pop(); + const auto socket_handle = rp.Pop(); + [[maybe_unused]] const auto max_addr_len = rp.Pop(); rp.PopPID(); sockaddr dest_addr; @@ -761,25 +761,26 @@ void SOC_U::Shutdown(Kernel::HLERequestContext& ctx) { void SOC_U::GetPeerName(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x18, 2, 2); - u32 socket_handle = rp.Pop(); - u32 max_addr_len = rp.Pop(); + const auto socket_handle = rp.Pop(); + [[maybe_unused]] const auto max_addr_len = rp.Pop(); rp.PopPID(); sockaddr dest_addr; socklen_t dest_addr_len = sizeof(dest_addr); - int ret = ::getpeername(socket_handle, &dest_addr, &dest_addr_len); + const int ret = ::getpeername(socket_handle, &dest_addr, &dest_addr_len); CTRSockAddr ctr_dest_addr = CTRSockAddr::FromPlatform(dest_addr); std::vector dest_addr_buff(sizeof(ctr_dest_addr)); std::memcpy(dest_addr_buff.data(), &ctr_dest_addr, sizeof(ctr_dest_addr)); int result = 0; - if (ret != 0) - ret = TranslateError(GET_ERRNO); + if (ret != 0) { + result = TranslateError(GET_ERRNO); + } IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); rb.Push(RESULT_SUCCESS); - rb.Push(ret); + rb.Push(result); rb.PushStaticBuffer(std::move(dest_addr_buff), 0); } @@ -788,8 +789,8 @@ void SOC_U::Connect(Kernel::HLERequestContext& ctx) { // preventing graceful shutdown when closing the emulator, this can be fixed by always // performing nonblocking operations and spinlock until the data is available IPC::RequestParser rp(ctx, 0x06, 2, 4); - u32 socket_handle = rp.Pop(); - u32 input_addr_len = rp.Pop(); + const auto socket_handle = rp.Pop(); + [[maybe_unused]] const auto input_addr_len = rp.Pop(); rp.PopPID(); auto input_addr_buf = rp.PopStaticBuffer(); @@ -809,7 +810,7 @@ void SOC_U::Connect(Kernel::HLERequestContext& ctx) { void SOC_U::InitializeSockets(Kernel::HLERequestContext& ctx) { // TODO(Subv): Implement IPC::RequestParser rp(ctx, 0x01, 1, 4); - u32 memory_block_size = rp.Pop(); + [[maybe_unused]] const auto memory_block_size = rp.Pop(); rp.PopPID(); rp.PopObject(); @@ -861,12 +862,12 @@ void SOC_U::GetSockOpt(Kernel::HLERequestContext& ctx) { void SOC_U::SetSockOpt(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x12, 4, 4); - u32 socket_handle = rp.Pop(); - u32 level = rp.Pop(); - s32 optname = rp.Pop(); - socklen_t optlen = static_cast(rp.Pop()); + const auto socket_handle = rp.Pop(); + const auto level = rp.Pop(); + const auto optname = rp.Pop(); + [[maybe_unused]] const auto optlen = static_cast(rp.Pop()); rp.PopPID(); - auto optval = rp.PopStaticBuffer(); + const auto optval = rp.PopStaticBuffer(); s32 err = 0;