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/cmStringCommand.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/cmStringCommand.cxx')
-rw-r--r-- | Source/cmStringCommand.cxx | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index f9b69e3..7bc7b05 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -103,7 +103,7 @@ bool cmStringCommand } std::string e = "does not recognize sub-command "+subCommand; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -115,15 +115,15 @@ bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args) { cmOStringStream e; e << args[0] << " requires an output variable and an input string"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str())); if(hash.get()) { - std::string out = hash->HashString(args[2].c_str()); - this->Makefile->AddDefinition(args[1].c_str(), out.c_str()); + std::string out = hash->HashString(args[2]); + this->Makefile->AddDefinition(args[1], out.c_str()); return true; } return false; @@ -158,7 +158,7 @@ bool cmStringCommand::HandleToUpperLowerCommand( } // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -185,12 +185,12 @@ bool cmStringCommand::HandleAsciiCommand(std::vector<std::string> const& args) std::string error = "Character with code "; error += args[cc]; error += " does not exist."; - this->SetError(error.c_str()); + this->SetError(error); return false; } } // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -226,7 +226,7 @@ bool cmStringCommand::HandleConfigureCommand( { cmOStringStream err; err << "Unrecognized argument \"" << args[i] << "\""; - this->SetError(err.str().c_str()); + this->SetError(err.str()); return false; } } @@ -236,7 +236,7 @@ bool cmStringCommand::HandleConfigureCommand( this->Makefile->ConfigureString(args[1], output, atOnly, escapeQuotes); // Store the output in the provided variable. - this->Makefile->AddDefinition(args[2].c_str(), output.c_str()); + this->Makefile->AddDefinition(args[2], output.c_str()); return true; } @@ -282,7 +282,7 @@ bool cmStringCommand::HandleRegexCommand(std::vector<std::string> const& args) } std::string e = "sub-command REGEX does not recognize mode "+mode; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -308,7 +308,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args) { std::string e = "sub-command REGEX, mode MATCH failed to compile regex \""+regex+"\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -324,14 +324,14 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args) std::string e = "sub-command REGEX, mode MATCH regex \""+regex+ "\" matched an empty string."; - this->SetError(e.c_str()); + this->SetError(e); return false; } output = input.substr(l, r-l); } // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -358,7 +358,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args) std::string e = "sub-command REGEX, mode MATCHALL failed to compile regex \""+ regex+"\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -374,7 +374,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args) { std::string e = "sub-command REGEX, mode MATCHALL regex \""+ regex+"\" matched an empty string."; - this->SetError(e.c_str()); + this->SetError(e); return false; } if(output.length() > 0) @@ -386,7 +386,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args) } // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -439,7 +439,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) std::string e = "sub-command REGEX, mode REPLACE: Unknown escape \""; e += replace.substr(r, 2); e += "\" in replace-expression."; - this->SetError(e.c_str()); + this->SetError(e); return false; } r += 2; @@ -462,7 +462,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) std::string e = "sub-command REGEX, mode REPLACE failed to compile regex \""+ regex+"\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -483,7 +483,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) { std::string e = "sub-command REGEX, mode REPLACE regex \""+ regex+"\" matched an empty string."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -513,7 +513,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) "sub-command REGEX, mode REPLACE: replace expression \""+ replace+"\" contains an out-of-range escape for regex \""+ regex+"\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } } @@ -527,7 +527,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) output += input.substr(base, input.length()-base); // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -616,12 +616,12 @@ bool cmStringCommand::HandleFindCommand(std::vector<std::string> const& { cmOStringStream s; s << pos; - this->Makefile->AddDefinition(outvar.c_str(), s.str().c_str()); + this->Makefile->AddDefinition(outvar, s.str().c_str()); return true; } // the character was not found, but this is not really an error - this->Makefile->AddDefinition(outvar.c_str(), "-1"); + this->Makefile->AddDefinition(outvar, "-1"); return true; } @@ -643,7 +643,7 @@ bool cmStringCommand::HandleCompareCommand(std::vector<std::string> const& std::string e = "sub-command COMPARE, mode "; e += mode; e += " needs at least 5 arguments total to command."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -669,16 +669,16 @@ bool cmStringCommand::HandleCompareCommand(std::vector<std::string> const& } if(result) { - this->Makefile->AddDefinition(outvar.c_str(), "1"); + this->Makefile->AddDefinition(outvar, "1"); } else { - this->Makefile->AddDefinition(outvar.c_str(), "0"); + this->Makefile->AddDefinition(outvar, "0"); } return true; } std::string e = "sub-command COMPARE does not recognize mode "+mode; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -705,7 +705,7 @@ bool cmStringCommand::HandleReplaceCommand(std::vector<std::string> const& cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(), replaceExpression.c_str()); - this->Makefile->AddDefinition(variableName.c_str(), input.c_str()); + this->Makefile->AddDefinition(variableName, input.c_str()); return true; } @@ -731,7 +731,7 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const& cmOStringStream ostr; ostr << "begin index: " << begin << " is out of range 0 - " << stringLength; - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return false; } int leftOverLength = intStringLength - begin; @@ -740,11 +740,11 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const& cmOStringStream ostr; ostr << "end index: " << end << " is out of range -1 - " << leftOverLength; - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return false; } - this->Makefile->AddDefinition(variableName.c_str(), + this->Makefile->AddDefinition(variableName, stringValue.substr(begin, end).c_str()); return true; } @@ -766,7 +766,7 @@ bool cmStringCommand char buffer[1024]; sprintf(buffer, "%d", static_cast<int>(length)); - this->Makefile->AddDefinition(variableName.c_str(), buffer); + this->Makefile->AddDefinition(variableName, buffer); return true; } @@ -787,7 +787,7 @@ bool cmStringCommand value += args[i]; } - this->Makefile->AddDefinition(variableName.c_str(), value.c_str()); + this->Makefile->AddDefinition(variableName, value.c_str()); return true; } @@ -804,7 +804,7 @@ bool cmStringCommand const std::string& input = args[1]; const std::string& variableName = args[2]; - this->Makefile->AddDefinition(variableName.c_str(), + this->Makefile->AddDefinition(variableName, cmSystemTools::MakeCidentifier(input.c_str()).c_str()); return true; } @@ -853,7 +853,7 @@ bool cmStringCommand::HandleStripCommand( outLength=endPos - startPos + 1; } - this->Makefile->AddDefinition(variableName.c_str(), + this->Makefile->AddDefinition(variableName, stringValue.substr(startPos, outLength).c_str()); return true; } @@ -937,7 +937,7 @@ bool cmStringCommand } result.push_back(0); - this->Makefile->AddDefinition(variableName.c_str(), &*result.begin()); + this->Makefile->AddDefinition(variableName, &*result.begin()); return true; } @@ -977,14 +977,14 @@ bool cmStringCommand { std::string e = " TIMESTAMP sub-command does not recognize option " + args[argsIndex] + "."; - this->SetError(e.c_str()); + this->SetError(e); return false; } } cmTimestamp timestamp; std::string result = timestamp.CurrentTime(formatString, utcFlag); - this->Makefile->AddDefinition(outputVariable.c_str(), result.c_str()); + this->Makefile->AddDefinition(outputVariable, result.c_str()); return true; } |