Skip to content

core: Cleanup some SwfSlice/buffer::Slice code#23124

Open
moulins wants to merge 6 commits intoruffle-rs:masterfrom
moulins:slice-logic-cleanup
Open

core: Cleanup some SwfSlice/buffer::Slice code#23124
moulins wants to merge 6 commits intoruffle-rs:masterfrom
moulins:slice-logic-cleanup

Conversation

@moulins
Copy link
Contributor

@moulins moulins commented Feb 26, 2026

  • Use SwfSlice::to_subslice instead of to_unbounded_subslice outside of AVM1 bytecode (which is the only place that needs to allow whole-movie access not restricted to the current tag);
  • Remove unneeded arguments in decode_tags's callback & SwfSlice::resize_to_reader;
  • Implement io::Read on buffer::Slice directly (instead of buffer::SliceCursor);
  • Remove unused code after the previous changes.

Either the parent slice pointed to an entire movie, or the subslice was known
to be in the current tag; in both case, `to_unbounded_subslice` is unnecessary.
Consumers can always get it directly from the passed-in reader if needed.
Every caller was passing in the length of the reader; furthermore, readers are always
in bound of the current `SwfSlice`, so the method can be simplified to forward to
`SwfSlice::to_subslice`.
@moulins moulins added A-core Area: Core player, where no other category fits T-refactor Type: Refactor / Cleanup labels Feb 26, 2026
We can implement `io::Read` on `Slice` directly.
There were only to callers, and they could both be replaced by something simpler.
@moulins moulins force-pushed the slice-logic-cleanup branch from 7cf3f18 to afa2039 Compare February 26, 2026 01:20
@moulins moulins added the waiting-on-review Waiting on review from a Ruffle team member label Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-core Area: Core player, where no other category fits T-refactor Type: Refactor / Cleanup waiting-on-review Waiting on review from a Ruffle team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant