diff --git a/boost_test_schedule b/boost_test_schedule index 174330ac08c..ef622c72324 100644 --- a/boost_test_schedule +++ b/boost_test_schedule @@ -89,7 +89,6 @@ config_cache/test_transaction config_cache/test_define_loading config_cache/test_lead_spaces_loading config_filters/test_int_add_sub_filter -config_filters/test_int_positive_filter config_filters/test_int_signed_filter config_filters/test_without_attribute_filter filesystem/test_fs_game_path_reverse_engineering diff --git a/src/serialization/string_utils.cpp b/src/serialization/string_utils.cpp index f53342a6a84..279d03d8a1f 100644 --- a/src/serialization/string_utils.cpp +++ b/src/serialization/string_utils.cpp @@ -67,7 +67,7 @@ void trim(std::string_view& s) return; } //find_last_not_of never returns npos because !s.empty() - size_t first_to_trim = s.find_last_not_of(" \t\r\n") + 1; + std::size_t first_to_trim = s.find_last_not_of(" \t\r\n") + 1; s = s.substr(0, first_to_trim); } diff --git a/src/tests/test_config_filters.cpp b/src/tests/test_config_filters.cpp index 2788ed4fc47..52e2722292c 100644 --- a/src/tests/test_config_filters.cpp +++ b/src/tests/test_config_filters.cpp @@ -25,21 +25,6 @@ using namespace utils::config_filters; BOOST_AUTO_TEST_SUITE(config_filters) -BOOST_AUTO_TEST_CASE(test_int_positive_filter) -{ - // These can be used both as the filter and as the input to be filtered, - // but for the unsigned_matches_if_present function only one of them is - // a valid filter. - config minus_3 {"x", -3}; - config plus_3 {"x", 3}; - - BOOST_ASSERT(!unsigned_matches_if_present(minus_3, minus_3, "x")); - BOOST_ASSERT(unsigned_matches_if_present(plus_3, plus_3, "x")); - - BOOST_ASSERT(!unsigned_matches_if_present(minus_3, plus_3, "x")); - BOOST_ASSERT(!unsigned_matches_if_present(plus_3, minus_3, "x")); -} - BOOST_AUTO_TEST_CASE(test_int_signed_filter) { // These can be used both as the filter and as the input to be filtered. diff --git a/src/utils/config_filters.cpp b/src/utils/config_filters.cpp index fa35e1bec42..2763fb8263a 100644 --- a/src/utils/config_filters.cpp +++ b/src/utils/config_filters.cpp @@ -65,21 +65,6 @@ bool utils::config_filters::set_includes_if_present(const config& filter, const return true; } -bool utils::config_filters::unsigned_matches_if_present(const config& filter, const config& cfg, const std::string& attribute) -{ - if(!filter.has_attribute(attribute)) { - return true; - } - //Here, since no default variable is implemented, - //if the attribute is absent no checked value can match - //and false is automatically returned. - if(!cfg.has_attribute(attribute)) { - return false; - } - - return in_ranges(cfg[attribute].to_int(0), utils::parse_ranges_unsigned(filter[attribute].str())); -} - bool utils::config_filters::int_matches_if_present(const config& filter, const config& cfg, const std::string& attribute, utils::optional def) { if(!filter.has_attribute(attribute)) { diff --git a/src/utils/config_filters.hpp b/src/utils/config_filters.hpp index 3d3a8f9dd99..ff50eb1785d 100644 --- a/src/utils/config_filters.hpp +++ b/src/utils/config_filters.hpp @@ -43,14 +43,6 @@ bool bool_matches_if_present(const config& filter, const config& cfg, const std: bool double_matches_if_present(const config& filter, const config& cfg, const std::string& attribute, utils::optional def = utils::nullopt); bool int_matches_if_present(const config& filter, const config& cfg, const std::string& attribute, utils::optional def = utils::nullopt); -/** - * Restricts filters to only looking for values that are zero or more. - * - * A filter such as "-1-10" or "-10--1,1-10" is considered invalid and never matches anything, not - * even a positive value that would be accepted by a stricter subset of the filter. - */ -bool unsigned_matches_if_present(const config& filter, const config& cfg, const std::string& attribute); - /** * Supports filters using "add" and "sub" attributes, for example a filter `add=1` matching a cfg containing either * `add=1` or `sub=-1`; this assumes that code elsewhere has already checked that cfg contains at most one of those