From 370ac940dd7816ad4052fafa4e0f8d17784fa16b Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Thu, 1 Aug 2024 13:42:02 -0700 Subject: refactor: make HashType and Base enum classes for type safety Change-Id: I9fbd55a9d50464a56fe11cb42a06a206914150d8 --- src/libstore/build/worker.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstore/build/worker.cc') diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index 84727a377..04f0575b1 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -580,7 +580,7 @@ bool Worker::pathContentsGood(const StorePath & path) res = false; else { HashResult current = hashPath(info->narHash.type, store.printStorePath(path)); - Hash nullHash(htSHA256); + Hash nullHash(HashType::SHA256); res = info->narHash == nullHash || info->narHash == current.first; } pathContentsGoodCache.insert_or_assign(path, res); -- cgit v1.2.3 From e34833c0253340f47dc0add8609eb86cf9cba19b Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Sun, 4 Aug 2024 20:19:58 -0700 Subject: tree-wide: fix a pile of lints This: - Converts a bunch of C style casts into C++ casts. - Removes some very silly pointer subtraction code (which is no more or less busted on i686 than it began) - Fixes some "technically UB" that never had to be UB in the first place. - Makes finally follow the noexcept status of the inner function. Maybe in the future we should ban the function from not being noexcept, but that is not today. - Makes various locally-used exceptions inherit from std::exception. Change-Id: I22e66972602604989b5e494fd940b93e0e6e9297 --- src/libstore/build/worker.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libstore/build/worker.cc') diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index 04f0575b1..135cfecf5 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -4,7 +4,7 @@ #include "drv-output-substitution-goal.hh" #include "local-derivation-goal.hh" #include "signals.hh" -#include "hook-instance.hh" +#include "hook-instance.hh" // IWYU pragma: keep #include @@ -529,7 +529,7 @@ void Worker::waitForInput() } else { printMsg(lvlVomit, "%1%: read %2% bytes", goal->getName(), rd); - std::string_view data((char *) buffer.data(), rd); + std::string_view data(reinterpret_cast(buffer.data()), rd); j->lastOutput = after; handleWorkResult(goal, goal->handleChildOutput(k, data)); } -- cgit v1.2.3