Adrian Wielgosik
d6dbc5e767
core: Support dependent strings for concatenation
2024-05-26 12:14:30 +02:00
Nathan Adams
7309e457d5
avm2: Transform css properties from with-dashes to snakeCase
2024-05-14 21:03:37 +02:00
TÖRÖK Attila
7f33dace8e
nit: Silence nightly `clippy::missing_transmute_annotations` lint
2024-04-20 17:39:54 +02:00
Adrian Wielgosik
9d2664f752
wstr: Fix parsing of '+'
2024-04-14 13:24:42 +02:00
Kamil Jarosz
b39919951b
wstr: Add UTF-8/UTF-16 index mapping
...
Methods `utf8_index` and `utf16_index` from `WStrToUtf8`
may be used to map code unit indices between UTF-8 (str)
and UTF-16 (WStr) strings.
2024-02-01 20:18:29 +01:00
TÖRÖK Attila
d153290fd6
nits: Fix a whole bunch of typos all over the place
2024-01-17 23:59:19 +01:00
Nathan Adams
658ac2dd9f
core: Implement url handling (+asfunction) in textedits
2023-08-20 22:31:27 +02:00
Moulins
ff01444e63
wstr: return correct result for `split_ascii_prefix_bytes(<ascii str>)`
...
`split_ascii_prefix_bytes(b"abc")` should return `("abc", b"")`, not
`("", b"abc")`
This doesn't affect correctness, but should increase performance of
ASCII `String` -> `WString` conversions.
2023-08-03 00:25:11 +02:00
relrelb
006393c581
chore: Appease nightly clippy
2023-08-01 22:44:00 +03:00
Moulins
e5caf0fda8
core: use unified repr for non-static `AvmString`s, interned and not
...
This shrinks the size of `AvmString` back from 3 to 2 usizes.
2023-04-27 00:17:31 +02:00
Moulins
90d5515d47
wstr: fix `wstr_impl_traits` macro not working without `use ruffle_wstr::*`
2023-04-26 23:49:18 +02:00
Moulins
e9a16ff5fe
wstr: cleanup and expose the `ptr` module
...
- move `WStr` declaration to `common`;
- move `MAX_STRING_LEN` to the `WStr` type;
- split `ptr` methods into `*const` and `*mut` variants;
- add safe methods `WStrMetadata::new32/len32`;
- add `WString::{from, into}_raw_parts`.
2023-04-26 23:49:18 +02:00
Moulins
604a15f957
wstr: add `WStr::make_ascii_lowercase`
2023-04-26 23:49:18 +02:00
Moulins
83f7bfc0c2
wstr: improve `Cow<WStr>` support
...
This adds missing `From` implementations, and utf8 conversion methods
returning `Cow<WStr>`.
2023-04-26 23:49:18 +02:00
Moulins
ab0f9b9fc2
wstr: Inline more `WString` methods
2023-04-26 23:49:18 +02:00
Moulins
be67761a22
chore: appease (beta) clippy
2023-04-21 14:44:15 +02:00
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
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
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