aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--audio/midiparser_xmidi.cpp33
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