diff options
author | Kane York <kanepyork@gmail.com> | 2020-08-02T00·17-0700 |
---|---|---|
committer | kanepyork <rikingcoding@gmail.com> | 2020-08-08T22·16+0000 |
commit | 1de00e6c42ee6beaaa490104888ef09be1d4a0d4 (patch) | |
tree | d98a37ae13525510e3b76feed56b3865360374d1 /third_party/nix/src/libstore/build.cc | |
parent | 053a1380023591e8eb3f514b4214226c95da207d (diff) |
chore(3p/nix): apply google-readability-casting r/1619
Command run: jq <compile_commands.json -r 'map(.file)|.[]' | grep -v '/generated/' | parallel clang-tidy -p compile_commands.json -checks=-*,google-readability-casting --fix Manual fixes applied in src/nix-env/nix-env.cc, src/libstore/store-api.cc Change-Id: I406b4be9368c557ca59329bf6f7002704e955f8d Reviewed-on: https://cl.tvl.fyi/c/depot/+/1557 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi> Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'third_party/nix/src/libstore/build.cc')
-rw-r--r-- | third_party/nix/src/libstore/build.cc | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/third_party/nix/src/libstore/build.cc b/third_party/nix/src/libstore/build.cc index 9bff3b8345df..c48e1abd722a 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<unsigned long long>(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<unsigned long long>(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<DerivationGoal*>(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<char*>( + 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<std::chrono::seconds>(nearest - before) - .count()); + 1L, static_cast<long>(std::chrono::duration_cast<std::chrono::seconds>( + 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<std::chrono::seconds>( - lastWokenUp + std::chrono::seconds(settings.pollInterval) - before) - .count()); + 1L, static_cast<long>(std::chrono::duration_cast<std::chrono::seconds>( + 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<char*>(buffer.data()), rd); j->lastOutput = after; goal->handleChildOutput(k, data); } |