Browse Source

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());
                    ^ ~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Brad King 14 years ago
parent
commit
7ff98b7a8c
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Source/cmStringCommand.cxx

+ 2 - 2
Source/cmStringCommand.cxx

@@ -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;
         }
       }