Skip to content

Commit

Permalink
SOUND: Use ScopedPtr in the MP3 decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Oct 26, 2016
1 parent 1fdd556 commit f660b1b
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/sound/decoders/mp3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
#include <cassert>
#include <cstring>

#include "src/sound/decoders/mp3.h"
#include <mad.h>

#include "src/common/readstream.h"
#include "src/common/scopedptr.h"
#include "src/common/util.h"
#include "src/common/readstream.h"

#include "src/sound/audiostream.h"

#include <mad.h>

#include "src/sound/decoders/mp3.h"

namespace Sound {

Expand Down Expand Up @@ -352,16 +352,12 @@ size_t MP3Stream::readBuffer(int16 *buffer, const size_t numSamples) {
return samples;
}

RewindableAudioStream *makeMP3Stream(
Common::SeekableReadStream *stream,
bool disposeAfterUse) {
RewindableAudioStream *s = new MP3Stream(stream, disposeAfterUse);
if (s && s->endOfData()) {
delete s;
RewindableAudioStream *makeMP3Stream(Common::SeekableReadStream *stream, bool disposeAfterUse) {
Common::ScopedPtr<RewindableAudioStream> s(new MP3Stream(stream, disposeAfterUse));
if (s && s->endOfData())
return 0;
} else {
return s;
}

return s.release();
}

} // End of namespace Sound

0 comments on commit f660b1b

Please sign in to comment.