Skip to content

Commit

Permalink
apacheGH-41116: [C++] IO: enhance boundary checking in CompressedInpu…
Browse files Browse the repository at this point in the history
…tStream (apache#41117)

### Rationale for this change

Enhance the boundary checking code style in `io::CompressedInputStream`.

### What changes are included in this PR?

* Add `compressed_buffer_available` and `decompressed_buffer_available` in the class, and uses them for checking the boundary
* Change `Status(bool*)` to `Result<bool>`

### Are these changes tested?

Already has testing. I don't know how to hacking into internal

### Are there any user-facing changes?

No

* GitHub Issue: apache#41116

Lead-authored-by: mwish <[email protected]>
Co-authored-by: mwish <[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: mwish <[email protected]>
  • Loading branch information
3 people authored and tolleybot committed May 4, 2024
1 parent 0af60f0 commit 52a7fe7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cpp/src/arrow/io/compressed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ class CompressedInputStream::Impl {
ARROW_ASSIGN_OR_RAISE(auto buf, AllocateResizableBuffer(nbytes, pool_));
ARROW_ASSIGN_OR_RAISE(int64_t bytes_read, Read(nbytes, buf->mutable_data()));
RETURN_NOT_OK(buf->Resize(bytes_read));
// Using std::move because the some compiler might has issue below:
// Using std::move because some compiler might has issue below:
// https://wg21.cmeerw.net/cwg/issue1579
return std::move(buf);
}
Expand Down

0 comments on commit 52a7fe7

Please sign in to comment.