Additional none_of conversion (#1113)

This commit is contained in:
Rosen Penev 2023-08-15 07:21:43 -07:00 committed by GitHub
parent 574604765f
commit f69c21c8e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,14 +58,8 @@ namespace
static constexpr std::array invalidKeys { "ID3", "TAG", "OGGS", "MP+" };
// only allow printable ASCII including space (32..126)
for(auto it = key.begin(); it != key.end(); ++it) {
const int c = static_cast<unsigned char>(*it);
if(c < 32 || c > 126)
return false;
}
return std::none_of(invalidKeys.begin(), invalidKeys.end(), [upperKey = String(key).upper()](auto k) { return upperKey == k; });
return std::none_of(key.begin(), key.end(), [](unsigned char c) { return c < 32 || c > 126; })
&& std::none_of(invalidKeys.begin(), invalidKeys.end(), [upperKey = String(key).upper()](auto k) { return upperKey == k; });
}
} // namespace