diff options
author | Kane York <kanepyork@gmail.com> | 2020-07-25T04·09-0700 |
---|---|---|
committer | kanepyork <rikingcoding@gmail.com> | 2020-07-27T21·16+0000 |
commit | ef54f5da9fa30b5c302f2a49595ee5d041f9706a (patch) | |
tree | 8d1da709a2e2d3b135d1e84eda9c402bde467726 /third_party/nix/src/libutil/compression.cc | |
parent | 69f402563a14d4b668980e4228d033d80e3bb05d (diff) |
fix(3p/nix): apply all clang-tidy fixes r/1495
Change-Id: I265e763393422ee1881653527c91024458060825 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1432 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'third_party/nix/src/libutil/compression.cc')
-rw-r--r-- | third_party/nix/src/libutil/compression.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/third_party/nix/src/libutil/compression.cc b/third_party/nix/src/libutil/compression.cc index 779d326eb204..b598927c88f7 100644 --- a/third_party/nix/src/libutil/compression.cc +++ b/third_party/nix/src/libutil/compression.cc @@ -17,7 +17,7 @@ namespace nix { // Don't feed brotli too much at once. struct ChunkedCompressionSink : CompressionSink { - uint8_t outbuf[32 * 1024]; + uint8_t outbuf[32 * 1024]{}; void write(const unsigned char* data, size_t len) override { const size_t CHUNK_SIZE = sizeof(outbuf) << 2; @@ -43,7 +43,7 @@ struct NoneSink : CompressionSink { struct XzDecompressionSink : CompressionSink { Sink& nextSink; - uint8_t outbuf[BUFSIZ]; + uint8_t outbuf[BUFSIZ]{}; lzma_stream strm = LZMA_STREAM_INIT; bool finished = false; @@ -89,7 +89,7 @@ struct XzDecompressionSink : CompressionSink { struct BzipDecompressionSink : ChunkedCompressionSink { Sink& nextSink; - bz_stream strm; + bz_stream strm{}; bool finished = false; explicit BzipDecompressionSink(Sink& nextSink) : nextSink(nextSink) { @@ -99,7 +99,7 @@ struct BzipDecompressionSink : ChunkedCompressionSink { throw CompressionError("unable to initialise bzip2 decoder"); } - strm.next_out = (char*)outbuf; + strm.next_out = reinterpret_cast<char*>(outbuf); strm.avail_out = sizeof(outbuf); } @@ -128,7 +128,7 @@ struct BzipDecompressionSink : ChunkedCompressionSink { if (strm.avail_out < sizeof(outbuf) || strm.avail_in == 0) { nextSink(outbuf, sizeof(outbuf) - strm.avail_out); - strm.next_out = (char*)outbuf; + strm.next_out = reinterpret_cast<char*>(outbuf); strm.avail_out = sizeof(outbuf); } } @@ -205,12 +205,12 @@ ref<CompressionSink> makeDecompressionSink(const std::string& method, struct XzCompressionSink : CompressionSink { Sink& nextSink; - uint8_t outbuf[BUFSIZ]; + uint8_t outbuf[BUFSIZ]{}; lzma_stream strm = LZMA_STREAM_INIT; bool finished = false; XzCompressionSink(Sink& nextSink, bool parallel) : nextSink(nextSink) { - lzma_ret ret; + lzma_ret ret{}; bool done = false; if (parallel) { @@ -277,7 +277,7 @@ struct XzCompressionSink : CompressionSink { struct BzipCompressionSink : ChunkedCompressionSink { Sink& nextSink; - bz_stream strm; + bz_stream strm{}; bool finished = false; explicit BzipCompressionSink(Sink& nextSink) : nextSink(nextSink) { @@ -287,7 +287,7 @@ struct BzipCompressionSink : ChunkedCompressionSink { throw CompressionError("unable to initialise bzip2 encoder"); } - strm.next_out = (char*)outbuf; + strm.next_out = reinterpret_cast<char*>(outbuf); strm.avail_out = sizeof(outbuf); } @@ -316,7 +316,7 @@ struct BzipCompressionSink : ChunkedCompressionSink { if (strm.avail_out < sizeof(outbuf) || strm.avail_in == 0) { nextSink(outbuf, sizeof(outbuf) - strm.avail_out); - strm.next_out = (char*)outbuf; + strm.next_out = reinterpret_cast<char*>(outbuf); strm.avail_out = sizeof(outbuf); } } @@ -325,7 +325,7 @@ struct BzipCompressionSink : ChunkedCompressionSink { struct BrotliCompressionSink : ChunkedCompressionSink { Sink& nextSink; - uint8_t outbuf[BUFSIZ]; + uint8_t outbuf[BUFSIZ]{}; BrotliEncoderState* state; bool finished = false; |