Skip to content
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

Fixes reading of macro table appends. #979

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

tgregg
Copy link
Contributor

@tgregg tgregg commented Oct 21, 2024

Issue #, if available:

Fixes #978

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -2417,6 +2417,7 @@ private boolean slowReadHeader(final int typeIdByte, final boolean isAnnotated,
}
if (minorVersion == 1) {
if (valueTid.isMacroInvocation) {
setCheckpointAfterValueHeader();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, the reader will in certain cases attempt to read the same byte repetitively, not making any forward progress.

) {
class EncodingContext(macroTable: Map<MacroRef, Macro>) {

val macroTable = macroTable.toMutableMap()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This performs a copy, allowing the caller to mutate the map passed in as an argument without modifying the underlying encoding context. This map is mutable because users may add new macros to the table.

@jobarr-amzn jobarr-amzn merged commit 3f92b94 into ion-11-encoding Oct 21, 2024
17 checks passed
@jobarr-amzn jobarr-amzn deleted the ion-11-encoding-fix-macro-append branch October 21, 2024 21:18
tgregg added a commit that referenced this pull request Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants