Commit ef3bfa01 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

c_str: Don't use .c_str() when streaming strings

It's not needed and just clutters the code.

Change-Id: I9e69621be79b8bfebe6790edae4cdb86e8389733
parent f3a36760
...@@ -235,7 +235,7 @@ int CommandLineArguments::Parse() ...@@ -235,7 +235,7 @@ int CommandLineArguments::Parse()
return 0; return 0;
} }
CommandLineArguments_DEBUG("This is a space argument: " << arg CommandLineArguments_DEBUG("This is a space argument: " << arg
<< " value: " << this->Internals->Argv[cc+1].c_str()); << " value: " << this->Internals->Argv[cc+1]);
// Value is the next argument // Value is the next argument
if ( !this->PopulateVariable(cs, this->Internals->Argv[cc+1].c_str()) ) if ( !this->PopulateVariable(cs, this->Internals->Argv[cc+1].c_str()) )
{ {
...@@ -313,7 +313,7 @@ int CommandLineArguments::Parse() ...@@ -313,7 +313,7 @@ int CommandLineArguments::Parse()
} }
else else
{ {
kwsys_ios::cerr << "Got unknown argument: \"" << arg.c_str() << "\"" << kwsys_ios::endl; kwsys_ios::cerr << "Got unknown argument: \"" << arg << "\"" << kwsys_ios::endl;
this->Internals->LastArgument --; this->Internals->LastArgument --;
return 0; return 0;
} }
......
...@@ -3041,7 +3041,7 @@ bool SystemTools::FindProgramPath(const char* argv0, ...@@ -3041,7 +3041,7 @@ bool SystemTools::FindProgramPath(const char* argv0,
kwsys_stl::vector<kwsys_stl::string>::iterator i; kwsys_stl::vector<kwsys_stl::string>::iterator i;
for(i=failures.begin(); i != failures.end(); ++i) for(i=failures.begin(); i != failures.end(); ++i)
{ {
msg << " \"" << i->c_str() << "\"\n"; msg << " \"" << *i << "\"\n";
} }
errorMsg = msg.str(); errorMsg = msg.str();
return false; return false;
......
...@@ -171,7 +171,7 @@ int testCommandLineArguments(int argc, char* argv[]) ...@@ -171,7 +171,7 @@ int testCommandLineArguments(int argc, char* argv[])
CompareTwoLists(strings_argument, valid_strings, 4); CompareTwoLists(strings_argument, valid_strings, 4);
CompareTwoLists(stl_strings_argument, valid_stl_strings, 4); CompareTwoLists(stl_strings_argument, valid_stl_strings, 4);
kwsys_ios::cout << "Some STL String variable was set to: " << some_stl_string_variable.c_str() << kwsys_ios::endl; kwsys_ios::cout << "Some STL String variable was set to: " << some_stl_string_variable << kwsys_ios::endl;
kwsys_ios::cout << "Some bool variable was set to: " << some_bool_variable << kwsys_ios::endl; kwsys_ios::cout << "Some bool variable was set to: " << some_bool_variable << kwsys_ios::endl;
kwsys_ios::cout << "Some bool variable was set to: " << some_bool_variable1 << kwsys_ios::endl; kwsys_ios::cout << "Some bool variable was set to: " << some_bool_variable1 << kwsys_ios::endl;
kwsys_ios::cout << "bool_arg1 variable was set to: " << bool_arg1 << kwsys_ios::endl; kwsys_ios::cout << "bool_arg1 variable was set to: " << bool_arg1 << kwsys_ios::endl;
......
...@@ -57,12 +57,12 @@ int testCommandLineArguments1(int argc, char* argv[]) ...@@ -57,12 +57,12 @@ int testCommandLineArguments1(int argc, char* argv[])
} }
if ( p != "1" ) if ( p != "1" )
{ {
kwsys_ios::cout << "Problem setting P. Value of P: " << p.c_str() << kwsys_ios::endl; kwsys_ios::cout << "Problem setting P. Value of P: " << p << kwsys_ios::endl;
res = 1; res = 1;
} }
kwsys_ios::cout << "Value of N: " << n << kwsys_ios::endl; kwsys_ios::cout << "Value of N: " << n << kwsys_ios::endl;
kwsys_ios::cout << "Value of M: " << m << kwsys_ios::endl; kwsys_ios::cout << "Value of M: " << m << kwsys_ios::endl;
kwsys_ios::cout << "Value of P: " << p.c_str() << kwsys_ios::endl; kwsys_ios::cout << "Value of P: " << p << kwsys_ios::endl;
if ( m ) if ( m )
{ {
delete [] m; delete [] m;
......
...@@ -60,8 +60,8 @@ static bool CheckConvertToUnixSlashes(kwsys_stl::string input, ...@@ -60,8 +60,8 @@ static bool CheckConvertToUnixSlashes(kwsys_stl::string input,
if ( result != output ) if ( result != output )
{ {
kwsys_ios::cerr kwsys_ios::cerr
<< "Problem with ConvertToUnixSlashes - input: " << input.c_str() << "Problem with ConvertToUnixSlashes - input: " << input
<< " output: " << result.c_str() << " expected: " << output.c_str() << " output: " << result << " expected: " << output
<< kwsys_ios::endl; << kwsys_ios::endl;
return false; return false;
} }
...@@ -86,8 +86,8 @@ static bool CheckEscapeChars(kwsys_stl::string input, ...@@ -86,8 +86,8 @@ static bool CheckEscapeChars(kwsys_stl::string input,
if (result != output) if (result != output)
{ {
kwsys_ios::cerr kwsys_ios::cerr
<< "Problem with CheckEscapeChars - input: " << input.c_str() << "Problem with CheckEscapeChars - input: " << input
<< " output: " << result.c_str() << " expected: " << output.c_str() << " output: " << result << " expected: " << output
<< kwsys_ios::endl; << kwsys_ios::endl;
return false; return false;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment