diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-03-10 23:04:11 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-03-11 14:03:50 (GMT) |
commit | 21c573f682f9eafbc8d4402f7febbb1bec1cb86a (patch) | |
tree | 8c9e0b913c7de5737a770430064ff5533a19477d /Source/cmGetPropertyCommand.cxx | |
parent | e21ffaf8fe5499426604b4ebb9cd08798ee6107c (diff) | |
download | CMake-21c573f682f9eafbc8d4402f7febbb1bec1cb86a.zip CMake-21c573f682f9eafbc8d4402f7febbb1bec1cb86a.tar.gz CMake-21c573f682f9eafbc8d4402f7febbb1bec1cb86a.tar.bz2 |
Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
Diffstat (limited to 'Source/cmGetPropertyCommand.cxx')
-rw-r--r-- | Source/cmGetPropertyCommand.cxx | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 30bec16..6dd40c9 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -73,7 +73,7 @@ bool cmGetPropertyCommand e << "given invalid scope " << args[1] << ". " << "Valid scopes are " << "GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, VARIABLE, CACHE."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -120,7 +120,7 @@ bool cmGetPropertyCommand { cmOStringStream e; e << "given invalid argument \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -139,7 +139,7 @@ bool cmGetPropertyCommand std::string output; if(cmPropertyDefinition* def = this->Makefile->GetCMakeInstance()-> - GetPropertyDefinition(this->PropertyName.c_str(), scope)) + GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetShortDescription(); } @@ -147,7 +147,7 @@ bool cmGetPropertyCommand { output = "NOTFOUND"; } - this->Makefile->AddDefinition(this->Variable.c_str(), output.c_str()); + this->Makefile->AddDefinition(this->Variable, output.c_str()); } else if(this->InfoType == OutFullDoc) { @@ -155,7 +155,7 @@ bool cmGetPropertyCommand std::string output; if(cmPropertyDefinition* def = this->Makefile->GetCMakeInstance()-> - GetPropertyDefinition(this->PropertyName.c_str(), scope)) + GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetFullDescription(); } @@ -163,19 +163,19 @@ bool cmGetPropertyCommand { output = "NOTFOUND"; } - this->Makefile->AddDefinition(this->Variable.c_str(), output.c_str()); + this->Makefile->AddDefinition(this->Variable, output.c_str()); } else if(this->InfoType == OutDefined) { // Lookup if the property is defined if(this->Makefile->GetCMakeInstance()-> - GetPropertyDefinition(this->PropertyName.c_str(), scope)) + GetPropertyDefinition(this->PropertyName, scope)) { - this->Makefile->AddDefinition(this->Variable.c_str(), "1"); + this->Makefile->AddDefinition(this->Variable, "1"); } else { - this->Makefile->AddDefinition(this->Variable.c_str(), "0"); + this->Makefile->AddDefinition(this->Variable, "0"); } } else @@ -204,17 +204,17 @@ bool cmGetPropertyCommand::StoreResult(const char* value) { if(this->InfoType == OutSet) { - this->Makefile->AddDefinition(this->Variable.c_str(), value? "1":"0"); + this->Makefile->AddDefinition(this->Variable, value? "1":"0"); } else // if(this->InfoType == OutValue) { if(value) { - this->Makefile->AddDefinition(this->Variable.c_str(), value); + this->Makefile->AddDefinition(this->Variable, value); } else { - this->Makefile->RemoveDefinition(this->Variable.c_str()); + this->Makefile->RemoveDefinition(this->Variable); } } return true; @@ -231,7 +231,7 @@ bool cmGetPropertyCommand::HandleGlobalMode() // Get the property. cmake* cm = this->Makefile->GetCMakeInstance(); - return this->StoreResult(cm->GetProperty(this->PropertyName.c_str())); + return this->StoreResult(cm->GetProperty(this->PropertyName)); } //---------------------------------------------------------------------------- @@ -259,7 +259,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode() // Lookup the generator. if(cmLocalGenerator* lg = (this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->FindLocalGenerator(dir.c_str()))) + ->GetGlobalGenerator()->FindLocalGenerator(dir))) { // Use the makefile for the directory found. mf = lg->GetMakefile(); @@ -276,7 +276,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode() } // Get the property. - return this->StoreResult(mf->GetProperty(this->PropertyName.c_str())); + return this->StoreResult(mf->GetProperty(this->PropertyName)); } //---------------------------------------------------------------------------- @@ -302,14 +302,14 @@ bool cmGetPropertyCommand::HandleTargetMode() } if(cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) { - return this->StoreResult(target->GetProperty(this->PropertyName.c_str())); + return this->StoreResult(target->GetProperty(this->PropertyName)); } else { cmOStringStream e; e << "could not find TARGET " << this->Name << ". Perhaps it has not yet been created."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -325,17 +325,17 @@ bool cmGetPropertyCommand::HandleSourceMode() // Get the source file. if(cmSourceFile* sf = - this->Makefile->GetOrCreateSource(this->Name.c_str())) + this->Makefile->GetOrCreateSource(this->Name)) { return - this->StoreResult(sf->GetPropertyForUser(this->PropertyName.c_str())); + this->StoreResult(sf->GetPropertyForUser(this->PropertyName)); } else { cmOStringStream e; e << "given SOURCE name that could not be found or created: " << this->Name; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -350,15 +350,15 @@ bool cmGetPropertyCommand::HandleTestMode() } // Loop over all tests looking for matching names. - if(cmTest* test = this->Makefile->GetTest(this->Name.c_str())) + if(cmTest* test = this->Makefile->GetTest(this->Name)) { - return this->StoreResult(test->GetProperty(this->PropertyName.c_str())); + return this->StoreResult(test->GetProperty(this->PropertyName)); } // If not found it is an error. cmOStringStream e; e << "given TEST name that does not exist: " << this->Name; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -372,7 +372,7 @@ bool cmGetPropertyCommand::HandleVariableMode() } return this->StoreResult - (this->Makefile->GetDefinition(this->PropertyName.c_str())); + (this->Makefile->GetDefinition(this->PropertyName)); } //---------------------------------------------------------------------------- @@ -389,7 +389,7 @@ bool cmGetPropertyCommand::HandleCacheMode() this->Makefile->GetCacheManager()->GetCacheIterator(this->Name.c_str()); if(!it.IsAtEnd()) { - value = it.GetProperty(this->PropertyName.c_str()); + value = it.GetProperty(this->PropertyName); } this->StoreResult(value); return true; |