mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-01 20:00:51 -05:00
cmFileCommand.cxx: Optimize cmStrCat() calls
This commit is contained in:
+16
-16
@@ -1104,7 +1104,7 @@ bool HandleRPathChangeCommand(std::vector<std::string> const& args,
|
|||||||
if (!cmSystemTools::ChangeRPath(file, *oldRPath, *newRPath,
|
if (!cmSystemTools::ChangeRPath(file, *oldRPath, *newRPath,
|
||||||
removeEnvironmentRPath, &emsg, &changed)) {
|
removeEnvironmentRPath, &emsg, &changed)) {
|
||||||
status.SetError(cmStrCat("RPATH_CHANGE could not write new RPATH:\n ",
|
status.SetError(cmStrCat("RPATH_CHANGE could not write new RPATH:\n ",
|
||||||
*newRPath, "\nto the file:\n ", file, "\n",
|
*newRPath, "\nto the file:\n ", file, '\n',
|
||||||
emsg));
|
emsg));
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
@@ -1159,7 +1159,7 @@ bool HandleRPathSetCommand(std::vector<std::string> const& args,
|
|||||||
|
|
||||||
if (!cmSystemTools::SetRPath(file, *newRPath, &emsg, &changed)) {
|
if (!cmSystemTools::SetRPath(file, *newRPath, &emsg, &changed)) {
|
||||||
status.SetError(cmStrCat("RPATH_SET could not write new RPATH:\n ",
|
status.SetError(cmStrCat("RPATH_SET could not write new RPATH:\n ",
|
||||||
*newRPath, "\nto the file:\n ", file, "\n",
|
*newRPath, "\nto the file:\n ", file, '\n',
|
||||||
emsg));
|
emsg));
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
@@ -1209,7 +1209,7 @@ bool HandleRPathRemoveCommand(std::vector<std::string> const& args,
|
|||||||
if (!cmSystemTools::RemoveRPath(file, &emsg, &removed)) {
|
if (!cmSystemTools::RemoveRPath(file, &emsg, &removed)) {
|
||||||
status.SetError(
|
status.SetError(
|
||||||
cmStrCat("RPATH_REMOVE could not remove RPATH from file: \n ", file,
|
cmStrCat("RPATH_REMOVE could not remove RPATH from file: \n ", file,
|
||||||
"\n", emsg));
|
'\n', emsg));
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
if (success) {
|
if (success) {
|
||||||
@@ -1538,7 +1538,7 @@ bool HandleRename(std::vector<std::string> const& args,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
status.SetError(cmStrCat("RENAME failed to rename\n ", oldname, "\nto\n ",
|
status.SetError(cmStrCat("RENAME failed to rename\n ", oldname, "\nto\n ",
|
||||||
newname, "\nbecause: ", err, "\n"));
|
newname, "\nbecause: ", err, '\n'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1631,7 +1631,7 @@ bool HandleCopyFile(std::vector<std::string> const& args,
|
|||||||
status.GetMakefile().AddDefinition(arguments.Result, err);
|
status.GetMakefile().AddDefinition(arguments.Result, err);
|
||||||
} else {
|
} else {
|
||||||
status.SetError(cmStrCat("COPY_FILE failed to copy\n ", oldname,
|
status.SetError(cmStrCat("COPY_FILE failed to copy\n ", oldname,
|
||||||
"\nto\n ", newname, "\nbecause: ", err, "\n"));
|
"\nto\n ", newname, "\nbecause: ", err, '\n'));
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1822,7 +1822,7 @@ public:
|
|||||||
|
|
||||||
if (updated) {
|
if (updated) {
|
||||||
status =
|
status =
|
||||||
cmStrCat("[", this->Text, " ", this->CurrentPercentage, "% complete]");
|
cmStrCat('[', this->Text, ' ', this->CurrentPercentage, "% complete]");
|
||||||
}
|
}
|
||||||
|
|
||||||
return updated;
|
return updated;
|
||||||
@@ -2334,7 +2334,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
|
|||||||
"set environment variable CMAKE_TLS_VERIFY=0 to suppress it.");
|
"set environment variable CMAKE_TLS_VERIFY=0 to suppress it.");
|
||||||
}
|
}
|
||||||
status.GetMakefile().AddDefinition(
|
status.GetMakefile().AddDefinition(
|
||||||
statusVar, cmStrCat(static_cast<int>(res), ";\"", std::move(m), "\""));
|
statusVar, cmStrCat(static_cast<int>(res), ";\"", std::move(m), '"'));
|
||||||
}
|
}
|
||||||
|
|
||||||
::curl_global_cleanup();
|
::curl_global_cleanup();
|
||||||
@@ -2735,7 +2735,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
|
|||||||
"set environment variable CMAKE_TLS_VERIFY=0 to suppress it.");
|
"set environment variable CMAKE_TLS_VERIFY=0 to suppress it.");
|
||||||
}
|
}
|
||||||
status.GetMakefile().AddDefinition(
|
status.GetMakefile().AddDefinition(
|
||||||
statusVar, cmStrCat(static_cast<int>(res), ";\"", std::move(m), "\""));
|
statusVar, cmStrCat(static_cast<int>(res), ";\"", std::move(m), '"'));
|
||||||
}
|
}
|
||||||
|
|
||||||
::curl_global_cleanup();
|
::curl_global_cleanup();
|
||||||
@@ -3090,7 +3090,7 @@ bool HandleLockCommand(std::vector<std::string> const& args,
|
|||||||
if (resultVariable.empty() && !fileLockResult.IsOk()) {
|
if (resultVariable.empty() && !fileLockResult.IsOk()) {
|
||||||
status.GetMakefile().IssueMessage(
|
status.GetMakefile().IssueMessage(
|
||||||
MessageType::FATAL_ERROR,
|
MessageType::FATAL_ERROR,
|
||||||
cmStrCat("error locking file\n \"", path, "\"\n", result, "."));
|
cmStrCat("error locking file\n \"", path, "\"\n", result, '.'));
|
||||||
cmSystemTools::SetFatalErrorOccurred();
|
cmSystemTools::SetFatalErrorOccurred();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3339,7 +3339,7 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
|
|||||||
platform)) {
|
platform)) {
|
||||||
status.SetError(
|
status.SetError(
|
||||||
cmStrCat("GET_RUNTIME_DEPENDENCIES is not supported on system \"",
|
cmStrCat("GET_RUNTIME_DEPENDENCIES is not supported on system \"",
|
||||||
platform, "\""));
|
platform, '"'));
|
||||||
cmSystemTools::SetFatalErrorOccurred();
|
cmSystemTools::SetFatalErrorOccurred();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3406,7 +3406,7 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
|
|||||||
parser.Parse(cmMakeRange(args).advance(1), &unrecognizedArguments);
|
parser.Parse(cmMakeRange(args).advance(1), &unrecognizedArguments);
|
||||||
auto argIt = unrecognizedArguments.begin();
|
auto argIt = unrecognizedArguments.begin();
|
||||||
if (argIt != unrecognizedArguments.end()) {
|
if (argIt != unrecognizedArguments.end()) {
|
||||||
status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, "\""));
|
status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, '"'));
|
||||||
cmSystemTools::SetFatalErrorOccurred();
|
cmSystemTools::SetFatalErrorOccurred();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3538,7 +3538,7 @@ bool HandleConfigureCommand(std::vector<std::string> const& args,
|
|||||||
auto argIt = unrecognizedArguments.begin();
|
auto argIt = unrecognizedArguments.begin();
|
||||||
if (argIt != unrecognizedArguments.end()) {
|
if (argIt != unrecognizedArguments.end()) {
|
||||||
status.SetError(
|
status.SetError(
|
||||||
cmStrCat("CONFIGURE Unrecognized argument: \"", *argIt, "\""));
|
cmStrCat("CONFIGURE Unrecognized argument: \"", *argIt, '"'));
|
||||||
cmSystemTools::SetFatalErrorOccurred();
|
cmSystemTools::SetFatalErrorOccurred();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3672,7 +3672,7 @@ bool HandleArchiveCreateCommand(std::vector<std::string> const& args,
|
|||||||
parser.Parse(cmMakeRange(args).advance(1), &unrecognizedArguments);
|
parser.Parse(cmMakeRange(args).advance(1), &unrecognizedArguments);
|
||||||
auto argIt = unrecognizedArguments.begin();
|
auto argIt = unrecognizedArguments.begin();
|
||||||
if (argIt != unrecognizedArguments.end()) {
|
if (argIt != unrecognizedArguments.end()) {
|
||||||
status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, "\""));
|
status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, '"'));
|
||||||
cmSystemTools::SetFatalErrorOccurred();
|
cmSystemTools::SetFatalErrorOccurred();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3801,7 +3801,7 @@ bool HandleArchiveExtractCommand(std::vector<std::string> const& args,
|
|||||||
parser.Parse(cmMakeRange(args).advance(1), &unrecognizedArguments);
|
parser.Parse(cmMakeRange(args).advance(1), &unrecognizedArguments);
|
||||||
auto argIt = unrecognizedArguments.begin();
|
auto argIt = unrecognizedArguments.begin();
|
||||||
if (argIt != unrecognizedArguments.end()) {
|
if (argIt != unrecognizedArguments.end()) {
|
||||||
status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, "\""));
|
status.SetError(cmStrCat("Unrecognized argument: \"", *argIt, '"'));
|
||||||
cmSystemTools::SetFatalErrorOccurred();
|
cmSystemTools::SetFatalErrorOccurred();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3826,7 +3826,7 @@ bool HandleArchiveExtractCommand(std::vector<std::string> const& args,
|
|||||||
if (cmSystemTools::FileIsFullPath(parsedArgs.Destination)) {
|
if (cmSystemTools::FileIsFullPath(parsedArgs.Destination)) {
|
||||||
destDir = parsedArgs.Destination;
|
destDir = parsedArgs.Destination;
|
||||||
} else {
|
} else {
|
||||||
destDir = cmStrCat(destDir, "/", parsedArgs.Destination);
|
destDir = cmStrCat(destDir, '/', parsedArgs.Destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cmSystemTools::MakeDirectory(destDir)) {
|
if (!cmSystemTools::MakeDirectory(destDir)) {
|
||||||
@@ -3837,7 +3837,7 @@ bool HandleArchiveExtractCommand(std::vector<std::string> const& args,
|
|||||||
|
|
||||||
if (!cmSystemTools::FileIsFullPath(inFile)) {
|
if (!cmSystemTools::FileIsFullPath(inFile)) {
|
||||||
inFile =
|
inFile =
|
||||||
cmStrCat(cmSystemTools::GetLogicalWorkingDirectory(), "/", inFile);
|
cmStrCat(cmSystemTools::GetLogicalWorkingDirectory(), '/', inFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user