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

Establish a contract around Writer::write() #281

Closed
wants to merge 4 commits into from

Conversation

aliddell
Copy link
Member

In a previous PR we altered bool Writer::write(const uint8_t*, size_t) to size_t Writer::write(const uint8_t*, size_t), i.e., to return the number of bytes written

In this PR we establish the following contract:

Let uint8_t* data be a buffer of size nbytes_in, and let nbytes_out be the value returned by Writer::write(data, nbytes_in). If nbytes_out < nbytes_in, then Writer::write(data + nbytes_out, nbytes_in - nbytes_out) should do what we expect. In other words, when writing the 2nd (or 3rd, or ...) part of a partial frame, the Writer should copy the data to the correct position in its buffers, instead of overwriting old data or beginning a new frame.

@aliddell aliddell closed this Jul 29, 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.

1 participant