Avoid casting numbers to narrower types (#10645)
Motivation: Avoid implicit conversions to narrower types in AbstractMemoryHttpData and Bzip2HuffmanStageEncoder classes reported by LGTM. Modifications: Updated the classes to avoid implicit casting to narrower types. It doesn't look like that an integer overflow is possible there, therefore no checks for overflows were added. Result: No warnings about implicit conversions to narrower types.
This commit is contained in:
parent
00f21845f8
commit
5b55ee434b
@ -237,7 +237,7 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
|
||||
return true;
|
||||
}
|
||||
int length = byteBuf.readableBytes();
|
||||
int written = 0;
|
||||
long written = 0;
|
||||
RandomAccessFile accessFile = new RandomAccessFile(dest, "rw");
|
||||
try {
|
||||
FileChannel fileChannel = accessFile.getChannel();
|
||||
|
@ -219,7 +219,7 @@ final class Bzip2HuffmanStageEncoder {
|
||||
final int groupEnd = Math.min(groupStart + HUFFMAN_GROUP_RUN_LENGTH, mtfLength) - 1;
|
||||
|
||||
// Calculate the cost of this group when encoded by each table
|
||||
short[] cost = new short[totalTables];
|
||||
int[] cost = new int[totalTables];
|
||||
for (int i = groupStart; i <= groupEnd; i++) {
|
||||
final int value = mtfBlock[i];
|
||||
for (int j = 0; j < totalTables; j++) {
|
||||
|
Loading…
Reference in New Issue
Block a user