7-Zip-FL2 icon indicating copy to clipboard operation
7-Zip-FL2 copied to clipboard

How flzma2 decode ?

Open jinfeihan57 opened this issue 4 years ago • 2 comments

In file /CPP/7zip/Compress/Lzma2Encoder.cpp HRESULT CFastEncoder::FastLzma2::AddByteCount(size_t count, ISequentialOutStream *outStream, ICompressProgressInfo *progress) { dict_pos += count; if (dict_pos == dict.size) { size_t res = FL2_updateDictionary(fcs, dict_pos); CHECK_H(WaitAndReport(res, progress)); if (res != 0) CHECK_H(WriteBuffers(outStream)); res = FL2_getDictionaryBuffer(fcs, &dict); while (FL2_isTimedOut(res)) { if (!UpdateProgress(progress)) return S_FALSE; res = FL2_getDictionaryBuffer(fcs, &dict); } CHECK_S(res); dict_pos = 0; } if (!UpdateProgress(progress)) return S_FALSE; return S_OK; } You didn't call FL2_compressStream() to compress src data. Can FL2_getDictionaryBuffer also compress data? You use basic Flzma2 API to compress. Did you change the FL2_compressStream() format? Did you change the format to support the decompression of lzma2 OR Can FL2_compressStream() compressed data be decompressed by Lzma2Decode() .

jinfeihan57 avatar May 12 '20 08:05 jinfeihan57

FL2_getDictionaryBuffer() is part of an alternate set of functions which skip a copy operation. The output stream is decoded by Lzma2Decode().

conor42 avatar May 14 '20 01:05 conor42

Thanks for your answer. I think i found it. flzma2copy FL2_compressStream() need a memcopy. 7zipflzma2 In 7zip-FL,you skip it. 👍 )

jinfeihan57 avatar May 14 '20 03:05 jinfeihan57