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/libstore/build.cc | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'third_party/nix/src/libstore/build.cc') diff --git a/third_party/nix/src/libstore/build.cc b/third_party/nix/src/libstore/build.cc index 9bff3b8345..c48e1abd72 100644 --- a/third_party/nix/src/libstore/build.cc +++ b/third_party/nix/src/libstore/build.cc @@ -1589,11 +1589,13 @@ MakeError(NotDeterministic, BuildError) 8ULL * 1024 * 1024; // FIXME: make configurable struct statvfs st; if (statvfs(worker.store.realStoreDir.c_str(), &st) == 0 && - (unsigned long long)st.f_bavail * st.f_bsize < required) { + static_cast(st.f_bavail) * st.f_bsize < + required) { diskFull = true; } if (statvfs(tmpDir.c_str(), &st) == 0 && - (unsigned long long)st.f_bavail * st.f_bsize < required) { + static_cast(st.f_bavail) * st.f_bsize < + required) { diskFull = true; } #endif @@ -1832,7 +1834,7 @@ void chmod_(const Path& path, mode_t mode) { } int childEntry(void* arg) { - ((DerivationGoal*)arg)->runChild(); + (static_cast(arg))->runChild(); return 1; } @@ -2361,9 +2363,9 @@ void DerivationGoal::startBuilder() { } size_t stackSize = 1 * 1024 * 1024; - char* stack = - (char*)mmap(nullptr, stackSize, PROT_WRITE | PROT_READ, - MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0); + char* stack = static_cast( + mmap(nullptr, stackSize, PROT_WRITE | PROT_READ, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0)); if (stack == MAP_FAILED) { throw SysError("allocating stack"); } @@ -4483,9 +4485,9 @@ void Worker::waitForInput() { } if (nearest != steady_time_point::max()) { timeout.tv_sec = std::max( - 1L, - (long)std::chrono::duration_cast(nearest - before) - .count()); + 1L, static_cast(std::chrono::duration_cast( + nearest - before) + .count())); useTimeout = true; } @@ -4500,10 +4502,11 @@ void Worker::waitForInput() { lastWokenUp = before; } timeout.tv_sec = std::max( - 1L, - (long)std::chrono::duration_cast( - lastWokenUp + std::chrono::seconds(settings.pollInterval) - before) - .count()); + 1L, static_cast(std::chrono::duration_cast( + lastWokenUp + + std::chrono::seconds(settings.pollInterval) - + before) + .count())); } else { lastWokenUp = steady_time_point::min(); } @@ -4568,7 +4571,7 @@ void Worker::waitForInput() { } } else { DLOG(INFO) << goal->getName() << ": read " << rd << " bytes"; - std::string data((char*)buffer.data(), rd); + std::string data(reinterpret_cast(buffer.data()), rd); j->lastOutput = after; goal->handleChildOutput(k, data); } -- cgit 1.4.1