Skip to content

Commit 7d8378c

Browse files
committed
changes after code review
1 parent c71caa6 commit 7d8378c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

libbz2-rs-sys/src/decompress.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ pub(crate) fn decompress(
594594
let ll16 = s.ll16.as_mut_slice();
595595
let ll4 = s.ll4.as_mut_slice();
596596

597-
'c_10064: loop {
597+
'state_machine: loop {
598598
match current_block {
599599
BZ_X_MAPPING_1 => {
600600
s.state = State::BZ_X_MAPPING_1;
@@ -745,7 +745,8 @@ pub(crate) fn decompress(
745745

746746
macro_rules! get_next_sym {
747747
($next_block:ident) => {
748-
if (zn > 20/* the longest code */) {
748+
if zn > 20 {
749+
// zn is higher than the longest code, that's invalid input
749750
error!(BZ_DATA_ERROR);
750751
} else if zvec <= s.limit[usize::from(gSel)][zn as usize] {
751752
let index = zvec - s.base[usize::from(gSel)][zn as usize];
@@ -756,7 +757,7 @@ pub(crate) fn decompress(
756757
} else {
757758
zn += 1;
758759
current_block = $next_block;
759-
continue 'c_10064;
760+
continue 'state_machine;
760761
}
761762
};
762763
}
@@ -984,7 +985,7 @@ pub(crate) fn decompress(
984985
Block28 => {
985986
if j < 16 {
986987
current_block = BZ_X_MAPPING_2;
987-
continue 'c_10064;
988+
continue 'state_machine;
988989
}
989990
}
990991
Block39 => {
@@ -1058,7 +1059,7 @@ pub(crate) fn decompress(
10581059
}
10591060
Block25 => {
10601061
current_block = BZ_X_SELECTOR_3;
1061-
continue 'c_10064;
1062+
continue 'state_machine;
10621063
}
10631064
_ => {
10641065
if false {
@@ -1067,7 +1068,7 @@ pub(crate) fn decompress(
10671068
}
10681069
if (1..=20).contains(&curr) {
10691070
current_block = BZ_X_CODING_2;
1070-
continue 'c_10064;
1071+
continue 'state_machine;
10711072
}
10721073
error!(BZ_DATA_ERROR);
10731074
}

0 commit comments

Comments
 (0)