summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-06-06 07:41:20 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-06-07 07:29:30 (GMT)
commit3ac4b90bfdcca97f1f63056c97afee38cf66ea12 (patch)
treebbfa8812400f195520a2d305b74750606bc2286e
parent7c0aa672fe4f1b5c4a15a89d90cd80009a1399d0 (diff)
downloadCMake-3ac4b90bfdcca97f1f63056c97afee38cf66ea12.zip
CMake-3ac4b90bfdcca97f1f63056c97afee38cf66ea12.tar.gz
CMake-3ac4b90bfdcca97f1f63056c97afee38cf66ea12.tar.bz2
cmPropertyMap: Require a non-empty name parameter.
The cmGetPropertyCommand already checks for this.
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx8
-rw-r--r--Source/cmGetDirectoryPropertyCommand.cxx6
-rw-r--r--Source/cmGetSourceFilePropertyCommand.cxx6
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx6
-rw-r--r--Source/cmGetTestPropertyCommand.cxx6
-rw-r--r--Source/cmPropertyMap.cxx7
6 files changed, 28 insertions, 11 deletions
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 76803c1..6717035 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -52,9 +52,11 @@ bool cmGetCMakePropertyCommand
}
else
{
- const char *prop =
- this->Makefile->GetState()
- ->GetGlobalProperty(args[1]);
+ const char *prop = 0;
+ if (!args[1].empty())
+ {
+ prop = this->Makefile->GetState()->GetGlobalProperty(args[1]);
+ }
if (prop)
{
output = prop;
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index 4fe3318..228e53c 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -84,7 +84,11 @@ bool cmGetDirectoryPropertyCommand
return true;
}
- const char *prop = dir->GetProperty(*i);
+ const char *prop = 0;
+ if (!i->empty())
+ {
+ prop = dir->GetProperty(*i);
+ }
if (prop)
{
this->Makefile->AddDefinition(variable, prop);
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index 7667a85..46daa34 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -38,7 +38,11 @@ bool cmGetSourceFilePropertyCommand
this->Makefile->AddDefinition(var, sf->GetLanguage().c_str());
return true;
}
- const char *prop = sf->GetPropertyForUser(args[2]);
+ const char *prop = 0;
+ if (!args[2].empty())
+ {
+ prop = sf->GetPropertyForUser(args[2]);
+ }
if (prop)
{
this->Makefile->AddDefinition(var, prop);
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index 315e851..ca40bd0 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -40,7 +40,11 @@ bool cmGetTargetPropertyCommand
else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName))
{
cmTarget& target = *tgt;
- const char* prop_cstr = target.GetProperty(args[2], this->Makefile);
+ const char* prop_cstr = 0;
+ if (!args[2].empty())
+ {
+ prop_cstr = target.GetProperty(args[2], this->Makefile);
+ }
if(prop_cstr)
{
prop = prop_cstr;
diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx
index b3df4c3..bf34589 100644
--- a/Source/cmGetTestPropertyCommand.cxx
+++ b/Source/cmGetTestPropertyCommand.cxx
@@ -29,7 +29,11 @@ bool cmGetTestPropertyCommand
cmTest *test = this->Makefile->GetTest(testName);
if (test)
{
- const char *prop = test->GetProperty(args[1]);
+ const char *prop = 0;
+ if (!args[1].empty())
+ {
+ prop = test->GetProperty(args[1]);
+ }
if (prop)
{
this->Makefile->AddDefinition(var, prop);
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx
index d1402c8..de2cd05 100644
--- a/Source/cmPropertyMap.cxx
+++ b/Source/cmPropertyMap.cxx
@@ -14,6 +14,8 @@
#include "cmake.h"
#include "cmState.h"
+#include <assert.h>
+
cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name)
{
cmPropertyMap::iterator it = this->find(name);
@@ -60,10 +62,7 @@ const char *cmPropertyMap
bool &chain) const
{
chain = false;
- if (name.empty())
- {
- return 0;
- }
+ assert(!name.empty());
cmPropertyMap::const_iterator it = this->find(name);
if (it == this->end())