From: Daniel Arndt Date: Tue, 16 May 2023 22:06:52 +0000 (-0400) Subject: Use std::strlen X-Git-Tag: v9.5.0-rc1~221^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2dc9063616a692627908c0dbf6314c06fc3fde26;p=dealii.git Use std::strlen --- diff --git a/source/base/patterns.cc b/source/base/patterns.cc index e76155a937..83a0486134 100644 --- a/source/base/patterns.cc +++ b/source/base/patterns.cc @@ -315,18 +315,18 @@ namespace Patterns { std::istringstream is(description); - if (is.str().size() > strlen(description_init) + 1) + if (is.str().size() > std::strlen(description_init) + 1) { // TODO: verify that description matches the pattern "^\[Integer // range \d+\.\.\.\d+\]$" int lower_bound, upper_bound; - is.ignore(strlen(description_init) + strlen(" range ")); + is.ignore(std::strlen(description_init) + std::strlen(" range ")); if (!(is >> lower_bound)) return std::make_unique(); - is.ignore(strlen("...")); + is.ignore(std::strlen("...")); if (!(is >> upper_bound)) return std::make_unique(); @@ -780,8 +780,9 @@ namespace Patterns { unsigned int min_elements = 0, max_elements = 0; - std::string::const_iterator it = - description.begin() + strlen(description_init) + strlen(" of <"); + std::string::const_iterator it = description.begin() + + std::strlen(description_init) + + std::strlen(" of <"); int n_open_angular = 1; auto tmp_it = it - 1; @@ -803,15 +804,15 @@ namespace Patterns pattern_factory(base_pattern_string)); std::istringstream is( - std::string(tmp_it + strlen(" of length "), description.end())); + std::string(tmp_it + std::strlen(" of length "), description.end())); if (!(is >> min_elements)) return std::make_unique(*base_pattern); - is.ignore(strlen("...")); + is.ignore(std::strlen("...")); if (!(is >> max_elements)) return std::make_unique(*base_pattern, min_elements); - is.ignore(strlen(" (inclusive) separated by <")); + is.ignore(std::strlen(" (inclusive) separated by <")); std::string separator; if (!is.eof()) std::getline(is, separator, '>'); @@ -988,7 +989,7 @@ namespace Patterns unsigned int min_elements = 0, max_elements = 0; std::istringstream is(description); - is.ignore(strlen(description_init) + strlen(" of <")); + is.ignore(std::strlen(description_init) + std::strlen(" of <")); std::string key; std::getline(is, key, '>'); @@ -1003,17 +1004,17 @@ namespace Patterns std::unique_ptr key_pattern(pattern_factory(key)); std::unique_ptr value_pattern(pattern_factory(value)); - is.ignore(strlen(" of length ")); + is.ignore(std::strlen(" of length ")); if (!(is >> min_elements)) return std::make_unique(*key_pattern, *value_pattern); - is.ignore(strlen("...")); + is.ignore(std::strlen("...")); if (!(is >> max_elements)) return std::make_unique(*key_pattern, *value_pattern, min_elements); - is.ignore(strlen(" (inclusive) separated by <")); + is.ignore(std::strlen(" (inclusive) separated by <")); std::string separator; if (!is.eof()) std::getline(is, separator, '>'); @@ -1194,7 +1195,7 @@ namespace Patterns std::vector> patterns; std::istringstream is(description); - is.ignore(strlen(description_init) + strlen(" of <")); + is.ignore(std::strlen(description_init) + std::strlen(" of <")); std::string len; std::getline(is, len, '>'); @@ -1203,7 +1204,7 @@ namespace Patterns ExcMessage("Provide at least 1 element in the tuple.")); patterns.resize(n_elements); - is.ignore(strlen(" elements <")); + is.ignore(std::strlen(" elements <")); std::string element; std::getline(is, element, '>'); @@ -1211,12 +1212,12 @@ namespace Patterns for (unsigned int i = 1; i < n_elements; ++i) { - is.ignore(strlen(", <")); + is.ignore(std::strlen(", <")); std::getline(is, element, '>'); patterns[i] = pattern_factory(element); } - is.ignore(strlen(" separated by <")); + is.ignore(std::strlen(" separated by <")); std::string separator; if (!is.eof()) @@ -1590,7 +1591,7 @@ namespace Patterns std::string file_type; FileType type; - is.ignore(strlen(description_init) + strlen(" (Type:")); + is.ignore(std::strlen(description_init) + std::strlen(" (Type:")); is >> file_type;