From e97292430dad8923282073cb49c12d0c7ec8f1c3 Mon Sep 17 00:00:00 2001 From: trompetin17 Date: Fri, 20 Jun 2025 12:31:35 -0500 Subject: [PATCH] Remove manual Close method from OggStream The OggStream interface no longer needs the Close() method. OpenOggNonstream returns a smart pointer (OggStreamPtr), so resource cleanup is automatically handled by the destructor. OggStreamImpl now calls ov_clear in its destructor, making manual cleanup unnecessary. This commit removes the Close() method from the interface and its implementation. --- source/soundmanager/data/OggData.cpp | 6 +----- source/soundmanager/data/ogg.cpp | 4 +--- source/soundmanager/data/ogg.h | 1 - 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/source/soundmanager/data/OggData.cpp b/source/soundmanager/data/OggData.cpp index 7e21ebc560..528f9f97b8 100644 --- a/source/soundmanager/data/OggData.cpp +++ b/source/soundmanager/data/OggData.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -33,10 +33,6 @@ COggData::COggData() COggData::~COggData() { - AL_CHECK; - if (ogg) - ogg->Close(); - AL_CHECK; if ( m_BuffersUsed > 0 ) alDeleteBuffers(m_BuffersUsed, &m_Buffer[0]); diff --git a/source/soundmanager/data/ogg.cpp b/source/soundmanager/data/ogg.cpp index c5dcccbfac..eedee7d7f0 100644 --- a/source/soundmanager/data/ogg.cpp +++ b/source/soundmanager/data/ogg.cpp @@ -156,11 +156,9 @@ public: Open(); } - Status Close() + ~OggStreamImpl() { ov_clear(&m_VorbisFile); - - return 0; } virtual ALenum Format() diff --git a/source/soundmanager/data/ogg.h b/source/soundmanager/data/ogg.h index 534a3106a0..c7e192dc6d 100644 --- a/source/soundmanager/data/ogg.h +++ b/source/soundmanager/data/ogg.h @@ -34,7 +34,6 @@ public: virtual ALsizei SamplingRate() = 0; virtual bool atFileEOF() = 0; virtual Status ResetFile() = 0; - virtual Status Close() = 0; /** * @return bytes read (<= size) or a (negative) Status