forked from lix-project/lix
Rename fromSRI to parseSRI for constistency
This commit is contained in:
parent
f61bc45d19
commit
9462d8a50b
|
@ -35,7 +35,7 @@ std::unique_ptr<Input> inputFromAttrs(const Attrs & attrs)
|
||||||
auto res = inputScheme->inputFromAttrs(attrs2);
|
auto res = inputScheme->inputFromAttrs(attrs2);
|
||||||
if (res) {
|
if (res) {
|
||||||
if (auto narHash = maybeGetStrAttr(attrs, "narHash"))
|
if (auto narHash = maybeGetStrAttr(attrs, "narHash"))
|
||||||
res->narHash = Hash::fromSRI(*narHash);
|
res->narHash = Hash::parseSRI(*narHash);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,13 +242,13 @@ struct TarballInputScheme : InputScheme
|
||||||
|
|
||||||
auto hash = input->url.query.find("hash");
|
auto hash = input->url.query.find("hash");
|
||||||
if (hash != input->url.query.end()) {
|
if (hash != input->url.query.end()) {
|
||||||
input->hash = Hash::fromSRI(hash->second);
|
input->hash = Hash::parseSRI(hash->second);
|
||||||
input->url.query.erase(hash);
|
input->url.query.erase(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto narHash = input->url.query.find("narHash");
|
auto narHash = input->url.query.find("narHash");
|
||||||
if (narHash != input->url.query.end()) {
|
if (narHash != input->url.query.end()) {
|
||||||
input->narHash = Hash::fromSRI(narHash->second);
|
input->narHash = Hash::parseSRI(narHash->second);
|
||||||
input->url.query.erase(narHash);
|
input->url.query.erase(narHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ std::string Hash::to_string(Base base, bool includeType) const
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
Hash Hash::fromSRI(std::string_view original) {
|
Hash Hash::parseSRI(std::string_view original) {
|
||||||
auto rest = original;
|
auto rest = original;
|
||||||
|
|
||||||
// Parse the has type before the separater, if there was one.
|
// Parse the has type before the separater, if there was one.
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct Hash
|
||||||
// prefix parsed separately; non SRI hash
|
// prefix parsed separately; non SRI hash
|
||||||
static Hash parseAnyUnprefixed(std::string_view s, HashType type);
|
static Hash parseAnyUnprefixed(std::string_view s, HashType type);
|
||||||
|
|
||||||
static Hash fromSRI(std::string_view original);
|
static Hash parseSRI(std::string_view original);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// type must be provided, s must not include <type> prefix
|
// type must be provided, s must not include <type> prefix
|
||||||
|
|
Loading…
Reference in a new issue