aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/compression.cc
diff options
context:
space:
mode:
authorjade <lix@jade.fyi>2024-08-08 22:43:10 +0000
committerGerrit Code Review <gerrit@localhost>2024-08-08 22:43:10 +0000
commit757041c3e74787c755b3de826078968119f706d6 (patch)
tree9f3ea456c45130fb3a0910f9a9be9f60a74577cc /src/libutil/compression.cc
parente03cd8b3a6f70c60f359fd683c2b25f8eba4da0d (diff)
parent4ed8461cacced97717bf9a7525e12ba69fe168c0 (diff)
Merge changes I526cceed,Ia4e2f1fa,I22e66972,I9fbd55a9,Ifca22e44 into main
* changes: sqlite: add a Use::fromStrNullable util: implement charptr_cast tree-wide: fix a pile of lints refactor: make HashType and Base enum classes for type safety build: integrate clang-tidy into CI
Diffstat (limited to 'src/libutil/compression.cc')
-rw-r--r--src/libutil/compression.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc
index 773617031..6b0fa9d15 100644
--- a/src/libutil/compression.cc
+++ b/src/libutil/compression.cc
@@ -119,8 +119,8 @@ private:
static ssize_t callback_write(struct archive * archive, void * _self, const void * buffer, size_t length)
{
- auto self = (ArchiveCompressionSink *) _self;
- self->nextSink({(const char *) buffer, length});
+ auto self = static_cast<ArchiveCompressionSink *>(_self);
+ self->nextSink({static_cast<const char *>(buffer), length});
return length;
}
};
@@ -160,7 +160,7 @@ struct BrotliDecompressionSource : Source
size_t read(char * data, size_t len) override
{
- uint8_t * out = (uint8_t *) data;
+ uint8_t * out = reinterpret_cast<uint8_t *>(data);
const auto * begin = out;
while (len && !BrotliDecoderIsFinished(state.get())) {
@@ -172,7 +172,7 @@ struct BrotliDecompressionSource : Source
} catch (EndOfFile &) {
break;
}
- next_in = (const uint8_t *) buf.get();
+ next_in = reinterpret_cast<const uint8_t *>(buf.get());
}
if (!BrotliDecoderDecompressStream(
@@ -238,7 +238,7 @@ struct BrotliCompressionSink : ChunkedCompressionSink
void writeInternal(std::string_view data) override
{
- auto next_in = (const uint8_t *) data.data();
+ auto next_in = reinterpret_cast<const uint8_t *>(data.data());
size_t avail_in = data.size();
uint8_t * next_out = outbuf;
size_t avail_out = sizeof(outbuf);
@@ -254,7 +254,7 @@ struct BrotliCompressionSink : ChunkedCompressionSink
throw CompressionError("error while compressing brotli compression");
if (avail_out < sizeof(outbuf) || avail_in == 0) {
- nextSink({(const char *) outbuf, sizeof(outbuf) - avail_out});
+ nextSink({reinterpret_cast<const char *>(outbuf), sizeof(outbuf) - avail_out});
next_out = outbuf;
avail_out = sizeof(outbuf);
}