mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Source: Reduce string allocations, part 2
This commit is contained in:
@@ -80,8 +80,9 @@ int cmCPackAppImageGenerator::PackageFiles()
|
||||
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
||||
"Found Desktop file: \"" << desktopFile.value() << "\""
|
||||
<< std::endl);
|
||||
std::string desktopSymLink = this->toplevel + "/" +
|
||||
cmSystemTools::GetFilenameName(desktopFile.value());
|
||||
std::string desktopSymLink =
|
||||
cmStrCat(this->toplevel, '/',
|
||||
cmSystemTools::GetFilenameName(desktopFile.value()));
|
||||
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
||||
"Desktop file destination: \"" << desktopSymLink << "\""
|
||||
<< std::endl);
|
||||
@@ -139,7 +140,7 @@ int cmCPackAppImageGenerator::PackageFiles()
|
||||
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
||||
"Icon file: \"" << *iconFile << "\"" << std::endl);
|
||||
std::string iconSymLink =
|
||||
this->toplevel + "/" + cmSystemTools::GetFilenameName(*iconFile);
|
||||
cmStrCat(this->toplevel, '/', cmSystemTools::GetFilenameName(*iconFile));
|
||||
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
||||
"Icon link destination: \"" << iconSymLink << "\""
|
||||
<< std::endl);
|
||||
@@ -239,8 +240,9 @@ int cmCPackAppImageGenerator::PackageFiles()
|
||||
this->AppimagetoolPath,
|
||||
this->toplevel,
|
||||
};
|
||||
command.emplace_back("../" + *this->GetOption("CPACK_PACKAGE_FILE_NAME") +
|
||||
this->GetOutputExtension());
|
||||
command.emplace_back(cmStrCat("../",
|
||||
*this->GetOption("CPACK_PACKAGE_FILE_NAME"),
|
||||
this->GetOutputExtension()));
|
||||
|
||||
auto addOptionFlag = [&command, this](std::string const& op,
|
||||
std::string commandFlag) {
|
||||
|
||||
@@ -286,8 +286,8 @@ std::string cmCPackArchiveGenerator::GetArchiveComponentFileName(
|
||||
std::string componentUpper(cmSystemTools::UpperCase(component));
|
||||
std::string packageFileName;
|
||||
|
||||
if (cmValue v = this->GetOptionIfSet("CPACK_ARCHIVE_" + componentUpper +
|
||||
"_FILE_NAME")) {
|
||||
if (cmValue v = this->GetOptionIfSet(
|
||||
cmStrCat("CPACK_ARCHIVE_", componentUpper, "_FILE_NAME"))) {
|
||||
packageFileName += *v;
|
||||
} else if ((v = this->GetOptionIfSet("CPACK_ARCHIVE_FILE_NAME"))) {
|
||||
packageFileName +=
|
||||
@@ -328,8 +328,9 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
|
||||
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
|
||||
" - packaging component: " << component->Name << std::endl);
|
||||
// Add the files of this component to the archive
|
||||
std::string localToplevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY"));
|
||||
localToplevel += "/" + this->GetSanitizedDirOrFileName(component->Name);
|
||||
std::string localToplevel(
|
||||
cmStrCat(this->GetOption("CPACK_TEMPORARY_DIRECTORY"), '/',
|
||||
this->GetSanitizedDirOrFileName(component->Name)));
|
||||
// Change to local toplevel
|
||||
cmWorkingDirectory workdir(localToplevel);
|
||||
if (workdir.Failed()) {
|
||||
@@ -426,8 +427,9 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
|
||||
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
|
||||
"Packaging component group: " << compG.first << std::endl);
|
||||
// Begin the archive for this group
|
||||
std::string packageFileName = std::string(this->toplevel) + "/" +
|
||||
this->GetArchiveComponentFileName(compG.first, true);
|
||||
std::string packageFileName =
|
||||
cmStrCat(this->toplevel, '/',
|
||||
this->GetArchiveComponentFileName(compG.first, true));
|
||||
|
||||
Deduplicator deduplicator;
|
||||
|
||||
@@ -455,8 +457,9 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
|
||||
<< "> does not belong to any group, package it separately."
|
||||
<< std::endl);
|
||||
std::string packageFileName = std::string(this->toplevel);
|
||||
packageFileName +=
|
||||
"/" + this->GetArchiveComponentFileName(comp.first, false);
|
||||
packageFileName =
|
||||
cmStrCat(packageFileName, '/',
|
||||
this->GetArchiveComponentFileName(comp.first, false));
|
||||
|
||||
{
|
||||
DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive);
|
||||
@@ -473,8 +476,9 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
|
||||
else {
|
||||
for (auto& comp : this->Components) {
|
||||
std::string packageFileName = std::string(this->toplevel);
|
||||
packageFileName +=
|
||||
"/" + this->GetArchiveComponentFileName(comp.first, false);
|
||||
packageFileName =
|
||||
cmStrCat(packageFileName, '/',
|
||||
this->GetArchiveComponentFileName(comp.first, false));
|
||||
|
||||
{
|
||||
DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive);
|
||||
|
||||
@@ -520,9 +520,10 @@ bool DebGenerator::generateDeb() const
|
||||
deb.SetUNAMEAndGNAME("root", "root");
|
||||
|
||||
if (!deb.Add(tlDir + "debian-binary", tlDir.length()) ||
|
||||
!deb.Add(tlDir + "control.tar" + this->CompressionSuffix,
|
||||
!deb.Add(cmStrCat(tlDir, "control.tar", this->CompressionSuffix),
|
||||
tlDir.length()) ||
|
||||
!deb.Add(tlDir + "data.tar" + this->CompressionSuffix, tlDir.length())) {
|
||||
!deb.Add(cmStrCat(tlDir, "data.tar", this->CompressionSuffix),
|
||||
tlDir.length())) {
|
||||
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
||||
"Error creating debian package:\n"
|
||||
"#top level directory: "
|
||||
@@ -919,8 +920,8 @@ bool cmCPackDebGenerator::createDbgsymDDeb()
|
||||
controlValues["Version"] = *debian_pkg_version;
|
||||
controlValues["Auto-Built-Package"] = "debug-symbols";
|
||||
controlValues["Depends"] =
|
||||
*this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_NAME") + std::string(" (= ") +
|
||||
*debian_pkg_version + ")";
|
||||
cmStrCat(*this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_NAME"),
|
||||
" (= ", *debian_pkg_version, ')');
|
||||
controlValues["Section"] = "debug";
|
||||
controlValues["Priority"] = "optional";
|
||||
controlValues["Architecture"] =
|
||||
@@ -973,8 +974,8 @@ std::string cmCPackDebGenerator::GetComponentInstallSuffix(
|
||||
}
|
||||
// We have to find the name of the COMPONENT GROUP
|
||||
// the current COMPONENT belongs to.
|
||||
std::string groupVar =
|
||||
"CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP";
|
||||
std::string groupVar = cmStrCat(
|
||||
"CPACK_COMPONENT_", cmSystemTools::UpperCase(componentName), "_GROUP");
|
||||
if (cmValue v = this->GetOption(groupVar)) {
|
||||
return *v;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ int cmCPackGenerator::PrepareNames()
|
||||
// Determine temporary packaging-directory.
|
||||
std::string tmpDirectory = cmStrCat(topDirectory, '/', pkgBaseFileName);
|
||||
// Determine path to temporary package file.
|
||||
std::string tmpPkgFilePath = topDirectory + "/" + pkgFileName;
|
||||
std::string tmpPkgFilePath = cmStrCat(topDirectory, '/', pkgFileName);
|
||||
|
||||
// Set CPack variables which are not set already.
|
||||
this->SetOptionIfNotSet("CPACK_REMOVE_TOPLEVEL_DIRECTORY", "1");
|
||||
@@ -620,8 +620,9 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
|
||||
if (this->SupportsComponentInstallation() &&
|
||||
!(this->IsOn("CPACK_MONOLITHIC_INSTALL"))) {
|
||||
// Determine the installation types for this project (if provided).
|
||||
std::string installTypesVar = "CPACK_" +
|
||||
cmSystemTools::UpperCase(project.Component) + "_INSTALL_TYPES";
|
||||
std::string installTypesVar =
|
||||
cmStrCat("CPACK_", cmSystemTools::UpperCase(project.Component),
|
||||
"_INSTALL_TYPES");
|
||||
cmValue installTypes = this->GetOption(installTypesVar);
|
||||
if (!installTypes.IsEmpty()) {
|
||||
cmList installTypesList{ installTypes };
|
||||
@@ -837,7 +838,7 @@ int cmCPackGenerator::InstallCMakeProject(
|
||||
if (cmHasPrefix(dir, '/')) {
|
||||
dir = tempInstallDirectory + dir;
|
||||
} else {
|
||||
dir = tempInstallDirectory + "/" + dir;
|
||||
dir = cmStrCat(tempInstallDirectory, '/', dir);
|
||||
}
|
||||
/*
|
||||
* We must re-set DESTDIR for each component
|
||||
@@ -987,8 +988,8 @@ int cmCPackGenerator::InstallCMakeProject(
|
||||
// define component specific var
|
||||
if (componentInstall) {
|
||||
std::string absoluteDestFileComponent =
|
||||
std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" +
|
||||
this->GetComponentInstallSuffix(component);
|
||||
cmStrCat("CPACK_ABSOLUTE_DESTINATION_FILES_",
|
||||
this->GetComponentInstallSuffix(component));
|
||||
if (cmValue v = this->GetOption(absoluteDestFileComponent)) {
|
||||
std::string absoluteDestFilesListComponent = cmStrCat(*v, ';', *d);
|
||||
this->SetOption(absoluteDestFileComponent,
|
||||
@@ -1665,12 +1666,13 @@ std::string cmCPackGenerator::GetComponentPackageFileName(
|
||||
std::string suffix = "-" + groupOrComponentName;
|
||||
/* check if we should use DISPLAY name */
|
||||
std::string dispNameVar =
|
||||
"CPACK_" + this->Name + "_USE_DISPLAY_NAME_IN_FILENAME";
|
||||
cmStrCat("CPACK_", this->Name, "_USE_DISPLAY_NAME_IN_FILENAME");
|
||||
if (this->IsOn(dispNameVar)) {
|
||||
/* the component Group case */
|
||||
if (isGroupName) {
|
||||
std::string groupDispVar = "CPACK_COMPONENT_GROUP_" +
|
||||
cmSystemTools::UpperCase(groupOrComponentName) + "_DISPLAY_NAME";
|
||||
std::string groupDispVar = cmStrCat(
|
||||
"CPACK_COMPONENT_GROUP_",
|
||||
cmSystemTools::UpperCase(groupOrComponentName), "_DISPLAY_NAME");
|
||||
cmValue groupDispName = this->GetOption(groupDispVar);
|
||||
if (groupDispName) {
|
||||
suffix = "-" + *groupDispName;
|
||||
@@ -1678,8 +1680,9 @@ std::string cmCPackGenerator::GetComponentPackageFileName(
|
||||
}
|
||||
/* the [single] component case */
|
||||
else {
|
||||
std::string dispVar = "CPACK_COMPONENT_" +
|
||||
cmSystemTools::UpperCase(groupOrComponentName) + "_DISPLAY_NAME";
|
||||
std::string dispVar = cmStrCat(
|
||||
"CPACK_COMPONENT_", cmSystemTools::UpperCase(groupOrComponentName),
|
||||
"_DISPLAY_NAME");
|
||||
cmValue dispName = this->GetOption(dispVar);
|
||||
if (dispName) {
|
||||
suffix = "-" + *dispName;
|
||||
|
||||
@@ -750,8 +750,8 @@ bool cmCPackInnoSetupGenerator::ProcessComponents()
|
||||
return false;
|
||||
}
|
||||
|
||||
codeIncludes.push_back("#include " + QuotePath(componentsScriptTemplate) +
|
||||
"\n");
|
||||
codeIncludes.push_back(
|
||||
cmStrCat("#include ", QuotePath(componentsScriptTemplate), '\n'));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "cmCPackComponentGroup.h"
|
||||
#include "cmCPackLog.h"
|
||||
#include "cmList.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmValue.h"
|
||||
|
||||
@@ -81,7 +82,7 @@ void cmCPackNuGetGenerator::SetupGroupComponentVariables(bool ignoreGroup)
|
||||
end(compG.second.Components),
|
||||
std::back_inserter(components),
|
||||
[](cmCPackComponent const* comp) { return comp->Name; });
|
||||
this->SetOption("CPACK_NUGET_" + compGUp + "_GROUP_COMPONENTS",
|
||||
this->SetOption(cmStrCat("CPACK_NUGET_", compGUp, "_GROUP_COMPONENTS"),
|
||||
cmList::to_string(components));
|
||||
}
|
||||
if (!groups.empty()) {
|
||||
|
||||
@@ -82,10 +82,10 @@ int cmCPackRPMGenerator::PackageOnePack(std::string const& initialToplevel,
|
||||
this->GetOption("CPACK_PACKAGE_FILE_NAME"), packageName, true) +
|
||||
this->GetOutputExtension());
|
||||
|
||||
localToplevel += "/" + sanitizedPkgDirName;
|
||||
localToplevel = cmStrCat(localToplevel, '/', sanitizedPkgDirName);
|
||||
/* replace the TEMP DIRECTORY with the component one */
|
||||
this->SetOption("CPACK_TEMPORARY_DIRECTORY", localToplevel);
|
||||
packageFileName += "/" + outputFileName;
|
||||
packageFileName = cmStrCat(packageFileName, '/', outputFileName);
|
||||
/* replace proposed CPACK_OUTPUT_FILE_NAME */
|
||||
this->SetOption("CPACK_OUTPUT_FILE_NAME", outputFileName);
|
||||
/* replace the TEMPORARY package file name */
|
||||
@@ -146,8 +146,10 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
|
||||
std::transform(component.begin(), component.end(), component.begin(),
|
||||
cmsysString_toupper);
|
||||
|
||||
if (this->IsOn("CPACK_RPM_" + compIt->first + "_DEBUGINFO_PACKAGE") ||
|
||||
this->IsOn("CPACK_RPM_" + component + "_DEBUGINFO_PACKAGE")) {
|
||||
if (this->IsOn(
|
||||
cmStrCat("CPACK_RPM_", compIt->first, "_DEBUGINFO_PACKAGE")) ||
|
||||
this->IsOn(
|
||||
cmStrCat("CPACK_RPM_", component, "_DEBUGINFO_PACKAGE"))) {
|
||||
shouldSet = false;
|
||||
break;
|
||||
}
|
||||
@@ -160,8 +162,10 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
|
||||
std::transform(component.begin(), component.end(), component.begin(),
|
||||
cmsysString_toupper);
|
||||
|
||||
if (this->IsOn("CPACK_RPM_" + compGIt->first + "_DEBUGINFO_PACKAGE") ||
|
||||
this->IsOn("CPACK_RPM_" + component + "_DEBUGINFO_PACKAGE")) {
|
||||
if (this->IsOn(
|
||||
cmStrCat("CPACK_RPM_", compGIt->first, "_DEBUGINFO_PACKAGE")) ||
|
||||
this->IsOn(
|
||||
cmStrCat("CPACK_RPM_", component, "_DEBUGINFO_PACKAGE"))) {
|
||||
shouldSet = false;
|
||||
break;
|
||||
}
|
||||
@@ -177,9 +181,10 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
|
||||
std::transform(component.begin(), component.end(),
|
||||
component.begin(), cmsysString_toupper);
|
||||
|
||||
if (this->IsOn("CPACK_RPM_" + compIt->first +
|
||||
"_DEBUGINFO_PACKAGE") ||
|
||||
this->IsOn("CPACK_RPM_" + component + "_DEBUGINFO_PACKAGE")) {
|
||||
if (this->IsOn(cmStrCat("CPACK_RPM_", compIt->first,
|
||||
"_DEBUGINFO_PACKAGE")) ||
|
||||
this->IsOn(
|
||||
cmStrCat("CPACK_RPM_", component, "_DEBUGINFO_PACKAGE"))) {
|
||||
shouldSet = false;
|
||||
break;
|
||||
}
|
||||
@@ -389,11 +394,11 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne(
|
||||
std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) +
|
||||
this->GetOutputExtension());
|
||||
// all GROUP in one vs all COMPONENT in one
|
||||
localToplevel += "/" + compInstDirName;
|
||||
localToplevel = cmStrCat(localToplevel, '/', compInstDirName);
|
||||
|
||||
/* replace the TEMP DIRECTORY with the component one */
|
||||
this->SetOption("CPACK_TEMPORARY_DIRECTORY", localToplevel);
|
||||
packageFileName += "/" + outputFileName;
|
||||
packageFileName = cmStrCat(packageFileName, '/', outputFileName);
|
||||
/* replace proposed CPACK_OUTPUT_FILE_NAME */
|
||||
this->SetOption("CPACK_OUTPUT_FILE_NAME", outputFileName);
|
||||
/* replace the TEMPORARY package file name */
|
||||
@@ -457,8 +462,8 @@ std::string cmCPackRPMGenerator::GetComponentInstallSuffix(
|
||||
}
|
||||
// We have to find the name of the COMPONENT GROUP
|
||||
// the current COMPONENT belongs to.
|
||||
std::string groupVar =
|
||||
"CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP";
|
||||
std::string groupVar = cmStrCat(
|
||||
"CPACK_COMPONENT_", cmSystemTools::UpperCase(componentName), "_GROUP");
|
||||
if (cmValue v = this->GetOption(groupVar)) {
|
||||
return *v;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "cmArchiveWrite.h"
|
||||
#include "cmCPackGenerator.h"
|
||||
#include "cmCPackLog.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmValue.h"
|
||||
|
||||
@@ -77,7 +78,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
|
||||
cmsys::ifstream ilfs(inLicFile.c_str());
|
||||
std::string licenseText;
|
||||
while (cmSystemTools::GetLineFromStream(ilfs, line)) {
|
||||
licenseText += line + "\n";
|
||||
licenseText = cmStrCat(licenseText, line, '\n');
|
||||
}
|
||||
this->SetOptionIfNotSet("CPACK_RESOURCE_FILE_LICENSE_CONTENT", licenseText);
|
||||
|
||||
@@ -88,7 +89,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
|
||||
cmsys::ifstream ifs(inFile.c_str());
|
||||
std::string packageHeaderText;
|
||||
while (cmSystemTools::GetLineFromStream(ifs, line)) {
|
||||
packageHeaderText += line + "\n";
|
||||
packageHeaderText = cmStrCat(packageHeaderText, line, '\n');
|
||||
}
|
||||
|
||||
// Configure in the values
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestVC.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmXMLParser.h"
|
||||
|
||||
@@ -399,7 +400,7 @@ bool cmCTestBZR::LoadRevisions()
|
||||
std::string revs;
|
||||
if (atoi(this->OldRevision.c_str()) <= atoi(this->NewRevision.c_str())) {
|
||||
// DoRevision takes care of discarding the information about OldRevision
|
||||
revs = this->OldRevision + ".." + this->NewRevision;
|
||||
revs = cmStrCat(this->OldRevision, "..", this->NewRevision);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1099,7 +1099,8 @@ void cmCTestBuildHandler::ProcessBuffer(char const* data, size_t length,
|
||||
|
||||
// Copy pre-context to report
|
||||
for (std::string const& pc : this->PreContext) {
|
||||
errorwarning.PreContext += pc + "\n";
|
||||
errorwarning.PreContext =
|
||||
cmStrCat(errorwarning.PreContext, pc, '\n');
|
||||
}
|
||||
this->PreContext.clear();
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ bool cmCTestCVS::UpdateImpl()
|
||||
|
||||
// Specify the start time for nightly testing.
|
||||
if (this->CTest->GetTestModel() == cmCTest::NIGHTLY) {
|
||||
args.push_back("-D" + this->GetNightlyTime() + " UTC");
|
||||
args.push_back(cmStrCat("-D", this->GetNightlyTime(), " UTC"));
|
||||
}
|
||||
|
||||
// Run "cvs update" to update the work tree.
|
||||
@@ -241,7 +241,7 @@ void cmCTestCVS::WriteXMLDirectory(cmXMLWriter& xml, std::string const& path,
|
||||
// Load revisions and write an entry for each file in this directory.
|
||||
std::vector<Revision> revisions;
|
||||
for (auto const& fi : dir) {
|
||||
std::string full = path + slash + fi.first;
|
||||
std::string full = cmStrCat(path, slash, fi.first);
|
||||
|
||||
// Load two real or unknown revisions.
|
||||
revisions.clear();
|
||||
|
||||
@@ -164,7 +164,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(std::string const& file,
|
||||
} else {
|
||||
checkDir = fSrcDir;
|
||||
}
|
||||
fFile = checkDir + "/" + relPath;
|
||||
fFile = cmStrCat(checkDir, '/', relPath);
|
||||
fFile = cmSystemTools::GetFilenamePath(fFile);
|
||||
|
||||
if (fileDir == fFile) {
|
||||
@@ -492,7 +492,7 @@ int cmCTestCoverageHandler::ProcessHandler()
|
||||
// Handle all the files in the extra coverage globs that have no cov data
|
||||
for (std::string const& u : uncovered) {
|
||||
std::string fileName = cmSystemTools::GetFilenameName(u);
|
||||
std::string fullPath = cont.SourceDir + "/" + u;
|
||||
std::string fullPath = cmStrCat(cont.SourceDir, '/', u);
|
||||
|
||||
covLogXML.StartElement("File");
|
||||
covLogXML.Attribute("Name", fileName);
|
||||
@@ -1866,11 +1866,11 @@ std::string cmCTestCoverageHandler::FindFile(
|
||||
std::string fileNameNoE =
|
||||
cmSystemTools::GetFilenameWithoutLastExtension(fileName);
|
||||
// First check in source and binary directory
|
||||
std::string fullName = cont->SourceDir + "/" + fileNameNoE + ".py";
|
||||
std::string fullName = cmStrCat(cont->SourceDir, '/', fileNameNoE, ".py");
|
||||
if (cmSystemTools::FileExists(fullName)) {
|
||||
return fullName;
|
||||
}
|
||||
fullName = cont->BinaryDir + "/" + fileNameNoE + ".py";
|
||||
fullName = cmStrCat(cont->BinaryDir, '/', fileNameNoE, ".py");
|
||||
if (cmSystemTools::FileExists(fullName)) {
|
||||
return fullName;
|
||||
}
|
||||
@@ -2436,7 +2436,7 @@ std::set<std::string> cmCTestCoverageHandler::FindUncoveredFiles(
|
||||
cmsys::Glob gl;
|
||||
gl.RecurseOn();
|
||||
gl.RecurseThroughSymlinksOff();
|
||||
std::string glob = cont->SourceDir + "/" + ecg;
|
||||
std::string glob = cmStrCat(cont->SourceDir, '/', ecg);
|
||||
gl.FindFiles(glob);
|
||||
std::vector<std::string> files = gl.GetFiles();
|
||||
for (std::string const& f : files) {
|
||||
|
||||
@@ -103,8 +103,8 @@ bool cmCTestDiscoverTests(cmTestDiscoveryArgs const& args,
|
||||
|
||||
cmsys::RegularExpression re;
|
||||
if (!re.compile(AddAnchors(args.DiscoveryMatch))) {
|
||||
std::string e = "DISCOVERY_MATCH failed to compile regex \"" +
|
||||
args.DiscoveryMatch + "\".";
|
||||
std::string e = cmStrCat("DISCOVERY_MATCH failed to compile regex \"",
|
||||
args.DiscoveryMatch, "\".");
|
||||
status.SetError(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ std::string cmCTestGIT::FindGitDir()
|
||||
// Git reports a relative path only when the .git directory is in
|
||||
// the current directory.
|
||||
if (git_dir[0] == '.') {
|
||||
git_dir = this->SourceDirectory + "/" + git_dir;
|
||||
git_dir = cmStrCat(this->SourceDirectory, '/', git_dir);
|
||||
}
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
else if (git_dir[0] == '/') {
|
||||
@@ -602,7 +602,7 @@ char const cmCTestGIT::CommitParser::SectionSep[SectionCount] = { '\n', '\n',
|
||||
bool cmCTestGIT::LoadRevisions()
|
||||
{
|
||||
// Use 'git rev-list ... | git diff-tree ...' to get revisions.
|
||||
std::string range = this->OldRevision + ".." + this->NewRevision;
|
||||
std::string range = cmStrCat(this->OldRevision, "..", this->NewRevision);
|
||||
std::string git = this->CommandLineTool;
|
||||
std::vector<std::string> git_rev_list = { git, "rev-list", "--reverse",
|
||||
range, "--" };
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmXMLWriter.h"
|
||||
|
||||
@@ -82,7 +83,7 @@ void cmCTestGlobalVC::WriteXMLDirectory(cmXMLWriter& xml,
|
||||
xml.StartElement("Directory");
|
||||
xml.Element("Name", path);
|
||||
for (auto const& f : dir) {
|
||||
std::string const full = path + slash + f.first;
|
||||
std::string const full = cmStrCat(path, slash, f.first);
|
||||
this->WriteXMLEntry(xml, path, f.first, full, f.second);
|
||||
}
|
||||
xml.EndElement(); // Directory
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestVC.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmXMLParser.h"
|
||||
|
||||
@@ -272,7 +273,7 @@ bool cmCTestHG::LoadRevisions()
|
||||
// The "list of strings" templates like {files} will not work when
|
||||
// the project has spaces in the path. Also, they may not have
|
||||
// proper XML escapes.
|
||||
std::string range = this->OldRevision + ":" + this->NewRevision;
|
||||
std::string range = cmStrCat(this->OldRevision, ':', this->NewRevision);
|
||||
std::string hg = this->CommandLineTool;
|
||||
std::string hgXMLTemplate = "<logentry\n"
|
||||
" revision=\"{node|short}\">\n"
|
||||
|
||||
@@ -249,7 +249,7 @@ bool cmCTestSVN::UpdateImpl()
|
||||
|
||||
// Specify the start time for nightly testing.
|
||||
if (this->CTest->GetTestModel() == cmCTest::NIGHTLY) {
|
||||
args.push_back("-r{" + this->GetNightlyTime() + " +0000}");
|
||||
args.push_back(cmStrCat("-r{", this->GetNightlyTime(), " +0000}"));
|
||||
}
|
||||
|
||||
std::vector<std::string> svn_update;
|
||||
@@ -383,7 +383,7 @@ bool cmCTestSVN::LoadRevisions(SVNInfo& svninfo)
|
||||
// We are interested in every revision included in the update.
|
||||
std::string revs;
|
||||
if (atoi(svninfo.OldRevision.c_str()) < atoi(svninfo.NewRevision.c_str())) {
|
||||
revs = "-r" + svninfo.OldRevision + ":" + svninfo.NewRevision;
|
||||
revs = cmStrCat("-r", svninfo.OldRevision, ':', svninfo.NewRevision);
|
||||
} else {
|
||||
revs = "-r" + svninfo.NewRevision;
|
||||
}
|
||||
|
||||
@@ -280,7 +280,8 @@ bool cmCTestDiscoverTestsCommand::InitialPass(
|
||||
}
|
||||
|
||||
if (!unparsed.empty()) {
|
||||
status.SetError(" given unknown argument \"" + unparsed.front() + "\".");
|
||||
status.SetError(
|
||||
cmStrCat(" given unknown argument \"", unparsed.front(), "\"."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1083,7 +1084,7 @@ void cmCTestTestHandler::ComputeOutOfDateTests()
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string const stampFile = stampDir + "/" + tp.GetStampFile();
|
||||
std::string const stampFile = cmStrCat(stampDir, '/', tp.GetStampFile());
|
||||
|
||||
if (!cmSystemTools::FileExists(stampFile)) {
|
||||
finalList.push_back(tp);
|
||||
@@ -1129,17 +1130,17 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
|
||||
setupRegExp = this->TestOptions.ExcludeFixtureSetupRegularExpression;
|
||||
} else {
|
||||
setupRegExp.append(
|
||||
"(" + setupRegExp + ")|(" +
|
||||
this->TestOptions.ExcludeFixtureSetupRegularExpression + ")");
|
||||
cmStrCat('(', setupRegExp, ")|(",
|
||||
this->TestOptions.ExcludeFixtureSetupRegularExpression, ')'));
|
||||
}
|
||||
}
|
||||
if (!this->TestOptions.ExcludeFixtureCleanupRegularExpression.empty()) {
|
||||
if (cleanupRegExp.empty()) {
|
||||
cleanupRegExp = this->TestOptions.ExcludeFixtureCleanupRegularExpression;
|
||||
} else {
|
||||
cleanupRegExp.append(
|
||||
"(" + cleanupRegExp + ")|(" +
|
||||
this->TestOptions.ExcludeFixtureCleanupRegularExpression + ")");
|
||||
cleanupRegExp.append(cmStrCat(
|
||||
'(', cleanupRegExp, ")|(",
|
||||
this->TestOptions.ExcludeFixtureCleanupRegularExpression, ')'));
|
||||
}
|
||||
}
|
||||
cmsys::RegularExpression excludeSetupRegex(setupRegExp);
|
||||
@@ -1574,7 +1575,7 @@ void cmCTestTestHandler::GenerateCTestXML(cmXMLWriter& xml)
|
||||
xml.Element("StartTestTime", this->StartTestTime);
|
||||
xml.StartElement("TestList");
|
||||
for (cmCTestTestResult const& result : this->TestResults) {
|
||||
std::string testPath = result.Path + "/" + result.Name;
|
||||
std::string testPath = cmStrCat(result.Path, '/', result.Name);
|
||||
xml.Element("Test", this->CTest->GetShortPathToFile(testPath));
|
||||
}
|
||||
xml.EndElement(); // TestList
|
||||
@@ -1696,7 +1697,7 @@ void cmCTestTestHandler::WriteTestResultHeader(cmXMLWriter& xml,
|
||||
} else {
|
||||
xml.Attribute("Status", "failed");
|
||||
}
|
||||
std::string testPath = result.Path + "/" + result.Name;
|
||||
std::string testPath = cmStrCat(result.Path, '/', result.Name);
|
||||
xml.Element("Name", result.Name);
|
||||
xml.Element("Path", this->CTest->GetShortPathToFile(result.Path));
|
||||
xml.Element("FullName", this->CTest->GetShortPathToFile(testPath));
|
||||
@@ -2128,7 +2129,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
|
||||
}
|
||||
|
||||
std::string lastTestsFailedLog =
|
||||
this->CTest->GetBinaryDir() + "/Testing/Temporary/" + logName;
|
||||
cmStrCat(this->CTest->GetBinaryDir(), "/Testing/Temporary/", logName);
|
||||
|
||||
if (!cmSystemTools::FileExists(lastTestsFailedLog)) {
|
||||
if (!this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels()) {
|
||||
@@ -2210,7 +2211,7 @@ void cmCTestTestHandler::RecordCustomTestMeasurements(cmXMLWriter& xml,
|
||||
xml.StartElement("NamedMeasurement");
|
||||
xml.Attribute("name", parser.MeasurementName);
|
||||
xml.Attribute("text", "text/string");
|
||||
xml.Element("Value", "File " + filename + " not found");
|
||||
xml.Element("Value", cmStrCat("File ", filename, " not found"));
|
||||
xml.EndElement();
|
||||
cmCTestOptionalLog(
|
||||
this->CTest, HANDLER_OUTPUT,
|
||||
@@ -2222,7 +2223,7 @@ void cmCTestTestHandler::RecordCustomTestMeasurements(cmXMLWriter& xml,
|
||||
xml.Attribute("name", parser.MeasurementName);
|
||||
xml.Attribute("type", "text/string");
|
||||
xml.Attribute("encoding", "none");
|
||||
xml.Element("Value", "Image " + filename + " is empty");
|
||||
xml.Element("Value", cmStrCat("Image ", filename, " is empty"));
|
||||
xml.EndElement();
|
||||
} else {
|
||||
if (parser.MeasurementType == "file") {
|
||||
@@ -2328,7 +2329,7 @@ void cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length,
|
||||
} else if (truncate == cmCTestTypes::TruncationMode::Middle) {
|
||||
char const* current = utf8_advance(begin, end, length / 2);
|
||||
output.erase(current - begin, output.size() - length);
|
||||
output.insert(current - begin, "..." + msg + "...");
|
||||
output.insert(current - begin, cmStrCat("...", msg, "..."));
|
||||
} else { // default or "tail"
|
||||
char const* current = utf8_advance(begin, end, length);
|
||||
output.erase(current - begin);
|
||||
|
||||
@@ -260,8 +260,8 @@ bool cmCTestUpdateCommand::ExecuteUpdate(UpdateArguments& args,
|
||||
xml.Element("Site", mf.GetSafeDefinition("CTEST_SITE"));
|
||||
xml.Element("BuildName", buildname);
|
||||
xml.Element("BuildStamp",
|
||||
this->CTest->GetCurrentTag() + "-" +
|
||||
this->CTest->GetTestGroupString());
|
||||
cmStrCat(this->CTest->GetCurrentTag(), '-',
|
||||
this->CTest->GetTestGroupString()));
|
||||
xml.Element("StartDateTime", start_time);
|
||||
xml.Element("StartTime", start_time_time);
|
||||
xml.Element("UpdateCommand", vc->GetUpdateCommandLine());
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmVersion.h"
|
||||
#include "cmXMLWriter.h"
|
||||
@@ -59,8 +60,8 @@ bool cmCTestUploadCommand::ExecuteUpload(UploadArguments& args,
|
||||
xml.StartElement("Site");
|
||||
xml.Attribute("BuildName", buildname);
|
||||
xml.Attribute("BuildStamp",
|
||||
this->CTest->GetCurrentTag() + "-" +
|
||||
this->CTest->GetTestGroupString());
|
||||
cmStrCat(this->CTest->GetCurrentTag(), '-',
|
||||
this->CTest->GetTestGroupString()));
|
||||
xml.Attribute("Name", mf.GetSafeDefinition("CTEST_SITE"));
|
||||
xml.Attribute("Generator",
|
||||
std::string("ctest-") + cmVersion::GetCMakeVersion());
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "cmCTest.h"
|
||||
#include "cmCTestCoverageHandler.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
|
||||
class cmParseDelphiCoverage::HTMLParser
|
||||
@@ -133,7 +134,7 @@ public:
|
||||
cmsys::Glob gl;
|
||||
gl.RecurseOn();
|
||||
gl.RecurseThroughSymlinksOff();
|
||||
std::string glob = this->Coverage.SourceDir + "*/" + filename;
|
||||
std::string glob = cmStrCat(this->Coverage.SourceDir, "*/", filename);
|
||||
gl.FindFiles(glob);
|
||||
std::vector<std::string> const& files = gl.GetFiles();
|
||||
if (files.empty()) {
|
||||
|
||||
@@ -48,7 +48,7 @@ protected:
|
||||
"Reading file: " << fileName << std::endl,
|
||||
this->Coverage.Quiet);
|
||||
|
||||
this->FilePath = this->PackagePath + "/" + fileName;
|
||||
this->FilePath = cmStrCat(this->PackagePath, '/', fileName);
|
||||
cmsys::ifstream fin(this->FilePath.c_str());
|
||||
if (!fin) {
|
||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||
|
||||
@@ -456,10 +456,11 @@ void cmCursesMainForm::UpdateProgress(std::string const& msg, float prog)
|
||||
int percentCompleted = static_cast<int>(100 * prog);
|
||||
this->LastProgress = (percentCompleted < 100 ? " " : "");
|
||||
this->LastProgress += (percentCompleted < 10 ? " " : "");
|
||||
this->LastProgress += std::to_string(percentCompleted) + "% [";
|
||||
this->LastProgress =
|
||||
cmStrCat(this->LastProgress, std::to_string(percentCompleted), "% [");
|
||||
this->LastProgress.append(progressBarCompleted, '#');
|
||||
this->LastProgress.append(progressBarWidth - progressBarCompleted, ' ');
|
||||
this->LastProgress += "] " + msg + "...";
|
||||
this->LastProgress = cmStrCat(this->LastProgress, "] ", msg, "...");
|
||||
this->DisplayOutputs(std::string());
|
||||
} else {
|
||||
this->Outputs.emplace_back(msg);
|
||||
|
||||
@@ -64,7 +64,7 @@ std::vector<std::string> cmEnvironment::GetVariables() const
|
||||
result.reserve(this->Map.size());
|
||||
for (auto const& elem : this->Map) {
|
||||
if (elem.second) {
|
||||
result.push_back(elem.first + '=' + *elem.second);
|
||||
result.push_back(cmStrCat(elem.first, '=', *elem.second));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -208,7 +208,7 @@ void cmEnvironmentModification::ApplyTo(cmEnvironment& env)
|
||||
|
||||
for (auto const& e : this->Entries) {
|
||||
if (e.Op == "set") {
|
||||
env.PutEnv(e.Name + "=" + e.Value);
|
||||
env.PutEnv(cmStrCat(e.Name, '=', e.Value));
|
||||
} else if (e.Op == "unset") {
|
||||
env.UnPutEnv(e.Name);
|
||||
} else if (e.Op == "string_append") {
|
||||
|
||||
Reference in New Issue
Block a user