1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

Merge remote-tracking branch 'upstream/master' into hash-always-has-type

This commit is contained in:
John Ericson 2020-06-29 17:56:46 +00:00
commit 987a4a0be9
16 changed files with 96 additions and 47 deletions

View file

@ -104,6 +104,7 @@ static string printHash32(const Hash & hash)
string printHash16or32(const Hash & hash)
{
assert(hash.type);
return hash.to_string(hash.type == htMD5 ? Base16 : Base32, false);
}
@ -365,14 +366,15 @@ HashType parseHashType(std::string_view s)
string printHashType(HashType ht)
{
switch (ht) {
case htMD5: return "md5"; break;
case htSHA1: return "sha1"; break;
case htSHA256: return "sha256"; break;
case htSHA512: return "sha512"; break;
case htMD5: return "md5";
case htSHA1: return "sha1";
case htSHA256: return "sha256";
case htSHA512: return "sha512";
default:
// illegal hash type enum value internally, as opposed to external input
// which should be validated with nice error message.
abort();
}
// illegal hash type enum value internally, as opposed to external input
// which should be validated with nice error message.
abort();
}
}