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

Make encoder / decoder compatible with stream subclassing #776

Open
PetteriAimonen opened this issue Apr 22, 2022 · 0 comments
Open

Make encoder / decoder compatible with stream subclassing #776

PetteriAimonen opened this issue Apr 22, 2022 · 0 comments

Comments

@PetteriAimonen
Copy link
Member

Currently the encoding and decoding functions make a copy of the pb_istream_t / pb_ostream_t for the substream. This means that if your own code tries to do this:

 struct my_stream_t {
        pb_istream_t stream;
        int extra_state;
 };

It doesn't work, as the extra fields do not get along when copied.

The substream implementation could instead just change the max_size on the stream structure, without copying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant