diff options
author | Max Horn | 2011-06-09 18:16:14 +0200 |
---|---|---|
committer | Max Horn | 2011-06-10 22:15:39 +0200 |
commit | 55e1b08e22b737f6a64ae0505b4bdd190c9e08eb (patch) | |
tree | b04cc8ecb9533e176f5aff40e963c517f400663f /audio | |
parent | bdad493f3f01768f5693cc379609c2c89d6b2200 (diff) | |
download | scummvm-rg350-55e1b08e22b737f6a64ae0505b4bdd190c9e08eb.tar.gz scummvm-rg350-55e1b08e22b737f6a64ae0505b4bdd190c9e08eb.tar.bz2 scummvm-rg350-55e1b08e22b737f6a64ae0505b4bdd190c9e08eb.zip |
AUDIO: Small cleanup in MidiParser_XMIDI::loadMusic
Diffstat (limited to 'audio')
-rw-r--r-- | audio/midiparser_xmidi.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/audio/midiparser_xmidi.cpp b/audio/midiparser_xmidi.cpp index 7c3cf102d1..85491faaf8 100644 --- a/audio/midiparser_xmidi.cpp +++ b/audio/midiparser_xmidi.cpp @@ -256,26 +256,25 @@ bool MidiParser_XMIDI::loadMusic(byte *data, uint32 size) { // Add eight bytes i += 8; - if (memcmp(buf, "INFO", 4)) { - // Must align - pos += (chunk_len + 1) & ~1; - i += (chunk_len + 1) & ~1; - continue; - } - - // Must be at least 2 bytes long - if (chunk_len < 2) { - warning("Invalid chunk length %d for 'INFO' block", (int)chunk_len); - return false; - } + if (memcmp(buf, "INFO", 4) == 0) { + // Must be at least 2 bytes long + if (chunk_len < 2) { + warning("Invalid chunk length %d for 'INFO' block", (int)chunk_len); + return false; + } - _num_tracks = (byte)read2low(pos); + _num_tracks = (byte)read2low(pos); - if (chunk_len > 2) { - warning("Chunk length %d is greater than 2", (int)chunk_len); - pos += chunk_len - 2; + if (chunk_len > 2) { + warning("Chunk length %d is greater than 2", (int)chunk_len); + //pos += chunk_len - 2; + } + break; } - break; + + // Must align + pos += (chunk_len + 1) & ~1; + i += (chunk_len + 1) & ~1; } // Didn't get to fill the header |