chore: Rename AvmUtf8Decoder to DecodeAvmUtf8
This commit is contained in:
parent
dda97dbccb
commit
efa8dbbc40
|
@ -6,9 +6,7 @@ use core::mem::{self, ManuallyDrop};
|
|||
use core::ops::{Deref, DerefMut};
|
||||
use core::ptr::{self, NonNull};
|
||||
|
||||
use super::utils::{
|
||||
encode_raw_utf16, split_ascii_prefix, split_ascii_prefix_bytes, AvmUtf8Decoder,
|
||||
};
|
||||
use super::utils::{encode_raw_utf16, split_ascii_prefix, split_ascii_prefix_bytes, DecodeAvmUtf8};
|
||||
use super::{Units, WStr, MAX_STRING_LEN};
|
||||
|
||||
/// An owned, extensible UCS2 string, analoguous to `String`.
|
||||
|
@ -112,11 +110,11 @@ impl WString {
|
|||
return Self::from_buf(b);
|
||||
}
|
||||
|
||||
let is_wide = AvmUtf8Decoder::new(tail).any(|ch| ch > u8::MAX.into());
|
||||
let is_wide = DecodeAvmUtf8::new(tail).any(|ch| ch > u8::MAX.into());
|
||||
if is_wide {
|
||||
let mut buf = Vec::new();
|
||||
buf.extend(ascii.iter().map(|c| u16::from(*c)));
|
||||
for ch in AvmUtf8Decoder::new(tail) {
|
||||
for ch in DecodeAvmUtf8::new(tail) {
|
||||
encode_raw_utf16(ch, &mut buf);
|
||||
}
|
||||
Self::from_buf(buf)
|
||||
|
|
|
@ -112,18 +112,18 @@ pub fn swf_to_uppercase(c: u16) -> u16 {
|
|||
/// Another difference is that if a multibyte sequence is expecting 4 bytes, rather than failing/replacing with a
|
||||
/// replacement character since the maximum is 3, Flash will instead just only read the next 3 bytes and completely
|
||||
/// ignore the fact that the starting byte was expecting 4.
|
||||
pub struct AvmUtf8Decoder<'a> {
|
||||
pub struct DecodeAvmUtf8<'a> {
|
||||
src: &'a [u8],
|
||||
index: usize,
|
||||
}
|
||||
|
||||
impl<'a> AvmUtf8Decoder<'a> {
|
||||
impl<'a> DecodeAvmUtf8<'a> {
|
||||
pub fn new(src: &'a [u8]) -> Self {
|
||||
Self { src, index: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator for AvmUtf8Decoder<'a> {
|
||||
impl<'a> Iterator for DecodeAvmUtf8<'a> {
|
||||
type Item = u32;
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
let mut ch: u32;
|
||||
|
|
Loading…
Reference in New Issue