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

Decode List(Text) encoded by other tools #12

Merged
merged 2 commits into from
Apr 12, 2021
Merged

Decode List(Text) encoded by other tools #12

merged 2 commits into from
Apr 12, 2021

Conversation

bucko909
Copy link
Owner

@bucko909 bucko909 commented Apr 8, 2021

Without this, a List(Text) (which is List(List(Int8))) which is not
encodeded as List(struct { x @0 :Text; }), will decode the first text
pointer as a tag and get very wrong answers. The patch:

  • Makes sure we give a sensible error for unsupported types.
  • Provides better checking that data is correctly formatted.
  • Also adds support for decoding List(Text) correctly, as well as
    decoding List(struct {}) which was upgraded from List(Int64) or
    List(AnyPointer) (or compatible types).

We still don't support double lists.

This relates to Issue #3 (which relies on the upgrade decoding for its
List(Text) encoding to be valid).

@bucko909
Copy link
Owner Author

bucko909 commented Apr 8, 2021

Need to actually check this works...

@bucko909 bucko909 force-pushed the list-list branch 2 times, most recently from 71ba16b to 62c1429 Compare April 8, 2021 16:26
@bucko909
Copy link
Owner Author

bucko909 commented Apr 8, 2021

(Fixed one sanity check and added another.)

src/capnp_compile.erl Outdated Show resolved Hide resolved
I will make it not require a tag, this will capture all schema changes to avoid pollution
Without this, a `List(Text)` (which is `List(List(Int8))`) which is not
encodeded as `List(struct { x @0 :Text; })`, will decode the first text
pointer as a tag and get very wrong answers. The patch:

* Makes sure we give a sensible error for unsupported types.
* Provides better checking that data is correctly formatted.
* Also adds support for decoding `List(Text)` correctly, as well as
  decoding `List(struct {})` which was upgraded from `List(Int64)` or
  `List(AnyPointer)` (or compatible types).

We still don't support double lists.

This relates to Issue #3 (which relies on the upgrade decoding for its
`List(Text)` encoding to be valid).
@bucko909 bucko909 merged commit 923cb5f into master Apr 12, 2021
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