From 19e893a2ad934f64f51bd3bf4e1cd3a4de4300be Mon Sep 17 00:00:00 2001 From: Ian M7HNF Date: Sat, 6 Jun 2026 18:58:18 +0100 Subject: [PATCH] fix(audio): replace unreachable fallback in primaryRateOrder with Q_UNREACHABLE (#3432) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The trailing `return {internalRate}` after both direction/OS switch statements was dead code — every TargetOs value is covered in both the Output and Input branches. It silently masked future omissions: adding a new TargetOs enum value without updating a switch would compile cleanly and return the wrong rate list. Replace with Q_UNREACHABLE() so the compiler/runtime enforces the invariant instead. All 25 audio_format_negotiation_test checks pass. --- src/core/AudioFormatNegotiator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/AudioFormatNegotiator.cpp b/src/core/AudioFormatNegotiator.cpp index a856e3b2..75afd8e2 100644 --- a/src/core/AudioFormatNegotiator.cpp +++ b/src/core/AudioFormatNegotiator.cpp @@ -43,7 +43,7 @@ QList primaryRateOrder(TargetOs os, Direction dir, int internalRate) case TargetOs::Linux: return {internalRate, 48000, 44100}; } } - return {internalRate}; + Q_UNREACHABLE(); // every TargetOs value is covered in both branches above } // Format attempt order per direction. Output is Float-first (RX/sidetone/Quindar