clp icon indicating copy to clipboard operation
clp copied to clipboard

core-clp: Refactor `LibarchiveFileReader` to properly handle empty data blocks (fixes #389).

Open LinZhihao-723 opened this issue 8 months ago • 3 comments

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

LinZhihao-723 avatar Jun 21 '24 05:06 LinZhihao-723