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

Use std::string_view in a few more places

This commit is contained in:
John Ericson 2020-06-12 21:12:36 +00:00
parent 2853ba4ab2
commit f6f01416b7
6 changed files with 12 additions and 12 deletions

View file

@ -125,7 +125,7 @@ std::string Hash::to_string(Base base, bool includeType) const
}
Hash::Hash(const std::string & s, HashType type)
Hash::Hash(std::string_view s, HashType type)
: type(type)
{
size_t pos = 0;
@ -194,7 +194,7 @@ Hash::Hash(const std::string & s, HashType type)
}
else if (isSRI || size == base64Len()) {
auto d = base64Decode(std::string(s, pos));
auto d = base64Decode(s.substr(pos));
if (d.size() != hashSize)
throw BadHash("invalid %s hash '%s'", isSRI ? "SRI" : "base-64", s);
assert(hashSize);