Skip to content

Commit 01d8dfa

Browse files
Fix SpotBugs SA_FIELD_SELF_ASSIGNMENT warnings in gzip package
- Removed redundant self-assignments in `InfBlocks.java` when restoring state in `case TYPE` and `case DRY`. - Refactored `Inflate.java` to use `this.marker` directly instead of a local variable `m`, eliminating the redundant self-assignment while preserving logic. - Updated `.github/scripts/generate-quality-report.py` to enforce `SA_FIELD_SELF_ASSIGNMENT` check.
1 parent c03d9ae commit 01d8dfa

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

CodenameOne/src/com/codename1/io/gzip/Inflate.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -623,15 +623,14 @@ int inflateSync() {
623623
return Z_BUF_ERROR;
624624

625625
p = z.next_in_index;
626-
m = this.marker;
627626
// search
628-
while (n != 0 && m < 4) {
629-
if (z.next_in[p] == mark[m]) {
630-
m++;
627+
while (n != 0 && this.marker < 4) {
628+
if (z.next_in[p] == mark[this.marker]) {
629+
this.marker++;
631630
} else if (z.next_in[p] != 0) {
632-
m = 0;
631+
this.marker = 0;
633632
} else {
634-
m = 4 - m;
633+
this.marker = 4 - this.marker;
635634
}
636635
p++;
637636
n--;
@@ -641,12 +640,9 @@ int inflateSync() {
641640
z.total_in += p - z.next_in_index;
642641
z.next_in_index = p;
643642
z.avail_in = n;
644-
if (this.marker != m) {
645-
this.marker = m;
646-
}
647643

648644
// return no joy or set up to restart on a new block
649-
if (m != 4) {
645+
if (this.marker != 4) {
650646
return Z_DATA_ERROR;
651647
}
652648
r = z.total_in;

0 commit comments

Comments
 (0)