AUDIO: Simplify complicated loop condition.
- The loop is exited with break; when stream gets assigned, so stream == NULL is always true. - When iterating using the length of an array a terminator element is unnecessary.
This commit is contained in:
parent
a5a8833c05
commit
e3e0a317e7
1 changed files with 1 additions and 3 deletions
|
@ -61,15 +61,13 @@ static const StreamFileFormat STREAM_FILEFORMATS[] = {
|
|||
{ "MPEG Layer 3", ".mp3", makeMP3Stream },
|
||||
#endif
|
||||
{ "MPEG-4 Audio", ".m4a", makeQuickTimeStream },
|
||||
|
||||
{ NULL, NULL, NULL } // Terminator
|
||||
};
|
||||
|
||||
SeekableAudioStream *SeekableAudioStream::openStreamFile(const Common::String &basename) {
|
||||
SeekableAudioStream *stream = NULL;
|
||||
Common::File *fileHandle = new Common::File();
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(STREAM_FILEFORMATS)-1 && stream == NULL; ++i) {
|
||||
for (int i = 0; i < ARRAYSIZE(STREAM_FILEFORMATS); ++i) {
|
||||
Common::String filename = basename + STREAM_FILEFORMATS[i].fileExtension;
|
||||
fileHandle->open(filename);
|
||||
if (fileHandle->isOpen()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue