From d6ebfed43293f83e7522d5db90c82ec989b145c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 29 Jan 2026 12:36:27 +0100 Subject: [PATCH] Fix some bugs and warnings from a pass of static analysis --- Common/Arm64Emitter.cpp | 6 +++++ Common/ArmEmitter.cpp | 1 + Common/GPU/D3D11/thin3d_d3d11.cpp | 1 + Common/GPU/OpenGL/GLFeatures.cpp | 6 ++--- Common/UI/TabHolder.cpp | 1 + Core/Debugger/MemBlockInfo.cpp | 6 +++-- Core/Debugger/WebSocket/CPUCoreSubscriber.cpp | 2 +- Core/HLE/sceIo.cpp | 3 +++ Core/HLE/sceKernelVTimer.cpp | 4 ++-- Core/HLE/sceNetAdhoc.cpp | 4 +--- Core/MIPS/MIPSInt.cpp | 1 + Core/MIPS/x86/Jit.cpp | 2 ++ GPU/Common/FramebufferManagerCommon.cpp | 12 ++++++---- GPU/Common/VertexDecoderCommon.h | 2 +- GPU/GPUState.h | 4 ++-- GPU/Software/FuncId.cpp | 1 + UI/ImDebugger/ImGe.cpp | 4 ++-- UI/ImDebugger/ImStructViewer.cpp | 1 + UI/MainScreen.cpp | 3 ++- UI/SystemInfoScreen.cpp | 23 +++++++++---------- UI/SystemInfoScreen.h | 1 - Windows/Debugger/DumpMemoryWindow.cpp | 2 +- Windows/DinputDevice.cpp | 2 +- Windows/GEDebugger/GEDebugger.cpp | 10 +++++--- ext/gason/gason.cpp | 19 +++++++-------- 25 files changed, 72 insertions(+), 49 deletions(-) diff --git a/Common/Arm64Emitter.cpp b/Common/Arm64Emitter.cpp index f33f7452a1..c933793a63 100644 --- a/Common/Arm64Emitter.cpp +++ b/Common/Arm64Emitter.cpp @@ -896,7 +896,10 @@ void ARM64XEmitter::SetJumpTarget(FixupBranch const& branch) switch (branch.type) { case 1: // CBNZ + { Not = true; + [[fallthrough]]; + } case 0: // CBZ { _assert_msg_(IsInRangeImm19(distance), "%s(%d): Received too large distance: %llx", __FUNCTION__, branch.type, distance); @@ -910,7 +913,10 @@ void ARM64XEmitter::SetJumpTarget(FixupBranch const& branch) inst = (0x2A << 25) | (MaskImm19(distance) << 5) | branch.cond; break; case 4: // TBNZ + { Not = true; + [[fallthrough]]; + } case 3: // TBZ { _assert_msg_(IsInRangeImm14(distance), "%s(%d): Received too large distance: %llx", __FUNCTION__, branch.type, distance); diff --git a/Common/ArmEmitter.cpp b/Common/ArmEmitter.cpp index 6b2745e618..40bdca9ab8 100644 --- a/Common/ArmEmitter.cpp +++ b/Common/ArmEmitter.cpp @@ -1166,6 +1166,7 @@ void ARMXEmitter::WriteStoreOp(u32 Op, ARMReg Rt, ARMReg Rn, Operand2 Rm, bool R break; } // Intentional fallthrough: TYPE_IMMSREG not supported for misc addressing. + [[fallthrough]]; default: // RSR not supported for any of these // We already have the warning above diff --git a/Common/GPU/D3D11/thin3d_d3d11.cpp b/Common/GPU/D3D11/thin3d_d3d11.cpp index 7ebf8a3cee..99d886fd36 100644 --- a/Common/GPU/D3D11/thin3d_d3d11.cpp +++ b/Common/GPU/D3D11/thin3d_d3d11.cpp @@ -1771,6 +1771,7 @@ bool D3D11DrawContext::CopyFramebufferToMemory(Framebuffer *src, Aspect channelB case Aspect::STENCIL_BIT: if (!fb) return false; + break; default: break; } diff --git a/Common/GPU/OpenGL/GLFeatures.cpp b/Common/GPU/OpenGL/GLFeatures.cpp index 48008f884d..2b798142ca 100644 --- a/Common/GPU/OpenGL/GLFeatures.cpp +++ b/Common/GPU/OpenGL/GLFeatures.cpp @@ -213,9 +213,9 @@ bool CheckGLExtensions() { // Start by assuming we're at 2.0. int parsed[2] = {2, 0}; { // Grab the version and attempt to parse. - char buffer[128] = { 0 }; - strncpy(buffer, versionStr, sizeof(buffer) - 1); - + char buffer[128]{}; + truncate_cpy(buffer, versionStr); + const int len = (int)strlen(buffer); bool beforeDot = true; int lastDigit = 0; diff --git a/Common/UI/TabHolder.cpp b/Common/UI/TabHolder.cpp index 04a8776521..0691b207bc 100644 --- a/Common/UI/TabHolder.cpp +++ b/Common/UI/TabHolder.cpp @@ -67,6 +67,7 @@ TabHolder::TabHolder(Orientation orientation, float stripSize, TabHolderFlags fl void TabHolder::AddBack(UIScreen *parent) { if (tabContainer_) { auto di = GetI18NCategory(I18NCat::DIALOG); + tabContainer_->Add(new UI::Spacer(8.0f)); tabContainer_->Add(new Choice(di->T("Back"), ImageID("I_NAVIGATE_BACK"), new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 0.0f, Margins(0, 0, 10, 10))))->OnClick.Handle(parent, &UIScreen::OnBack); } } diff --git a/Core/Debugger/MemBlockInfo.cpp b/Core/Debugger/MemBlockInfo.cpp index ef67ee3ba4..ba99beeb70 100644 --- a/Core/Debugger/MemBlockInfo.cpp +++ b/Core/Debugger/MemBlockInfo.cpp @@ -243,8 +243,10 @@ void MemSlabMap::DoState(PointerWrap &p) { Slab *slab = first_; for (int i = 0; i < count; ++i) { - slab->next->DoState(p); - slab = slab->next; + if (slab->next) { + slab->next->DoState(p); + slab = slab->next; + } } } } diff --git a/Core/Debugger/WebSocket/CPUCoreSubscriber.cpp b/Core/Debugger/WebSocket/CPUCoreSubscriber.cpp index 323117f423..57d79459b3 100644 --- a/Core/Debugger/WebSocket/CPUCoreSubscriber.cpp +++ b/Core/Debugger/WebSocket/CPUCoreSubscriber.cpp @@ -276,7 +276,7 @@ void WebSocketCPUGetReg(DebuggerRequest &req) { return; int cat, reg; - uint32_t val; + uint32_t val = 0; switch (ValidateCatReg(req, &cat, ®)) { case DebuggerRegType::NORMAL: val = cpuDebug->GetRegValue(cat, reg); diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 4db3820ff5..25bb31f23d 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -1285,6 +1285,9 @@ static u32 sceIoWrite(int id, u32 data_addr, int size) { int us; bool complete = __IoWrite(result, id, data_addr, size, us); if (!complete) { + if (!f) { + return hleLogError(Log::sceIo, error, "bad file descriptor"); + } __IoSchedSync(f, id, us); __KernelWaitCurThread(WAITTYPE_IO, id, 0, 0, false, "io write"); f->waitingSyncThreads.push_back(__KernelGetCurThread()); diff --git a/Core/HLE/sceKernelVTimer.cpp b/Core/HLE/sceKernelVTimer.cpp index c6e1d4e140..1b82a9e1ac 100644 --- a/Core/HLE/sceKernelVTimer.cpp +++ b/Core/HLE/sceKernelVTimer.cpp @@ -65,11 +65,11 @@ struct VTimer : public KernelObject { } } - NativeVTimer nvt; + NativeVTimer nvt{}; }; KernelObject *__KernelVTimerObject() { - return new VTimer; + return new VTimer(); } static u64 __getVTimerRunningTime(const VTimer *vt) { diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index 2490f31325..8ea3257fb1 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -1189,10 +1189,9 @@ int DoBlockingPtpConnect(AdhocSocketRequest& req, s64& result, AdhocSendTargets& } int sockerr = 0, ret; - struct sockaddr_in sin; + struct sockaddr_in sin{}; // Try to connect again if the first attempt failed due to remote side was not listening yet (ie. ECONNREFUSED or ETIMEDOUT) if (ptpsocket.state == ADHOC_PTP_STATE_CLOSED) { - memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_addr.s_addr = targetPeer.peers[0].ip; sin.sin_port = htons(ptpsocket.pport + targetPeer.peers[0].portOffset); @@ -1247,7 +1246,6 @@ int DoBlockingPtpConnect(AdhocSocketRequest& req, s64& result, AdhocSendTargets& // Check whether the connection has been established or not if (!serverHasRelay && ret != SOCKET_ERROR) { socklen_t sinlen = sizeof(sin); - memset(&sin, 0, sinlen); // Note: "getpeername" shouldn't failed if the connection has been established, but on Windows it may succeed even when "connect" is still in-progress and not accepted yet (ie. "Tales of VS" on Windows) ret = getpeername(ptpsocket.id, (struct sockaddr*)&sin, &sinlen); if (ret == SOCKET_ERROR) { diff --git a/Core/MIPS/MIPSInt.cpp b/Core/MIPS/MIPSInt.cpp index e9c31f6e71..ba926a7e57 100644 --- a/Core/MIPS/MIPSInt.cpp +++ b/Core/MIPS/MIPSInt.cpp @@ -528,6 +528,7 @@ namespace MIPSInt } break; } + break; case 4: //mtc1 FI(fs) = R(rt); diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index cd01ddcdc8..d16b97ddd3 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -595,6 +595,8 @@ bool Jit::ReplaceJalTo(u32 dest) { return true; } + + void Jit::Comp_ReplacementFunc(MIPSOpcode op) { // We get here if we execute the first instruction of a replaced function. This means // that we do need to return to RA. diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 530b7b1a5c..9c814bf003 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -2627,7 +2627,7 @@ bool FramebufferManagerCommon::NotifyBlockTransferBefore(u32 dstBasePtr, int dst if (PSP_CoreParameter().compat.flags().BlockTransferAllowCreateFB || GetSkipGPUReadbackMode() == SkipGPUReadbackMode::COPY_TO_TEXTURE || (PSP_CoreParameter().compat.flags().IntraVRAMBlockTransferAllowCreateFB && - Memory::IsVRAMAddress(srcRect.vfb->fb_address) && Memory::IsVRAMAddress(dstBasePtr))) { + (srcRect.vfb && Memory::IsVRAMAddress(srcRect.vfb->fb_address)) && Memory::IsVRAMAddress(dstBasePtr))) { GEBufferFormat ramFormat; // Try to guess the appropriate format. We only know the bpp from the block transfer command (16 or 32 bit). if (srcRect.channel == RASTER_COLOR) { @@ -2719,9 +2719,11 @@ bool FramebufferManagerCommon::NotifyBlockTransferBefore(u32 dstBasePtr, int dst } // Getting to the more complex cases. Have not actually seen much of these yet. - WARN_LOG_N_TIMES(blockformat, 5, Log::G3D, "Mismatched buffer formats in block transfer: %s->%s (%dx%d)", - GeBufferFormatToString(srcRect.vfb->Format(srcRect.channel)), GeBufferFormatToString(dstRect.vfb->Format(dstRect.channel)), - width, height); + if (srcRect.vfb && dstRect.vfb) { + WARN_LOG_N_TIMES(blockformat, 5, Log::G3D, "Mismatched buffer formats in block transfer: %s->%s (%dx%d)", + GeBufferFormatToString(srcRect.vfb->Format(srcRect.channel)), GeBufferFormatToString(dstRect.vfb->Format(dstRect.channel)), + width, height); + } // TODO @@ -2753,7 +2755,7 @@ bool FramebufferManagerCommon::NotifyBlockTransferBefore(u32 dstBasePtr, int dst srcBasePtr, srcRect.x_bytes / bpp, srcRect.y, srcStride, dstBasePtr, dstRect.x_bytes / bpp, dstRect.y, dstStride); FlushBeforeCopy(); - if (GetSkipGPUReadbackMode() == SkipGPUReadbackMode::NO_SKIP && !srcRect.vfb->memoryUpdated) { + if (GetSkipGPUReadbackMode() == SkipGPUReadbackMode::NO_SKIP && srcRect.vfb && !srcRect.vfb->memoryUpdated) { const int srcBpp = BufferFormatBytesPerPixel(srcRect.vfb->fb_format); const float srcXFactor = (float)bpp / srcBpp; const bool tooTall = srcY + srcRect.h > srcRect.vfb->bufferHeight; diff --git a/GPU/Common/VertexDecoderCommon.h b/GPU/Common/VertexDecoderCommon.h index 6578571d64..6888b4892f 100644 --- a/GPU/Common/VertexDecoderCommon.h +++ b/GPU/Common/VertexDecoderCommon.h @@ -87,7 +87,7 @@ struct DecVtxFormat { void GetIndexBounds(const void *inds, int count, u32 vertType, u16 *indexLowerBound, u16 *indexUpperBound); -inline int RoundUp4(int x) { +inline int constexpr RoundUp4(int x) { return (x + 3) & ~3; } diff --git a/GPU/GPUState.h b/GPU/GPUState.h index 9c14867cb0..627a4c05c8 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -431,8 +431,8 @@ struct GPUgstate { bool vertTypeIsSkinningEnabled(u32 vertType); -inline int vertTypeGetNumBoneWeights(u32 vertType) { return 1 + ((vertType & GE_VTYPE_WEIGHTCOUNT_MASK) >> GE_VTYPE_WEIGHTCOUNT_SHIFT); } -inline int vertTypeGetWeightMask(u32 vertType) { return vertType & GE_VTYPE_WEIGHT_MASK; } +inline constexpr int vertTypeGetNumBoneWeights(u32 vertType) { return 1 + ((vertType & GE_VTYPE_WEIGHTCOUNT_MASK) >> GE_VTYPE_WEIGHTCOUNT_SHIFT); } +inline constexpr int vertTypeGetWeightMask(u32 vertType) { return vertType & GE_VTYPE_WEIGHT_MASK; } // The rest is cached simplified/converted data for fast access. // Does not need to be saved when saving/restoring context. diff --git a/GPU/Software/FuncId.cpp b/GPU/Software/FuncId.cpp index e1520b8d72..c024c39e78 100644 --- a/GPU/Software/FuncId.cpp +++ b/GPU/Software/FuncId.cpp @@ -590,6 +590,7 @@ std::string DescribeSamplerID(const SamplerID &id) { break; case GE_TEXFUNC_ADD: name += ":ADD"; + break; default: break; } diff --git a/UI/ImDebugger/ImGe.cpp b/UI/ImDebugger/ImGe.cpp index 70cc812eb4..3ce5f82a9b 100644 --- a/UI/ImDebugger/ImGe.cpp +++ b/UI/ImDebugger/ImGe.cpp @@ -501,7 +501,7 @@ void ImGePixelViewer::UpdateTexture(Draw::DrawContext *draw) { case GE_FORMAT_5551: if (showAlpha) { uint32_t *dst32 = (uint32_t *)dst; - uint16_t *src16 = (uint16_t *)dst; + const uint16_t *src16 = (const uint16_t *)src; for (int x = 0; x < width; x++) { dst32[x] = (src16[x] >> 15) ? 0xFFFFFFFF : 0xFF000000; } @@ -514,7 +514,7 @@ void ImGePixelViewer::UpdateTexture(Draw::DrawContext *draw) { break; case GE_FORMAT_DEPTH16: { - uint16_t *src16 = (uint16_t *)src; + const uint16_t *src16 = (const uint16_t *)src; float scale = this->scale / 256.0f; for (int x = 0; x < width; x++) { // Just pick off the upper bits by adding 1 to the byte address diff --git a/UI/ImDebugger/ImStructViewer.cpp b/UI/ImDebugger/ImStructViewer.cpp index 6f2e75a20a..1d605dd87f 100644 --- a/UI/ImDebugger/ImStructViewer.cpp +++ b/UI/ImDebugger/ImStructViewer.cpp @@ -168,6 +168,7 @@ static void DrawBuiltInContent(const BuiltIn &builtIn, const u32 address) { break; case BuiltInType::Void: ImGui::Text(""); + break; default: return; } diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 49ae911e28..204667c5e4 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -287,7 +287,7 @@ void GameButton::Draw(UIContext &dc) { switch (ginfo->fileType) { case IdentifiedFileType::UNKNOWN_ELF: imageIcon = ImageID("I_DEBUGGER"); break; case IdentifiedFileType::PPSSPP_GE_DUMP: imageIcon = ImageID("I_DISPLAY"); break; - case IdentifiedFileType::PSX_ISO: imageIcon = ImageID("I_PSX_ISO"); break; + case IdentifiedFileType::PSX_ISO: case IdentifiedFileType::PSP_PS1_PBP: imageIcon = ImageID("I_PSX_ISO"); break; case IdentifiedFileType::PS2_ISO: imageIcon = ImageID("I_PS2_ISO"); break; case IdentifiedFileType::PS3_ISO: imageIcon = ImageID("I_PS3_ISO"); break; @@ -296,6 +296,7 @@ void GameButton::Draw(UIContext &dc) { case IdentifiedFileType::PPSSPP_SAVESTATE: case IdentifiedFileType::ERROR_IDENTIFYING: case IdentifiedFileType::UNKNOWN_BIN: imageIcon = ImageID("I_FILE"); break; + default: break; } if (imageIcon.isValid()) { diff --git a/UI/SystemInfoScreen.cpp b/UI/SystemInfoScreen.cpp index 42a47ccb8e..40e4a8eea3 100644 --- a/UI/SystemInfoScreen.cpp +++ b/UI/SystemInfoScreen.cpp @@ -35,7 +35,7 @@ void SystemInfoScreen::update() { } // TODO: How can we de-duplicate this and SystemInfoScreen::CreateTabs? -void SystemInfoScreen::CopySummaryToClipboard(UI::EventParams &e) { +static void CopySummaryToClipboard(Draw::DrawContext *draw) { auto di = GetI18NCategory(I18NCat::DIALOG); auto si = GetI18NCategory(I18NCat::DIALOG); @@ -56,7 +56,6 @@ void SystemInfoScreen::CopySummaryToClipboard(UI::EventParams &e) { std::string board = System_GetProperty(SYSPROP_BOARDNAME); if (!board.empty()) w.C("Board: ").W(board).endl(); - Draw::DrawContext *draw = screenManager()->getDrawContext(); w.C("3D API: ").W(draw->GetInfoString(Draw::InfoField::APINAME)).endl(); w.C("API version: ").W(draw->GetInfoString(Draw::InfoField::APIVERSION)).endl(); w.C("Device API version: ").W(draw->GetInfoString(Draw::InfoField::DEVICE_API_VERSION)).endl(); @@ -117,7 +116,9 @@ void SystemInfoScreen::CreateDeviceInfoTab(UI::LinearLayout *deviceSpecs) { UI::CollapsibleSection *systemInfo = deviceSpecs->Add(new UI::CollapsibleSection(si->T("System Information"))); - systemInfo->Add(new Choice(si->T("Copy summary to clipboard"), ImageID("I_FILE_COPY")))->OnClick.Handle(this, &SystemInfoScreen::CopySummaryToClipboard); + Draw::DrawContext *draw = screenManager()->getDrawContext(); + + systemInfo->Add(new Choice(si->T("Copy summary to clipboard"), ImageID("I_FILE_COPY")))->OnClick.Add([draw](UI::EventParams &e) { CopySummaryToClipboard(draw); }); systemInfo->Add(new InfoItem(si->T("System Name"), System_GetProperty(SYSPROP_NAME))); #if PPSSPP_PLATFORM(ANDROID) systemInfo->Add(new InfoItem(si->T("System Version"), StringFromInt(System_GetPropertyInt(SYSPROP_SYSTEMVERSION)))); @@ -139,7 +140,7 @@ void SystemInfoScreen::CreateDeviceInfoTab(UI::LinearLayout *deviceSpecs) { UI::CollapsibleSection *cpuInfo = deviceSpecs->Add(new UI::CollapsibleSection(si->T("CPU Information"))); // Don't bother showing the CPU name if we don't have one. - if (strcmp(cpu_info.brand_string, "Unknown") != 0) { + if (equals(cpu_info.brand_string, "Unknown")) { cpuInfo->Add(new InfoItem(si->T("CPU Name"), cpu_info.brand_string)); } @@ -152,8 +153,6 @@ void SystemInfoScreen::CreateDeviceInfoTab(UI::LinearLayout *deviceSpecs) { CollapsibleSection *gpuInfo = deviceSpecs->Add(new CollapsibleSection(si->T("GPU Information"))); - DrawContext *draw = screenManager()->getDrawContext(); - const std::string apiNameKey = draw->GetInfoString(InfoField::APINAME); std::string_view apiName = gr->T(apiNameKey); gpuInfo->Add(new InfoItem(si->T("3D API"), apiName)); @@ -177,10 +176,10 @@ void SystemInfoScreen::CreateDeviceInfoTab(UI::LinearLayout *deviceSpecs) { #endif if (GetGPUBackend() == GPUBackend::OPENGL) { gpuInfo->Add(new InfoItem(si->T("Core Context"), gl_extensions.IsCoreContext ? di->T("Active") : di->T("Inactive"))); - int highp_int_min = gl_extensions.range[1][5][0]; - int highp_int_max = gl_extensions.range[1][5][1]; - int highp_float_min = gl_extensions.range[1][2][0]; - int highp_float_max = gl_extensions.range[1][2][1]; + const int highp_int_min = gl_extensions.range[1][5][0]; + const int highp_int_max = gl_extensions.range[1][5][1]; + const int highp_float_min = gl_extensions.range[1][2][0]; + const int highp_float_max = gl_extensions.range[1][2][1]; if (highp_int_max != 0) { char temp[128]; snprintf(temp, sizeof(temp), "%d-%d", highp_int_min, highp_int_max); @@ -188,7 +187,7 @@ void SystemInfoScreen::CreateDeviceInfoTab(UI::LinearLayout *deviceSpecs) { } if (highp_float_max != 0) { char temp[128]; - snprintf(temp, sizeof(temp), "%d-%d", highp_int_min, highp_int_max); + snprintf(temp, sizeof(temp), "%d-%d", highp_float_min, highp_float_max); gpuInfo->Add(new InfoItem(si->T("High precision float range"), temp)); } } @@ -282,7 +281,7 @@ void SystemInfoScreen::CreateDeviceInfoTab(UI::LinearLayout *deviceSpecs) { if (draw->GetDeviceCaps().presentModesSupported & Draw::PresentMode::FIFO) presentModes += "FIFO, "; if (draw->GetDeviceCaps().presentModesSupported & Draw::PresentMode::IMMEDIATE) presentModes += "IMMEDIATE, "; if (draw->GetDeviceCaps().presentModesSupported & Draw::PresentMode::MAILBOX) presentModes += "MAILBOX, "; - if (!presentModes.empty()) { + if (presentModes.size() > 2) { presentModes.pop_back(); presentModes.pop_back(); } diff --git a/UI/SystemInfoScreen.h b/UI/SystemInfoScreen.h index 079b8be3a0..0d57954dbe 100644 --- a/UI/SystemInfoScreen.h +++ b/UI/SystemInfoScreen.h @@ -18,7 +18,6 @@ public: void resized() override { RecreateViews(); } protected: - void CopySummaryToClipboard(UI::EventParams &e); bool ShowSearchControls() const override { return false; } private: diff --git a/Windows/Debugger/DumpMemoryWindow.cpp b/Windows/Debugger/DumpMemoryWindow.cpp index 6d90a2c1ca..4942a7cf03 100644 --- a/Windows/Debugger/DumpMemoryWindow.cpp +++ b/Windows/Debugger/DumpMemoryWindow.cpp @@ -129,7 +129,7 @@ INT_PTR CALLBACK DumpMemoryWindow::dlgFunc(HWND hwnd, UINT iMsg, WPARAM wParam, EndDialog(hwnd,false); break; } - + break; case WM_KEYDOWN: break; diff --git a/Windows/DinputDevice.cpp b/Windows/DinputDevice.cpp index 867e24e3e5..119a09d7e1 100644 --- a/Windows/DinputDevice.cpp +++ b/Windows/DinputDevice.cpp @@ -384,7 +384,7 @@ static std::set DetectXInputVIDPIDs() { while (SUCCEEDED(pEnumDevices->Next(10000, 32, pDevices, &uReturned)) && uReturned > 0) { for (ULONG i = 0; i < uReturned; i++) { - VARIANT var; + VARIANT var{}; if (SUCCEEDED(pDevices[i]->Get(L"DeviceID", 0, &var, nullptr, nullptr))) { if (wcsstr(var.bstrVal, L"IG_")) diff --git a/Windows/GEDebugger/GEDebugger.cpp b/Windows/GEDebugger/GEDebugger.cpp index 2aeaa8f64a..26f68a475c 100644 --- a/Windows/GEDebugger/GEDebugger.cpp +++ b/Windows/GEDebugger/GEDebugger.cpp @@ -314,6 +314,7 @@ void CGEDebugger::SetupPreviews() { case ID_GEDBG_ENABLE_PREVIEW: previewsEnabled_ ^= 1; primaryWindow->Redraw(); + break; default: break; } @@ -362,6 +363,7 @@ void CGEDebugger::SetupPreviews() { case ID_GEDBG_ENABLE_PREVIEW: previewsEnabled_ ^= 2; secondWindow->Redraw(); + break; default: break; } @@ -576,9 +578,11 @@ void CGEDebugger::UpdatePreviews() { UpdatePrimPreview(primOp, 3); } - wchar_t primCounter[1024]{}; - swprintf(primCounter, ARRAY_SIZE(primCounter), L"%d/%d", gpuDebug->PrimsThisFrame(), gpuDebug->PrimsLastFrame()); - SetDlgItemText(m_hDlg, IDC_GEDBG_PRIMCOUNTER, primCounter); + if (gpuDebug) { + wchar_t primCounter[1024]{}; + swprintf(primCounter, ARRAY_SIZE(primCounter), L"%d/%d", gpuDebug->PrimsThisFrame(), gpuDebug->PrimsLastFrame()); + SetDlgItemText(m_hDlg, IDC_GEDBG_PRIMCOUNTER, primCounter); + } for (GEDebuggerTab &tabState : tabStates_) { UpdateTab(&tabState); diff --git a/ext/gason/gason.cpp b/ext/gason/gason.cpp index c3ce4efec7..f690901640 100644 --- a/ext/gason/gason.cpp +++ b/ext/gason/gason.cpp @@ -155,15 +155,16 @@ int jsonParse(char *s, char **endptr, JsonValue *value, JsonAllocator &allocator *endptr = s; return JSON_BAD_NUMBER; } - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': + [[fallthrough]]; + case '0': [[fallthrough]]; + case '1': [[fallthrough]]; + case '2': [[fallthrough]]; + case '3': [[fallthrough]]; + case '4': [[fallthrough]]; + case '5': [[fallthrough]]; + case '6': [[fallthrough]]; + case '7': [[fallthrough]]; + case '8': [[fallthrough]]; case '9': o = JsonValue(string2double(*endptr, &s)); if (!isdelim(*s)) {