mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
Use enum struct
and drop prefixes
This does a few enums; the rest will be gotten in subsequent commits.
This commit is contained in:
parent
eb1911e277
commit
87b32bab05
57 changed files with 382 additions and 354 deletions
|
@ -20,7 +20,7 @@ void DerivationOutput::parseHashInfo(bool & recursive, Hash & hash) const
|
|||
}
|
||||
|
||||
HashType hashType = parseHashType(algo);
|
||||
if (hashType == htUnknown)
|
||||
if (hashType == HashType::Unknown)
|
||||
throw Error("unknown hash algorithm '%s'", algo);
|
||||
|
||||
hash = Hash(this->hash, hashType);
|
||||
|
@ -364,7 +364,7 @@ Hash hashDerivationModulo(Store & store, const Derivation & drv, bool maskOutput
|
|||
/* Return a fixed hash for fixed-output derivations. */
|
||||
if (drv.isFixedOutput()) {
|
||||
DerivationOutputs::const_iterator i = drv.outputs.begin();
|
||||
return hashString(htSHA256, "fixed:out:"
|
||||
return hashString(HashType::SHA256, "fixed:out:"
|
||||
+ i->second.hashAlgo + ":"
|
||||
+ i->second.hash + ":"
|
||||
+ store.printStorePath(i->second.path));
|
||||
|
@ -380,10 +380,10 @@ Hash hashDerivationModulo(Store & store, const Derivation & drv, bool maskOutput
|
|||
h = drvHashes.insert_or_assign(i.first.clone(), hashDerivationModulo(store,
|
||||
readDerivation(store, store.toRealPath(store.printStorePath(i.first))), false)).first;
|
||||
}
|
||||
inputs2.insert_or_assign(h->second.to_string(Base16, false), i.second);
|
||||
inputs2.insert_or_assign(h->second.to_string(Base::Base16, false), i.second);
|
||||
}
|
||||
|
||||
return hashString(htSHA256, drv.unparse(store, maskOutputs, &inputs2));
|
||||
return hashString(HashType::SHA256, drv.unparse(store, maskOutputs, &inputs2));
|
||||
}
|
||||
|
||||
|
||||
|
@ -453,7 +453,7 @@ void writeDerivation(Sink & out, const Store & store, const BasicDerivation & dr
|
|||
std::string hashPlaceholder(const std::string & outputName)
|
||||
{
|
||||
// FIXME: memoize?
|
||||
return "/" + hashString(htSHA256, "nix-output:" + outputName).to_string(Base32, false);
|
||||
return "/" + hashString(HashType::SHA256, "nix-output:" + outputName).to_string(Base::Base32, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue