diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-10-13 11:00:10 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2021-10-13 11:00:10 +0200 |
commit | 0fac86fd6feea5f584cb5765b04baeba908bcc03 (patch) | |
tree | f80b467c0c7ad5d0ac9fd93940156fa426634c63 /src | |
parent | abd685d3730a5760cd1c766f7fbde8fe85952011 (diff) |
Style tweaks
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/compression.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc index 4802edb78..f80ca664c 100644 --- a/src/libutil/compression.cc +++ b/src/libutil/compression.cc @@ -67,17 +67,16 @@ struct ArchiveCompressionSink : CompressionSink Sink & nextSink; struct archive * archive; - ArchiveCompressionSink(Sink & nextSink, std::string format, bool parallel, int _level = COMPRESSION_LEVEL_DEFAULT) : nextSink(nextSink) { + ArchiveCompressionSink(Sink & nextSink, std::string format, bool parallel, int level = COMPRESSION_LEVEL_DEFAULT) : nextSink(nextSink) + { archive = archive_write_new(); if (!archive) throw Error("failed to initialize libarchive"); check(archive_write_add_filter_by_name(archive, format.c_str()), "couldn't initialize compression (%s)"); check(archive_write_set_format_raw(archive)); - if (parallel) { + if (parallel) check(archive_write_set_filter_option(archive, format.c_str(), "threads", "0")); - } - if (_level != COMPRESSION_LEVEL_DEFAULT){ - check(archive_write_set_filter_option(archive, format.c_str(), "compression-level", std::to_string(_level).c_str())); - } + if (level != COMPRESSION_LEVEL_DEFAULT) + check(archive_write_set_filter_option(archive, format.c_str(), "compression-level", std::to_string(level).c_str())); // disable internal buffering check(archive_write_set_bytes_per_block(archive, 0)); // disable output padding @@ -131,9 +130,10 @@ private: struct NoneSink : CompressionSink { Sink & nextSink; - NoneSink(Sink & nextSink, int level = COMPRESSION_LEVEL_DEFAULT) : nextSink(nextSink) { + NoneSink(Sink & nextSink, int level = COMPRESSION_LEVEL_DEFAULT) : nextSink(nextSink) + { if (level != COMPRESSION_LEVEL_DEFAULT) - printError("Warning: requested compression level '%d' not supported by compression method 'none'", level); + warn("requested compression level '%d' not supported by compression method 'none'", level); } void finish() override { flush(); } void write(std::string_view data) override { nextSink(data); } |