mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-19 18:15:50 +00:00
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:
committed by
Nikolaos D. Bougalis
parent
02c487348a
commit
b4e1b3c1b1
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user