aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/compression.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/compression.cc')
-rw-r--r--src/libutil/compression.cc25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc
index d93a1b1d6..a66069e52 100644
--- a/src/libutil/compression.cc
+++ b/src/libutil/compression.cc
@@ -163,23 +163,24 @@ struct BrotliDecompressionSource : Source
uint8_t * out = (uint8_t *) data;
const auto * begin = out;
- try {
- while (len && !BrotliDecoderIsFinished(state.get())) {
- checkInterrupt();
+ while (len && !BrotliDecoderIsFinished(state.get())) {
+ checkInterrupt();
- while (avail_in == 0) {
+ while (avail_in == 0) {
+ try {
avail_in = inner->read(buf.get(), BUF_SIZE);
- next_in = (const uint8_t *) buf.get();
+ } catch (EndOfFile &) {
+ break;
}
+ next_in = (const uint8_t *) buf.get();
+ }
- if (!BrotliDecoderDecompressStream(
- state.get(), &avail_in, &next_in, &len, &out, nullptr
- ))
- {
- throw CompressionError("error while decompressing brotli file");
- }
+ if (!BrotliDecoderDecompressStream(
+ state.get(), &avail_in, &next_in, &len, &out, nullptr
+ ))
+ {
+ throw CompressionError("error while decompressing brotli file");
}
- } catch (EndOfFile &) {
}
if (begin != out) {