Skip to content

fix: fastbufferreader does not honor arraysegment configuration #3320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Feb 24, 2025

This PR resolves the issue where FastBufferReader did not provide constructors that would automatically use an ArraySegment's configuration (Count and Offset) to define the FastBufferReader.

MTTB-34

fix: #2885

up-port: #3321

Changelog

  • Added FastBufferReader(ArraySegment<byte> buffer, Allocator copyAllocator) constructor that uses the ArraySegment.Offset as the FastBufferReader offset and the ArraySegment.Count as the FastBufferReader length.
  • Added FastBufferReader(ArraySegment<byte> buffer, Allocator copyAllocator, int length = -1) constructor that uses the ArraySegment.Offset as the FastBufferReader offset.

Testing and Documentation

  • Includes unit test.
  • Includes public API documentation.

Fixing issue where FastBufferReader did not provide constructors to honor an ArraySegment's configuration.
adding change log entries.
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner February 24, 2025 18:41
removing the not supported exception  from xml api
@NoelStephensUnity NoelStephensUnity added the port:2.x-needed This issue needs to be ported to 2.X branch label Feb 24, 2025
Adding unit test to run a simple validation for this update.
Adding PR number to change log entries.
Excluding the PVP-151 exception for this added test.
@EmandM EmandM merged commit 66a7be4 into develop Feb 25, 2025
40 checks passed
@EmandM EmandM deleted the fix/fastbufferreader-does-not-honor-arraysegment-configuration branch February 25, 2025 14:47
EmandM pushed a commit that referenced this pull request Feb 25, 2025
…ort) (#3321)

Up port of #3320

This PR resolves the issue where `FastBufferReader` did not provide
constructors that would automatically use an `ArraySegment`'s
configuration (Count and Offset) to define the `FastBufferReader`.

[MTTB-34](https://jira.unity3d.com/browse/MTTB-34)

fix: #2885

## Changelog

- Added `FastBufferReader(ArraySegment<byte> buffer, Allocator
copyAllocator)` constructor that uses the `ArraySegment.Offset` as the
`FastBufferReader` offset and the `ArraySegment.Count` as the
`FastBufferReader` length.
- Added `FastBufferReader(ArraySegment<byte> buffer, Allocator
copyAllocator, int length = -1)` constructor that uses the
`ArraySegment.Offset` as the `FastBufferReader` offset.

## Testing and Documentation

- Includes unit test.
- Includes public API documentation.

<!-- Uncomment and mark items off with a * if this PR deprecates any
API:
### Deprecated API
- [ ] An `[Obsolete]` attribute was added along with a `(RemovedAfter
yyyy-mm-dd)` entry.
- [ ] An [api updater] was added.
- [ ] Deprecation of the API is explained in the CHANGELOG.
- [ ] The users can understand why this API was removed and what they
should use instead.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
port:2.x-completed This issue was ported to 2.X branch port:2.x-needed This issue needs to be ported to 2.X branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FastBufferReader does not respect ArraySegment.Offset
2 participants