clp
clp copied to clipboard
core-clp: Refactor `LibarchiveFileReader` to properly handle empty data blocks (fixes #389).
Description
The current LibarchiveFileReader
implementation has the following problems:
- It doesn't handle the case where the data block is empty, which is the root cause of #389
- Not all data members are initialized in the default constructor
- Buffer peeking method's signature can be improved with C++20 enabled
This PR makes the following changes accordingly:
- Handle the empty data block properly. All empty blocks will be skipped and only nonempty blocks can be read
- Initialize all data members in the member declaration (which matches our latest coding guideline)
- Using
std::span
for peeking buffer content
Validation performed
- Ensure CI passed
- Ensure the bug has been fixed in #389