From 1de00e6c42ee6beaaa490104888ef09be1d4a0d4 Mon Sep 17 00:00:00 2001 From: Kane York Date: Sat, 1 Aug 2020 17:17:44 -0700 Subject: chore(3p/nix): apply google-readability-casting Command run: jq Reviewed-by: tazjin --- third_party/nix/src/libutil/serialise.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'third_party/nix/src/libutil/serialise.cc') diff --git a/third_party/nix/src/libutil/serialise.cc b/third_party/nix/src/libutil/serialise.cc index d02a0205af0d..288255089bb6 100644 --- a/third_party/nix/src/libutil/serialise.cc +++ b/third_party/nix/src/libutil/serialise.cc @@ -96,7 +96,7 @@ std::string Source::drain() { size_t n; try { n = read(buf.data(), buf.size()); - s.append((char*)buf.data(), n); + s.append(reinterpret_cast(buf.data()), n); } catch (EndOfFile&) { break; } @@ -129,7 +129,7 @@ size_t FdSource::readUnbuffered(unsigned char* data, size_t len) { ssize_t n; do { checkInterrupt(); - n = ::read(fd, (char*)data, len); + n = ::read(fd, reinterpret_cast(data), len); } while (n == -1 && errno == EINTR); if (n == -1) { _good = false; @@ -149,7 +149,7 @@ size_t StringSource::read(unsigned char* data, size_t len) { if (pos == s.size()) { throw EndOfFile("end of string reached"); } - size_t n = s.copy((char*)data, len, pos); + size_t n = s.copy(reinterpret_cast(data), len, pos); pos += n; return n; } @@ -179,7 +179,7 @@ std::unique_ptr sinkToSource(const std::function& fun, coro = coro_t::pull_type([&](coro_t::push_type& yield) { LambdaSink sink([&](const unsigned char* data, size_t len) { if (len != 0u) { - yield(std::string((const char*)data, len)); + yield(std::string(reinterpret_cast(data), len)); } }); fun(sink); @@ -200,7 +200,7 @@ std::unique_ptr sinkToSource(const std::function& fun, } auto n = std::min(cur.size() - pos, len); - memcpy(data, (unsigned char*)cur.data() + pos, n); + memcpy(data, reinterpret_cast(cur.data()) + pos, n); pos += n; return n; @@ -225,7 +225,7 @@ void writeString(const unsigned char* buf, size_t len, Sink& sink) { } Sink& operator<<(Sink& sink, const std::string& s) { - writeString((const unsigned char*)s.data(), s.size(), sink); + writeString(reinterpret_cast(s.data()), s.size(), sink); return sink; } @@ -276,7 +276,7 @@ std::string readString(Source& source, size_t max) { throw SerialisationError("string is too long"); } std::string res(len, 0); - source((unsigned char*)res.data(), len); + source(reinterpret_cast(res.data()), len); readPadding(len, source); return res; } @@ -305,7 +305,7 @@ void StringSink::operator()(const unsigned char* data, size_t len) { warnLargeDump(); warned = true; } - s->append((const char*)data, len); + s->append(reinterpret_cast(data), len); } } // namespace nix -- cgit 1.4.1