Make compression interruptible

This commit is contained in:
Eelco Dolstra 2016-04-22 18:15:02 +02:00
parent 456179018a
commit 58c84cda3b

View file

@ -1,5 +1,5 @@
#include "compression.hh" #include "compression.hh"
#include "types.hh" #include "util.hh"
#include <lzma.h> #include <lzma.h>
#include <cstdio> #include <cstdio>
@ -35,6 +35,7 @@ std::string compressXZ(const std::string & in)
strm().avail_out = sizeof(outbuf); strm().avail_out = sizeof(outbuf);
while (true) { while (true) {
checkInterrupt();
if (strm().avail_in == 0) if (strm().avail_in == 0)
action = LZMA_FINISH; action = LZMA_FINISH;
@ -73,6 +74,7 @@ ref<std::string> decompressXZ(const std::string & in)
strm().avail_out = sizeof(outbuf); strm().avail_out = sizeof(outbuf);
while (true) { while (true) {
checkInterrupt();
if (strm().avail_in == 0) if (strm().avail_in == 0)
action = LZMA_FINISH; action = LZMA_FINISH;