|
|
|
@ -192,11 +192,11 @@ bool httpDownload(const std::string &url, const std::string &file, size_t chunk_ |
|
|
|
|
return httpDownload(url, of, chunk_size, size, abort); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::string decompressBZ2(const std::string &in) { |
|
|
|
|
return decompressBZ2((std::byte *)in.data(), in.size()); |
|
|
|
|
std::string decompressBZ2(const std::string &in, std::atomic<bool> *abort) { |
|
|
|
|
return decompressBZ2((std::byte *)in.data(), in.size(), abort); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::string decompressBZ2(const std::byte *in, size_t in_size) { |
|
|
|
|
std::string decompressBZ2(const std::byte *in, size_t in_size, std::atomic<bool> *abort) { |
|
|
|
|
if (in_size == 0) return {}; |
|
|
|
|
|
|
|
|
|
bz_stream strm = {}; |
|
|
|
@ -222,10 +222,10 @@ std::string decompressBZ2(const std::byte *in, size_t in_size) { |
|
|
|
|
if (bzerror == BZ_OK && strm.avail_in > 0 && strm.avail_out == 0) { |
|
|
|
|
out.resize(out.size() * 2); |
|
|
|
|
} |
|
|
|
|
} while (bzerror == BZ_OK); |
|
|
|
|
} while (bzerror == BZ_OK && !(abort && *abort)); |
|
|
|
|
|
|
|
|
|
BZ2_bzDecompressEnd(&strm); |
|
|
|
|
if (bzerror == BZ_STREAM_END) { |
|
|
|
|
if (bzerror == BZ_STREAM_END && !(abort && *abort)) { |
|
|
|
|
out.resize(strm.total_out_lo32); |
|
|
|
|
return out; |
|
|
|
|
} |
|
|
|
|