1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

treewide: Rename hashBase to hashFormat

hashBase is ambiguous, since it's not about the digital bases, but about
the format of hashes. Base16, Base32 and Base64 are all character maps
for binary encoding.

Rename the enum Base to HashFormat.

Rename variables of type HashFormat from [hash]Base to hashFormat,
including CmdHashBase::hashFormat and CmdToBase::hashFormat.
This commit is contained in:
Yueh-Shun Li 2023-10-10 18:53:01 +08:00
parent aff177d860
commit 838c70f621
6 changed files with 41 additions and 41 deletions

View file

@ -115,14 +115,14 @@ std::string printHash16or32(const Hash & hash)
}
std::string Hash::to_string(Base base, bool includeType) const
std::string Hash::to_string(HashFormat hashFormat, bool includeType) const
{
std::string s;
if (base == SRI || includeType) {
if (hashFormat == SRI || includeType) {
s += printHashType(type);
s += base == SRI ? '-' : ':';
s += hashFormat == SRI ? '-' : ':';
}
switch (base) {
switch (hashFormat) {
case Base16:
s += printHash16(*this);
break;