git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270430 13f79535-47bb-0310-9956-ffa450edef68master
@@ -15,8 +15,7 @@ package org.apache.tools.bzip2; | |||||
*/ | */ | ||||
public interface BZip2Constants | public interface BZip2Constants | ||||
{ | { | ||||
int baseBlockSize = 100000; | |||||
int BASE_BLOCK_SIZE = 100000; | |||||
int MAX_ALPHA_SIZE = 258; | int MAX_ALPHA_SIZE = 258; | ||||
int MAX_CODE_LEN = 23; | int MAX_CODE_LEN = 23; | ||||
int RUNA = 0; | int RUNA = 0; | ||||
@@ -27,7 +26,8 @@ public interface BZip2Constants | |||||
int MAX_SELECTORS = ( 2 + ( 900000 / G_SIZE ) ); | int MAX_SELECTORS = ( 2 + ( 900000 / G_SIZE ) ); | ||||
int NUM_OVERSHOOT_BYTES = 20; | int NUM_OVERSHOOT_BYTES = 20; | ||||
int rNums[] = { | |||||
int RAND_NUMS[] = | |||||
{ | |||||
619, 720, 127, 481, 931, 816, 813, 233, 566, 247, | 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, | ||||
985, 724, 205, 454, 863, 491, 741, 242, 949, 214, | 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, | ||||
733, 859, 335, 708, 621, 574, 73, 654, 730, 472, | 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, | ||||
@@ -188,7 +188,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants | |||||
if( newSize100k == 0 ) | if( newSize100k == 0 ) | ||||
return; | return; | ||||
int n = baseBlockSize * newSize100k; | |||||
int n = BASE_BLOCK_SIZE * newSize100k; | |||||
ll8 = new char[ n ]; | ll8 = new char[ n ]; | ||||
tt = new int[ n ]; | tt = new int[ n ]; | ||||
} | } | ||||
@@ -306,7 +306,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants | |||||
tPos = tt[ tPos ]; | tPos = tt[ tPos ]; | ||||
if( rNToGo == 0 ) | if( rNToGo == 0 ) | ||||
{ | { | ||||
rNToGo = rNums[ rTPos ]; | |||||
rNToGo = RAND_NUMS[ rTPos ]; | |||||
rTPos++; | rTPos++; | ||||
if( rTPos == 512 ) | if( rTPos == 512 ) | ||||
rTPos = 0; | rTPos = 0; | ||||
@@ -344,7 +344,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants | |||||
tPos = tt[ tPos ]; | tPos = tt[ tPos ]; | ||||
if( rNToGo == 0 ) | if( rNToGo == 0 ) | ||||
{ | { | ||||
rNToGo = rNums[ rTPos ]; | |||||
rNToGo = RAND_NUMS[ rTPos ]; | |||||
rTPos++; | rTPos++; | ||||
if( rTPos == 512 ) | if( rTPos == 512 ) | ||||
rTPos = 0; | rTPos = 0; | ||||
@@ -391,7 +391,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants | |||||
int groupNo; | int groupNo; | ||||
int groupPos; | int groupPos; | ||||
limitLast = baseBlockSize * blockSize100k; | |||||
limitLast = BASE_BLOCK_SIZE * blockSize100k; | |||||
origPtr = bsGetIntVS( 24 ); | origPtr = bsGetIntVS( 24 ); | ||||
recvDecodingTables(); | recvDecodingTables(); | ||||
@@ -399,7 +399,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
private void allocateCompressStructures() | private void allocateCompressStructures() | ||||
{ | { | ||||
int n = baseBlockSize * blockSize100k; | |||||
int n = BASE_BLOCK_SIZE * blockSize100k; | |||||
block = new char[ ( n + 1 + NUM_OVERSHOOT_BYTES ) ]; | block = new char[ ( n + 1 + NUM_OVERSHOOT_BYTES ) ]; | ||||
quadrant = new int[ ( n + NUM_OVERSHOOT_BYTES ) ]; | quadrant = new int[ ( n + NUM_OVERSHOOT_BYTES ) ]; | ||||
zptr = new int[ n ]; | zptr = new int[ n ]; | ||||
@@ -871,7 +871,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
/* | /* | ||||
* 20 is just a paranoia constant | * 20 is just a paranoia constant | ||||
*/ | */ | ||||
allowableBlockSize = baseBlockSize * blockSize100k - 20; | |||||
allowableBlockSize = BASE_BLOCK_SIZE * blockSize100k - 20; | |||||
} | } | ||||
private void initialize() | private void initialize() | ||||
@@ -1277,7 +1277,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
{ | { | ||||
if( rNToGo == 0 ) | if( rNToGo == 0 ) | ||||
{ | { | ||||
rNToGo = (char)rNums[ rTPos ]; | |||||
rNToGo = (char)RAND_NUMS[ rTPos ]; | |||||
rTPos++; | rTPos++; | ||||
if( rTPos == 512 ) | if( rTPos == 512 ) | ||||
rTPos = 0; | rTPos = 0; | ||||
@@ -15,8 +15,7 @@ package org.apache.tools.bzip2; | |||||
*/ | */ | ||||
public interface BZip2Constants | public interface BZip2Constants | ||||
{ | { | ||||
int baseBlockSize = 100000; | |||||
int BASE_BLOCK_SIZE = 100000; | |||||
int MAX_ALPHA_SIZE = 258; | int MAX_ALPHA_SIZE = 258; | ||||
int MAX_CODE_LEN = 23; | int MAX_CODE_LEN = 23; | ||||
int RUNA = 0; | int RUNA = 0; | ||||
@@ -27,7 +26,8 @@ public interface BZip2Constants | |||||
int MAX_SELECTORS = ( 2 + ( 900000 / G_SIZE ) ); | int MAX_SELECTORS = ( 2 + ( 900000 / G_SIZE ) ); | ||||
int NUM_OVERSHOOT_BYTES = 20; | int NUM_OVERSHOOT_BYTES = 20; | ||||
int rNums[] = { | |||||
int RAND_NUMS[] = | |||||
{ | |||||
619, 720, 127, 481, 931, 816, 813, 233, 566, 247, | 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, | ||||
985, 724, 205, 454, 863, 491, 741, 242, 949, 214, | 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, | ||||
733, 859, 335, 708, 621, 574, 73, 654, 730, 472, | 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, | ||||
@@ -188,7 +188,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants | |||||
if( newSize100k == 0 ) | if( newSize100k == 0 ) | ||||
return; | return; | ||||
int n = baseBlockSize * newSize100k; | |||||
int n = BASE_BLOCK_SIZE * newSize100k; | |||||
ll8 = new char[ n ]; | ll8 = new char[ n ]; | ||||
tt = new int[ n ]; | tt = new int[ n ]; | ||||
} | } | ||||
@@ -306,7 +306,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants | |||||
tPos = tt[ tPos ]; | tPos = tt[ tPos ]; | ||||
if( rNToGo == 0 ) | if( rNToGo == 0 ) | ||||
{ | { | ||||
rNToGo = rNums[ rTPos ]; | |||||
rNToGo = RAND_NUMS[ rTPos ]; | |||||
rTPos++; | rTPos++; | ||||
if( rTPos == 512 ) | if( rTPos == 512 ) | ||||
rTPos = 0; | rTPos = 0; | ||||
@@ -344,7 +344,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants | |||||
tPos = tt[ tPos ]; | tPos = tt[ tPos ]; | ||||
if( rNToGo == 0 ) | if( rNToGo == 0 ) | ||||
{ | { | ||||
rNToGo = rNums[ rTPos ]; | |||||
rNToGo = RAND_NUMS[ rTPos ]; | |||||
rTPos++; | rTPos++; | ||||
if( rTPos == 512 ) | if( rTPos == 512 ) | ||||
rTPos = 0; | rTPos = 0; | ||||
@@ -391,7 +391,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants | |||||
int groupNo; | int groupNo; | ||||
int groupPos; | int groupPos; | ||||
limitLast = baseBlockSize * blockSize100k; | |||||
limitLast = BASE_BLOCK_SIZE * blockSize100k; | |||||
origPtr = bsGetIntVS( 24 ); | origPtr = bsGetIntVS( 24 ); | ||||
recvDecodingTables(); | recvDecodingTables(); | ||||
@@ -399,7 +399,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
private void allocateCompressStructures() | private void allocateCompressStructures() | ||||
{ | { | ||||
int n = baseBlockSize * blockSize100k; | |||||
int n = BASE_BLOCK_SIZE * blockSize100k; | |||||
block = new char[ ( n + 1 + NUM_OVERSHOOT_BYTES ) ]; | block = new char[ ( n + 1 + NUM_OVERSHOOT_BYTES ) ]; | ||||
quadrant = new int[ ( n + NUM_OVERSHOOT_BYTES ) ]; | quadrant = new int[ ( n + NUM_OVERSHOOT_BYTES ) ]; | ||||
zptr = new int[ n ]; | zptr = new int[ n ]; | ||||
@@ -871,7 +871,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
/* | /* | ||||
* 20 is just a paranoia constant | * 20 is just a paranoia constant | ||||
*/ | */ | ||||
allowableBlockSize = baseBlockSize * blockSize100k - 20; | |||||
allowableBlockSize = BASE_BLOCK_SIZE * blockSize100k - 20; | |||||
} | } | ||||
private void initialize() | private void initialize() | ||||
@@ -1277,7 +1277,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
{ | { | ||||
if( rNToGo == 0 ) | if( rNToGo == 0 ) | ||||
{ | { | ||||
rNToGo = (char)rNums[ rTPos ]; | |||||
rNToGo = (char)RAND_NUMS[ rTPos ]; | |||||
rTPos++; | rTPos++; | ||||
if( rTPos == 512 ) | if( rTPos == 512 ) | ||||
rTPos = 0; | rTPos = 0; | ||||