summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-01-25 14:35:26 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-02-06 18:04:09 (GMT)
commit74c4d9d27aece9a619eaab330ad23cf4b0de2b19 (patch)
tree9872bc29405a9cf68635e76f13023c7cc06b9406 /Source
parent71d47115d009983665d6db4b25ea0ef40464f365 (diff)
downloadCMake-74c4d9d27aece9a619eaab330ad23cf4b0de2b19.zip
CMake-74c4d9d27aece9a619eaab330ad23cf4b0de2b19.tar.gz
CMake-74c4d9d27aece9a619eaab330ad23cf4b0de2b19.tar.bz2
Take a size check outside of an inner loop.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmSetTargetPropertiesCommand.cxx10
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx10
2 files changed, 10 insertions, 10 deletions
diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx
index aeb8077..9a7fab2 100644
--- a/Source/cmSetTargetPropertiesCommand.cxx
+++ b/Source/cmSetTargetPropertiesCommand.cxx
@@ -35,15 +35,15 @@ bool cmSetTargetPropertiesCommand
doingFiles = false;
// now loop through the rest of the arguments, new style
++j;
+ if (std::distance(j, args.end()) % 2 != 0)
+ {
+ this->SetError("called with incorrect number of arguments.");
+ return false;
+ }
while (j != args.end())
{
propertyPairs.push_back(*j);
++j;
- if(j == args.end())
- {
- this->SetError("called with incorrect number of arguments.");
- return false;
- }
propertyPairs.push_back(*j);
++j;
}
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index e66d13d..032c78e 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -36,15 +36,15 @@ bool cmSetTestsPropertiesCommand
doingFiles = false;
// now loop through the rest of the arguments, new style
++j;
+ if (std::distance(j, args.end()) % 2 != 0)
+ {
+ this->SetError("called with incorrect number of arguments.");
+ return false;
+ }
while (j != args.end())
{
propertyPairs.push_back(*j);
++j;
- if(j == args.end())
- {
- this->SetError("called with incorrect number of arguments.");
- return false;
- }
propertyPairs.push_back(*j);
++j;
}