wstr: statically check the size of WString
This adds the 'static_assertions' crate as a dependency of 'ruffle_wstr', but this dependency was already present in the dep tree.
This commit is contained in:
parent
8806e9921a
commit
03d54262c6
|
@ -399,11 +399,12 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
|
|||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.20"
|
||||
version = "0.4.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6127248204b9aba09a362f6c930ef6a78f2c1b2215f8a7b398c06e1083f17af0"
|
||||
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"libc",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"time",
|
||||
|
@ -3221,6 +3222,9 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruffle_wstr"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
|
@ -3635,18 +3639,18 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.32"
|
||||
version = "1.0.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994"
|
||||
checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.32"
|
||||
version = "1.0.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21"
|
||||
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
@ -6,3 +6,4 @@ authors = ["Arthur Heuillard <arthur.heuillard<orange.fr>"]
|
|||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
static_assertions = "1.1.0"
|
||||
|
|
|
@ -5,6 +5,7 @@ use core::fmt;
|
|||
use core::mem::{self, ManuallyDrop};
|
||||
use core::ops::{Deref, DerefMut};
|
||||
use core::ptr::NonNull;
|
||||
use static_assertions::assert_eq_size;
|
||||
|
||||
use super::utils::{encode_raw_utf16, split_ascii_prefix, split_ascii_prefix_bytes, DecodeAvmUtf8};
|
||||
use super::{ptr, Units, WStr, MAX_STRING_LEN};
|
||||
|
@ -16,6 +17,12 @@ pub struct WString {
|
|||
capacity: u32,
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
assert_eq_size!(WString, [u8; 12]);
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
assert_eq_size!(WString, [u8; 16]);
|
||||
|
||||
impl WString {
|
||||
/// Creates a new empty `WString`.
|
||||
#[inline]
|
||||
|
|
Loading…
Reference in New Issue