mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-25 11:05:34 +00:00
Fix xperm parsing logic
This commit is contained in:
parent
d654b9cb97
commit
a9ee2d7d18
@ -164,7 +164,11 @@ fn xperm_to_string(perm: &ffi::Xperm) -> String {
|
|||||||
if perm.reset {
|
if perm.reset {
|
||||||
s.push('~');
|
s.push('~');
|
||||||
}
|
}
|
||||||
s.write_fmt(format_args!("{{ {:#06x}-{:#06x} }}", perm.low, perm.high))
|
if perm.low == perm.high {
|
||||||
|
s.write_fmt(format_args!("{{ {:#06X} }}", perm.low)).ok();
|
||||||
|
} else {
|
||||||
|
s.write_fmt(format_args!("{{ {:#06X}-{:#06X} }}", perm.low, perm.high))
|
||||||
.ok();
|
.ok();
|
||||||
|
}
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ fn parse_terms<'a>(tokens: &mut Tokens<'a>) -> LoggedResult<Vec<&'a str>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// xperm ::= HX(low) { Xperm{low, high: 0, reset: false} };
|
// xperm ::= HX(low) { Xperm{low, high: low, reset: false} };
|
||||||
// xperm ::= HX(low) HP HX(high) { Xperm{low, high, reset: false} };
|
// xperm ::= HX(low) HP HX(high) { Xperm{low, high, reset: false} };
|
||||||
fn parse_xperm(tokens: &mut Tokens) -> LoggedResult<Xperm> {
|
fn parse_xperm(tokens: &mut Tokens) -> LoggedResult<Xperm> {
|
||||||
let low = match tokens.next() {
|
let low = match tokens.next() {
|
||||||
@ -102,7 +102,7 @@ fn parse_xperm(tokens: &mut Tokens) -> LoggedResult<Xperm> {
|
|||||||
_ => throw!(),
|
_ => throw!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => 0,
|
_ => low,
|
||||||
};
|
};
|
||||||
Ok(Xperm {
|
Ok(Xperm {
|
||||||
low,
|
low,
|
||||||
@ -111,7 +111,7 @@ fn parse_xperm(tokens: &mut Tokens) -> LoggedResult<Xperm> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// xperms ::= HX(low) { if low > 0 { vec![Xperm{low, high: 0, reset: false}] } else { vec![Xperm{low: 0x0000, high: 0xFFFF, reset: true}] }};
|
// xperms ::= HX(low) { if low > 0 { vec![Xperm{low, high: low, reset: false}] } else { vec![Xperm{low: 0x0000, high: 0xFFFF, reset: true}] }};
|
||||||
// xperms ::= LB xperm_list(l) RB { l };
|
// xperms ::= LB xperm_list(l) RB { l };
|
||||||
// xperms ::= TL LB xperm_list(mut l) RB { l.iter_mut().for_each(|x| { x.reset = true; }); l };
|
// xperms ::= TL LB xperm_list(mut l) RB { l.iter_mut().for_each(|x| { x.reset = true; }); l };
|
||||||
// xperms ::= ST { vec![Xperm{low: 0x0000, high: 0xFFFF, reset: false}] };
|
// xperms ::= ST { vec![Xperm{low: 0x0000, high: 0xFFFF, reset: false}] };
|
||||||
@ -154,7 +154,7 @@ fn parse_xperms(tokens: &mut Tokens) -> LoggedResult<Vec<Xperm>> {
|
|||||||
if low > 0 {
|
if low > 0 {
|
||||||
xperms.push(Xperm {
|
xperms.push(Xperm {
|
||||||
low,
|
low,
|
||||||
high: 0,
|
high: low,
|
||||||
reset,
|
reset,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user