Fix regression in Zlib which was introduced while refactoring the code. See #255

This commit is contained in:
norman 2012-04-11 10:26:29 +02:00
parent 962a67dc03
commit 3f8c13f138

View File

@ -124,15 +124,16 @@ final class InfBlocks {
int m; // bytes to end of window or read pointer
// copy input/output information to locals (UPDATE macro restores)
{
p = z.next_in_index;
n = z.avail_in;
b = bitb;
k = bitk;
}
{
q = write;
m = q < read? read - q - 1 : end - q;
}
// process input based on current state
while (true) {
@ -160,17 +161,20 @@ final class InfBlocks {
switch (t >>> 1) {
case 0: // stored
{
b >>>= 3;
k -= 3;
}
t = k & 7; // go to byte boundary
{
b >>>= t;
k -= t;
}
mode = LENS; // get length of stored block
break;
case 1: // fixed
{
int[] bl = new int[1];
int[] bd = new int[1];
int[][] tl = new int[1][];
@ -178,24 +182,30 @@ final class InfBlocks {
InfTree.inflate_trees_fixed(bl, bd, tl, td);
codes.init(bl[0], bd[0], tl[0], 0, td[0], 0);
}
{
b >>>= 3;
k -= 3;
}
mode = CODES;
break;
case 2: // dynamic
{
b >>>= 3;
k -= 3;
}
mode = TABLE;
break;
case 3: // illegal
{
b >>>= 3;
k -= 3;
}
mode = BAD;
z.msg = "invalid block type";
r = JZlib.Z_DATA_ERROR;
@ -342,9 +352,10 @@ final class InfBlocks {
}
}
{
b >>>= 14;
k -= 14;
}
index = 0;
mode = BTREE;
@ -369,9 +380,10 @@ final class InfBlocks {
blens[border[index ++]] = b & 7;
{
b >>>= 3;
k -= 3;
}
}
while (index < 19) {
@ -493,7 +505,7 @@ final class InfBlocks {
}
tb[0] = -1;
{
int[] bl = new int[1];
int[] bd = new int[1];
int[] tl = new int[1];
@ -522,7 +534,7 @@ final class InfBlocks {
return inflate_flush(z, r);
}
codes.init(bl[0], bd[0], hufts, tl[0], hufts, td[0]);
}
mode = CODES;
case CODES:
bitb = b;