Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: haiqi96 <[email protected]>
  • Loading branch information
Bill-hbrhbr and haiqi96 authored Dec 6, 2024
1 parent 8ab0653 commit c436f21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ auto Compressor::write(char const* data, size_t data_length) -> void {
}

auto Compressor::flush() -> void {
if (nullptr == m_compressed_stream_file_writer) {
throw OperationFailed(ErrorCode_NotInit, __FILENAME__, __LINE__);
}
flush_lzma(LZMA_SYNC_FLUSH);
}

Expand Down Expand Up @@ -228,7 +231,7 @@ auto Compressor::flush_lzma(lzma_action flush_action) -> void {
case LZMA_BUF_ERROR: // No encoding progress can be made
// NOTE: this can happen if we are using LZMA_FULL_FLUSH or
// LZMA_FULL_BARRIER. These two actions keeps encoding input
// data alongside flushing already encoded but buffered data.
// data alongside flushing buffered encoded data.
SPDLOG_ERROR("LZMA compressor input stream is corrupt.");
throw OperationFailed(ErrorCode_Failure, __FILENAME__, __LINE__);
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Compressor : public ::clp::streaming_compression::Compressor {
* Invoke lzma_code() repeatedly with LZMA_RUN until the input is exhausted
*
* At the end of the workflow, the last bytes of encoded data may still be
* buffered and thus not immediately available at the output block buffer.
* buffered in the LZMA stream and thus not immediately available at the output block buffer.
*
* Assumes input stream and output block buffer are both in valid states.
* @throw `OperationFailed` if LZMA returns an unexpected error value
Expand All @@ -113,8 +113,8 @@ class Compressor : public ::clp::streaming_compression::Compressor {
auto flush_lzma(lzma_action flush_action) -> void;

/**
* Flushes the current compressed data in the LZMA output buffer to the
* output file handler. Reset the compression buffer to receive new data.
* Flushes the current compressed data in the output block buffer to the
* output file handler. Reset the output block buffer to receive new data.
*/
auto flush_stream_output_block_buffer() -> void;

Expand Down

0 comments on commit c436f21

Please sign in to comment.