Enable reporting LZMA writing progress

This commit is contained in:
Martin Briza 2017-01-17 11:22:52 +01:00
parent fe8c09b43a
commit b7db4ce72e

View File

@ -114,6 +114,8 @@ bool WriteJob::write(int fd) {
}
bool WriteJob::writeCompressed(int fd) {
qint64 totalRead = 0;
lzma_stream strm = LZMA_STREAM_INIT;
lzma_ret ret;
@ -141,8 +143,13 @@ bool WriteJob::writeCompressed(int fd) {
while (true) {
if (strm.avail_in == 0) {
qint64 len = file.read((char*) inBuffer, bufferSize);
totalRead += len;
strm.next_in = inBuffer;
strm.avail_in = len;
out << totalRead << "\n";
out.flush();
}
ret = lzma_code(&strm, strm.avail_in == 0 ? LZMA_FINISH : LZMA_RUN);