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:
Brad King 2011-05-23 15:57:41 -04:00
parent 3d92c8c827
commit 7ff98b7a8c
1 changed files with 2 additions and 2 deletions

View File

@ -770,7 +770,7 @@ bool cmStringCommand
static bool seeded = false; static bool seeded = false;
bool force_seed = false; bool force_seed = false;
int seed = 0; unsigned int seed = 0;
int length = 5; int length = 5;
const char cmStringCommandDefaultAlphabet[] = "qwertyuiopasdfghjklzxcvbnm" const char cmStringCommandDefaultAlphabet[] = "qwertyuiopasdfghjklzxcvbnm"
"QWERTYUIOPASDFGHJKLZXCVBNM" "QWERTYUIOPASDFGHJKLZXCVBNM"
@ -797,7 +797,7 @@ bool cmStringCommand
else if ( args[i] == "RANDOM_SEED" ) else if ( args[i] == "RANDOM_SEED" )
{ {
++i; ++i;
seed = atoi(args[i].c_str()); seed = static_cast<unsigned int>(atoi(args[i].c_str()));
force_seed = true; force_seed = true;
} }
} }