From b20162f4d721ac43b1c5df3b590078e49816f2ea Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Fri, 20 Dec 2024 18:19:41 -0500 Subject: [PATCH] Address review concern --- .../core/src/clp/streaming_compression/lzma/Compressor.cpp | 4 ++-- components/core/tests/test-StreamingCompression.cpp | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/components/core/src/clp/streaming_compression/lzma/Compressor.cpp b/components/core/src/clp/streaming_compression/lzma/Compressor.cpp index 8061807da..a9fa0d5a0 100644 --- a/components/core/src/clp/streaming_compression/lzma/Compressor.cpp +++ b/components/core/src/clp/streaming_compression/lzma/Compressor.cpp @@ -26,7 +26,7 @@ auto Compressor::open(FileWriter& file_writer) -> void { m_compressed_stream_block_buffer.size() )) { - throw OperationFailed(ErrorCode_NotInit, __FILENAME__, __LINE__); + throw OperationFailed(ErrorCode_NoMem, __FILENAME__, __LINE__); } m_compressed_stream_file_writer = &file_writer; m_uncompressed_stream_pos = 0; @@ -153,7 +153,7 @@ auto Compressor::flush_stream_output_block_buffer() -> void { m_compressed_stream_block_buffer.size() )) { - throw OperationFailed(ErrorCode_NotInit, __FILENAME__, __LINE__); + throw OperationFailed(ErrorCode_NoMem, __FILENAME__, __LINE__); } } diff --git a/components/core/tests/test-StreamingCompression.cpp b/components/core/tests/test-StreamingCompression.cpp index 5ae5532a0..c3e981562 100644 --- a/components/core/tests/test-StreamingCompression.cpp +++ b/components/core/tests/test-StreamingCompression.cpp @@ -35,13 +35,20 @@ using std::string_view; namespace { constexpr string_view cCompressedFilePath{"test_streaming_compressed_file.bin"}; constexpr size_t cBufferSize{128L * 1024 * 1024}; // 128MB +// Interleave no-ops to ensure the integrity of the compressor states at all times. constexpr auto cCompressionChunkSizes = std::to_array( {cBufferSize / 100, + 0, cBufferSize / 50, + 0, cBufferSize / 25, + 0, cBufferSize / 10, + 0, cBufferSize / 5, + 0, cBufferSize / 2, + 0, cBufferSize} );