Remove undefined behavior from <ctype.h> calls:

For the functions defined in <ctype.h> the C standard requires
that the value of the int argument be in the range of an
unsigned char, or be EOF.  Violation of this requirement
results in undefined behavior.
This commit is contained in:
Howard Hinnant
2018-03-21 16:25:14 -04:00
committed by Nikolaos D. Bougalis
parent 02c487348a
commit b4e1b3c1b1
17 changed files with 49 additions and 74 deletions

View File

@@ -95,7 +95,11 @@ DatabaseShardImp::init()
if (!is_directory(d))
continue;
auto dirName = d.path().stem().string();
if (!std::all_of(dirName.begin(), dirName.end(), ::isdigit))
if (!std::all_of(dirName.begin(), dirName.end(),
[](auto c)
{
return ::isdigit(static_cast<unsigned char>(c));
}))
continue;
auto const shardIndex {std::stoul(dirName)};
if (shardIndex < earliestShardIndex())