This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 73f82de7f712461ecb7ec938206affc38dabf991 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Fri Nov 4 17:35:21 2022 -0400 Implicit narrowing conversion in compound assignment Code scanning alerts #16 --- .../compressors/bzip2/BZip2CompressorOutputStream.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java index 1026424c..3c565b56 100644 --- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java @@ -828,6 +828,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream final int ge = Math.min(gs + G_SIZE - 1, nMTFShadow - 1); + final byte mask = (byte) 0xff; if (nGroups == N_GROUPS) { // unrolled version of the else-block @@ -840,12 +841,12 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream for (int i = gs; i <= ge; i++) { final int icv = sfmap[i]; - cost0 += len_0[icv] & 0xff; - cost1 += len_1[icv] & 0xff; - cost2 += len_2[icv] & 0xff; - cost3 += len_3[icv] & 0xff; - cost4 += len_4[icv] & 0xff; - cost5 += len_5[icv] & 0xff; + cost0 += len_0[icv] & mask; + cost1 += len_1[icv] & mask; + cost2 += len_2[icv] & mask; + cost3 += len_3[icv] & mask; + cost4 += len_4[icv] & mask; + cost5 += len_5[icv] & mask; } cost[0] = cost0; @@ -863,7 +864,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream for (int i = gs; i <= ge; i++) { final int icv = sfmap[i]; for (int t = nGroups; --t >= 0;) { - cost[t] += len[t][icv] & 0xff; + cost[t] += len[t][icv] & mask; } } }