From e500b39e474876988d7421f5ad17e132ba4d82a9 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Tue, 3 Aug 2021 11:30:30 +0200 Subject: [PATCH] LibAudio: Use an existing file stream when parsing a FLAC header Before this change the file stream was generated two times: one time in the parse_header(), and another time for the whole class in the constructor. The previous commit moved the m_stream initialization before executing the parse_header function, so we can now reuse that here. --- Userland/Libraries/LibAudio/FlacLoader.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Userland/Libraries/LibAudio/FlacLoader.cpp b/Userland/Libraries/LibAudio/FlacLoader.cpp index 695faf57b0..b36797117b 100644 --- a/Userland/Libraries/LibAudio/FlacLoader.cpp +++ b/Userland/Libraries/LibAudio/FlacLoader.cpp @@ -69,13 +69,11 @@ bool FlacLoaderPlugin::sniff() bool FlacLoaderPlugin::parse_header() { - Optional fis; bool ok = true; InputBitStream bit_input = [&]() -> InputBitStream { if (m_file) { - fis = Core::InputFileStream(*m_file); - return InputBitStream(*fis); + return InputBitStream(m_stream->get()); } return InputBitStream(m_stream->get()); }();