aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops.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/libexpr/primops.cc
parentf3ef0899c744ff5256414c8539c75e798a058ee0 (diff)
refactor: make HashType and Base enum classes for type safety
Change-Id: I9fbd55a9d50464a56fe11cb42a06a206914150d8
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 561492f86..228e4e1ba 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -1336,7 +1336,7 @@ drvName, Bindings * attrs, Value & v)
state.error<EvalError>("derivation cannot be both content-addressed and impure")
.atPos(v).debugThrow();
- auto ht = parseHashTypeOpt(outputHashAlgo).value_or(htSHA256);
+ auto ht = parseHashTypeOpt(outputHashAlgo).value_or(HashType::SHA256);
auto method = ingestionMethod.value_or(FileIngestionMethod::Recursive);
for (auto & i : outputs) {
@@ -1764,7 +1764,7 @@ static void prim_hashFile(EvalState & state, const PosIdx pos, Value * * args, V
auto path = realisePath(state, pos, *args[1]);
- v.mkString(hashString(*ht, path.readFile()).to_string(Base16, false));
+ v.mkString(hashString(*ht, path.readFile()).to_string(Base::Base16, false));
}
static RegisterPrimOp primop_hashFile({
@@ -2346,7 +2346,7 @@ static void prim_path(EvalState & state, const PosIdx pos, Value * * args, Value
else if (n == "recursive")
method = FileIngestionMethod { state.forceBool(*attr.value, attr.pos, "while evaluating the `recursive` attribute passed to builtins.path") };
else if (n == "sha256")
- expectedHash = newHashAllowEmpty(state.forceStringNoCtx(*attr.value, attr.pos, "while evaluating the `sha256` attribute passed to builtins.path"), htSHA256);
+ expectedHash = newHashAllowEmpty(state.forceStringNoCtx(*attr.value, attr.pos, "while evaluating the `sha256` attribute passed to builtins.path"), HashType::SHA256);
else
state.error<EvalError>(
"unsupported argument '%1%' to 'addPath'",
@@ -3861,7 +3861,7 @@ static void prim_hashString(EvalState & state, const PosIdx pos, Value * * args,
NixStringContext context; // discarded
auto s = state.forceString(*args[1], context, pos, "while evaluating the second argument passed to builtins.hashString");
- v.mkString(hashString(*ht, s).to_string(Base16, false));
+ v.mkString(hashString(*ht, s).to_string(Base::Base16, false));
}
static RegisterPrimOp primop_hashString({