cache: fix trackloader sometmies producing corrupt midis

OutputStream is free to internally resize its bytebuffer. Remove byte[] constructor to prevent misuse again.
This commit is contained in:
Adam
2017-06-04 19:42:26 -04:00
parent 0ef72eb878
commit 7e0a1c37d3
2 changed files with 2 additions and 7 deletions

View File

@@ -246,8 +246,7 @@ public class TrackLoader
var1.skip(var25);
int var50 = var1.getOffset();
var1.skip(tempoOpcodes * 3);
def.midi = new byte[offset];
OutputStream var51 = new OutputStream(def.midi);
OutputStream var51 = new OutputStream(offset);
var51.writeInt(1297377380); // MThd header
var51.writeInt(6); // length of header
var51.writeShort(tracks > 1 ? 1 : 0); // format
@@ -457,5 +456,6 @@ public class TrackLoader
}
}
def.midi = var51.flip();
}
}

View File

@@ -41,11 +41,6 @@ public final class OutputStream extends java.io.OutputStream
this(16);
}
public OutputStream(byte[] b)
{
buffer = ByteBuffer.wrap(b);
}
public byte[] getArray()
{
assert buffer.hasArray();