aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/compression.cc
diff options
context:
space:
mode:
authorjade <lix@jade.fyi>2024-08-08 23:09:30 +0000
committerGerrit Code Review <gerrit@localhost>2024-08-08 23:09:30 +0000
commit9682ab4f3859ca60b0b4525452b27297e31cb751 (patch)
tree140cf7817556db65c80693f8b89a76c722b6d726 /src/libutil/compression.cc
parent757041c3e74787c755b3de826078968119f706d6 (diff)
parenta5f0954c290157875b4dfb79edcf651f55742dc2 (diff)
Merge changes I6358a393,I2d9f276b,Idd096dc9 into main
* changes: clang-tidy: write a lint for charptr_cast tree-wide: automated migration to charptr_cast clang-tidy: enforce the new rules
Diffstat (limited to 'src/libutil/compression.cc')
-rw-r--r--src/libutil/compression.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc
index 6b0fa9d15..5152a2146 100644
--- a/src/libutil/compression.cc
+++ b/src/libutil/compression.cc
@@ -1,3 +1,4 @@
+#include "charptr-cast.hh"
#include "compression.hh"
#include "tarfile.hh"
#include "signals.hh"
@@ -160,7 +161,7 @@ struct BrotliDecompressionSource : Source
size_t read(char * data, size_t len) override
{
- uint8_t * out = reinterpret_cast<uint8_t *>(data);
+ uint8_t * out = charptr_cast<uint8_t *>(data);
const auto * begin = out;
while (len && !BrotliDecoderIsFinished(state.get())) {
@@ -172,7 +173,7 @@ struct BrotliDecompressionSource : Source
} catch (EndOfFile &) {
break;
}
- next_in = reinterpret_cast<const uint8_t *>(buf.get());
+ next_in = charptr_cast<const uint8_t *>(buf.get());
}
if (!BrotliDecoderDecompressStream(
@@ -238,7 +239,7 @@ struct BrotliCompressionSink : ChunkedCompressionSink
void writeInternal(std::string_view data) override
{
- auto next_in = reinterpret_cast<const uint8_t *>(data.data());
+ auto next_in = charptr_cast<const uint8_t *>(data.data());
size_t avail_in = data.size();
uint8_t * next_out = outbuf;
size_t avail_out = sizeof(outbuf);