return (Type.empty() || Hash.empty());
}
/*}}}*/
+APT_PURE bool HashString::usable() const /*{{{*/
+{
+ return (
+ (Type != "Checksum-FileSize") &&
+ (Type != "MD5Sum")
+ );
+}
+ /*}}}*/
std::string HashString::toStr() const /*{{{*/
{
return Type + ":" + Hash;
std::string const forcedType = _config->Find("Acquire::ForceHash", "");
if (forcedType.empty() == true)
{
- // FileSize alone isn't usable
- for (std::vector<HashString>::const_iterator hs = list.begin(); hs != list.end(); ++hs)
- if (hs->HashType() != "Checksum-FileSize")
- return true;
+ // See if there is at least one usable hash
+ for (auto const &hs: list)
+ if (hs.usable())
+ return true;
return false;
}
return find(forcedType) != NULL;