fix: cast explicitly to avoid un/signed comparison

This commit is contained in:
ToruNiina
2023-02-12 16:44:18 +09:00
parent 15346114ef
commit 418bfe9117

View File

@@ -68,7 +68,8 @@ parse_binary_integer(location& loc)
assert(str.empty() || str.front() == '1');
// since toml11 uses int64_t, 64bit (unsigned) input cannot be read.
if(64 + std::count(str.begin(), str.end(), '_') <= str.size())
const auto max_length = 63 + std::count(str.begin(), str.end(), '_');
if(static_cast<std::string::size_type>(max_length) < str.size())
{
loc.reset(first);
return err(format_underline("toml::parse_binary_integer: "