Repository navigation
Compiled mapper: write a raw integer not in the mappings through - #183
Merged
Merged
Conversation
The compiled read returns the raw id for a value not in the mappings, so a proxy that re-encodes what it reads (e.g. bedrock-protocol Relay) has to be able to write that integer back. Since ProtoDef-io#176 the write threw on it. Pass raw integers through to the underlying type; unmapped names and undefined still throw.
Contributor
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #176, addressing #176 (comment).
The compiled read returns the raw id when a value isn't in the mappings, so anything that re-encodes what it reads (e.g. bedrock-protocol Relay proxying a packet with an out-of-range enum value) has to be able to write that integer back. #176 made the compiled write/sizeOf throw on it.
Now a raw
numbernot in the mappings is passed through to the underlying type. Unmapped names andundefinedstill throw, so the original bug (an unknown packet name serializing as0x00) stays fixed. Covered by a new round-trip test.