diff --git a/src/Cafe/CafeSystem.cpp b/src/Cafe/CafeSystem.cpp index 8ec6ff0a..2cadc106 100644 --- a/src/Cafe/CafeSystem.cpp +++ b/src/Cafe/CafeSystem.cpp @@ -577,7 +577,7 @@ namespace CafeSystem const auto file = fsc_open(rpxPath.c_str(), FSC_ACCESS_FLAG::OPEN_FILE | FSC_ACCESS_FLAG::READ_PERMISSION, &status); if (file) { - _pathToExecutable = rpxPath; + _pathToExecutable = std::move(rpxPath); fsc_close(file); } } diff --git a/src/Cafe/Filesystem/fsc.cpp b/src/Cafe/Filesystem/fsc.cpp index d7d9971f..71bae60e 100644 --- a/src/Cafe/Filesystem/fsc.cpp +++ b/src/Cafe/Filesystem/fsc.cpp @@ -143,7 +143,7 @@ sint32 fsc_mount(std::string_view mountPath, std::string_view targetPath, fscDev } node->device = fscDevice; node->ctx = ctx; - node->deviceTargetPath = targetPathWithSlash; + node->deviceTargetPath = std::move(targetPathWithSlash); fscLeave(); return FSC_STATUS_OK; } diff --git a/src/Cafe/GraphicPack/GraphicPack2.cpp b/src/Cafe/GraphicPack/GraphicPack2.cpp index 808536d5..959441d7 100644 --- a/src/Cafe/GraphicPack/GraphicPack2.cpp +++ b/src/Cafe/GraphicPack/GraphicPack2.cpp @@ -1020,9 +1020,9 @@ bool GraphicPack2::Deactivate() m_upscaling_shader_ud.reset(); m_downscaling_shader_ud.reset(); - m_output_shader_source = ""; - m_upscaling_shader_source = ""; - m_downscaling_shader_source = ""; + m_output_shader_source.clear(); + m_upscaling_shader_source.clear(); + m_downscaling_shader_source.clear(); if (HasCustomVSyncFrequency()) { diff --git a/src/Cafe/HW/Espresso/EspressoISA.h b/src/Cafe/HW/Espresso/EspressoISA.h index 4c630e4c..b3ae45c3 100644 --- a/src/Cafe/HW/Espresso/EspressoISA.h +++ b/src/Cafe/HW/Espresso/EspressoISA.h @@ -101,7 +101,7 @@ namespace Espresso struct BOField { - BOField() {}; + BOField() = default; BOField(uint8 bo) : bo(bo) {}; bool conditionInverted() const diff --git a/src/Cafe/HW/Espresso/Recompiler/PPCFunctionBoundaryTracker.h b/src/Cafe/HW/Espresso/Recompiler/PPCFunctionBoundaryTracker.h index 3fc48a93..48782454 100644 --- a/src/Cafe/HW/Espresso/Recompiler/PPCFunctionBoundaryTracker.h +++ b/src/Cafe/HW/Espresso/Recompiler/PPCFunctionBoundaryTracker.h @@ -10,7 +10,7 @@ class PPCFunctionBoundaryTracker public: struct PPCRange_t { - PPCRange_t() {}; + PPCRange_t() = default; PPCRange_t(uint32 _startAddress) : startAddress(_startAddress) {}; uint32 startAddress{}; diff --git a/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.h b/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.h index ee0454ce..82fa15e6 100644 --- a/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.h +++ b/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.h @@ -197,7 +197,7 @@ struct raLivenessLocation_t bool isRead; bool isWrite; - raLivenessLocation_t() {}; + raLivenessLocation_t() = default; raLivenessLocation_t(sint32 index, bool isRead, bool isWrite) : index(index), isRead(isRead), isWrite(isWrite) {}; diff --git a/src/Cafe/HW/Latte/Core/LatteBufferCache.cpp b/src/Cafe/HW/Latte/Core/LatteBufferCache.cpp index b74f67b9..426568a8 100644 --- a/src/Cafe/HW/Latte/Core/LatteBufferCache.cpp +++ b/src/Cafe/HW/Latte/Core/LatteBufferCache.cpp @@ -29,7 +29,7 @@ class IntervalTree2 struct InternalRange { - InternalRange() {}; + InternalRange() = default; InternalRange(TRangeData _rangeBegin, TRangeData _rangeEnd) : rangeBegin(_rangeBegin), rangeEnd(_rangeEnd) { cemu_assert_debug(_rangeBegin < _rangeEnd); }; TRangeData rangeBegin; diff --git a/src/Cafe/HW/Latte/Core/LatteGSCopyShaderParser.cpp b/src/Cafe/HW/Latte/Core/LatteGSCopyShaderParser.cpp index 7df5eecd..1c0752f1 100644 --- a/src/Cafe/HW/Latte/Core/LatteGSCopyShaderParser.cpp +++ b/src/Cafe/HW/Latte/Core/LatteGSCopyShaderParser.cpp @@ -208,7 +208,7 @@ LatteParsedGSCopyShader* LatteGSCopyShaderParser_parse(uint8* programData, uint3 uint32 bufferIndex; if (cf_inst23_7 == GPU7_CF_INST_MEM_STREAM0_WRITE) bufferIndex = 0; - else if (cf_inst23_7 == GPU7_CF_INST_MEM_STREAM0_WRITE) + else if (cf_inst23_7 == GPU7_CF_INST_MEM_STREAM1_WRITE) bufferIndex = 1; else cemu_assert_debug(false); diff --git a/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp b/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp index 416245b9..11048504 100644 --- a/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp +++ b/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp @@ -493,17 +493,18 @@ bool LatteMRT::UpdateCurrentFBO() sint32 colorAttachmentWidth; sint32 colorAttachmentHeight; + LatteTexture_getSize(colorAttachmentView->baseTexture, &colorAttachmentWidth, &colorAttachmentHeight, nullptr, colorAttachmentView->firstMip); // set effective size sint32 effectiveWidth, effectiveHeight; LatteTexture_getEffectiveSize(colorAttachmentView->baseTexture, &effectiveWidth, &effectiveHeight, nullptr, colorAttachmentView->firstMip); - if( rtEffectiveSize->width == 0 && rtEffectiveSize->height == 0 ) + if (rtEffectiveSize->width == 0 && rtEffectiveSize->height == 0) { rtEffectiveSize->width = effectiveWidth; rtEffectiveSize->height = effectiveHeight; } - else if( rtEffectiveSize->width != effectiveWidth && rtEffectiveSize->height != effectiveHeight ) + else if (rtEffectiveSize->width != effectiveWidth && rtEffectiveSize->height != effectiveHeight) { #ifndef PUBLIC_RELEASE forceLog_printf("Color buffer size mismatch (%dx%d). Effective size: %dx%d Real size: %dx%d Mismatching texture: %08x %dx%d fmt %04x", rtEffectiveSize->width, rtEffectiveSize->height, effectiveWidth, effectiveHeight, colorAttachmentView->baseTexture->width, colorAttachmentView->baseTexture->height, colorAttachmentView->baseTexture->physAddress, colorAttachmentView->baseTexture->width, colorAttachmentView->baseTexture->height, (uint32)colorAttachmentView->baseTexture->format); diff --git a/src/Cafe/HW/Latte/Core/LatteShaderCache.cpp b/src/Cafe/HW/Latte/Core/LatteShaderCache.cpp index ebf425bc..e39d0e86 100644 --- a/src/Cafe/HW/Latte/Core/LatteShaderCache.cpp +++ b/src/Cafe/HW/Latte/Core/LatteShaderCache.cpp @@ -609,7 +609,7 @@ void LatteShaderCache_loadOrCompileSeparableShader(LatteDecompilerShader* shader bool LatteShaderCache_readSeparableVertexShader(MemStreamReader& streamReader, uint8 version) { - std::unique_ptr lcr(new LatteContextRegister()); + auto lcr = std::make_unique(); if (version != 1) return false; uint64 shaderBaseHash = streamReader.readBE(); @@ -658,7 +658,7 @@ bool LatteShaderCache_readSeparableGeometryShader(MemStreamReader& streamReader, { if (version != 1) return false; - std::unique_ptr lcr(new LatteContextRegister()); + auto lcr = std::make_unique(); uint64 shaderBaseHash = streamReader.readBE(); uint64 shaderAuxHash = streamReader.readBE(); uint32 vsRingParameterCount = streamReader.readBE(); @@ -698,7 +698,7 @@ bool LatteShaderCache_readSeparablePixelShader(MemStreamReader& streamReader, ui { if (version != 1) return false; - std::unique_ptr lcr(new LatteContextRegister()); + auto lcr = std::make_unique(); uint64 shaderBaseHash = streamReader.readBE(); uint64 shaderAuxHash = streamReader.readBE(); bool usesGeometryShader = streamReader.readBE() != 0; diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineStableCache.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineStableCache.cpp index 50d5a256..bb6c966e 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineStableCache.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineStableCache.cpp @@ -214,6 +214,10 @@ void VulkanPipelineStableCache::LoadPipelineFromCache(std::span fileData) if (!DeserializePipeline(streamReader, *cachedPipeline)) { // failed to deserialize + s_spinlockSharedInternal.acquire(); + delete lcr; + delete cachedPipeline; + s_spinlockSharedInternal.release(); return; } // restored register view from compacted state diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineStableCache.h b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineStableCache.h index dbf64614..a18bb982 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineStableCache.h +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineStableCache.h @@ -3,7 +3,7 @@ struct VulkanPipelineHash { - VulkanPipelineHash() {}; + VulkanPipelineHash() = default; VulkanPipelineHash(uint64 h0, uint64 h1) : h0(h0), h1(h1) {}; uint64 h0; diff --git a/src/Cafe/OS/RPL/rpl.cpp b/src/Cafe/OS/RPL/rpl.cpp index b1af5535..1c779308 100644 --- a/src/Cafe/OS/RPL/rpl.cpp +++ b/src/Cafe/OS/RPL/rpl.cpp @@ -243,6 +243,7 @@ bool RPLLoader_ProcessHeaders(std::string_view moduleName, uint8* rplData, uint3 if (fileinfoSection->sectionSize < sizeof(RPLFileInfoData)) { cemuLog_force("RPLLoader: FILEINFO section size is below expected size"); + delete rplLoaderContext; return false; } @@ -1963,7 +1964,7 @@ void RPLLoader_AddDependency(const char* name) if (rplLoader_currentTlsModuleIndex == 0x7FFF) cemuLog_force("RPLLoader: Exhausted TLS module indices pool"); // convert name to path/filename if it isn't already one - if (strstr(name, ".")) + if (strchr(name, '.')) { strcpy_s(newDependency->filepath, name); } diff --git a/src/Cafe/OS/common/PPCConcurrentQueue.h b/src/Cafe/OS/common/PPCConcurrentQueue.h index 089515c5..3f0f9851 100644 --- a/src/Cafe/OS/common/PPCConcurrentQueue.h +++ b/src/Cafe/OS/common/PPCConcurrentQueue.h @@ -10,7 +10,7 @@ template class PPCConcurrentQueue { public: - PPCConcurrentQueue() {} + PPCConcurrentQueue() = default; PPCConcurrentQueue(const PPCConcurrentQueue&) = delete; PPCConcurrentQueue& operator=(const PPCConcurrentQueue&) = delete; diff --git a/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp b/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp index e01fda73..d57580f3 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp @@ -54,9 +54,7 @@ namespace coreinit { } - ~OSHostThread() - { - } + ~OSHostThread() = default; OSThread_t* m_thread; Fiber m_fiber; @@ -1223,7 +1221,7 @@ namespace coreinit { struct DeallocatorQueueEntry { - DeallocatorQueueEntry() {}; + DeallocatorQueueEntry() = default; DeallocatorQueueEntry(OSThread_t* thread, MEMPTR stack, MEMPTR deallocatorFunc) : thread(thread), stack(stack), deallocatorFunc(deallocatorFunc) {}; OSThread_t* thread{}; diff --git a/src/Cafe/OS/libs/h264_avc/H264Dec.cpp b/src/Cafe/OS/libs/h264_avc/H264Dec.cpp index 085a2e69..8dbd8ecf 100644 --- a/src/Cafe/OS/libs/h264_avc/H264Dec.cpp +++ b/src/Cafe/OS/libs/h264_avc/H264Dec.cpp @@ -835,8 +835,11 @@ namespace H264 auto asyncTask = std::async(std::launch::async, _async_H264DECEnd, executeDoneEvent.GetPointer(), session, ctx, &results); coreinit::OSWaitEvent(executeDoneEvent); _ReleaseDecoderSession(session); - for (auto& itr : results) - H264DoFrameOutputCallback(ctx, itr); + if (!results.empty()) + { + for (auto& itr : results) + H264DoFrameOutputCallback(ctx, itr); + } return H264DEC_STATUS::SUCCESS; } diff --git a/src/Cafe/TitleList/MetaInfo.cpp b/src/Cafe/TitleList/MetaInfo.cpp index 3ae77a05..b08c4fc2 100644 --- a/src/Cafe/TitleList/MetaInfo.cpp +++ b/src/Cafe/TitleList/MetaInfo.cpp @@ -72,7 +72,6 @@ void MetaInfo::ParseDirectory(const fs::path& filename) bool MetaInfo::ParseFile(const fs::path& filename) { - const auto extension = filename.extension(); if (filename.filename() != "meta.xml") return false; diff --git a/src/Cafe/TitleList/TitleInfo.cpp b/src/Cafe/TitleList/TitleInfo.cpp index c58e1841..ef97e6eb 100644 --- a/src/Cafe/TitleList/TitleInfo.cpp +++ b/src/Cafe/TitleList/TitleInfo.cpp @@ -287,7 +287,6 @@ void TitleInfo::CalcUID() m_uid = 0; return; } - std::error_code ec; // get absolute normalized path fs::path normalizedPath; if (m_fullPath.is_relative()) diff --git a/src/Cafe/TitleList/TitleList.cpp b/src/Cafe/TitleList/TitleList.cpp index f7c1b6f8..deb4564f 100644 --- a/src/Cafe/TitleList/TitleList.cpp +++ b/src/Cafe/TitleList/TitleList.cpp @@ -78,9 +78,9 @@ void CafeTitleList::LoadCacheFile() cacheEntry.titleVersion = titleVersion; cacheEntry.titleDataFormat = format; cacheEntry.region = region; - cacheEntry.titleName = name; + cacheEntry.titleName = std::move(name); cacheEntry.path = _utf8ToPath(path); - cacheEntry.subPath = sub_path; + cacheEntry.subPath = std::move(sub_path); cacheEntry.group_id = group_id; cacheEntry.app_type = app_type; @@ -482,7 +482,7 @@ void CafeTitleList::AddTitle(TitleInfo* titleInfo) } } sTLList.emplace_back(titleInfo); - sTLMap.insert(std::pair(titleInfo->GetAppTitleId(), titleInfo)); + sTLMap.emplace(titleInfo->GetAppTitleId(), titleInfo); // send out notification CafeTitleListCallbackEvent evt; evt.eventType = CafeTitleListCallbackEvent::TYPE::TITLE_DISCOVERED; diff --git a/src/Cemu/FileCache/FileCache.cpp b/src/Cemu/FileCache/FileCache.cpp index 0165f0c4..105ee860 100644 --- a/src/Cemu/FileCache/FileCache.cpp +++ b/src/Cemu/FileCache/FileCache.cpp @@ -287,7 +287,10 @@ uint8* _fileCache_compressFileData(const uint8* fileData, uint32 fileSize, sint3 Bytef* compressedData = (Bytef*)malloc(4 + compressedLen); int zret = compress2(compressedData + 4, &compressedLen, uncompressedInput, uncompressedLen, 4); // level 4 has good compression to performance ratio if (zret != Z_OK) + { + free(compressedData); return nullptr; + } compressedData[0] = ((uint32)fileSize >> 24) & 0xFF; compressedData[1] = ((uint32)fileSize >> 16) & 0xFF; compressedData[2] = ((uint32)fileSize >> 8) & 0xFF; diff --git a/src/Cemu/Tools/DownloadManager/DownloadManager.cpp b/src/Cemu/Tools/DownloadManager/DownloadManager.cpp index 33af7433..5ede52d4 100644 --- a/src/Cemu/Tools/DownloadManager/DownloadManager.cpp +++ b/src/Cemu/Tools/DownloadManager/DownloadManager.cpp @@ -967,7 +967,7 @@ void DownloadManager::setPackageError(Package* package, std::string errorMsg) if (package->state.hasError) return; // dont overwrite already set error message package->state.hasError = true; - package->state.errorMsg = errorMsg; + package->state.errorMsg = std::move(errorMsg); reportPackageStatus(package); } @@ -1216,7 +1216,6 @@ void DownloadManager::asyncPackageDownloadContentFile(Package* package, uint16 i void DownloadManager::asyncPackageVerifyFile(Package* package, uint16 index, bool isCheckState) { uint8 tmdContentHash[32]; - std::string filePathStr; // get titleId, contentId and file path std::unique_lock _l(m_mutex); uint64 titleId = package->titleId; diff --git a/src/Cemu/Tools/DownloadManager/DownloadManager.h b/src/Cemu/Tools/DownloadManager/DownloadManager.h index fa6749b8..1693318c 100644 --- a/src/Cemu/Tools/DownloadManager/DownloadManager.h +++ b/src/Cemu/Tools/DownloadManager/DownloadManager.h @@ -446,7 +446,7 @@ public: std::unique_lock _l(m_mutex); m_packageList.clear(); m_statusCode = DLMGR_STATUS_CODE::UNINITIALIZED; - m_statusMessage = ""; + m_statusMessage.clear(); } private: diff --git a/src/Cemu/napi/napi_act.cpp b/src/Cemu/napi/napi_act.cpp index b9a9c16c..663de2c4 100644 --- a/src/Cemu/napi/napi_act.cpp +++ b/src/Cemu/napi/napi_act.cpp @@ -355,7 +355,6 @@ namespace NAPI std::string_view host = tokenNode.child_value("host"); std::string_view nex_password = tokenNode.child_value("nex_password"); - std::string_view pid = tokenNode.child_value("pid"); std::string_view port = tokenNode.child_value("port"); std::string_view token = tokenNode.child_value("token"); diff --git a/src/Cemu/napi/napi_ec.cpp b/src/Cemu/napi/napi_ec.cpp index 82ab5be4..2d559e81 100644 --- a/src/Cemu/napi/napi_ec.cpp +++ b/src/Cemu/napi/napi_ec.cpp @@ -360,7 +360,7 @@ namespace NAPI // ticketVersion starts at 0 and increments every time the ticket is updated (e.g. for AOC content, when purchasing additional DLC packages) const char* tivValue = tivNode.child_value(); const char* tivValueEnd = tivValue + strlen(tivValue); - const char* tivValueSeparator = std::strstr(tivValue, "."); + const char* tivValueSeparator = std::strchr(tivValue, '.'); if (tivValueSeparator == nullptr) tivValueSeparator = tivValueEnd; diff --git a/src/Cemu/nex/nex.cpp b/src/Cemu/nex/nex.cpp index 147d37da..010f806c 100644 --- a/src/Cemu/nex/nex.cpp +++ b/src/Cemu/nex/nex.cpp @@ -739,7 +739,7 @@ nexService* nex_establishSecureConnection(uint32 authServerIp, uint16 authServer return nullptr; } // auth info - std::unique_ptr authServerInfo(new authServerInfo_t); + auto authServerInfo = std::make_unique(); // decrypt ticket RC4Ctx_t rc4Ticket; RC4_initCtx(&rc4Ticket, kerberosKey, 16); diff --git a/src/Cemu/nex/nexFriends.h b/src/Cemu/nex/nexFriends.h index cb935068..16548bf3 100644 --- a/src/Cemu/nex/nexFriends.h +++ b/src/Cemu/nex/nexFriends.h @@ -7,10 +7,7 @@ class nexGameKey : public nexType { public: - nexGameKey() - { - - } + nexGameKey() = default; nexGameKey(uint64 titleId, uint16 ukn) { @@ -175,10 +172,9 @@ public: } nexPrincipalBasicInfo(uint32 principalId, char* nnid, const nexMiiV2& mii) + : principalId(principalId), mii(mii) { - this->principalId = principalId; strcpy(this->nnid, nnid); - this->mii = mii; } nexPrincipalBasicInfo(nexPacketBuffer* pb) @@ -218,10 +214,8 @@ public: } nexNNAInfo(uint8 countryCode, uint8 countrySubCode, const nexPrincipalBasicInfo& principalBasicInfo) + : countryCode(countryCode), countrySubCode(countrySubCode), principalInfo(principalBasicInfo) { - this->countryCode = countryCode; - this->countrySubCode = countrySubCode; - this->principalInfo = principalBasicInfo; } nexNNAInfo(nexPacketBuffer* pb) @@ -250,10 +244,7 @@ public: class nexPrincipalPreference : public nexType { public: - nexPrincipalPreference() - { - - } + nexPrincipalPreference() = default; nexPrincipalPreference(uint8 ukn0, uint8 ukn1, uint8 ukn2) { diff --git a/src/Cemu/nex/nexTypes.h b/src/Cemu/nex/nexTypes.h index 8147836c..49edd3d3 100644 --- a/src/Cemu/nex/nexTypes.h +++ b/src/Cemu/nex/nexTypes.h @@ -222,7 +222,7 @@ public: if (this->currentIndex + bufferLength > this->size) { readOutOfBounds = true; - outputStr = std::string(""); + outputStr.clear(); return 0; } sint32 copiedLength = bufferLength; diff --git a/src/Common/windows/FileStream_win32.h b/src/Common/windows/FileStream_win32.h index c7ad802a..a0b1b30a 100644 --- a/src/Common/windows/FileStream_win32.h +++ b/src/Common/windows/FileStream_win32.h @@ -43,7 +43,7 @@ class FileStream void writeLine(const char* str); ~FileStream(); - FileStream() {}; + FileStream() = default; private: FileStream(HANDLE hFile); diff --git a/src/config/CemuConfig.cpp b/src/config/CemuConfig.cpp index 31a3b3e2..f996fc94 100644 --- a/src/config/CemuConfig.cpp +++ b/src/config/CemuConfig.cpp @@ -557,7 +557,7 @@ void CemuConfig::SetGameListCustomName(uint64 titleId, std::string customName) return; gameEntry = CreateGameEntry(titleId); } - gameEntry->custom_name = customName; + gameEntry->custom_name = std::move(customName); } void CemuConfig::AddRecentlyLaunchedFile(std::wstring_view file) diff --git a/src/gui/GameProfileWindow.cpp b/src/gui/GameProfileWindow.cpp index f710988f..330e290e 100644 --- a/src/gui/GameProfileWindow.cpp +++ b/src/gui/GameProfileWindow.cpp @@ -168,7 +168,6 @@ GameProfileWindow::GameProfileWindow(wxWindow* parent, uint64_t title_id) { profile_sizer->Add(new wxStaticText(panel, wxID_ANY, fmt::format("{} {}", _("Controller").ToStdString(), (i + 1))), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); - wxArrayString m_controller_profileChoices; m_controller_profile[i] = new wxComboBox(panel, wxID_ANY,"", wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_DROPDOWN| wxCB_READONLY); m_controller_profile[i]->SetMinSize(wxSize(250, -1)); m_controller_profile[i]->Bind(wxEVT_COMBOBOX_DROPDOWN, &GameProfileWindow::OnControllerProfileDropdown, this); diff --git a/src/gui/GameUpdateWindow.cpp b/src/gui/GameUpdateWindow.cpp index 3ea3f9d1..bf4cd49a 100644 --- a/src/gui/GameUpdateWindow.cpp +++ b/src/gui/GameUpdateWindow.cpp @@ -213,7 +213,6 @@ void GameUpdateWindow::ThreadWork() create_directories(targetDir); } - const auto target_path = fs::path(m_target_path); for (auto& path : m_source_paths) { if (m_thread_state == ThreadCanceled) diff --git a/src/gui/GeneralSettings2.cpp b/src/gui/GeneralSettings2.cpp index 78e1feec..41f7b4fc 100644 --- a/src/gui/GeneralSettings2.cpp +++ b/src/gui/GeneralSettings2.cpp @@ -843,7 +843,7 @@ void GeneralSettings2::StoreConfig() config.tv_volume = m_tv_volume->GetValue(); config.pad_volume = m_pad_volume->GetValue(); - config.tv_device = L""; + config.tv_device.clear(); const auto tv_device = m_tv_device->GetSelection(); if (tv_device != wxNOT_FOUND && tv_device != 0 && m_tv_device->HasClientObjectData()) { @@ -852,7 +852,7 @@ void GeneralSettings2::StoreConfig() config.tv_device = device_description->GetDescription()->GetIdentifier(); } - config.pad_device = L""; + config.pad_device.clear(); const auto pad_device = m_pad_device->GetSelection(); if (pad_device != wxNOT_FOUND && pad_device != 0 && m_pad_device->HasClientObjectData()) { diff --git a/src/gui/components/wxTitleManagerList.cpp b/src/gui/components/wxTitleManagerList.cpp index 9a8c17a3..8f43630d 100644 --- a/src/gui/components/wxTitleManagerList.cpp +++ b/src/gui/components/wxTitleManagerList.cpp @@ -343,7 +343,7 @@ void wxTitleManagerList::OnConvertToCompressedFormat(uint64 titleId) if (!GetConfig().game_paths.empty()) defaultDir = GetConfig().game_paths.front(); // get the short name, which we will use as a suggested default file name - std::string defaultFileName = shortName; + std::string defaultFileName = std::move(shortName); boost::replace_all(defaultFileName, "/", ""); boost::replace_all(defaultFileName, "\\", ""); @@ -474,7 +474,7 @@ void wxTitleManagerList::OnConvertToCompressedFormat(uint64 titleId) { std::string temporaryMountPath = TitleInfo::GetUniqueTempMountingPath(); titleInfo->Mount(temporaryMountPath.c_str(), "", FSC_PRIORITY_BASE); - bool r = RecursivelyAddFiles(fmt::format("{:016x}_v{}/", titleInfo->GetAppTitleId(), titleInfo->GetAppTitleVersion()), temporaryMountPath.c_str()); + bool r = RecursivelyAddFiles(fmt::format("{:016x}_v{}/", titleInfo->GetAppTitleId(), titleInfo->GetAppTitleVersion()), temporaryMountPath); titleInfo->Unmount(temporaryMountPath.c_str()); return r; } diff --git a/src/gui/debugger/DumpCtrl.cpp b/src/gui/debugger/DumpCtrl.cpp index d8cd6448..cc1d5fee 100644 --- a/src/gui/debugger/DumpCtrl.cpp +++ b/src/gui/debugger/DumpCtrl.cpp @@ -251,7 +251,7 @@ void DumpCtrl::GoToAddressDialog() m_lastGotoOffset = result; CenterOffset(result); } - catch (const std::exception ex) + catch (const std::exception& ex) { wxMessageBox(ex.what(), _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this); } diff --git a/src/gui/debugger/SymbolCtrl.cpp b/src/gui/debugger/SymbolCtrl.cpp index d9adaa32..cb1f3b1a 100644 --- a/src/gui/debugger/SymbolCtrl.cpp +++ b/src/gui/debugger/SymbolCtrl.cpp @@ -36,7 +36,7 @@ SymbolListCtrl::SymbolListCtrl(wxWindow* parent, const wxWindowID& id, const wxP Bind(wxEVT_LIST_ITEM_ACTIVATED, &SymbolListCtrl::OnLeftDClick, this); Bind(wxEVT_LIST_ITEM_RIGHT_CLICK, &SymbolListCtrl::OnRightClick, this); - m_list_filter = ""; + m_list_filter.Clear(); OnGameLoaded(); @@ -65,7 +65,7 @@ void SymbolListCtrl::OnGameLoaded() new_entry.first->second.searchName += new_entry.first->second.libName; new_entry.first->second.searchName.MakeLower(); - if (m_list_filter == "") + if (m_list_filter.IsEmpty()) new_entry.first->second.visible = true; else if (new_entry.first->second.searchName.Contains(m_list_filter)) new_entry.first->second.visible = true; @@ -149,7 +149,7 @@ void SymbolListCtrl::ChangeListFilter(std::string filter) size_t visible_entries = m_data.size(); for (auto& [address, symbol] : m_data) { - if (m_list_filter == "") + if (m_list_filter.IsEmpty()) symbol.visible = true; else if (symbol.searchName.Contains(m_list_filter)) symbol.visible = true; diff --git a/src/gui/debugger/SymbolCtrl.h b/src/gui/debugger/SymbolCtrl.h index 9aebdedc..81ccd326 100644 --- a/src/gui/debugger/SymbolCtrl.h +++ b/src/gui/debugger/SymbolCtrl.h @@ -11,7 +11,7 @@ public: void ChangeListFilter(std::string filter); private: struct SymbolItem { - SymbolItem() {} + SymbolItem() = default; SymbolItem(wxString name, wxString libName, wxString searchName, bool visible) : name(name), libName(libName), searchName(searchName), visible(visible) {} diff --git a/src/gui/input/InputSettings2.cpp b/src/gui/input/InputSettings2.cpp index 5793cbd2..e5f4891d 100644 --- a/src/gui/input/InputSettings2.cpp +++ b/src/gui/input/InputSettings2.cpp @@ -568,8 +568,6 @@ void InputSettings2::on_profile_text_changed(wxCommandEvent& event) auto& page_data = get_current_page_data(); - const auto selection = page_data.m_emulated_controller->GetStringSelection(); - // load_bttn, save_bttn, delete_bttn, profile_status const auto text = event.GetString(); const auto text_str = from_wxString(text); diff --git a/src/input/api/Controller.h b/src/input/api/Controller.h index 29b01f28..8b1c8e62 100644 --- a/src/input/api/Controller.h +++ b/src/input/api/Controller.h @@ -189,7 +189,7 @@ public: // update provider if settings are different from default provider void update_provider(std::shared_ptr provider) { - m_provider = provider; + m_provider = std::move(provider); } protected: diff --git a/src/input/motion/MotionSample.h b/src/input/motion/MotionSample.h index f4015afb..bb47f784 100644 --- a/src/input/motion/MotionSample.h +++ b/src/input/motion/MotionSample.h @@ -104,9 +104,7 @@ struct Quat class MotionSample { public: - MotionSample() - { - } + MotionSample() = default; MotionSample(float acc[3], float accAcceleration, float gyro[3], float orientation[3], float quaternion[4] diff --git a/src/util/Zir/Core/IR.h b/src/util/Zir/Core/IR.h index 71191024..a59c7837 100644 --- a/src/util/Zir/Core/IR.h +++ b/src/util/Zir/Core/IR.h @@ -289,7 +289,7 @@ namespace ZpIR // IR register constant definition stored in basic block struct IRRegConstDef { - IRRegConstDef() {}; + IRRegConstDef() = default; // todo - support for constants with more than one element? IRRegConstDef& setU32(uint32 v) { value_u32 = v; type = DataType::U32; return *this; }; @@ -513,7 +513,7 @@ namespace ZpIR LOC_TYPE_ATTRIBUTE = 3, }; public: - ShaderImportLocation() {} + ShaderImportLocation() = default; ShaderImportLocation(LocationSymbolName loc) { uint64 v = (uint64)loc; @@ -598,7 +598,7 @@ namespace ZpIR LOC_TYPE_OUTPUT = 2, }; public: - ShaderExportLocation() {} + ShaderExportLocation() = default; ShaderExportLocation(LocationSymbolName loc) { uint64 v = (uint64)loc; diff --git a/src/util/Zir/EmitterGLSL/ZpIREmitGLSL.cpp b/src/util/Zir/EmitterGLSL/ZpIREmitGLSL.cpp index 0b0c2dc5..cb42111b 100644 --- a/src/util/Zir/EmitterGLSL/ZpIREmitGLSL.cpp +++ b/src/util/Zir/EmitterGLSL/ZpIREmitGLSL.cpp @@ -12,9 +12,7 @@ class DualStringBuffer public: DualStringBuffer() : m_offsetBegin(N / 2), m_offsetEnd(N / 2) { } - ~DualStringBuffer() - { - } + ~DualStringBuffer() = default; static_assert(sizeof(char) == sizeof(uint8)); diff --git a/src/util/containers/IntervalBucketContainer.h b/src/util/containers/IntervalBucketContainer.h index e48d305e..a85aca78 100644 --- a/src/util/containers/IntervalBucketContainer.h +++ b/src/util/containers/IntervalBucketContainer.h @@ -15,7 +15,7 @@ class IntervalBucketContainer public: - IntervalBucketContainer() {}; + IntervalBucketContainer() = default; // range is defined as inclusive rangeStart and exclusive rangeEnd void addRange(TAddr rangeStart, TAddr rangeEnd, TData* data) diff --git a/src/util/containers/RangeStore.h b/src/util/containers/RangeStore.h index d1167b29..e20688e6 100644 --- a/src/util/containers/RangeStore.h +++ b/src/util/containers/RangeStore.h @@ -13,10 +13,7 @@ public: size_t lastIterationIndex; }rangeEntry_t; - RangeStore() - { - - } + RangeStore() = default; size_t getBucket(_ADDR addr) { diff --git a/src/util/containers/SmallBitset.h b/src/util/containers/SmallBitset.h index 87fae9d8..27109183 100644 --- a/src/util/containers/SmallBitset.h +++ b/src/util/containers/SmallBitset.h @@ -6,7 +6,7 @@ template class SmallBitset { public: - SmallBitset() {}; + SmallBitset() = default; static_assert(N <= 32); bool test(size_t index) const diff --git a/src/util/containers/flat_hash_map.hpp b/src/util/containers/flat_hash_map.hpp index 3dee0b16..1eccc307 100644 --- a/src/util/containers/flat_hash_map.hpp +++ b/src/util/containers/flat_hash_map.hpp @@ -166,9 +166,7 @@ namespace ska : distance_from_desired(distance_from_desired) { } - ~sherwood_v3_entry() - { - } + ~sherwood_v3_entry() = default; static sherwood_v3_entry* empty_default_table() { static sherwood_v3_entry result[min_lookups] = { {}, {}, {}, {special_end_value} }; @@ -297,9 +295,7 @@ namespace ska using pointer = value_type*; using const_pointer = const value_type*; - sherwood_v3_table() - { - } + sherwood_v3_table() = default; explicit sherwood_v3_table(size_type bucket_count, const ArgumentHash& hash = ArgumentHash(), const ArgumentEqual& equal = ArgumentEqual(), const ArgumentAlloc& alloc = ArgumentAlloc()) : EntryAlloc(alloc), Hasher(hash), Equal(equal) { @@ -1324,9 +1320,7 @@ namespace ska using mapped_type = V; using Table::Table; - flat_hash_map() - { - } + flat_hash_map() = default; inline V& operator[](const K& key) { @@ -1442,9 +1436,7 @@ namespace ska using key_type = T; using Table::Table; - flat_hash_set() - { - } + flat_hash_set() = default; template std::pair emplace(Args &&... args)