diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCommandArgumentParserHelper.cxx | 12 | ||||
-rw-r--r-- | Source/cmCommandArgumentParserHelper.h | 2 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmXCodeObject.cxx | 2 | ||||
-rw-r--r-- | Source/cmXCodeObject.h | 2 |
6 files changed, 11 insertions, 11 deletions
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index dbeeb07..6284cb7 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -49,14 +49,14 @@ void cmCommandArgumentParserHelper::SetLineFile(long line, const char* file) this->FileName = file; } -char* cmCommandArgumentParserHelper::AddString(const char* str) +char* cmCommandArgumentParserHelper::AddString(const std::string& str) { - if ( !str || !*str ) + if ( str.empty() ) { return this->EmptyVariable; } - char* stVal = new char[strlen(str)+1]; - strcpy(stVal, str); + char* stVal = new char[str.size()+1]; + strcpy(stVal, str.c_str()); this->Variables.push_back(stVal); return stVal; } @@ -153,7 +153,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) { return this->AddString(cmSystemTools::EscapeQuotes(value).c_str()); } - return this->AddString(value); + return this->AddString(value ? value : ""); } char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) @@ -166,7 +166,7 @@ char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) // then return an empty string if(!ret && this->RemoveEmpty) { - return this->AddString(ret); + return this->AddString(""); } // if the ret was not 0, then return it if(ret) diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index f8c672f..da00124 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -86,7 +86,7 @@ private: void Print(const char* place, const char* str); void SafePrintMissing(const char* str, int line, int cnt); - char* AddString(const char* str); + char* AddString(const std::string& str); void CleanupParser(); void SetError(std::string const& msg); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 004f7ac..ab92c6e 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -613,7 +613,7 @@ cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::Type type) //---------------------------------------------------------------------------- cmXCodeObject* -cmGlobalXCodeGenerator::CreateString(const char* s) +cmGlobalXCodeGenerator::CreateString(const std::string& s) { cmXCodeObject* obj = this->CreateObject(cmXCodeObject::STRING); obj->SetString(s); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c9d20c2..31c2cfb 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -135,7 +135,7 @@ private: // correctly. All objects created are stored in this->XCodeObjects. cmXCodeObject* CreateObject(cmXCodeObject::PBXType ptype); cmXCodeObject* CreateObject(cmXCodeObject::Type type); - cmXCodeObject* CreateString(const char* s); + cmXCodeObject* CreateString(const std::string& s); cmXCodeObject* CreateObjectReference(cmXCodeObject*); cmXCodeObject* CreateXCodeTarget(cmTarget& target, cmXCodeObject* buildPhases); diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 6abf6bf..3b9035f 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -266,7 +266,7 @@ void cmXCodeObject::PrintString(std::ostream& os) const } //---------------------------------------------------------------------------- -void cmXCodeObject::SetString(const char* s) +void cmXCodeObject::SetString(const std::string& s) { this->String = s; } diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index b89f78c..0761136 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -37,7 +37,7 @@ public: Type GetType() { return this->TypeValue;} PBXType GetIsA() { return this->IsA;} - void SetString(const char* s); + void SetString(const std::string& s); const char* GetString() { return this->String.c_str(); |