wstr: Fix small logic error when decoding UTF-8
This commit is contained in:
parent
bc31014f93
commit
dda97dbccb
|
@ -155,11 +155,13 @@ impl<'a> Iterator for AvmUtf8Decoder<'a> {
|
||||||
ch <<= 6;
|
ch <<= 6;
|
||||||
ch |= (*b & (u8::MAX >> 2)) as u32;
|
ch |= (*b & (u8::MAX >> 2)) as u32;
|
||||||
}
|
}
|
||||||
if ch <= 128 {
|
if !fail {
|
||||||
self.index += 1;
|
if ch <= 128 {
|
||||||
ch = first as u32;
|
self.index += 1;
|
||||||
} else if !fail {
|
ch = first as u32;
|
||||||
self.index += mb_count as usize + 1;
|
} else {
|
||||||
|
self.index += mb_count as usize + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
|
Loading…
Reference in New Issue