about summary refs log tree commit diff
path: root/third_party/nix/src/libutil/compression.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-19T21·02+0100
committerVincent Ambo <tazjin@google.com>2020-05-19T21·02+0100
commit88f337588c9f1a41ac67b3afb8d43f124b4d153b (patch)
tree1e7ee739c979f5a54a1c23fcb1a6adf49652a7e5 /third_party/nix/src/libutil/compression.cc
parent39087321811e81e26a1a47d6967df1088dcf0e95 (diff)
refactor(3p/nix): Make all single-argument constructors explicit r/778
Implicit constructors can be confusing, especially in a codebase that
is already as unintentionally obfuscated as this one.

https://google.github.io/styleguide/cppguide.html#Explicit_Constructors
Diffstat (limited to 'third_party/nix/src/libutil/compression.cc')
-rw-r--r--third_party/nix/src/libutil/compression.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/third_party/nix/src/libutil/compression.cc b/third_party/nix/src/libutil/compression.cc
index e13ffcec74d8..93e2360bd58c 100644
--- a/third_party/nix/src/libutil/compression.cc
+++ b/third_party/nix/src/libutil/compression.cc
@@ -34,7 +34,7 @@ struct ChunkedCompressionSink : CompressionSink {
 
 struct NoneSink : CompressionSink {
   Sink& nextSink;
-  NoneSink(Sink& nextSink) : nextSink(nextSink) {}
+  explicit NoneSink(Sink& nextSink) : nextSink(nextSink) {}
   void finish() override { flush(); }
   void write(const unsigned char* data, size_t len) override {
     nextSink(data, len);
@@ -47,7 +47,7 @@ struct XzDecompressionSink : CompressionSink {
   lzma_stream strm = LZMA_STREAM_INIT;
   bool finished = false;
 
-  XzDecompressionSink(Sink& nextSink) : nextSink(nextSink) {
+  explicit XzDecompressionSink(Sink& nextSink) : nextSink(nextSink) {
     lzma_ret ret = lzma_stream_decoder(&strm, UINT64_MAX, LZMA_CONCATENATED);
     if (ret != LZMA_OK) {
       throw CompressionError("unable to initialise lzma decoder");
@@ -92,7 +92,7 @@ struct BzipDecompressionSink : ChunkedCompressionSink {
   bz_stream strm;
   bool finished = false;
 
-  BzipDecompressionSink(Sink& nextSink) : nextSink(nextSink) {
+  explicit BzipDecompressionSink(Sink& nextSink) : nextSink(nextSink) {
     memset(&strm, 0, sizeof(strm));
     int ret = BZ2_bzDecompressInit(&strm, 0, 0);
     if (ret != BZ_OK) {
@@ -140,7 +140,7 @@ struct BrotliDecompressionSink : ChunkedCompressionSink {
   BrotliDecoderState* state;
   bool finished = false;
 
-  BrotliDecompressionSink(Sink& nextSink) : nextSink(nextSink) {
+  explicit BrotliDecompressionSink(Sink& nextSink) : nextSink(nextSink) {
     state = BrotliDecoderCreateInstance(nullptr, nullptr, nullptr);
     if (!state) {
       throw CompressionError("unable to initialize brotli decoder");
@@ -284,7 +284,7 @@ struct BzipCompressionSink : ChunkedCompressionSink {
   bz_stream strm;
   bool finished = false;
 
-  BzipCompressionSink(Sink& nextSink) : nextSink(nextSink) {
+  explicit BzipCompressionSink(Sink& nextSink) : nextSink(nextSink) {
     memset(&strm, 0, sizeof(strm));
     int ret = BZ2_bzCompressInit(&strm, 9, 0, 30);
     if (ret != BZ_OK) {
@@ -333,7 +333,7 @@ struct BrotliCompressionSink : ChunkedCompressionSink {
   BrotliEncoderState* state;
   bool finished = false;
 
-  BrotliCompressionSink(Sink& nextSink) : nextSink(nextSink) {
+  explicit BrotliCompressionSink(Sink& nextSink) : nextSink(nextSink) {
     state = BrotliEncoderCreateInstance(nullptr, nullptr, nullptr);
     if (!state) {
       throw CompressionError("unable to initialise brotli encoder");