aboutsummaryrefslogtreecommitdiff
path: root/src/nix/prefetch.cc
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-08-01 13:42:02 -0700
committerJade Lovelace <lix@jade.fyi>2024-08-08 14:53:17 -0700
commit370ac940dd7816ad4052fafa4e0f8d17784fa16b (patch)
tree8b44ebb7e8f4e218c1b4e57edfc6aaac212b90fa /src/nix/prefetch.cc
parentf3ef0899c744ff5256414c8539c75e798a058ee0 (diff)
refactor: make HashType and Base enum classes for type safety
Change-Id: I9fbd55a9d50464a56fe11cb42a06a206914150d8
Diffstat (limited to 'src/nix/prefetch.cc')
-rw-r--r--src/nix/prefetch.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nix/prefetch.cc b/src/nix/prefetch.cc
index 13d94d645..0b04a04e6 100644
--- a/src/nix/prefetch.cc
+++ b/src/nix/prefetch.cc
@@ -133,7 +133,7 @@ std::tuple<StorePath, Hash> prefetchFile(
static int main_nix_prefetch_url(int argc, char * * argv)
{
{
- HashType ht = htSHA256;
+ HashType ht = HashType::SHA256;
std::vector<std::string> args;
bool printPath = getEnv("PRINT_PATH") == "1";
bool fromExpr = false;
@@ -256,7 +256,7 @@ struct CmdStorePrefetchFile : StoreCommand, MixJSON
bool executable = false;
bool unpack = false;
std::optional<std::string> name;
- HashType hashType = htSHA256;
+ HashType hashType = HashType::SHA256;
std::optional<Hash> expectedHash;
CmdStorePrefetchFile()
@@ -316,13 +316,13 @@ struct CmdStorePrefetchFile : StoreCommand, MixJSON
if (json) {
auto res = nlohmann::json::object();
res["storePath"] = store->printStorePath(storePath);
- res["hash"] = hash.to_string(SRI, true);
+ res["hash"] = hash.to_string(Base::SRI, true);
logger->cout(res.dump());
} else {
notice("Downloaded '%s' to '%s' (hash '%s').",
url,
store->printStorePath(storePath),
- hash.to_string(SRI, true));
+ hash.to_string(Base::SRI, true));
}
}
};