mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 22:30:07 -05:00
Fix forced-seed argument type in string(RANDOM)
Clang points out that local variable 'seed' needs to be "unsigned int":
Source/cmStringCommand.cxx:828:21: warning: operands of ? are integers
of different signs: 'int' and 'unsigned int' [-Wsign-compare]
srand(force_seed? seed : cmSystemTools::RandomSeed());
^ ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
@@ -770,7 +770,7 @@ bool cmStringCommand
|
||||
|
||||
static bool seeded = false;
|
||||
bool force_seed = false;
|
||||
int seed = 0;
|
||||
unsigned int seed = 0;
|
||||
int length = 5;
|
||||
const char cmStringCommandDefaultAlphabet[] = "qwertyuiopasdfghjklzxcvbnm"
|
||||
"QWERTYUIOPASDFGHJKLZXCVBNM"
|
||||
@@ -797,7 +797,7 @@ bool cmStringCommand
|
||||
else if ( args[i] == "RANDOM_SEED" )
|
||||
{
|
||||
++i;
|
||||
seed = atoi(args[i].c_str());
|
||||
seed = static_cast<unsigned int>(atoi(args[i].c_str()));
|
||||
force_seed = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user