Fix checkstyle problems
This commit is contained in:
parent
b22ebbe430
commit
5d99d57cab
@ -112,4 +112,8 @@ final class Adler32 {
|
|||||||
}
|
}
|
||||||
return s2 << 16 | s1;
|
return s2 << 16 | s1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Adler32() {
|
||||||
|
// Utility Class
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,4 +92,8 @@ final class CRC32 {
|
|||||||
crc32 ^= 0xffffffff;
|
crc32 ^= 0xffffffff;
|
||||||
return crc32;
|
return crc32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CRC32() {
|
||||||
|
// Utility Class
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ final class Deflate {
|
|||||||
"data error", // Z_DATA_ERROR (-3)
|
"data error", // Z_DATA_ERROR (-3)
|
||||||
"insufficient memory", // Z_MEM_ERROR (-4)
|
"insufficient memory", // Z_MEM_ERROR (-4)
|
||||||
"buffer error", // Z_BUF_ERROR (-5)
|
"buffer error", // Z_BUF_ERROR (-5)
|
||||||
"incompatible version",// Z_VERSION_ERROR (-6)
|
"incompatible version", // Z_VERSION_ERROR (-6)
|
||||||
"" };
|
"" };
|
||||||
|
|
||||||
// block not completed, need more input or more output
|
// block not completed, need more input or more output
|
||||||
@ -342,7 +342,7 @@ final class Deflate {
|
|||||||
|
|
||||||
// Scan a literal or distance tree to determine the frequencies of the codes
|
// Scan a literal or distance tree to determine the frequencies of the codes
|
||||||
// in the bit length tree.
|
// in the bit length tree.
|
||||||
private void scan_tree(short[] tree,// the tree to be scanned
|
private void scan_tree(short[] tree, // the tree to be scanned
|
||||||
int max_code // and its largest code of non zero frequency
|
int max_code // and its largest code of non zero frequency
|
||||||
) {
|
) {
|
||||||
int n; // iterates over all tree elements
|
int n; // iterates over all tree elements
|
||||||
@ -437,7 +437,7 @@ final class Deflate {
|
|||||||
|
|
||||||
// Send a literal or distance tree in compressed form, using the codes in
|
// Send a literal or distance tree in compressed form, using the codes in
|
||||||
// bl_tree.
|
// bl_tree.
|
||||||
private void send_tree(short[] tree,// the tree to be sent
|
private void send_tree(short[] tree, // the tree to be sent
|
||||||
int max_code // and its largest code of non zero frequency
|
int max_code // and its largest code of non zero frequency
|
||||||
) {
|
) {
|
||||||
int n; // iterates over all tree elements
|
int n; // iterates over all tree elements
|
||||||
@ -514,7 +514,7 @@ final class Deflate {
|
|||||||
|
|
||||||
private void send_code(int c, short[] tree) {
|
private void send_code(int c, short[] tree) {
|
||||||
int c2 = c * 2;
|
int c2 = c * 2;
|
||||||
send_bits((tree[c2] & 0xffff), (tree[c2 + 1] & 0xffff));
|
send_bits(tree[c2] & 0xffff, tree[c2 + 1] & 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void send_bits(int value, int length) {
|
private void send_bits(int value, int length) {
|
||||||
@ -804,7 +804,7 @@ final class Deflate {
|
|||||||
int stored_len, // length of input block
|
int stored_len, // length of input block
|
||||||
boolean eof // true if this is the last block for a file
|
boolean eof // true if this is the last block for a file
|
||||||
) {
|
) {
|
||||||
int opt_lenb, static_lenb;// opt_len and static_len in bytes
|
int opt_lenb, static_lenb; // opt_len and static_len in bytes
|
||||||
int max_blindex = 0; // index of last bit length code of non zero freq
|
int max_blindex = 0; // index of last bit length code of non zero freq
|
||||||
|
|
||||||
// Build the Huffman trees unless a stored block is forced
|
// Build the Huffman trees unless a stored block is forced
|
||||||
|
@ -61,7 +61,7 @@ final class InfBlocks {
|
|||||||
|
|
||||||
private static final int TYPE = 0; // get type bits (3, including end bit)
|
private static final int TYPE = 0; // get type bits (3, including end bit)
|
||||||
private static final int LENS = 1; // get lengths for stored
|
private static final int LENS = 1; // get lengths for stored
|
||||||
private static final int STORED = 2;// processing stored block
|
private static final int STORED = 2; // processing stored block
|
||||||
private static final int TABLE = 3; // get table lengths
|
private static final int TABLE = 3; // get table lengths
|
||||||
private static final int BTREE = 4; // get bit lengths tree for a dynamic block
|
private static final int BTREE = 4; // get bit lengths tree for a dynamic block
|
||||||
private static final int DTREE = 5; // get length, distance trees for a dynamic block
|
private static final int DTREE = 5; // get length, distance trees for a dynamic block
|
||||||
@ -124,16 +124,15 @@ final class InfBlocks {
|
|||||||
int m; // bytes to end of window or read pointer
|
int m; // bytes to end of window or read pointer
|
||||||
|
|
||||||
// copy input/output information to locals (UPDATE macro restores)
|
// copy input/output information to locals (UPDATE macro restores)
|
||||||
{
|
|
||||||
p = z.next_in_index;
|
p = z.next_in_index;
|
||||||
n = z.avail_in;
|
n = z.avail_in;
|
||||||
b = bitb;
|
b = bitb;
|
||||||
k = bitk;
|
k = bitk;
|
||||||
}
|
|
||||||
{
|
q = write;
|
||||||
q = write;
|
m = q < read? read - q - 1 : end - q;
|
||||||
m = q < read? read - q - 1 : end - q;
|
|
||||||
}
|
|
||||||
|
|
||||||
// process input based on current state
|
// process input based on current state
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -161,20 +160,17 @@ final class InfBlocks {
|
|||||||
|
|
||||||
switch (t >>> 1) {
|
switch (t >>> 1) {
|
||||||
case 0: // stored
|
case 0: // stored
|
||||||
{
|
|
||||||
b >>>= 3;
|
b >>>= 3;
|
||||||
k -= 3;
|
k -= 3;
|
||||||
}
|
|
||||||
t = k & 7; // go to byte boundary
|
t = k & 7; // go to byte boundary
|
||||||
|
|
||||||
{
|
b >>>= t;
|
||||||
b >>>= t;
|
k -= t;
|
||||||
k -= t;
|
|
||||||
}
|
|
||||||
mode = LENS; // get length of stored block
|
mode = LENS; // get length of stored block
|
||||||
break;
|
break;
|
||||||
case 1: // fixed
|
case 1: // fixed
|
||||||
{
|
|
||||||
int[] bl = new int[1];
|
int[] bl = new int[1];
|
||||||
int[] bd = new int[1];
|
int[] bd = new int[1];
|
||||||
int[][] tl = new int[1][];
|
int[][] tl = new int[1][];
|
||||||
@ -182,30 +178,24 @@ final class InfBlocks {
|
|||||||
|
|
||||||
InfTree.inflate_trees_fixed(bl, bd, tl, td);
|
InfTree.inflate_trees_fixed(bl, bd, tl, td);
|
||||||
codes.init(bl[0], bd[0], tl[0], 0, td[0], 0);
|
codes.init(bl[0], bd[0], tl[0], 0, td[0], 0);
|
||||||
}
|
|
||||||
|
|
||||||
{
|
b >>>= 3;
|
||||||
b >>>= 3;
|
k -= 3;
|
||||||
k -= 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
mode = CODES;
|
mode = CODES;
|
||||||
break;
|
break;
|
||||||
case 2: // dynamic
|
case 2: // dynamic
|
||||||
|
|
||||||
{
|
|
||||||
b >>>= 3;
|
b >>>= 3;
|
||||||
k -= 3;
|
k -= 3;
|
||||||
}
|
|
||||||
|
|
||||||
mode = TABLE;
|
mode = TABLE;
|
||||||
break;
|
break;
|
||||||
case 3: // illegal
|
case 3: // illegal
|
||||||
|
|
||||||
{
|
|
||||||
b >>>= 3;
|
b >>>= 3;
|
||||||
k -= 3;
|
k -= 3;
|
||||||
}
|
|
||||||
mode = BAD;
|
mode = BAD;
|
||||||
z.msg = "invalid block type";
|
z.msg = "invalid block type";
|
||||||
r = JZlib.Z_DATA_ERROR;
|
r = JZlib.Z_DATA_ERROR;
|
||||||
@ -352,10 +342,9 @@ final class InfBlocks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
b >>>= 14;
|
b >>>= 14;
|
||||||
k -= 14;
|
k -= 14;
|
||||||
}
|
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
mode = BTREE;
|
mode = BTREE;
|
||||||
@ -380,10 +369,9 @@ final class InfBlocks {
|
|||||||
|
|
||||||
blens[border[index ++]] = b & 7;
|
blens[border[index ++]] = b & 7;
|
||||||
|
|
||||||
{
|
b >>>= 3;
|
||||||
b >>>= 3;
|
k -= 3;
|
||||||
k -= 3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (index < 19) {
|
while (index < 19) {
|
||||||
@ -505,36 +493,36 @@ final class InfBlocks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tb[0] = -1;
|
tb[0] = -1;
|
||||||
{
|
|
||||||
int[] bl = new int[1];
|
|
||||||
int[] bd = new int[1];
|
|
||||||
int[] tl = new int[1];
|
|
||||||
int[] td = new int[1];
|
|
||||||
bl[0] = 9; // must be <= 9 for lookahead assumptions
|
|
||||||
bd[0] = 6; // must be <= 9 for lookahead assumptions
|
|
||||||
|
|
||||||
t = table;
|
int[] bl = new int[1];
|
||||||
t = inftree.inflate_trees_dynamic(257 + (t & 0x1f),
|
int[] bd = new int[1];
|
||||||
1 + (t >> 5 & 0x1f), blens, bl, bd, tl, td, hufts,
|
int[] tl = new int[1];
|
||||||
z);
|
int[] td = new int[1];
|
||||||
|
bl[0] = 9; // must be <= 9 for lookahead assumptions
|
||||||
|
bd[0] = 6; // must be <= 9 for lookahead assumptions
|
||||||
|
|
||||||
if (t != JZlib.Z_OK) {
|
t = table;
|
||||||
if (t == JZlib.Z_DATA_ERROR) {
|
t = inftree.inflate_trees_dynamic(257 + (t & 0x1f),
|
||||||
blens = null;
|
1 + (t >> 5 & 0x1f), blens, bl, bd, tl, td, hufts,
|
||||||
mode = BAD;
|
z);
|
||||||
}
|
|
||||||
r = t;
|
|
||||||
|
|
||||||
bitb = b;
|
if (t != JZlib.Z_OK) {
|
||||||
bitk = k;
|
if (t == JZlib.Z_DATA_ERROR) {
|
||||||
z.avail_in = n;
|
blens = null;
|
||||||
z.total_in += p - z.next_in_index;
|
mode = BAD;
|
||||||
z.next_in_index = p;
|
|
||||||
write = q;
|
|
||||||
return inflate_flush(z, r);
|
|
||||||
}
|
}
|
||||||
codes.init(bl[0], bd[0], hufts, tl[0], hufts, td[0]);
|
r = t;
|
||||||
|
|
||||||
|
bitb = b;
|
||||||
|
bitk = k;
|
||||||
|
z.avail_in = n;
|
||||||
|
z.total_in += p - z.next_in_index;
|
||||||
|
z.next_in_index = p;
|
||||||
|
write = q;
|
||||||
|
return inflate_flush(z, r);
|
||||||
}
|
}
|
||||||
|
codes.init(bl[0], bd[0], hufts, tl[0], hufts, td[0]);
|
||||||
|
|
||||||
mode = CODES;
|
mode = CODES;
|
||||||
case CODES:
|
case CODES:
|
||||||
bitb = b;
|
bitb = b;
|
||||||
|
@ -71,7 +71,7 @@ final class InfCodes {
|
|||||||
// mode dependent information
|
// mode dependent information
|
||||||
private int len;
|
private int len;
|
||||||
private int[] tree; // pointer into tree
|
private int[] tree; // pointer into tree
|
||||||
private int tree_index = 0;
|
private int tree_index;
|
||||||
private int need; // bits needed
|
private int need; // bits needed
|
||||||
private int lit;
|
private int lit;
|
||||||
// if EXT or COPY, where and how much
|
// if EXT or COPY, where and how much
|
||||||
|
@ -180,8 +180,8 @@ final class InfTree {
|
|||||||
int[] e, // list of extra bits for non-simple codes
|
int[] e, // list of extra bits for non-simple codes
|
||||||
int[] t, // result: starting table
|
int[] t, // result: starting table
|
||||||
int[] m, // maximum lookup bits, returns actual
|
int[] m, // maximum lookup bits, returns actual
|
||||||
int[] hp,// space for trees
|
int[] hp, // space for trees
|
||||||
int[] hn,// hufts used in space
|
int[] hn, // hufts used in space
|
||||||
int[] v // working area: values in order of bit length
|
int[] v // working area: values in order of bit length
|
||||||
) {
|
) {
|
||||||
// Given a list of code lengths and a maximum table size, make a set of
|
// Given a list of code lengths and a maximum table size, make a set of
|
||||||
@ -437,7 +437,7 @@ final class InfTree {
|
|||||||
|
|
||||||
static int inflate_trees_fixed(int[] bl, //literal desired/actual bit depth
|
static int inflate_trees_fixed(int[] bl, //literal desired/actual bit depth
|
||||||
int[] bd, //distance desired/actual bit depth
|
int[] bd, //distance desired/actual bit depth
|
||||||
int[][] tl,//literal/length tree result
|
int[][] tl, //literal/length tree result
|
||||||
int[][] td //distance tree result
|
int[][] td //distance tree result
|
||||||
) {
|
) {
|
||||||
bl[0] = fixed_bl;
|
bl[0] = fixed_bl;
|
||||||
|
@ -76,7 +76,7 @@ final class Inflate {
|
|||||||
private static final int GZIP_FNAME = 21;
|
private static final int GZIP_FNAME = 21;
|
||||||
private static final int GZIP_FCOMMENT = 22;
|
private static final int GZIP_FCOMMENT = 22;
|
||||||
private static final int GZIP_FHCRC = 23;
|
private static final int GZIP_FHCRC = 23;
|
||||||
private static final int GZIP_CRC32= 24;
|
private static final int GZIP_CRC32 = 24;
|
||||||
private static final int GZIP_ISIZE = 25;
|
private static final int GZIP_ISIZE = 25;
|
||||||
|
|
||||||
private int mode; // current inflate mode
|
private int mode; // current inflate mode
|
||||||
@ -305,7 +305,7 @@ final class Inflate {
|
|||||||
break;
|
break;
|
||||||
} else if (z.istate.wrapperType == WrapperType.ZLIB) {
|
} else if (z.istate.wrapperType == WrapperType.ZLIB) {
|
||||||
z.istate.mode = CHECK4;
|
z.istate.mode = CHECK4;
|
||||||
} else if (z.istate.wrapperType == WrapperType.GZIP){
|
} else if (z.istate.wrapperType == WrapperType.GZIP) {
|
||||||
gzipCRC32 = 0;
|
gzipCRC32 = 0;
|
||||||
gzipISize = 0;
|
gzipISize = 0;
|
||||||
gzipBytesToRead = 4;
|
gzipBytesToRead = 4;
|
||||||
|
@ -105,4 +105,8 @@ public final class JZlib {
|
|||||||
enum WrapperType {
|
enum WrapperType {
|
||||||
NONE, ZLIB, GZIP, ZLIB_OR_NONE
|
NONE, ZLIB, GZIP, ZLIB_OR_NONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private JZlib() {
|
||||||
|
// Utility class
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011 The Netty Project
|
||||||
|
*
|
||||||
|
* The Netty Project licenses this file to you under the Apache License,
|
||||||
|
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at:
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <em>Internal-use-only</em> utilities which is not allowed to be used
|
||||||
|
* outside Netty.
|
||||||
|
*/
|
||||||
|
package io.netty.util.internal.jzlib;
|
Loading…
Reference in New Issue
Block a user