Skip to content

fix(dkapture): return bytes read, not remaining buffer size, in vector read()s - #140

Open
JoeSergen wants to merge 1 commit into
DKapture:mainfrom
JoeSergen:fix/dkapture-vector-read-return
Open

fix(dkapture): return bytes read, not remaining buffer size, in vector read()s#140
JoeSergen wants to merge 1 commit into
DKapture:mainfrom
JoeSergen:fix/dkapture-vector-read-return

Conversation

@JoeSergen

Copy link
Copy Markdown

Fixes #137

The two buffer-based overloads read(std::vector<DataType>&, pid, buf, bsz) and read(std::vector<const char*>&, buf, bsz) returned the leftover bsz after the loop instead of the number of bytes written, contradicting the documented contract. Accumulate the total bytes written and return that, matching read(DataType, std::vector<pid_t>&, ...).

…r read()s

The two buffer-based overloads read(std::vector<DataType>&, pid, buf,
bsz) and read(std::vector<const char*>&, buf, bsz) returned the
leftover bsz after the loop instead of the number of bytes written,
contradicting the documented contract ('success returns the number of
bytes read'). Accumulate total bytes written and return that, matching
the read(DataType, std::vector<pid_t>&, ...) overload.
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.

Bug: dkapture::read() 两个 vector 重载返回剩余缓冲区大小而非已读字节数

1 participant