Commit Graph

35 Commits

Author SHA1 Message Date
Moulins 5b4096de8b wstr: Revert incorrect optimization in hash calculation
Calling `Hash::write_bytes` isn't guaranteed to be equivalent to a
sequence of `Hash::write_u8`.

Additionally, make sure the hash is truly prefix-free by hashing the
length first.
2023-03-25 18:27:51 -07:00
relrelb 7cdac78321 chore: Remove `static_assertions` dependency
`static_assertions` seems unmaintained, and anyway `assert!()` is
usable in `const` contexts since Rust 1.57.0:
https://blog.rust-lang.org/2021/12/02/Rust-1.57.0.html#panic-in-const-contexts
So simply use the suggested method instead.

Also the `rustversion` dependency is no longer needed because
https://github.com/rust-lang/rust/pull/94075 already landed in stable.
2023-03-25 15:14:36 +03:00
Mike Welsh 696c9062d3 chore: Inherit cargo metadata from workspace
Use workspace inheritance added in Rust 1.64 to de-duplicate
various settings across all packages.
2022-12-16 15:53:59 -08:00
relrelb bd9078addf chore: Fix `clippy::uninlined_format_args` lints 2022-12-15 08:59:38 +02:00
Adrian Wielgosik 0861153626 swf: make Clippy happy 2022-12-03 22:18:22 +01:00
Aaron Hill 68471723b3 core: Fix clippy format string lint 2022-10-27 08:49:39 +03:00
relrelb 178bf4fe24 chore: Extract Cargo `edition` to `[workspace.package]`
This is possible since Rust 1.64.0: https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#cargo-improvements-workspace-inheritance-and-multi-target-builds
2022-10-14 22:13:29 +03:00
Moulins 03d54262c6 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.
2022-08-16 13:47:00 -07:00
Moulins 8806e9921a wstr: Fix provenance in WString::from_buf_unchecked
Get a pointer with provenance over the whole buffer, instead of a
pointer with provenance only to the initialized part.
2022-08-16 13:47:00 -07:00
Moulins a678a39e85 wstr: implement ToOwned::clone_into for WStr 2022-08-16 13:47:00 -07:00
Moulins 2e255a5bba wstr: Shrink WString to 16 bytes on 64-bits targets 2022-08-16 13:47:00 -07:00
Moulins 2d60e62b8b wstr: introduce explicit WStrMetadata type 2022-08-16 13:47:00 -07:00
CUB3D 05bfa3770e chore: Fix warnings with cargo doc 2022-08-08 20:20:18 +03:00
EmperorBale dde2895f98 wstr: Use `extend_from_slice` instead of manually pushing to output. 2022-07-25 10:52:56 -07:00
EmperorBale 026fcfff62 wstr: Ascii character detection in the UTF-8 decoder should use `<`, not `<=` 2022-07-25 10:52:56 -07:00
EmperorBale ae5e2be8a3 chore: Simplify code for UTF-8 decoding 2022-07-25 10:52:56 -07:00
EmperorBale df4e56f9dd chore: Appease clippy 2022-07-25 10:52:56 -07:00
EmperorBale 577f221db8 chore: Small cleanup 2022-07-25 10:52:56 -07:00
EmperorBale ea79f98eb5 wstr: All characters should be decoded before being pushed to the wstring buffer 2022-07-25 10:52:56 -07:00
EmperorBale efa8dbbc40 chore: Rename AvmUtf8Decoder to DecodeAvmUtf8 2022-07-25 10:52:56 -07:00
EmperorBale dda97dbccb wstr: Fix small logic error when decoding UTF-8 2022-07-25 10:52:56 -07:00
EmperorBale bc31014f93 chore: Better organization 2022-07-25 10:52:56 -07:00
EmperorBale 67dd53ac9f chore: Clippy 2022-07-25 10:52:56 -07:00
EmperorBale 19605cff45 chore: Add more comments 2022-07-25 10:52:56 -07:00
EmperorBale ba2416c126 core: Multibyte codepoints cannot be in ascii range 2022-07-25 10:52:56 -07:00
EmperorBale d6604f538c wstr: Implement custom UTF-8 decoding routine 2022-07-25 10:52:56 -07:00
relrelb c0e84e646e wstr: Implement `ToOwned` for `WStr`
Similarly to how `str` implements `ToOwned`, and `From<&str> for String`
forwards to `to_owned()`.

This will allow defining `Cow<WStr>`.
2022-07-06 09:19:12 +03:00
relrelb f66159a387 wstr: Allow creating `Pattern` from `FnMut`
This aligns with Rust's standard `Pattern`:
https://doc.rust-lang.org/std/str/pattern/trait.Pattern.html

Also rename `Predicate::is_match` to `matches` in order to appease
Clippy's `wrong-self-convention` lint, and anyway this is closer to
Rust's `MultiCharEq::matches`.
2022-06-21 08:02:40 +03:00
Mike Welsh 9d5e461278 core: Add WStr::eq_with_case 2022-05-09 17:39:49 -07:00
relrelb f6153ff7c1 chore: Appease clippy 2022-05-06 10:36:38 -07:00
Moulins 3bbbf2f764 wstr: make the crate no_std
This requires removing the Error impl of ParseNumError, because the
Error trait is std-only.
2022-03-26 13:42:57 -07:00
Moulins 1bff5c517a Move back AvmString into ruffle_core::string
This allows removing the gc_arena dependency in ruffle_wstr
2022-03-26 13:42:57 -07:00
Moulins bd576639d5 wstr: refactor traits macro (again) to make it usable outside the crate
And add the AsRef, Borrow, wstr::Pattern to the macro
2022-03-26 13:42:57 -07:00
Moulins 826708a91b wstr: refactor traits macro so that each wstr type uses it separately 2022-03-26 13:42:57 -07:00
Moulins 1911aa9a6b Move core::string into separate ruffle_wstr crate. 2022-03-26 13:42:57 -07:00