From ed9073e9fee521a53179760a673e95a8731dd2d2 Mon Sep 17 00:00:00 2001 From: conor42 Date: Fri, 29 Mar 2019 12:13:14 +1000 Subject: [PATCH] Add error check --- CPP/7zip/Compress/Lzma2Encoder.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CPP/7zip/Compress/Lzma2Encoder.cpp b/CPP/7zip/Compress/Lzma2Encoder.cpp index 0b689fb6..9b3a2614 100644 --- a/CPP/7zip/Compress/Lzma2Encoder.cpp +++ b/CPP/7zip/Compress/Lzma2Encoder.cpp @@ -121,6 +121,10 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream return SResToHRESULT(res); } + +// Fast LZMA2 encoder + + static HRESULT TranslateError(size_t res) { if (FL2_getErrorCode(res) == FL2_error_memory_allocation) @@ -298,7 +302,7 @@ HRESULT CFastEncoder::FastLzma2::End(ISequentialOutStream *outStream, ICompressP size_t res = FL2_endStream(fcs, nullptr); CHECK_H(WaitAndReport(res, progress)); while (res) { - WriteBuffers(outStream); + CHECK_H(WriteBuffers(outStream)); res = FL2_endStream(fcs, nullptr); CHECK_H(WaitAndReport(res, progress)); }