diff options
author | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2020-07-09 13:00:00 (GMT) |
---|---|---|
committer | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2020-07-09 13:42:00 (GMT) |
commit | 8ef18e8525107eac8bc00545d8dafb186f96a227 (patch) | |
tree | d35df73936bed697be6cf9dad2be0eedc229388f /Source/cmcmd.cxx | |
parent | 43372d5ba34d2a95a886f39a254870c122e98fa2 (diff) | |
download | CMake-8ef18e8525107eac8bc00545d8dafb186f96a227.zip CMake-8ef18e8525107eac8bc00545d8dafb186f96a227.tar.gz CMake-8ef18e8525107eac8bc00545d8dafb186f96a227.tar.bz2 |
Clean a few string conversions
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r-- | Source/cmcmd.cxx | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 6882fdd..49e8a4f 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -600,8 +600,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) } cmsys::ifstream fin(args[3].c_str(), std::ios::in | std::ios::binary); if (!fin) { - std::cerr << "could not open object list file: " << args[3].c_str() - << "\n"; + std::cerr << "could not open object list file: " << args[3] << "\n"; return 1; } std::vector<std::string> files; @@ -624,13 +623,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) } FILE* fout = cmsys::SystemTools::Fopen(args[2], "w+"); if (!fout) { - std::cerr << "could not open output .def file: " << args[2].c_str() - << "\n"; + std::cerr << "could not open output .def file: " << args[2] << "\n"; return 1; } bindexplib deffile; if (args.size() >= 5) { - auto a = args[4]; + std::string const& a = args[4]; if (cmHasLiteralPrefix(a, "--nm=")) { deffile.SetNmPath(a.substr(5)); std::cerr << a.substr(5) << "\n"; @@ -638,7 +636,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) std::cerr << "unknown argument: " << a << "\n"; } } - for (auto const& file : files) { + for (std::string const& file : files) { std::string const& ext = cmSystemTools::GetFilenameLastExtension(file); if (cmSystemTools::LowerCase(ext) == ".def") { if (!deffile.AddDefinitionFile(file.c_str())) { @@ -1020,7 +1018,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) // Command to create a symbolic link. Fails on platforms not // supporting them. if (args[1] == "create_symlink" && args.size() == 4) { - const char* destinationFileName = args[3].c_str(); + std::string const& destinationFileName = args[3]; if ((cmSystemTools::FileExists(destinationFileName) || cmSystemTools::FileIsSymlink(destinationFileName)) && !cmSystemTools::RemoveFile(destinationFileName)) { @@ -1377,15 +1375,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args) #if defined(_WIN32) && !defined(__CYGWIN__) // Write registry value if (args[1] == "write_regv" && args.size() > 3) { - return cmSystemTools::WriteRegistryValue(args[2].c_str(), - args[3].c_str()) - ? 0 - : 1; + return cmSystemTools::WriteRegistryValue(args[2], args[3]) ? 0 : 1; } // Delete registry value if (args[1] == "delete_regv" && args.size() > 2) { - return cmSystemTools::DeleteRegistryValue(args[2].c_str()) ? 0 : 1; + return cmSystemTools::DeleteRegistryValue(args[2]) ? 0 : 1; } // Remove file |