1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-01 04:18:00 +02:00

Revert the enum struct change

Not a regular git revert as there have been many merges and things.
This commit is contained in:
John Ericson 2020-06-18 22:09:22 +00:00
parent bbbf3602a3
commit 15abb2aa2b
68 changed files with 418 additions and 457 deletions

View file

@ -10,12 +10,7 @@ namespace nix {
MakeError(BadHash, Error);
enum struct HashType : char {
MD5,
SHA1,
SHA256,
SHA512,
};
enum HashType : char { htMD5, htSHA1, htSHA256, htSHA512 };
const int md5HashSize = 16;
@ -25,12 +20,7 @@ const int sha512HashSize = 64;
extern const string base32Chars;
enum struct Base {
Base64,
Base32,
Base16,
SRI,
};
enum Base : int { Base64, Base32, Base16, SRI };
struct Hash
@ -97,14 +87,14 @@ struct Hash
std::string gitRev() const
{
assert(type == HashType::SHA1);
return to_string(Base::Base16, false);
assert(type == htSHA1);
return to_string(Base16, false);
}
std::string gitShortRev() const
{
assert(type == HashType::SHA1);
return std::string(to_string(Base::Base16, false), 0, 7);
assert(type == htSHA1);
return std::string(to_string(Base16, false), 0, 7);
}
};