about summary refs log tree commit diff
path: root/third_party/nix/src/libutil/serialise.cc
diff options
context:
space:
mode:
authorKane York <kanepyork@gmail.com>2020-08-01T22·32-0700
committerkanepyork <rikingcoding@gmail.com>2020-08-01T22·45+0000
commit72fc2fd27e8ca9ddd6dad7f1c8f508e115aa2b60 (patch)
treeeacd58ae5e0de9ffaadc265b8fd417f2f62d0433 /third_party/nix/src/libutil/serialise.cc
parentcc3c45f739133162c840d500c0d633f46a524e06 (diff)
fix(3p/nix): revert "apply all clang-tidy fixes" r/1534
This reverts commit ef54f5da9fa30b5c302f2a49595ee5d041f9706a.

Resolved conflicts:
	third_party/nix/src/libexpr/eval.cc
	third_party/nix/src/libstore/builtins/fetchurl.cc
	third_party/nix/src/libstore/references.cc
	third_party/nix/src/libutil/hash.cc
	third_party/nix/src/nix-daemon/nix-daemon.cc

Change-Id: Ib9cf6e96a79a23bde3983579ced3f92e530cb011
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1547
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'third_party/nix/src/libutil/serialise.cc')
-rw-r--r--third_party/nix/src/libutil/serialise.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/third_party/nix/src/libutil/serialise.cc b/third_party/nix/src/libutil/serialise.cc
index 26ab9be959dc..d02a0205af0d 100644
--- a/third_party/nix/src/libutil/serialise.cc
+++ b/third_party/nix/src/libutil/serialise.cc
@@ -93,10 +93,10 @@ std::string Source::drain() {
   std::string s;
   std::vector<unsigned char> buf(8192);
   while (true) {
-    size_t n = 0;
+    size_t n;
     try {
       n = read(buf.data(), buf.size());
-      s.append(reinterpret_cast<char*>(buf.data()), n);
+      s.append((char*)buf.data(), n);
     } catch (EndOfFile&) {
       break;
     }
@@ -126,10 +126,10 @@ size_t BufferedSource::read(unsigned char* data, size_t len) {
 bool BufferedSource::hasData() { return bufPosOut < bufPosIn; }
 
 size_t FdSource::readUnbuffered(unsigned char* data, size_t len) {
-  ssize_t n = 0;
+  ssize_t n;
   do {
     checkInterrupt();
-    n = ::read(fd, reinterpret_cast<char*>(data), len);
+    n = ::read(fd, (char*)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(reinterpret_cast<char*>(data), len, pos);
+  size_t n = s.copy((char*)data, len, pos);
   pos += n;
   return n;
 }
@@ -179,7 +179,7 @@ std::unique_ptr<Source> sinkToSource(const std::function<void(Sink&)>& 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(reinterpret_cast<const char*>(data), len));
+              yield(std::string((const char*)data, len));
             }
           });
           fun(sink);
@@ -200,7 +200,7 @@ std::unique_ptr<Source> sinkToSource(const std::function<void(Sink&)>& fun,
       }
 
       auto n = std::min(cur.size() - pos, len);
-      memcpy(data, reinterpret_cast<unsigned char*>(cur.data()) + pos, n);
+      memcpy(data, (unsigned char*)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(reinterpret_cast<const unsigned char*>(s.data()), s.size(), sink);
+  writeString((const unsigned char*)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(reinterpret_cast<unsigned char*>(res.data()), len);
+  source((unsigned char*)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(reinterpret_cast<const char*>(data), len);
+  s->append((const char*)data, len);
 }
 
 }  // namespace nix