From 6d8042490891f3864bf1a6492de77b572932a212 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 17 Apr 2010 23:57:50 +0000 Subject: Fix warnings when FLAC&MP3&VORBIS is disabled; also fixes leak in Tinsel svn-id: r48696 --- engines/sword2/music.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'engines/sword2/music.cpp') diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp index 72971e2876..a68baed097 100644 --- a/engines/sword2/music.cpp +++ b/engines/sword2/music.cpp @@ -188,8 +188,6 @@ static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, fh->file.seek(pos, SEEK_SET); - SafeSubReadStream *tmp = 0; - switch (fh->fileType) { case kCLUMode: if (Sword2Engine::isPsx()) @@ -197,19 +195,22 @@ static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, else return makeCLUStream(&fh->file, enc_len); #ifdef USE_MAD - case kMP3Mode: - tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len); + case kMP3Mode: { + SafeSubReadStream *tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len); return Audio::makeMP3Stream(tmp, DisposeAfterUse::YES); + } #endif #ifdef USE_VORBIS - case kVorbisMode: - tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len); + case kVorbisMode: { + SafeSubReadStream *tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len); return Audio::makeVorbisStream(tmp, DisposeAfterUse::YES); + } #endif #ifdef USE_FLAC - case kFLACMode: - tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len); + case kFLACMode: { + SafeSubReadStream *tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len); return Audio::makeFLACStream(tmp, DisposeAfterUse::YES); + } #endif default: return NULL; -- cgit v1.2.3