Revise C++ coding style using clang-format with "east const"

Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Issue: #26123
This commit is contained in:
Kitware Robot
2025-01-23 11:54:40 -05:00
committed by Brad King
parent 6ef947ea97
commit 0b96ae1f6a
887 changed files with 9690 additions and 9692 deletions

View File

@@ -12,10 +12,10 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
// calculate square root
const double sqrt = MathFunctions::sqrt(inputValue);
double const sqrt = MathFunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << sqrt
<< std::endl;

View File

@@ -13,15 +13,15 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
// calculate square root
const double sqrt = MathFunctions::sqrt(inputValue);
double const sqrt = MathFunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << sqrt
<< std::endl;
// calculate sum
const double sum = MathFunctions::add(inputValue, inputValue);
double const sum = MathFunctions::add(inputValue, inputValue);
std::cout << inputValue << " + " << inputValue << " = " << sum << std::endl;
return 0;

View File

@@ -194,7 +194,7 @@ Lastly, replace ``sqrt`` with the wrapper function ``mathfunctions::sqrt``.
:caption: TODO 6: tutorial.cxx
:name: CMakeLists.txt-option
:language: cmake
:start-after: const double inputValue = std::stod(argv[1]);
:start-after: double const inputValue = std::stod(argv[1]);
:end-before: std::cout
.. raw:: html

View File

@@ -11,7 +11,7 @@ int main(int argc, char* argv[])
}
std::ofstream fout(argv[1], std::ios_base::out);
const bool fileOpen = fout.is_open();
bool const fileOpen = fout.is_open();
if (fileOpen) {
fout << "double sqrtTable[] = {" << std::endl;
for (int i = 0; i < 10; ++i) {

View File

@@ -16,9 +16,9 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
const double outputValue = mathfunctions::sqrt(inputValue);
double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;

View File

@@ -17,10 +17,10 @@ int main(int argc, char* argv[])
// convert input to double
// TODO 4: Replace atof(argv[1]) with std::stod(argv[1])
const double inputValue = atof(argv[1]);
double const inputValue = atof(argv[1]);
// calculate square root
const double outputValue = sqrt(inputValue);
double const outputValue = sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
return 0;

View File

@@ -11,7 +11,7 @@ int main(int argc, char* argv[])
}
std::ofstream fout(argv[1], std::ios_base::out);
const bool fileOpen = fout.is_open();
bool const fileOpen = fout.is_open();
if (fileOpen) {
fout << "double sqrtTable[] = {" << std::endl;
for (int i = 0; i < 10; ++i) {

View File

@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
const double outputValue = mathfunctions::sqrt(inputValue);
double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;

View File

@@ -11,7 +11,7 @@ int main(int argc, char* argv[])
}
std::ofstream fout(argv[1], std::ios_base::out);
const bool fileOpen = fout.is_open();
bool const fileOpen = fout.is_open();
if (fileOpen) {
fout << "double sqrtTable[] = {" << std::endl;
for (int i = 0; i < 10; ++i) {

View File

@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
const double outputValue = mathfunctions::sqrt(inputValue);
double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;

View File

@@ -11,7 +11,7 @@ int main(int argc, char* argv[])
}
std::ofstream fout(argv[1], std::ios_base::out);
const bool fileOpen = fout.is_open();
bool const fileOpen = fout.is_open();
if (fileOpen) {
fout << "double sqrtTable[] = {" << std::endl;
for (int i = 0; i < 10; ++i) {

View File

@@ -16,9 +16,9 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
const double outputValue = mathfunctions::sqrt(inputValue);
double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;

View File

@@ -17,12 +17,12 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
// TODO 6: Replace sqrt with mathfunctions::sqrt
// calculate square root
const double outputValue = sqrt(inputValue);
double const outputValue = sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;
return 0;

View File

@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
const double outputValue = mathfunctions::sqrt(inputValue);
double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;

View File

@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
const double outputValue = mathfunctions::sqrt(inputValue);
double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;

View File

@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
const double outputValue = mathfunctions::sqrt(inputValue);
double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;

View File

@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
const double outputValue = mathfunctions::sqrt(inputValue);
double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;

View File

@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
const double outputValue = mathfunctions::sqrt(inputValue);
double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;

View File

@@ -11,7 +11,7 @@ int main(int argc, char* argv[])
}
std::ofstream fout(argv[1], std::ios_base::out);
const bool fileOpen = fout.is_open();
bool const fileOpen = fout.is_open();
if (fileOpen) {
fout << "double sqrtTable[] = {" << std::endl;
for (int i = 0; i < 10; ++i) {

View File

@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
const double outputValue = mathfunctions::sqrt(inputValue);
double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;

View File

@@ -11,7 +11,7 @@ int main(int argc, char* argv[])
}
std::ofstream fout(argv[1], std::ios_base::out);
const bool fileOpen = fout.is_open();
bool const fileOpen = fout.is_open();
if (fileOpen) {
fout << "double sqrtTable[] = {" << std::endl;
for (int i = 0; i < 10; ++i) {

View File

@@ -17,9 +17,9 @@ int main(int argc, char* argv[])
}
// convert input to double
const double inputValue = std::stod(argv[1]);
double const inputValue = std::stod(argv[1]);
const double outputValue = mathfunctions::sqrt(inputValue);
double const outputValue = mathfunctions::sqrt(inputValue);
std::cout << "The square root of " << inputValue << " is " << outputValue
<< std::endl;

View File

@@ -1,7 +1,7 @@
/* Size of a pointer-to-data in bytes. */
#define SIZEOF_DPTR (sizeof(void*))
const char info_sizeof_dptr[] = {
char const info_sizeof_dptr[] = {
/* clang-format off */
'I', 'N', 'F', 'O', ':', 's', 'i', 'z', 'e', 'o', 'f', '_', 'd', 'p', 't',
'r', '[', ('0' + ((SIZEOF_DPTR / 10) % 10)), ('0' + (SIZEOF_DPTR % 10)), ']',

View File

@@ -11,7 +11,7 @@ static bool cmakeCompilerCUDAArch()
}
bool found = false;
const char* sep = "";
char const* sep = "";
for (int device = 0; device < count; ++device) {
cudaDeviceProp prop;
if (cudaGetDeviceProperties(&prop, device) == cudaSuccess) {

View File

@@ -7,7 +7,7 @@
#endif
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
static const char mpiver_str[] = { 'I', 'N',
static char const mpiver_str[] = { 'I', 'N',
'F', 'O',
':', 'M',
'P', 'I',

View File

@@ -20,29 +20,29 @@ cmCPackIFWCommon::cmCPackIFWCommon()
{
}
cmValue cmCPackIFWCommon::GetOption(const std::string& op) const
cmValue cmCPackIFWCommon::GetOption(std::string const& op) const
{
return this->Generator ? this->Generator->cmCPackGenerator::GetOption(op)
: nullptr;
}
bool cmCPackIFWCommon::IsOn(const std::string& op) const
bool cmCPackIFWCommon::IsOn(std::string const& op) const
{
return this->Generator && this->Generator->cmCPackGenerator::IsOn(op);
}
bool cmCPackIFWCommon::IsSetToOff(const std::string& op) const
bool cmCPackIFWCommon::IsSetToOff(std::string const& op) const
{
return this->Generator && this->Generator->cmCPackGenerator::IsSetToOff(op);
}
bool cmCPackIFWCommon::IsSetToEmpty(const std::string& op) const
bool cmCPackIFWCommon::IsSetToEmpty(std::string const& op) const
{
return this->Generator &&
this->Generator->cmCPackGenerator::IsSetToEmpty(op);
}
bool cmCPackIFWCommon::IsVersionLess(const char* version) const
bool cmCPackIFWCommon::IsVersionLess(char const* version) const
{
if (!this->Generator) {
return false;
@@ -52,7 +52,7 @@ bool cmCPackIFWCommon::IsVersionLess(const char* version) const
cmSystemTools::OP_LESS, this->Generator->FrameworkVersion, version);
}
bool cmCPackIFWCommon::IsVersionGreater(const char* version) const
bool cmCPackIFWCommon::IsVersionGreater(char const* version) const
{
if (!this->Generator) {
return false;
@@ -62,7 +62,7 @@ bool cmCPackIFWCommon::IsVersionGreater(const char* version) const
cmSystemTools::OP_GREATER, this->Generator->FrameworkVersion, version);
}
bool cmCPackIFWCommon::IsVersionEqual(const char* version) const
bool cmCPackIFWCommon::IsVersionEqual(char const* version) const
{
if (!this->Generator) {
return false;
@@ -73,7 +73,7 @@ bool cmCPackIFWCommon::IsVersionEqual(const char* version) const
}
void cmCPackIFWCommon::ExpandListArgument(
const std::string& arg, std::map<std::string, std::string>& argsOut)
std::string const& arg, std::map<std::string, std::string>& argsOut)
{
cmList args{ arg };
if (args.empty()) {
@@ -94,7 +94,7 @@ void cmCPackIFWCommon::ExpandListArgument(
}
void cmCPackIFWCommon::ExpandListArgument(
const std::string& arg, std::multimap<std::string, std::string>& argsOut)
std::string const& arg, std::multimap<std::string, std::string>& argsOut)
{
cmList args{ arg };
if (args.empty()) {

View File

@@ -28,32 +28,32 @@ public:
public:
// Internal implementation
cmValue GetOption(const std::string& op) const;
bool IsOn(const std::string& op) const;
bool IsSetToOff(const std::string& op) const;
bool IsSetToEmpty(const std::string& op) const;
cmValue GetOption(std::string const& op) const;
bool IsOn(std::string const& op) const;
bool IsSetToOff(std::string const& op) const;
bool IsSetToEmpty(std::string const& op) const;
/**
* Compare \a version with QtIFW framework version
*/
bool IsVersionLess(const char* version) const;
bool IsVersionLess(char const* version) const;
/**
* Compare \a version with QtIFW framework version
*/
bool IsVersionGreater(const char* version) const;
bool IsVersionGreater(char const* version) const;
/**
* Compare \a version with QtIFW framework version
*/
bool IsVersionEqual(const char* version) const;
bool IsVersionEqual(char const* version) const;
/** Expand the list argument containing the map of the key-value pairs.
* If the number of elements is odd, then the first value is used as the
* default value with an empty key.
* Any values with the same keys will be permanently overwritten.
*/
static void ExpandListArgument(const std::string& arg,
static void ExpandListArgument(std::string const& arg,
std::map<std::string, std::string>& argsOut);
/** Expand the list argument containing the multimap of the key-value pairs.
@@ -61,7 +61,7 @@ public:
* default value with an empty key.
*/
static void ExpandListArgument(
const std::string& arg, std::multimap<std::string, std::string>& argsOut);
std::string const& arg, std::multimap<std::string, std::string>& argsOut);
cmCPackIFWGenerator* Generator;

View File

@@ -116,7 +116,7 @@ std::vector<std::string> cmCPackIFWGenerator::BuildRepogenCommand()
return ifwCmd;
}
int cmCPackIFWGenerator::RunRepogen(const std::string& ifwTmpFile)
int cmCPackIFWGenerator::RunRepogen(std::string const& ifwTmpFile)
{
if (this->Installer.RemoteRepositories.empty()) {
return 1;
@@ -274,7 +274,7 @@ std::vector<std::string> cmCPackIFWGenerator::BuildBinaryCreatorCommand()
return ifwCmd;
}
int cmCPackIFWGenerator::RunBinaryCreator(const std::string& ifwTmpFile)
int cmCPackIFWGenerator::RunBinaryCreator(std::string const& ifwTmpFile)
{
std::vector<std::string> ifwCmd = this->BuildBinaryCreatorCommand();
cmCPackIFWLogger(VERBOSE,
@@ -303,9 +303,9 @@ int cmCPackIFWGenerator::RunBinaryCreator(const std::string& ifwTmpFile)
return 1;
}
const char* cmCPackIFWGenerator::GetPackagingInstallPrefix()
char const* cmCPackIFWGenerator::GetPackagingInstallPrefix()
{
const char* defPrefix = this->cmCPackGenerator::GetPackagingInstallPrefix();
char const* defPrefix = this->cmCPackGenerator::GetPackagingInstallPrefix();
std::string tmpPref = defPrefix ? defPrefix : "";
@@ -318,7 +318,7 @@ const char* cmCPackIFWGenerator::GetPackagingInstallPrefix()
return this->GetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX")->c_str();
}
const char* cmCPackIFWGenerator::GetOutputExtension()
char const* cmCPackIFWGenerator::GetOutputExtension()
{
return this->OutputExtension.c_str();
}
@@ -327,9 +327,9 @@ int cmCPackIFWGenerator::InitializeInternal()
{
// Search Qt Installer Framework tools
const std::string BinCreatorOpt = "CPACK_IFW_BINARYCREATOR_EXECUTABLE";
const std::string RepoGenOpt = "CPACK_IFW_REPOGEN_EXECUTABLE";
const std::string FrameworkVersionOpt = "CPACK_IFW_FRAMEWORK_VERSION";
std::string const BinCreatorOpt = "CPACK_IFW_BINARYCREATOR_EXECUTABLE";
std::string const RepoGenOpt = "CPACK_IFW_REPOGEN_EXECUTABLE";
std::string const FrameworkVersionOpt = "CPACK_IFW_FRAMEWORK_VERSION";
if (!this->IsSet(BinCreatorOpt) || !this->IsSet(RepoGenOpt) ||
!this->IsSet(FrameworkVersionOpt)) {
@@ -462,10 +462,10 @@ int cmCPackIFWGenerator::InitializeInternal()
}
std::string cmCPackIFWGenerator::GetComponentInstallSuffix(
const std::string& componentName)
std::string const& componentName)
{
const std::string prefix = "packages/";
const std::string suffix = "/data";
std::string const prefix = "packages/";
std::string const suffix = "/data";
if (this->componentPackageMethod == this->ONE_PACKAGE) {
return cmStrCat(prefix, this->GetRootPackageName(), suffix);
@@ -476,10 +476,10 @@ std::string cmCPackIFWGenerator::GetComponentInstallSuffix(
}
std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
const std::string& componentName)
std::string const& componentName)
{
const std::string prefix = "packages/";
const std::string suffix = "/data";
std::string const prefix = "packages/";
std::string const suffix = "/data";
if (this->componentPackageMethod == this->ONE_PACKAGE) {
return cmStrCat(prefix, this->GetRootPackageName(), suffix);
@@ -492,7 +492,7 @@ std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
}
cmCPackComponent* cmCPackIFWGenerator::GetComponent(
const std::string& projectName, const std::string& componentName)
std::string const& projectName, std::string const& componentName)
{
auto cit = this->Components.find(componentName);
if (cit != this->Components.end()) {
@@ -537,7 +537,7 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent(
}
cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
const std::string& projectName, const std::string& groupName)
std::string const& projectName, std::string const& groupName)
{
cmCPackComponentGroup* group =
this->cmCPackGenerator::GetComponentGroup(projectName, groupName);
@@ -682,7 +682,7 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
}
cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
const std::string& repositoryName)
std::string const& repositoryName)
{
auto rit = this->Repositories.find(repositoryName);
if (rit != this->Repositories.end()) {

View File

@@ -59,18 +59,18 @@ protected:
*/
int InitializeInternal() override;
int PackageFiles() override;
const char* GetPackagingInstallPrefix() override;
char const* GetPackagingInstallPrefix() override;
/**
* @brief Target binary extension
* @return Executable suffix or disk image format
*/
const char* GetOutputExtension() override;
char const* GetOutputExtension() override;
std::string GetComponentInstallSuffix(
const std::string& componentName) override;
std::string const& componentName) override;
std::string GetComponentInstallDirNameSuffix(
const std::string& componentName) override;
std::string const& componentName) override;
/**
* @brief Get Component
@@ -81,8 +81,8 @@ protected:
*
* @return Pointer to component
*/
cmCPackComponent* GetComponent(const std::string& projectName,
const std::string& componentName) override;
cmCPackComponent* GetComponent(std::string const& projectName,
std::string const& componentName) override;
/**
* @brief Get group of component
@@ -94,7 +94,7 @@ protected:
* @return Pointer to component group
*/
cmCPackComponentGroup* GetComponentGroup(
const std::string& projectName, const std::string& groupName) override;
std::string const& projectName, std::string const& groupName) override;
enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir()
const override;
@@ -114,7 +114,7 @@ protected:
cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup* group) const;
cmCPackIFWPackage* GetComponentPackage(cmCPackComponent* component) const;
cmCPackIFWRepository* GetRepository(const std::string& repositoryName);
cmCPackIFWRepository* GetRepository(std::string const& repositoryName);
protected:
// Data
@@ -143,10 +143,10 @@ protected:
private:
std::vector<std::string> BuildRepogenCommand();
int RunRepogen(const std::string& ifwTmpFile);
int RunRepogen(std::string const& ifwTmpFile);
std::vector<std::string> BuildBinaryCreatorCommand();
int RunBinaryCreator(const std::string& ifwTmpFile);
int RunBinaryCreator(std::string const& ifwTmpFile);
std::string RepoGen;
std::string BinCreator;

View File

@@ -23,7 +23,7 @@
cmCPackIFWInstaller::cmCPackIFWInstaller() = default;
void cmCPackIFWInstaller::printSkippedOptionWarning(
const std::string& optionName, const std::string& optionValue)
std::string const& optionName, std::string const& optionValue)
{
cmCPackIFWLogger(
WARNING,
@@ -293,7 +293,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
this->GetOption("CPACK_IFW_PACKAGE_RESOURCES")) {
this->Resources.clear();
cmExpandList(optIFW_PACKAGE_RESOURCES, this->Resources);
for (const auto& file : this->Resources) {
for (auto const& file : this->Resources) {
if (!cmSystemTools::FileExists(file)) {
// The warning will say skipped, but there will later be a hard error
// when the binarycreator tool tries to read the missing file.
@@ -308,7 +308,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
this->ProductImages.clear();
cmExpandList(productImages, this->ProductImages);
auto erase_missing_file_pred = [this](const std::string& file) -> bool {
auto erase_missing_file_pred = [this](std::string const& file) -> bool {
if (!cmSystemTools::FileExists(file)) {
this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_PRODUCT_IMAGES",
file);
@@ -396,7 +396,7 @@ public:
std::string path, basePath;
protected:
void StartElement(const std::string& name, const char** /*atts*/) override
void StartElement(std::string const& name, char const** /*atts*/) override
{
this->file = name == "file";
if (this->file) {
@@ -404,7 +404,7 @@ protected:
}
}
void CharacterDataHandler(const char* data, int length) override
void CharacterDataHandler(char const* data, int length) override
{
if (this->file) {
std::string content(data, data + length);
@@ -417,7 +417,7 @@ protected:
}
}
void EndElement(const std::string& /*name*/) override {}
void EndElement(std::string const& /*name*/) override {}
};
void cmCPackIFWInstaller::GenerateInstallerFile()
@@ -621,7 +621,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
// RunProgramArguments
if (!this->RunProgramArguments.empty()) {
xout.StartElement("RunProgramArguments");
for (const auto& arg : this->RunProgramArguments) {
for (auto const& arg : this->RunProgramArguments) {
xout.Element("Argument", arg);
}
xout.EndElement();
@@ -640,7 +640,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
// Product images (copy to config dir)
if (!this->IsVersionLess("4.0") && !this->ProductImages.empty()) {
xout.StartElement("ProductImages");
const bool hasProductImageUrl = !this->ProductImageUrls.empty();
bool const hasProductImageUrl = !this->ProductImageUrls.empty();
for (size_t i = 0; i < this->ProductImages.size(); ++i) {
xout.StartElement("ProductImage");
auto const& srcImg = this->ProductImages[i];

View File

@@ -158,6 +158,6 @@ public:
std::string Directory;
protected:
void printSkippedOptionWarning(const std::string& optionName,
const std::string& optionValue);
void printSkippedOptionWarning(std::string const& optionName,
std::string const& optionValue);
};

View File

@@ -32,7 +32,7 @@ cmCPackIFWPackage::CompareStruct::CompareStruct()
cmCPackIFWPackage::DependenceStruct::DependenceStruct() = default;
cmCPackIFWPackage::DependenceStruct::DependenceStruct(
const std::string& dependence)
std::string const& dependence)
{
// Preferred format is name and version are separated by a colon (:), but
// note that this is only supported with QtIFW 3.1 or later. Backward
@@ -51,7 +51,7 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct(
return;
}
const auto versionPart =
auto const versionPart =
cm::string_view(dependence.data() + pos, dependence.size() - pos);
if (cmHasLiteralPrefix(versionPart, "<=")) {
@@ -339,7 +339,7 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
return this->ConfigureFromPrefix(prefix);
}
int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName)
int cmCPackIFWPackage::ConfigureFromGroup(std::string const& groupName)
{
// Group configuration
@@ -373,7 +373,7 @@ int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName)
}
// Common options for components and groups
int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
int cmCPackIFWPackage::ConfigureFromPrefix(std::string const& prefix)
{
// Temporary variable for full option name
std::string option;
@@ -635,7 +635,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
}
// Dependencies
const bool hyphensInNamesUnsupported = this->Generator &&
bool const hyphensInNamesUnsupported = this->Generator &&
!this->Generator->FrameworkVersion.empty() && this->IsVersionLess("3.1");
bool warnUnsupportedNames = false;
std::set<DependenceStruct> compDepSet;

View File

@@ -44,14 +44,14 @@ public:
struct DependenceStruct
{
DependenceStruct();
explicit DependenceStruct(const std::string& dependence);
explicit DependenceStruct(std::string const& dependence);
std::string Name;
CompareStruct Compare;
std::string NameWithCompare() const;
bool operator<(const DependenceStruct& other) const
bool operator<(DependenceStruct const& other) const
{
return this->Name < other.Name;
}
@@ -132,8 +132,8 @@ public:
int ConfigureFromOptions();
int ConfigureFromComponent(cmCPackComponent* component);
int ConfigureFromGroup(cmCPackComponentGroup* group);
int ConfigureFromGroup(const std::string& groupName);
int ConfigureFromPrefix(const std::string& prefix);
int ConfigureFromGroup(std::string const& groupName);
int ConfigureFromPrefix(std::string const& prefix);
void GeneratePackageFile();

View File

@@ -124,22 +124,22 @@ public:
bool patched = false;
protected:
void StartElement(const std::string& name, const char** atts) override
void StartElement(std::string const& name, char const** atts) override
{
this->xout.StartElement(name);
this->StartFragment(atts);
}
void StartFragment(const char** atts)
void StartFragment(char const** atts)
{
for (size_t i = 0; atts[i]; i += 2) {
const char* key = atts[i];
const char* value = atts[i + 1];
char const* key = atts[i];
char const* value = atts[i + 1];
this->xout.Attribute(key, value);
}
}
void EndElement(const std::string& name) override
void EndElement(std::string const& name) override
{
if (name == "Updates" && !this->patched) {
this->repository->WriteRepositoryUpdates(this->xout);
@@ -155,7 +155,7 @@ protected:
}
}
void CharacterDataHandler(const char* data, int length) override
void CharacterDataHandler(char const* data, int length) override
{
std::string content(data, data + length);
if (content.empty() || content == " " || content == " " ||

View File

@@ -9,7 +9,7 @@
#ifdef __CYGWIN__
# include <sys/cygwin.h>
std::string CMakeToWixPath(const std::string& cygpath)
std::string CMakeToWixPath(std::string const& cygpath)
{
std::vector<char> winpath_chars;
ssize_t winpath_size;
@@ -32,7 +32,7 @@ std::string CMakeToWixPath(const std::string& cygpath)
return cmTrimWhitespace(winpath_chars.data());
}
#else
std::string CMakeToWixPath(const std::string& path)
std::string CMakeToWixPath(std::string const& path)
{
return path;
}

View File

@@ -6,4 +6,4 @@
#include <string>
std::string CMakeToWixPath(const std::string& cygpath);
std::string CMakeToWixPath(std::string const& cygpath);

View File

@@ -1224,7 +1224,7 @@ std::string cmCPackWIXGenerator::CreateHashedId(
cmCryptoHash sha1(cmCryptoHash::AlgoSHA1);
std::string const hash = sha1.HashString(path);
const size_t maxFileNameLength = 52;
size_t const maxFileNameLength = 52;
std::string identifier =
cmStrCat(cm::string_view(hash).substr(0, 7), '_',
cm::string_view(normalizedFilename).substr(0, maxFileNameLength));

View File

@@ -24,8 +24,8 @@ public:
cmCPackTypeMacro(cmCPackWIXGenerator, cmCPackGenerator);
cmCPackWIXGenerator();
cmCPackWIXGenerator(const cmCPackWIXGenerator&) = delete;
const cmCPackWIXGenerator& operator=(const cmCPackWIXGenerator&) = delete;
cmCPackWIXGenerator(cmCPackWIXGenerator const&) = delete;
cmCPackWIXGenerator const& operator=(cmCPackWIXGenerator const&) = delete;
~cmCPackWIXGenerator();
protected:
@@ -33,7 +33,7 @@ protected:
int PackageFiles() override;
const char* GetOutputExtension() override { return ".msi"; }
char const* GetOutputExtension() override { return ".msi"; }
enum CPackSetDestdirSupport SupportsSetDestdir() const override
{

View File

@@ -72,7 +72,7 @@ void cmWIXAccessControlList::ReportError(std::string const& entry,
bool cmWIXAccessControlList::IsBooleanAttribute(std::string const& name)
{
static const char* validAttributes[] = {
static char const* validAttributes[] = {
/* clang-format needs this comment to break after the opening brace */
"Append",
"ChangePermission",

View File

@@ -19,10 +19,10 @@ public:
void CreateCMakePackageRegistryEntry(std::string const& package,
std::string const& upgradeGuid);
void EmitFeatureForComponentGroup(const cmCPackComponentGroup& group,
void EmitFeatureForComponentGroup(cmCPackComponentGroup const& group,
cmWIXPatch& patch);
void EmitFeatureForComponent(const cmCPackComponent& component,
void EmitFeatureForComponent(cmCPackComponent const& component,
cmWIXPatch& patch);
void EmitComponentRef(std::string const& id);

View File

@@ -30,7 +30,7 @@ void cmWIXPatch::ApplyFragment(std::string const& id,
return;
}
const cmWIXPatchElement& fragment = i->second;
cmWIXPatchElement const& fragment = i->second;
for (auto const& attr : fragment.attributes) {
writer.AddAttribute(attr.first, attr.second);
}
@@ -39,22 +39,22 @@ void cmWIXPatch::ApplyFragment(std::string const& id,
Fragments.erase(i);
}
void cmWIXPatch::ApplyElementChildren(const cmWIXPatchElement& element,
void cmWIXPatch::ApplyElementChildren(cmWIXPatchElement const& element,
cmWIXSourceWriter& writer)
{
for (const auto& node : element.children) {
for (auto const& node : element.children) {
switch (node->type()) {
case cmWIXPatchNode::ELEMENT:
ApplyElement(dynamic_cast<const cmWIXPatchElement&>(*node), writer);
ApplyElement(dynamic_cast<cmWIXPatchElement const&>(*node), writer);
break;
case cmWIXPatchNode::TEXT:
writer.AddTextNode(dynamic_cast<const cmWIXPatchText&>(*node).text);
writer.AddTextNode(dynamic_cast<cmWIXPatchText const&>(*node).text);
break;
}
}
}
void cmWIXPatch::ApplyElement(const cmWIXPatchElement& element,
void cmWIXPatch::ApplyElement(cmWIXPatchElement const& element,
cmWIXSourceWriter& writer)
{
writer.BeginElement(element.name);

View File

@@ -22,10 +22,10 @@ public:
bool CheckForUnappliedFragments();
private:
void ApplyElementChildren(const cmWIXPatchElement& element,
void ApplyElementChildren(cmWIXPatchElement const& element,
cmWIXSourceWriter& writer);
void ApplyElement(const cmWIXPatchElement& element,
void ApplyElement(cmWIXPatchElement const& element,
cmWIXSourceWriter& writer);
cmCPackLog* Logger;

View File

@@ -35,7 +35,7 @@ cmWIXPatchParser::cmWIXPatchParser(fragment_map_t& fragments,
{
}
void cmWIXPatchParser::StartElement(const std::string& name, const char** atts)
void cmWIXPatchParser::StartElement(std::string const& name, char const** atts)
{
if (State == BEGIN_DOCUMENT) {
if (name == "CPackWiXPatch"_s) {
@@ -69,13 +69,13 @@ void cmWIXPatchParser::StartElement(const std::string& name, const char** atts)
}
}
void cmWIXPatchParser::StartFragment(const char** attributes)
void cmWIXPatchParser::StartFragment(char const** attributes)
{
cmWIXPatchElement* new_element = nullptr;
/* find the id of for fragment */
for (size_t i = 0; attributes[i]; i += 2) {
const std::string key = attributes[i];
const std::string value = attributes[i + 1];
std::string const key = attributes[i];
std::string const value = attributes[i + 1];
if (key == "Id"_s) {
if (Fragments.find(value) != Fragments.end()) {
@@ -94,8 +94,8 @@ void cmWIXPatchParser::StartFragment(const char** attributes)
ReportValidationError("No 'Id' specified for 'CPackWixFragment' element");
} else {
for (size_t i = 0; attributes[i]; i += 2) {
const std::string key = attributes[i];
const std::string value = attributes[i + 1];
std::string const key = attributes[i];
std::string const value = attributes[i + 1];
if (key != "Id"_s) {
new_element->attributes[key] = value;
@@ -104,7 +104,7 @@ void cmWIXPatchParser::StartFragment(const char** attributes)
}
}
void cmWIXPatchParser::EndElement(const std::string& name)
void cmWIXPatchParser::EndElement(std::string const& name)
{
if (State == INSIDE_FRAGMENT) {
if (name == "CPackWiXFragment"_s) {
@@ -116,9 +116,9 @@ void cmWIXPatchParser::EndElement(const std::string& name)
}
}
void cmWIXPatchParser::CharacterDataHandler(const char* data, int length)
void cmWIXPatchParser::CharacterDataHandler(char const* data, int length)
{
const char* whitespace = "\x20\x09\x0d\x0a";
char const* whitespace = "\x20\x09\x0d\x0a";
if (State == INSIDE_FRAGMENT) {
cmWIXPatchElement& parent = *ElementStack.back();
@@ -137,7 +137,7 @@ void cmWIXPatchParser::CharacterDataHandler(const char* data, int length)
}
}
void cmWIXPatchParser::ReportError(int line, int column, const char* msg)
void cmWIXPatchParser::ReportError(int line, int column, char const* msg)
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error while processing XML patch file at "

View File

@@ -35,8 +35,8 @@ struct cmWIXPatchElement : cmWIXPatchNode
cmWIXPatchElement();
cmWIXPatchElement(const cmWIXPatchElement&) = delete;
const cmWIXPatchElement& operator=(const cmWIXPatchElement&) = delete;
cmWIXPatchElement(cmWIXPatchElement const&) = delete;
cmWIXPatchElement const& operator=(cmWIXPatchElement const&) = delete;
~cmWIXPatchElement();
@@ -59,15 +59,15 @@ public:
cmWIXPatchParser(fragment_map_t& Fragments, cmCPackLog* logger);
private:
virtual void StartElement(const std::string& name, const char** atts);
virtual void StartElement(std::string const& name, char const** atts);
void StartFragment(const char** attributes);
void StartFragment(char const** attributes);
virtual void EndElement(const std::string& name);
virtual void EndElement(std::string const& name);
virtual void CharacterDataHandler(const char* data, int length);
virtual void CharacterDataHandler(char const* data, int length);
virtual void ReportError(int line, int column, const char* msg);
virtual void ReportError(int line, int column, char const* msg);
void ReportValidationError(std::string const& message);

View File

@@ -45,8 +45,8 @@ private:
* @return DeduplicateStatus indicating whether to add, skip, or flag an
* error for the file.
*/
DeduplicateStatus CompareFile(const std::string& path,
const std::string& localTopLevel)
DeduplicateStatus CompareFile(std::string const& path,
std::string const& localTopLevel)
{
auto fileItr = this->Files.find(path);
if (fileItr != this->Files.end()) {
@@ -65,7 +65,7 @@ private:
* @param path The path of the folder to compare.
* @return DeduplicateStatus indicating whether to add or skip the folder.
*/
DeduplicateStatus CompareFolder(const std::string& path)
DeduplicateStatus CompareFolder(std::string const& path)
{
if (this->Folders.find(path) != this->Folders.end()) {
return DeduplicateStatus::Skip;
@@ -82,7 +82,7 @@ private:
* @return DeduplicateStatus indicating whether to add, skip, or flag an
* error for the symlink.
*/
DeduplicateStatus CompareSymlink(const std::string& path)
DeduplicateStatus CompareSymlink(std::string const& path)
{
auto symlinkItr = this->Symlink.find(path);
std::string symlinkValue;
@@ -112,8 +112,8 @@ public:
* @return DeduplicateStatus indicating the action to take for the given
* path.
*/
DeduplicateStatus IsDeduplicate(const std::string& path,
const std::string& localTopLevel)
DeduplicateStatus IsDeduplicate(std::string const& path,
std::string const& localTopLevel)
{
DeduplicateStatus status;
if (cmSystemTools::FileIsDirectory(path)) {
@@ -186,7 +186,7 @@ cmCPackArchiveGenerator::cmCPackArchiveGenerator(
cmCPackArchiveGenerator::~cmCPackArchiveGenerator() = default;
std::string cmCPackArchiveGenerator::GetArchiveComponentFileName(
const std::string& component, bool isGroupName)
std::string const& component, bool isGroupName)
{
std::string componentUpper(cmSystemTools::UpperCase(component));
std::string packageFileName;

View File

@@ -44,7 +44,7 @@ public:
private:
// get archive component filename
std::string GetArchiveComponentFileName(const std::string& component,
std::string GetArchiveComponentFileName(std::string const& component,
bool isGroupName);
class Deduplicator;
@@ -82,9 +82,9 @@ protected:
int PackageComponentsAllInOne();
private:
const char* GetNameOfClass() override { return "cmCPackArchiveGenerator"; }
char const* GetNameOfClass() override { return "cmCPackArchiveGenerator"; }
const char* GetOutputExtension() override
char const* GetOutputExtension() override
{
return this->OutputExtension.c_str();
}

View File

@@ -27,7 +27,7 @@ int cmCPackBundleGenerator::InitializeInternal()
}
if (this->GetOption("CPACK_BUNDLE_APPLE_CERT_APP")) {
const std::string codesign_path = cmSystemTools::FindProgram(
std::string const codesign_path = cmSystemTools::FindProgram(
"codesign", std::vector<std::string>(), false);
if (codesign_path.empty()) {
@@ -41,7 +41,7 @@ int cmCPackBundleGenerator::InitializeInternal()
return this->Superclass::InitializeInternal();
}
const char* cmCPackBundleGenerator::GetPackagingInstallPrefix()
char const* cmCPackBundleGenerator::GetPackagingInstallPrefix()
{
this->InstallPrefix = cmStrCat('/', this->GetOption("CPACK_BUNDLE_NAME"),
".app/Contents/Resources");
@@ -176,7 +176,7 @@ bool cmCPackBundleGenerator::SupportsComponentInstallation() const
return false;
}
int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
int cmCPackBundleGenerator::SignBundle(std::string const& src_dir)
{
cmValue cpack_apple_cert_app =
this->GetOption("CPACK_BUNDLE_APPLE_CERT_APP");
@@ -189,7 +189,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
cmStrCat(src_dir, '/', this->GetOption("CPACK_BUNDLE_NAME"), ".app");
// A list of additional files to sign, ie. frameworks and plugins.
const std::string sign_parameter =
std::string const sign_parameter =
this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER")
? *this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER")
: "--deep -f";

View File

@@ -24,9 +24,9 @@ public:
protected:
int InitializeInternal() override;
const char* GetPackagingInstallPrefix() override;
char const* GetPackagingInstallPrefix() override;
int ConstructBundle();
int SignBundle(const std::string& src_dir);
int SignBundle(std::string const& src_dir);
int PackageFiles() override;
bool SupportsComponentInstallation() const override;

View File

@@ -8,7 +8,7 @@
#include "cmSystemTools.h"
unsigned long cmCPackComponent::GetInstalledSize(
const std::string& installDir) const
std::string const& installDir) const
{
if (this->TotalSize != 0) {
return this->TotalSize;
@@ -23,7 +23,7 @@ unsigned long cmCPackComponent::GetInstalledSize(
}
unsigned long cmCPackComponent::GetInstalledSizeInKbytes(
const std::string& installDir) const
std::string const& installDir) const
{
unsigned long result = (this->GetInstalledSize(installDir) + 512) / 1024;
return result ? result : 1;

View File

@@ -94,11 +94,11 @@ public:
/// Get the total installed size of all of the files in this
/// component, in bytes. installDir is the directory into which the
/// component was installed.
unsigned long GetInstalledSize(const std::string& installDir) const;
unsigned long GetInstalledSize(std::string const& installDir) const;
/// Identical to GetInstalledSize, but returns the result in
/// kilobytes.
unsigned long GetInstalledSizeInKbytes(const std::string& installDir) const;
unsigned long GetInstalledSizeInKbytes(std::string const& installDir) const;
private:
mutable unsigned long TotalSize = 0;

View File

@@ -55,7 +55,7 @@ int cmCPackCygwinBinaryGenerator::PackageFiles()
return this->Superclass::PackageFiles();
}
const char* cmCPackCygwinBinaryGenerator::GetOutputExtension()
char const* cmCPackCygwinBinaryGenerator::GetOutputExtension()
{
this->OutputExtension = "-";
cmValue patchNumber = this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");

View File

@@ -21,6 +21,6 @@ public:
protected:
int InitializeInternal() override;
int PackageFiles() override;
const char* GetOutputExtension() override;
char const* GetOutputExtension() override;
std::string OutputExtension;
};

View File

@@ -48,7 +48,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
// Now create a tar file that contains the above .tar.bz2 file
// and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY
// files
const std::string& compressOutFile = packageDirFileName;
std::string const& compressOutFile = packageDirFileName;
// at this point compressOutFile is the full path to
// _CPack_Package/.../package-2.5.0.tar.bz2
// we want to create a tar _CPack_Package/.../package-2.5.0-1-src.tar.bz2
@@ -135,14 +135,14 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
return 1;
}
const char* cmCPackCygwinSourceGenerator::GetPackagingInstallPrefix()
char const* cmCPackCygwinSourceGenerator::GetPackagingInstallPrefix()
{
this->InstallPrefix =
cmStrCat('/', this->GetOption("CPACK_PACKAGE_FILE_NAME"));
return this->InstallPrefix.c_str();
}
const char* cmCPackCygwinSourceGenerator::GetOutputExtension()
char const* cmCPackCygwinSourceGenerator::GetOutputExtension()
{
this->OutputExtension = "-";
cmValue patch = this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");

View File

@@ -19,10 +19,10 @@ public:
~cmCPackCygwinSourceGenerator() override;
protected:
const char* GetPackagingInstallPrefix() override;
char const* GetPackagingInstallPrefix() override;
int InitializeInternal() override;
int PackageFiles() override;
const char* GetOutputExtension() override;
char const* GetOutputExtension() override;
std::string InstallPrefix;
std::string OutputExtension;
};

View File

@@ -51,23 +51,23 @@ private:
bool generateDeb() const;
cmCPackLog* Logger;
const std::string OutputName;
const std::string WorkDir;
std::string const OutputName;
std::string const WorkDir;
std::string CompressionSuffix;
const std::string TopLevelDir;
const std::string TemporaryDir;
const std::string DebianArchiveType;
std::string const TopLevelDir;
std::string const TemporaryDir;
std::string const DebianArchiveType;
long NumThreads;
const std::map<std::string, std::string> ControlValues;
const bool GenShLibs;
const std::string ShLibsFilename;
const bool GenPostInst;
const std::string PostInst;
const bool GenPostRm;
const std::string PostRm;
std::map<std::string, std::string> const ControlValues;
bool const GenShLibs;
std::string const ShLibsFilename;
bool const GenPostInst;
std::string const PostInst;
bool const GenPostRm;
std::string const PostRm;
cmValue ControlExtra;
const bool PermissionStrictPolicy;
const std::vector<std::string> PackageFiles;
bool const PermissionStrictPolicy;
std::vector<std::string> const PackageFiles;
cmArchiveWrite::Compress TarCompressionType;
};
@@ -154,7 +154,7 @@ bool DebGenerator::generate() const
void DebGenerator::generateDebianBinaryFile() const
{
// debian-binary file
const std::string dbfilename = this->WorkDir + "/debian-binary";
std::string const dbfilename = this->WorkDir + "/debian-binary";
cmGeneratedFileStream out;
out.Open(dbfilename, false, true);
out << "2.0\n"; // required for valid debian package
@@ -342,9 +342,9 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const
and
https://lintian.debian.org/tags/control-file-has-bad-permissions.html
*/
const mode_t permission644 = 0644;
const mode_t permissionExecute = 0111;
const mode_t permission755 = permission644 | permissionExecute;
mode_t const permission644 = 0644;
mode_t const permissionExecute = 0111;
mode_t const permission755 = permission644 | permissionExecute;
// for md5sum and control (that we have generated here), we use 644
// (RW-R--R--)
@@ -420,7 +420,7 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const
if (this->ControlExtra) {
// permissions are now controlled by the original file permissions
static const char* strictFiles[] = { "config", "postinst", "postrm",
static char const* strictFiles[] = { "config", "postinst", "postrm",
"preinst", "prerm" };
std::set<std::string> setStrictFiles(
strictFiles, strictFiles + sizeof(strictFiles) / sizeof(strictFiles[0]));
@@ -501,7 +501,7 @@ bool DebGenerator::generateDeb() const
return true;
}
std::vector<std::string> findFilesIn(const std::string& path)
std::vector<std::string> findFilesIn(std::string const& path)
{
cmsys::Glob gl;
std::string findExpr = path + "/*";
@@ -614,7 +614,7 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup)
//----------------------------------------------------------------------
int cmCPackDebGenerator::PackageComponentsAllInOne(
const std::string& compInstDirName)
std::string const& compInstDirName)
{
/* Reset package file name list it will be populated during the
* component packaging run*/
@@ -684,12 +684,12 @@ int cmCPackDebGenerator::PackageFiles()
bool cmCPackDebGenerator::createDebPackages()
{
auto make_package = [this](const std::string& path,
const char* const output_var,
auto make_package = [this](std::string const& path,
char const* const output_var,
bool (cmCPackDebGenerator::*creator)()) -> bool {
try {
this->packageFiles = findFilesIn(path);
} catch (const std::runtime_error& ex) {
} catch (std::runtime_error const& ex) {
cmCPackLogger(cmCPackLog::LOG_ERROR, ex.what() << std::endl);
return false;
}
@@ -805,12 +805,12 @@ bool cmCPackDebGenerator::createDeb()
controlValues["Multi-Arch"] = *debian_pkg_multiarch;
}
const std::string strGenWDIR(this->GetOption("GEN_WDIR"));
const std::string shlibsfilename = strGenWDIR + "/shlibs";
std::string const strGenWDIR(this->GetOption("GEN_WDIR"));
std::string const shlibsfilename = strGenWDIR + "/shlibs";
cmValue debian_pkg_shlibs =
this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SHLIBS");
const bool gen_shibs = this->IsOn("CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS") &&
bool const gen_shibs = this->IsOn("CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS") &&
cmNonempty(debian_pkg_shlibs);
if (gen_shibs) {
cmGeneratedFileStream out;
@@ -819,8 +819,8 @@ bool cmCPackDebGenerator::createDeb()
out << '\n';
}
const std::string postinst = strGenWDIR + "/postinst";
const std::string postrm = strGenWDIR + "/postrm";
std::string const postinst = strGenWDIR + "/postinst";
std::string const postrm = strGenWDIR + "/postrm";
if (this->IsOn("GEN_CPACK_DEBIAN_GENERATE_POSTINST")) {
cmGeneratedFileStream out;
out.Open(postinst, false, true);
@@ -915,7 +915,7 @@ bool cmCPackDebGenerator::SupportsComponentInstallation() const
}
std::string cmCPackDebGenerator::GetComponentInstallSuffix(
const std::string& componentName)
std::string const& componentName)
{
if (this->componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) {
return componentName;
@@ -935,7 +935,7 @@ std::string cmCPackDebGenerator::GetComponentInstallSuffix(
}
std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix(
const std::string& componentName)
std::string const& componentName)
{
return this->GetSanitizedDirOrFileName(
this->GetComponentInstallSuffix(componentName));

View File

@@ -55,14 +55,14 @@ protected:
* Special case of component install where all
* components will be put in a single installer.
*/
int PackageComponentsAllInOne(const std::string& compInstDirName);
int PackageComponentsAllInOne(std::string const& compInstDirName);
int PackageFiles() override;
const char* GetOutputExtension() override { return ".deb"; }
char const* GetOutputExtension() override { return ".deb"; }
bool SupportsComponentInstallation() const override;
std::string GetComponentInstallSuffix(
const std::string& componentName) override;
std::string const& componentName) override;
std::string GetComponentInstallDirNameSuffix(
const std::string& componentName) override;
std::string const& componentName) override;
private:
bool createDebPackages();

View File

@@ -35,7 +35,7 @@
# include <CoreServices/CoreServices.h>
#endif
static const uint16_t DefaultLpic[] = {
static uint16_t const DefaultLpic[] = {
/* clang-format off */
0x0002, 0x0011, 0x0003, 0x0001, 0x0000, 0x0000, 0x0002, 0x0000,
0x0008, 0x0003, 0x0000, 0x0001, 0x0004, 0x0000, 0x0004, 0x0005,
@@ -47,7 +47,7 @@ static const uint16_t DefaultLpic[] = {
/* clang-format on */
};
static const std::vector<std::string> DefaultMenu = {
static std::vector<std::string> const DefaultMenu = {
{ "English", "Agree", "Disagree", "Print", "Save...",
// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
"You agree to the License Agreement terms when "
@@ -75,7 +75,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
paths.emplace_back("/Applications/Xcode.app/Contents/Developer/Tools");
paths.emplace_back("/Developer/Tools");
const std::string hdiutil_path =
std::string const hdiutil_path =
cmSystemTools::FindProgram("hdiutil", std::vector<std::string>(), false);
if (hdiutil_path.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -84,7 +84,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
}
this->SetOptionIfNotSet("CPACK_COMMAND_HDIUTIL", hdiutil_path);
const std::string setfile_path =
std::string const setfile_path =
cmSystemTools::FindProgram("SetFile", paths, false);
if (setfile_path.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -93,7 +93,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
}
this->SetOptionIfNotSet("CPACK_COMMAND_SETFILE", setfile_path);
const std::string rez_path = cmSystemTools::FindProgram("Rez", paths, false);
std::string const rez_path = cmSystemTools::FindProgram("Rez", paths, false);
if (rez_path.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot locate Rez command" << std::endl);
@@ -166,7 +166,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
return this->Superclass::InitializeInternal();
}
const char* cmCPackDragNDropGenerator::GetOutputExtension()
char const* cmCPackDragNDropGenerator::GetOutputExtension()
{
return ".dmg";
}
@@ -266,22 +266,22 @@ bool cmCPackDragNDropGenerator::RunCommand(std::string const& command,
return true;
}
int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
const std::string& output_file)
int cmCPackDragNDropGenerator::CreateDMG(std::string const& src_dir,
std::string const& output_file)
{
// Get optional arguments ...
cmValue cpack_package_icon = this->GetOption("CPACK_PACKAGE_ICON");
const std::string cpack_dmg_volume_name =
std::string const cpack_dmg_volume_name =
this->GetOption("CPACK_DMG_VOLUME_NAME")
? *this->GetOption("CPACK_DMG_VOLUME_NAME")
: *this->GetOption("CPACK_PACKAGE_FILE_NAME");
const std::string cpack_dmg_format = this->GetOption("CPACK_DMG_FORMAT")
std::string const cpack_dmg_format = this->GetOption("CPACK_DMG_FORMAT")
? *this->GetOption("CPACK_DMG_FORMAT")
: "UDZO";
const std::string cpack_dmg_filesystem =
std::string const cpack_dmg_filesystem =
this->GetOption("CPACK_DMG_FILESYSTEM")
? *this->GetOption("CPACK_DMG_FILESYSTEM")
: "HFS+";
@@ -302,7 +302,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
cmValue cpack_dmg_ds_store_setup_script =
this->GetOption("CPACK_DMG_DS_STORE_SETUP_SCRIPT");
const bool cpack_dmg_disable_applications_symlink =
bool const cpack_dmg_disable_applications_symlink =
this->IsOn("CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK");
// only put license on dmg if is user provided
@@ -372,7 +372,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
// Make sure the background file type is the same as the custom image
// and that the file is hidden so it doesn't show up.
if (!cpack_dmg_background_image->empty()) {
const std::string extension =
std::string const extension =
cmSystemTools::GetFilenameLastExtension(cpack_dmg_background_image);
std::ostringstream package_background_source;
package_background_source << cpack_dmg_background_image;
@@ -709,7 +709,7 @@ bool cmCPackDragNDropGenerator::SupportsComponentInstallation() const
}
std::string cmCPackDragNDropGenerator::GetComponentInstallSuffix(
const std::string& componentName)
std::string const& componentName)
{
// we want to group components together that go in the same dmg package
std::string package_file_name = this->GetOption("CPACK_PACKAGE_FILE_NAME");
@@ -749,7 +749,7 @@ std::string cmCPackDragNDropGenerator::GetComponentInstallSuffix(
}
std::string cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix(
const std::string& componentName)
std::string const& componentName)
{
return this->GetSanitizedDirOrFileName(
this->GetComponentInstallSuffix(componentName));
@@ -814,7 +814,7 @@ void cmCPackDragNDropGenerator::WriteRezDict(cmXMLWriter& xml,
bool cmCPackDragNDropGenerator::WriteLicense(RezDoc& rez, size_t licenseNumber,
std::string licenseLanguage,
const std::string& licenseFile,
std::string const& licenseFile,
std::string* error)
{
if (!licenseFile.empty() && !singleLicense) {
@@ -919,11 +919,11 @@ bool cmCPackDragNDropGenerator::ReadFile(std::string const& file,
return true;
}
bool cmCPackDragNDropGenerator::BreakLongLine(const std::string& line,
bool cmCPackDragNDropGenerator::BreakLongLine(std::string const& line,
std::vector<std::string>& lines,
std::string* error)
{
const size_t max_line_length = 255;
size_t const max_line_length = 255;
size_t line_length = max_line_length;
for (size_t i = 0; i < line.size(); i += line_length) {
line_length = max_line_length;

View File

@@ -27,7 +27,7 @@ public:
protected:
int InitializeInternal() override;
const char* GetOutputExtension() override;
char const* GetOutputExtension() override;
int PackageFiles() override;
bool SupportsComponentInstallation() const override;
@@ -36,11 +36,11 @@ protected:
bool RunCommand(std::string const& command, std::string* output = nullptr);
std::string GetComponentInstallSuffix(
const std::string& componentName) override;
std::string const& componentName) override;
std::string GetComponentInstallDirNameSuffix(
const std::string& componentName) override;
std::string const& componentName) override;
int CreateDMG(const std::string& src_dir, const std::string& output_file);
int CreateDMG(std::string const& src_dir, std::string const& output_file);
private:
std::string slaDirectory;
@@ -73,11 +73,11 @@ private:
bool WriteLicense(RezDoc& rez, size_t licenseNumber,
std::string licenseLanguage,
const std::string& licenseFile, std::string* error);
std::string const& licenseFile, std::string* error);
void EncodeLicense(RezDict& dict, std::vector<std::string> const& lines);
void EncodeMenu(RezDict& dict, std::vector<std::string> const& lines);
bool ReadFile(std::string const& file, std::vector<std::string>& lines,
std::string* error);
bool BreakLongLine(const std::string& line, std::vector<std::string>& lines,
bool BreakLongLine(std::string const& line, std::vector<std::string>& lines,
std::string* error);
};

View File

@@ -95,7 +95,7 @@ bool cmCPackExternalGenerator::SupportsComponentInstallation() const
}
int cmCPackExternalGenerator::InstallProjectViaInstallCommands(
bool setDestDir, const std::string& tempInstallDirectory)
bool setDestDir, std::string const& tempInstallDirectory)
{
if (this->StagingEnabled()) {
return this->cmCPackGenerator::InstallProjectViaInstallCommands(
@@ -106,7 +106,7 @@ int cmCPackExternalGenerator::InstallProjectViaInstallCommands(
}
int cmCPackExternalGenerator::InstallProjectViaInstallScript(
bool setDestDir, const std::string& tempInstallDirectory)
bool setDestDir, std::string const& tempInstallDirectory)
{
if (this->StagingEnabled()) {
return this->cmCPackGenerator::InstallProjectViaInstallScript(
@@ -117,8 +117,8 @@ int cmCPackExternalGenerator::InstallProjectViaInstallScript(
}
int cmCPackExternalGenerator::InstallProjectViaInstalledDirectories(
bool setDestDir, const std::string& tempInstallDirectory,
const mode_t* default_dir_mode)
bool setDestDir, std::string const& tempInstallDirectory,
mode_t const* default_dir_mode)
{
if (this->StagingEnabled()) {
return this->cmCPackGenerator::InstallProjectViaInstalledDirectories(
@@ -129,8 +129,8 @@ int cmCPackExternalGenerator::InstallProjectViaInstalledDirectories(
}
int cmCPackExternalGenerator::RunPreinstallTarget(
const std::string& installProjectName, const std::string& installDirectory,
cmGlobalGenerator* globalGenerator, const std::string& buildConfig)
std::string const& installProjectName, std::string const& installDirectory,
cmGlobalGenerator* globalGenerator, std::string const& buildConfig)
{
if (this->StagingEnabled()) {
return this->cmCPackGenerator::RunPreinstallTarget(
@@ -141,10 +141,10 @@ int cmCPackExternalGenerator::RunPreinstallTarget(
}
int cmCPackExternalGenerator::InstallCMakeProject(
bool setDestDir, const std::string& installDirectory,
const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode,
const std::string& component, bool componentInstall,
const std::string& installSubDirectory, const std::string& buildConfig,
bool setDestDir, std::string const& installDirectory,
std::string const& baseTempInstallDirectory, mode_t const* default_dir_mode,
std::string const& component, bool componentInstall,
std::string const& installSubDirectory, std::string const& buildConfig,
std::string& absoluteDestFiles)
{
if (this->StagingEnabled()) {

View File

@@ -22,7 +22,7 @@ class cmCPackExternalGenerator : public cmCPackGenerator
public:
cmCPackTypeMacro(cmCPackExternalGenerator, cmCPackGenerator);
const char* GetOutputExtension() override { return ".json"; }
char const* GetOutputExtension() override { return ".json"; }
protected:
int InitializeInternal() override;
@@ -32,23 +32,23 @@ protected:
bool SupportsComponentInstallation() const override;
int InstallProjectViaInstallCommands(
bool setDestDir, const std::string& tempInstallDirectory) override;
bool setDestDir, std::string const& tempInstallDirectory) override;
int InstallProjectViaInstallScript(
bool setDestDir, const std::string& tempInstallDirectory) override;
bool setDestDir, std::string const& tempInstallDirectory) override;
int InstallProjectViaInstalledDirectories(
bool setDestDir, const std::string& tempInstallDirectory,
const mode_t* default_dir_mode) override;
bool setDestDir, std::string const& tempInstallDirectory,
mode_t const* default_dir_mode) override;
int RunPreinstallTarget(const std::string& installProjectName,
const std::string& installDirectory,
int RunPreinstallTarget(std::string const& installProjectName,
std::string const& installDirectory,
cmGlobalGenerator* globalGenerator,
const std::string& buildConfig) override;
int InstallCMakeProject(bool setDestDir, const std::string& installDirectory,
const std::string& baseTempInstallDirectory,
const mode_t* default_dir_mode,
const std::string& component, bool componentInstall,
const std::string& installSubDirectory,
const std::string& buildConfig,
std::string const& buildConfig) override;
int InstallCMakeProject(bool setDestDir, std::string const& installDirectory,
std::string const& baseTempInstallDirectory,
mode_t const* default_dir_mode,
std::string const& component, bool componentInstall,
std::string const& installSubDirectory,
std::string const& buildConfig,
std::string& absoluteDestFiles) override;
private:

View File

@@ -22,8 +22,8 @@
#include "cmWorkingDirectory.h"
// Suffix used to tell libpkg what compression to use
static const char FreeBSDPackageCompression[] = "txz";
static const char FreeBSDPackageSuffix_17[] = ".pkg";
static char const FreeBSDPackageCompression[] = "txz";
static char const FreeBSDPackageSuffix_17[] = ".pkg";
cmCPackFreeBSDGenerator::cmCPackFreeBSDGenerator()
: cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr",
@@ -55,8 +55,8 @@ public:
: d(nullptr)
{
}
PkgCreate(const std::string& output_dir, const std::string& toplevel_dir,
const std::string& manifest_name)
PkgCreate(std::string const& output_dir, std::string const& toplevel_dir,
std::string const& manifest_name)
: d(pkg_create_new())
, manifest(manifest_name)
@@ -106,9 +106,9 @@ private:
class EscapeQuotes
{
public:
const std::string& value;
std::string const& value;
EscapeQuotes(const std::string& s)
EscapeQuotes(std::string const& s)
: value(s)
{
}
@@ -116,7 +116,7 @@ public:
// Output a string as "string" with escaping applied.
cmGeneratedFileStream& operator<<(cmGeneratedFileStream& s,
const EscapeQuotes& v)
EscapeQuotes const& v)
{
s << '"';
for (char c : v.value) {
@@ -179,7 +179,7 @@ class ManifestKeyValue : public ManifestKey
public:
std::string value;
ManifestKeyValue(const std::string& k, std::string v)
ManifestKeyValue(std::string const& k, std::string v)
: ManifestKey(k)
, value(std::move(v))
{
@@ -198,18 +198,18 @@ public:
using VList = std::vector<std::string>;
VList value;
ManifestKeyListValue(const std::string& k)
ManifestKeyListValue(std::string const& k)
: ManifestKey(k)
{
}
ManifestKeyListValue& operator<<(const std::string& v)
ManifestKeyListValue& operator<<(std::string const& v)
{
value.push_back(v);
return *this;
}
ManifestKeyListValue& operator<<(const std::vector<std::string>& v)
ManifestKeyListValue& operator<<(std::vector<std::string> const& v)
{
for (std::string const& e : v) {
(*this) << e;
@@ -237,7 +237,7 @@ public:
class ManifestKeyDepsValue : public ManifestKeyListValue
{
public:
ManifestKeyDepsValue(const std::string& k)
ManifestKeyDepsValue(std::string const& k)
: ManifestKeyListValue(k)
{
}
@@ -254,7 +254,7 @@ public:
// Write one of the key-value classes (above) to the stream @p s
cmGeneratedFileStream& operator<<(cmGeneratedFileStream& s,
const ManifestKey& v)
ManifestKey const& v)
{
s << '"' << v.key << "\": ";
v.write_value(s);
@@ -264,7 +264,7 @@ cmGeneratedFileStream& operator<<(cmGeneratedFileStream& s,
// Look up variable; if no value is set, returns an empty string;
// basically a wrapper that handles the nullptr return from GetOption().
std::string cmCPackFreeBSDGenerator::var_lookup(const char* var_name)
std::string cmCPackFreeBSDGenerator::var_lookup(char const* var_name)
{
cmValue pv = this->GetOption(var_name);
if (!pv) {
@@ -312,7 +312,7 @@ void cmCPackFreeBSDGenerator::write_manifest_fields(
// Package only actual files; others are ignored (in particular,
// intermediate subdirectories are ignored).
static bool ignore_file(const std::string& filename)
static bool ignore_file(std::string const& filename)
{
struct stat statbuf;
return stat(filename.c_str(), &statbuf) < 0 ||
@@ -325,8 +325,8 @@ static bool ignore_file(const std::string& filename)
// to paths relative to @p toplevel, with a leading / (since the paths
// in FreeBSD package files are supposed to be absolute).
void write_manifest_files(cmGeneratedFileStream& s,
const std::string& toplevel,
const std::vector<std::string>& files)
std::string const& toplevel,
std::vector<std::string> const& files)
{
s << "\"files\": {\n";
for (std::string const& file : files) {
@@ -405,7 +405,7 @@ int cmCPackFreeBSDGenerator::PackageFiles()
return 0;
}
const std::string output_dir = cmSystemTools::GetFilenamePath(toplevel);
std::string const output_dir = cmSystemTools::GetFilenamePath(toplevel);
PkgCreate package(output_dir, toplevel, manifestname);
if (package.isValid()) {
if (!package.Create()) {
@@ -431,17 +431,17 @@ int cmCPackFreeBSDGenerator::PackageFiles()
}
}
const std::string packageFileName =
std::string const packageFileName =
var_lookup("CPACK_PACKAGE_FILE_NAME") + FreeBSDPackageSuffix_17;
if (packageFileNames.size() == 1 && !packageFileName.empty() &&
packageFileNames[0] != packageFileName) {
// Since libpkg always writes <name>-<version>.<suffix>,
// if there is a CPACK_PACKAGE_FILE_NAME set, we need to
// rename, and then re-set the name.
const std::string sourceFile = packageFileNames[0];
const std::string packageSubDirectory =
std::string const sourceFile = packageFileNames[0];
std::string const packageSubDirectory =
cmSystemTools::GetParentDirectory(sourceFile);
const std::string targetFileName =
std::string const targetFileName =
packageSubDirectory + '/' + packageFileName;
if (cmSystemTools::RenameFile(sourceFile, targetFileName)) {
this->packageFileNames.clear();

View File

@@ -29,6 +29,6 @@ public:
int PackageFiles() override;
protected:
std::string var_lookup(const char* var_name);
std::string var_lookup(char const* var_name);
void write_manifest_fields(cmGeneratedFileStream&);
};

View File

@@ -50,7 +50,7 @@ cmCPackGenerator::~cmCPackGenerator()
this->MakefileMap = nullptr;
}
void cmCPackGenerator::DisplayVerboseOutput(const std::string& msg,
void cmCPackGenerator::DisplayVerboseOutput(std::string const& msg,
float /*unused*/)
{
cmCPackLogger(cmCPackLog::LOG_VERBOSE, msg << std::endl);
@@ -227,7 +227,7 @@ int cmCPackGenerator::InstallProject()
this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
if (cmNonempty(default_dir_install_permissions)) {
cmList items{ default_dir_install_permissions };
for (const auto& arg : items) {
for (auto const& arg : items) {
if (!cmFSPermissions::stringToModeT(arg, default_dir_mode_v)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Invalid permission value '"
@@ -275,8 +275,8 @@ int cmCPackGenerator::InstallProject()
// Run pre-build actions
cmValue preBuildScripts = this->GetOption("CPACK_PRE_BUILD_SCRIPTS");
if (preBuildScripts) {
const cmList scripts{ preBuildScripts };
for (const auto& script : scripts) {
cmList const scripts{ preBuildScripts };
for (auto const& script : scripts) {
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"Executing pre-build script: " << script << std::endl);
@@ -297,7 +297,7 @@ int cmCPackGenerator::InstallProject()
}
int cmCPackGenerator::InstallProjectViaInstallCommands(
bool setDestDir, const std::string& tempInstallDirectory)
bool setDestDir, std::string const& tempInstallDirectory)
{
(void)setDestDir;
cmValue installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
@@ -333,8 +333,8 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
}
int cmCPackGenerator::InstallProjectViaInstalledDirectories(
bool setDestDir, const std::string& tempInstallDirectory,
const mode_t* default_dir_mode)
bool setDestDir, std::string const& tempInstallDirectory,
mode_t const* default_dir_mode)
{
(void)setDestDir;
(void)tempInstallDirectory;
@@ -362,7 +362,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
return 0;
}
cmList::iterator it;
const std::string& tempDir = tempInstallDirectory;
std::string const& tempDir = tempInstallDirectory;
for (it = installDirectoriesList.begin();
it != installDirectoriesList.end(); ++it) {
std::vector<std::pair<std::string, std::string>> symlinkedFiles;
@@ -470,7 +470,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
}
int cmCPackGenerator::InstallProjectViaInstallScript(
bool setDestDir, const std::string& tempInstallDirectory)
bool setDestDir, std::string const& tempInstallDirectory)
{
cmValue cmakeScripts = this->GetOption("CPACK_INSTALL_SCRIPTS");
{
@@ -537,8 +537,8 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
}
int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
bool setDestDir, const std::string& baseTempInstallDirectory,
const mode_t* default_dir_mode)
bool setDestDir, std::string const& baseTempInstallDirectory,
mode_t const* default_dir_mode)
{
cmValue cmakeProjects = this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS");
cmValue cmakeGenerator = this->GetOption("CPACK_CMAKE_GENERATOR");
@@ -679,11 +679,11 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
}
int cmCPackGenerator::RunPreinstallTarget(
const std::string& installProjectName, const std::string& installDirectory,
cmGlobalGenerator* globalGenerator, const std::string& buildConfig)
std::string const& installProjectName, std::string const& installDirectory,
cmGlobalGenerator* globalGenerator, std::string const& buildConfig)
{
// Does this generator require pre-install?
if (const char* preinstall = globalGenerator->GetPreinstallTargetName()) {
if (char const* preinstall = globalGenerator->GetPreinstallTargetName()) {
std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand(
preinstall, buildConfig, "", "", false);
cmCPackLogger(cmCPackLog::LOG_DEBUG,
@@ -717,10 +717,10 @@ int cmCPackGenerator::RunPreinstallTarget(
}
int cmCPackGenerator::InstallCMakeProject(
bool setDestDir, const std::string& installDirectory,
const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode,
const std::string& component, bool componentInstall,
const std::string& installSubDirectory, const std::string& buildConfig,
bool setDestDir, std::string const& installDirectory,
std::string const& baseTempInstallDirectory, mode_t const* default_dir_mode,
std::string const& component, bool componentInstall,
std::string const& installSubDirectory, std::string const& buildConfig,
std::string& absoluteDestFiles)
{
std::string tempInstallDirectory = baseTempInstallDirectory;
@@ -736,7 +736,7 @@ int cmCPackGenerator::InstallCMakeProject(
cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions();
cm.AddCMakePaths();
cm.SetProgressCallback([this](const std::string& msg, float prog) {
cm.SetProgressCallback([this](std::string const& msg, float prog) {
this->DisplayVerboseOutput(msg, prog);
});
cm.SetTrace(this->Trace);
@@ -998,7 +998,7 @@ bool cmCPackGenerator::GenerateChecksumFile(cmCryptoHash& crypto,
return true;
}
bool cmCPackGenerator::CopyPackageFile(const std::string& srcFilePath,
bool cmCPackGenerator::CopyPackageFile(std::string const& srcFilePath,
cm::string_view filename) const
{
std::string destFilePath =
@@ -1021,7 +1021,7 @@ bool cmCPackGenerator::CopyPackageFile(const std::string& srcFilePath,
return true;
}
bool cmCPackGenerator::ReadListFile(const char* moduleName)
bool cmCPackGenerator::ReadListFile(char const* moduleName)
{
bool retval;
std::string fullPath = this->MakefileMap->GetModulesFile(moduleName);
@@ -1032,7 +1032,7 @@ bool cmCPackGenerator::ReadListFile(const char* moduleName)
}
template <typename ValueType>
void cmCPackGenerator::StoreOptionIfNotSet(const std::string& op,
void cmCPackGenerator::StoreOptionIfNotSet(std::string const& op,
ValueType value)
{
cmValue def = this->MakefileMap->GetDefinition(op);
@@ -1042,18 +1042,18 @@ void cmCPackGenerator::StoreOptionIfNotSet(const std::string& op,
this->StoreOption(op, value);
}
void cmCPackGenerator::SetOptionIfNotSet(const std::string& op,
const char* value)
void cmCPackGenerator::SetOptionIfNotSet(std::string const& op,
char const* value)
{
this->StoreOptionIfNotSet(op, value);
}
void cmCPackGenerator::SetOptionIfNotSet(const std::string& op, cmValue value)
void cmCPackGenerator::SetOptionIfNotSet(std::string const& op, cmValue value)
{
this->StoreOptionIfNotSet(op, value);
}
template <typename ValueType>
void cmCPackGenerator::StoreOption(const std::string& op, ValueType value)
void cmCPackGenerator::StoreOption(std::string const& op, ValueType value)
{
if (!value) {
this->MakefileMap->RemoveDefinition(op);
@@ -1065,11 +1065,11 @@ void cmCPackGenerator::StoreOption(const std::string& op, ValueType value)
this->MakefileMap->AddDefinition(op, value);
}
void cmCPackGenerator::SetOption(const std::string& op, const char* value)
void cmCPackGenerator::SetOption(std::string const& op, char const* value)
{
this->StoreOption(op, value);
}
void cmCPackGenerator::SetOption(const std::string& op, cmValue value)
void cmCPackGenerator::SetOption(std::string const& op, cmValue value)
{
this->StoreOption(op, value);
}
@@ -1186,8 +1186,8 @@ int cmCPackGenerator::DoPackage()
this->MakefileMap->AddDefinition(
"CPACK_PACKAGE_FILES", cmList::to_string(this->packageFileNames));
const cmList scripts{ postBuildScripts };
for (const auto& script : scripts) {
cmList const scripts{ postBuildScripts };
for (auto const& script : scripts) {
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"Executing post-build script: " << script << std::endl);
@@ -1230,7 +1230,7 @@ int cmCPackGenerator::DoPackage()
return 1;
}
int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf)
int cmCPackGenerator::Initialize(std::string const& name, cmMakefile* mf)
{
this->MakefileMap = mf;
this->Name = name;
@@ -1313,12 +1313,12 @@ int cmCPackGenerator::InitializeInternal()
return 1;
}
bool cmCPackGenerator::IsSet(const std::string& name) const
bool cmCPackGenerator::IsSet(std::string const& name) const
{
return this->MakefileMap->IsSet(name);
}
cmValue cmCPackGenerator::GetOptionIfSet(const std::string& name) const
cmValue cmCPackGenerator::GetOptionIfSet(std::string const& name) const
{
cmValue ret = this->MakefileMap->GetDefinition(name);
if (!ret || ret->empty() || cmIsNOTFOUND(*ret)) {
@@ -1327,12 +1327,12 @@ cmValue cmCPackGenerator::GetOptionIfSet(const std::string& name) const
return ret;
}
bool cmCPackGenerator::IsOn(const std::string& name) const
bool cmCPackGenerator::IsOn(std::string const& name) const
{
return this->GetOption(name).IsOn();
}
bool cmCPackGenerator::IsSetToOff(const std::string& op) const
bool cmCPackGenerator::IsSetToOff(std::string const& op) const
{
cmValue ret = this->MakefileMap->GetDefinition(op);
if (cmNonempty(ret)) {
@@ -1341,7 +1341,7 @@ bool cmCPackGenerator::IsSetToOff(const std::string& op) const
return false;
}
bool cmCPackGenerator::IsSetToEmpty(const std::string& op) const
bool cmCPackGenerator::IsSetToEmpty(std::string const& op) const
{
cmValue ret = this->MakefileMap->GetDefinition(op);
if (ret) {
@@ -1350,7 +1350,7 @@ bool cmCPackGenerator::IsSetToEmpty(const std::string& op) const
return false;
}
cmValue cmCPackGenerator::GetOption(const std::string& op) const
cmValue cmCPackGenerator::GetOption(std::string const& op) const
{
cmValue ret = this->MakefileMap->GetDefinition(op);
if (!ret) {
@@ -1370,7 +1370,7 @@ int cmCPackGenerator::PackageFiles()
return 0;
}
const char* cmCPackGenerator::GetInstallPath()
char const* cmCPackGenerator::GetInstallPath()
{
if (!this->InstallPath.empty()) {
return this->InstallPath.c_str();
@@ -1403,7 +1403,7 @@ const char* cmCPackGenerator::GetInstallPath()
return this->InstallPath.c_str();
}
const char* cmCPackGenerator::GetPackagingInstallPrefix()
char const* cmCPackGenerator::GetPackagingInstallPrefix()
{
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"GetPackagingInstallPrefix: '"
@@ -1434,15 +1434,15 @@ std::string cmCPackGenerator::FindTemplate(cm::string_view name,
return ffile;
}
bool cmCPackGenerator::ConfigureString(const std::string& inString,
bool cmCPackGenerator::ConfigureString(std::string const& inString,
std::string& outString)
{
this->MakefileMap->ConfigureString(inString, outString, true, false);
return true;
}
bool cmCPackGenerator::ConfigureFile(const std::string& inName,
const std::string& outName,
bool cmCPackGenerator::ConfigureFile(std::string const& inName,
std::string const& outName,
bool copyOnly /* = false */)
{
return this->MakefileMap->ConfigureFile(inName, outName, copyOnly, true,
@@ -1537,7 +1537,7 @@ int cmCPackGenerator::PrepareGroupingKind()
this->componentPackageMethod = method;
}
const char* method_names[] = { "ALL_COMPONENTS_IN_ONE", "IGNORE",
char const* method_names[] = { "ALL_COMPONENTS_IN_ONE", "IGNORE",
"ONE_PER_GROUP", "UNKNOWN" };
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
@@ -1550,7 +1550,7 @@ int cmCPackGenerator::PrepareGroupingKind()
}
std::string cmCPackGenerator::GetSanitizedDirOrFileName(
const std::string& name, bool isFullName) const
std::string const& name, bool isFullName) const
{
if (isFullName) {
#ifdef _WIN32
@@ -1577,10 +1577,10 @@ std::string cmCPackGenerator::GetSanitizedDirOrFileName(
}
#ifndef _WIN32
constexpr const char* prohibited_chars = "<>\"/\\|?*`";
constexpr char const* prohibited_chars = "<>\"/\\|?*`";
#else
// Note: Windows also excludes the colon.
constexpr const char* prohibited_chars = "<>\"/\\|?*`:";
constexpr char const* prohibited_chars = "<>\"/\\|?*`:";
#endif
// Given name contains non-supported character?
// Then return its MD5 hash.
@@ -1594,21 +1594,21 @@ std::string cmCPackGenerator::GetSanitizedDirOrFileName(
}
std::string cmCPackGenerator::GetComponentInstallSuffix(
const std::string& componentName)
std::string const& componentName)
{
return componentName;
}
std::string cmCPackGenerator::GetComponentInstallDirNameSuffix(
const std::string& componentName)
std::string const& componentName)
{
return this->GetSanitizedDirOrFileName(
this->GetComponentInstallSuffix(componentName));
}
std::string cmCPackGenerator::GetComponentPackageFileName(
const std::string& initialPackageFileName,
const std::string& groupOrComponentName, bool isGroupName)
std::string const& initialPackageFileName,
std::string const& groupOrComponentName, bool isGroupName)
{
/*
@@ -1667,7 +1667,7 @@ bool cmCPackGenerator::WantsComponentInstallation() const
}
cmCPackInstallationType* cmCPackGenerator::GetInstallationType(
const std::string& projectName, const std::string& name)
std::string const& projectName, std::string const& name)
{
(void)projectName;
bool hasInstallationType = this->InstallationTypes.count(name) != 0;
@@ -1691,7 +1691,7 @@ cmCPackInstallationType* cmCPackGenerator::GetInstallationType(
}
cmCPackComponent* cmCPackGenerator::GetComponent(
const std::string& projectName, const std::string& name)
std::string const& projectName, std::string const& name)
{
bool hasComponent = this->Components.count(name) != 0;
cmCPackComponent* component = &this->Components[name];
@@ -1760,7 +1760,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
}
cmCPackComponentGroup* cmCPackGenerator::GetComponentGroup(
const std::string& projectName, const std::string& name)
std::string const& projectName, std::string const& name)
{
(void)projectName;
std::string macroPrefix =

View File

@@ -31,7 +31,7 @@ class cmMakefile;
class cmCPackGenerator
{
public:
virtual const char* GetNameOfClass() = 0;
virtual char const* GetNameOfClass() = 0;
/**
* If verbose then more information is printed out
*/
@@ -79,7 +79,7 @@ public:
/**
* Initialize generator
*/
int Initialize(const std::string& name, cmMakefile* mf);
int Initialize(std::string const& name, cmMakefile* mf);
/**
* Construct generator
@@ -88,33 +88,33 @@ public:
virtual ~cmCPackGenerator();
//! Set and get the options
void SetOption(const std::string& op, const char* value);
void SetOption(const std::string& op, const std::string& value)
void SetOption(std::string const& op, char const* value);
void SetOption(std::string const& op, std::string const& value)
{
this->SetOption(op, cmValue(value));
}
void SetOption(const std::string& op, cmValue value);
void SetOptionIfNotSet(const std::string& op, const char* value);
void SetOptionIfNotSet(const std::string& op, const std::string& value)
void SetOption(std::string const& op, cmValue value);
void SetOptionIfNotSet(std::string const& op, char const* value);
void SetOptionIfNotSet(std::string const& op, std::string const& value)
{
this->SetOptionIfNotSet(op, cmValue(value));
}
void SetOptionIfNotSet(const std::string& op, cmValue value);
cmValue GetOption(const std::string& op) const;
void SetOptionIfNotSet(std::string const& op, cmValue value);
cmValue GetOption(std::string const& op) const;
std::vector<std::string> GetOptions() const;
bool IsSet(const std::string& name) const;
cmValue GetOptionIfSet(const std::string& name) const;
bool IsOn(const std::string& name) const;
bool IsSetToOff(const std::string& op) const;
bool IsSetToEmpty(const std::string& op) const;
bool IsSet(std::string const& name) const;
cmValue GetOptionIfSet(std::string const& name) const;
bool IsOn(std::string const& name) const;
bool IsSetToOff(std::string const& op) const;
bool IsSetToEmpty(std::string const& op) const;
//! Set the logger
void SetLogger(cmCPackLog* log) { this->Logger = log; }
//! Display verbose information via logger
void DisplayVerboseOutput(const std::string& msg, float progress);
void DisplayVerboseOutput(std::string const& msg, float progress);
bool ReadListFile(const char* moduleName);
bool ReadListFile(char const* moduleName);
protected:
/**
@@ -132,8 +132,8 @@ protected:
cmInstalledFile const* GetInstalledFile(std::string const& name) const;
virtual const char* GetOutputExtension() { return ".cpack"; }
virtual const char* GetOutputPostfix() { return nullptr; }
virtual char const* GetOutputExtension() { return ".cpack"; }
virtual char const* GetOutputPostfix() { return nullptr; }
/**
* Prepare requested grouping kind from CPACK_xxx vars
@@ -154,7 +154,7 @@ protected:
* directory or file. (Defaults to true.)
* @return the sanitized name.
*/
virtual std::string GetSanitizedDirOrFileName(const std::string& name,
virtual std::string GetSanitizedDirOrFileName(std::string const& name,
bool isFullName = true) const;
/**
@@ -168,7 +168,7 @@ protected:
* default is "componentName"
*/
virtual std::string GetComponentInstallSuffix(
const std::string& componentName);
std::string const& componentName);
/**
* The value that GetComponentInstallSuffix returns, but sanitized.
@@ -178,7 +178,7 @@ protected:
* default is "componentName".
*/
virtual std::string GetComponentInstallDirNameSuffix(
const std::string& componentName);
std::string const& componentName);
/**
* CPack specific generator may mangle CPACK_PACKAGE_FILE_NAME
@@ -190,8 +190,8 @@ protected:
* false otherwise
*/
virtual std::string GetComponentPackageFileName(
const std::string& initialPackageFileName,
const std::string& groupOrComponentName, bool isGroupName);
std::string const& initialPackageFileName,
std::string const& groupOrComponentName, bool isGroupName);
/**
* Package the list of files and/or components which
@@ -203,44 +203,44 @@ protected:
* the list of packages generated by the specific generator.
*/
virtual int PackageFiles();
virtual const char* GetInstallPath();
virtual const char* GetPackagingInstallPrefix();
virtual char const* GetInstallPath();
virtual char const* GetPackagingInstallPrefix();
bool GenerateChecksumFile(cmCryptoHash& crypto,
cm::string_view filename) const;
bool CopyPackageFile(const std::string& srcFilePath,
bool CopyPackageFile(std::string const& srcFilePath,
cm::string_view filename) const;
std::string FindTemplate(cm::string_view name,
cm::optional<cm::string_view> alt = cm::nullopt);
virtual bool ConfigureFile(const std::string& inName,
const std::string& outName,
virtual bool ConfigureFile(std::string const& inName,
std::string const& outName,
bool copyOnly = false);
virtual bool ConfigureString(const std::string& input, std::string& output);
virtual bool ConfigureString(std::string const& input, std::string& output);
virtual int InitializeInternal();
//! Run install commands if specified
virtual int InstallProjectViaInstallCommands(
bool setDestDir, const std::string& tempInstallDirectory);
bool setDestDir, std::string const& tempInstallDirectory);
virtual int InstallProjectViaInstallScript(
bool setDestDir, const std::string& tempInstallDirectory);
bool setDestDir, std::string const& tempInstallDirectory);
virtual int InstallProjectViaInstalledDirectories(
bool setDestDir, const std::string& tempInstallDirectory,
const mode_t* default_dir_mode);
bool setDestDir, std::string const& tempInstallDirectory,
mode_t const* default_dir_mode);
virtual int InstallProjectViaInstallCMakeProjects(
bool setDestDir, const std::string& tempInstallDirectory,
const mode_t* default_dir_mode);
bool setDestDir, std::string const& tempInstallDirectory,
mode_t const* default_dir_mode);
virtual int RunPreinstallTarget(const std::string& installProjectName,
const std::string& installDirectory,
virtual int RunPreinstallTarget(std::string const& installProjectName,
std::string const& installDirectory,
cmGlobalGenerator* globalGenerator,
const std::string& buildConfig);
std::string const& buildConfig);
virtual int InstallCMakeProject(
bool setDestDir, const std::string& installDirectory,
const std::string& baseTempInstallDirectory,
const mode_t* default_dir_mode, const std::string& component,
bool componentInstall, const std::string& installSubDirectory,
const std::string& buildConfig, std::string& absoluteDestFiles);
bool setDestDir, std::string const& installDirectory,
std::string const& baseTempInstallDirectory,
mode_t const* default_dir_mode, std::string const& component,
bool componentInstall, std::string const& installSubDirectory,
std::string const& buildConfig, std::string& absoluteDestFiles);
/**
* The various level of support of
@@ -291,11 +291,11 @@ protected:
*/
virtual bool WantsComponentInstallation() const;
virtual cmCPackInstallationType* GetInstallationType(
const std::string& projectName, const std::string& name);
virtual cmCPackComponent* GetComponent(const std::string& projectName,
const std::string& name);
std::string const& projectName, std::string const& name);
virtual cmCPackComponent* GetComponent(std::string const& projectName,
std::string const& name);
virtual cmCPackComponentGroup* GetComponentGroup(
const std::string& projectName, const std::string& name);
std::string const& projectName, std::string const& name);
cmSystemTools::OutputOption GeneratorVerbose;
std::string Name;
@@ -370,9 +370,9 @@ protected:
private:
template <typename ValueType>
void StoreOption(const std::string& op, ValueType value);
void StoreOption(std::string const& op, ValueType value);
template <typename ValueType>
void StoreOptionIfNotSet(const std::string& op, ValueType value);
void StoreOptionIfNotSet(std::string const& op, ValueType value);
};
#define cmCPackTypeMacro(klass, superclass) \

View File

@@ -133,7 +133,7 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
}
std::unique_ptr<cmCPackGenerator> cmCPackGeneratorFactory::NewGenerator(
const std::string& name)
std::string const& name)
{
auto it = this->GeneratorCreators.find(name);
if (it == this->GeneratorCreators.end()) {
@@ -148,7 +148,7 @@ std::unique_ptr<cmCPackGenerator> cmCPackGeneratorFactory::NewGenerator(
}
void cmCPackGeneratorFactory::RegisterGenerator(
const std::string& name, const char* generatorDescription,
std::string const& name, char const* generatorDescription,
CreateGeneratorCall* createGenerator)
{
if (!createGenerator) {

View File

@@ -23,18 +23,18 @@ public:
cmCPackGeneratorFactory();
//! Get the generator
std::unique_ptr<cmCPackGenerator> NewGenerator(const std::string& name);
std::unique_ptr<cmCPackGenerator> NewGenerator(std::string const& name);
using CreateGeneratorCall = cmCPackGenerator*();
void RegisterGenerator(const std::string& name,
const char* generatorDescription,
void RegisterGenerator(std::string const& name,
char const* generatorDescription,
CreateGeneratorCall* createGenerator);
void SetLogger(cmCPackLog* logger) { this->Logger = logger; }
using DescriptionsMap = std::map<std::string, std::string>;
const DescriptionsMap& GetGeneratorsList() const
DescriptionsMap const& GetGeneratorsList() const
{
return this->GeneratorDescriptions;
}

View File

@@ -46,7 +46,7 @@ int cmCPackInnoSetupGenerator::InitializeInternal()
#endif
SetOptionIfNotSet("CPACK_INNOSETUP_EXECUTABLE", "ISCC");
const std::string& isccPath = cmSystemTools::FindProgram(
std::string const& isccPath = cmSystemTools::FindProgram(
GetOption("CPACK_INNOSETUP_EXECUTABLE"), path, false);
if (isccPath.empty()) {
@@ -58,7 +58,7 @@ int cmCPackInnoSetupGenerator::InitializeInternal()
return 0;
}
const std::string isccCmd =
std::string const isccCmd =
cmStrCat(QuotePath(isccPath, PathType::Native), "/?");
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Test Inno Setup version: " << isccCmd << std::endl);
@@ -76,8 +76,8 @@ int cmCPackInnoSetupGenerator::InitializeInternal()
return 0;
}
const int isccVersion = atoi(vRex.match(1).c_str());
const int minIsccVersion = 6;
int const isccVersion = atoi(vRex.match(1).c_str());
int const minIsccVersion = 6;
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Inno Setup Version: " << isccVersion << std::endl);
@@ -98,8 +98,8 @@ int cmCPackInnoSetupGenerator::PackageFiles()
{
// Includes
if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_EXTRA_SCRIPTS")) {
const cmList extraScripts(*v);
for (const std::string& i : extraScripts) {
cmList const extraScripts(*v);
for (std::string const& i : extraScripts) {
includeDirectives.emplace_back(cmStrCat(
"#include ", QuotePath(cmSystemTools::CollapseFullPath(i, toplevel))));
}
@@ -107,7 +107,7 @@ int cmCPackInnoSetupGenerator::PackageFiles()
// [Languages] section
SetOptionIfNotSet("CPACK_INNOSETUP_LANGUAGES", "english");
const cmList languages(GetOption("CPACK_INNOSETUP_LANGUAGES"));
cmList const languages(GetOption("CPACK_INNOSETUP_LANGUAGES"));
for (std::string i : languages) {
cmCPackInnoSetupKeyValuePairs params;
@@ -133,8 +133,8 @@ int cmCPackInnoSetupGenerator::PackageFiles()
// [Code] section
if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_CODE_FILES")) {
const cmList codeFiles(*v);
for (const std::string& i : codeFiles) {
cmList const codeFiles(*v);
for (std::string const& i : codeFiles) {
codeIncludes.emplace_back(cmStrCat(
"#include ", QuotePath(cmSystemTools::CollapseFullPath(i, toplevel))));
}
@@ -288,9 +288,9 @@ bool cmCPackInnoSetupGenerator::ProcessSetupSection()
* Handle custom directives (they have higher priority than other variables,
* so they have to be processed after all other variables)
*/
for (const std::string& i : GetOptions()) {
for (std::string const& i : GetOptions()) {
if (cmHasPrefix(i, "CPACK_INNOSETUP_SETUP_")) {
const std::string& directive =
std::string const& directive =
i.substr(cmStrLen("CPACK_INNOSETUP_SETUP_"));
setupDirectives[directive] = GetOption(i);
}
@@ -304,7 +304,7 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
std::map<std::string, std::string> customFileInstructions;
if (cmValue v =
GetOptionIfSet("CPACK_INNOSETUP_CUSTOM_INSTALL_INSTRUCTIONS")) {
const cmList instructions(*v);
cmList const instructions(*v);
if (instructions.size() % 2 != 0) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_INNOSETUP_CUSTOM_INSTALL_INSTRUCTIONS should "
@@ -314,18 +314,18 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
}
for (auto it = instructions.begin(); it != instructions.end(); ++it) {
const std::string& key =
std::string const& key =
QuotePath(cmSystemTools::CollapseFullPath(*it, toplevel));
customFileInstructions[key] = *(++it);
}
}
const std::string& iconsPrefix =
std::string const& iconsPrefix =
toplevelProgramFolder ? "{autoprograms}\\" : "{group}\\";
std::map<std::string, std::string> icons;
if (cmValue v = GetOptionIfSet("CPACK_PACKAGE_EXECUTABLES")) {
const cmList executables(*v);
cmList const executables(*v);
if (executables.size() % 2 != 0) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_PACKAGE_EXECUTABLES should should contain pairs of "
@@ -335,7 +335,7 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
}
for (auto it = executables.begin(); it != executables.end(); ++it) {
const std::string& key = *it;
std::string const& key = *it;
icons[key] = *(++it);
}
}
@@ -350,7 +350,7 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
cmExpandList(*v, runExecutables);
}
for (const std::string& i : files) {
for (std::string const& i : files) {
cmCPackInnoSetupKeyValuePairs params;
std::string toplevelDirectory;
@@ -358,12 +358,12 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
cmCPackComponent* component = nullptr;
std::string componentParam;
if (!Components.empty()) {
const std::string& fileName = cmSystemTools::RelativePath(toplevel, i);
const std::string::size_type pos = fileName.find('/');
std::string const& fileName = cmSystemTools::RelativePath(toplevel, i);
std::string::size_type const pos = fileName.find('/');
// Use the custom component install directory if we have one
if (pos != std::string::npos) {
const std::string& componentName = fileName.substr(0, pos);
std::string const& componentName = fileName.substr(0, pos);
component = &Components[componentName];
toplevelDirectory =
@@ -420,10 +420,10 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
params["DestDir"] = QuotePath(destDir);
if (component && component->IsDownloaded) {
const std::string& archiveName =
std::string const& archiveName =
cmSystemTools::GetFilenameWithoutLastExtension(
component->ArchiveFile);
const std::string& relativePath =
std::string const& relativePath =
cmSystemTools::RelativePath(toplevelDirectory, i);
params["Source"] =
@@ -444,9 +444,9 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
fileInstructions.push_back(ISKeyValueLine(params));
// Icon
const std::string& name =
std::string const& name =
cmSystemTools::GetFilenameWithoutLastExtension(i);
const std::string& extension =
std::string const& extension =
cmSystemTools::GetFilenameLastExtension(i);
if ((extension == ".exe" || extension == ".com") && // only .exe, .com
icons.count(name)) {
@@ -504,7 +504,7 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
"^(mailto:|(ftps?|https?|news)://).*$");
if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_MENU_LINKS")) {
const cmList menuIcons(*v);
cmList const menuIcons(*v);
if (menuIcons.size() % 2 != 0) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_INNOSETUP_MENU_LINKS should "
@@ -514,8 +514,8 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
}
for (auto it = menuIcons.begin(); it != menuIcons.end(); ++it) {
const std::string& target = *it;
const std::string& label = *(++it);
std::string const& target = *it;
std::string const& label = *(++it);
cmCPackInnoSetupKeyValuePairs params;
params["Name"] = QuotePath(cmStrCat(iconsPrefix, label));
@@ -524,7 +524,7 @@ bool cmCPackInnoSetupGenerator::ProcessFiles()
} else {
std::string dir = "{app}";
std::string componentName;
for (const auto& i : Components) {
for (auto const& i : Components) {
if (cmSystemTools::FileExists(cmSystemTools::CollapseFullPath(
cmStrCat(i.second.Name, '\\', target), toplevel))) {
dir = CustomComponentInstallDirectory(&i.second);
@@ -684,10 +684,10 @@ bool cmCPackInnoSetupGenerator::ProcessComponents()
}
SetOptionIfNotSet("CPACK_INNOSETUP_VERIFY_DOWNLOADS", "ON");
const bool verifyDownloads =
bool const verifyDownloads =
GetOption("CPACK_INNOSETUP_VERIFY_DOWNLOADS").IsOn();
const std::string& urlPrefix =
std::string const& urlPrefix =
cmHasSuffix(GetOption("CPACK_DOWNLOAD_SITE").GetCStr(), '/')
? GetOption("CPACK_DOWNLOAD_SITE")
: cmStrCat(GetOption("CPACK_DOWNLOAD_SITE"), '/');
@@ -722,7 +722,7 @@ bool cmCPackInnoSetupGenerator::ProcessComponents()
SetOption("CPACK_INNOSETUP_DOWNLOAD_COMPONENTS_INTERNAL",
cmJoin(archiveComponents, ", "));
static const std::string& downloadLines =
static std::string const& downloadLines =
"#define protected CPackDownloadCount "
"@CPACK_INNOSETUP_DOWNLOAD_COUNT_INTERNAL@\n"
"#dim protected CPackDownloadUrls[CPackDownloadCount] "
@@ -742,7 +742,7 @@ bool cmCPackInnoSetupGenerator::ProcessComponents()
}
// Add the required script
const std::string& componentsScriptTemplate =
std::string const& componentsScriptTemplate =
FindTemplate("ISComponents.pas");
if (componentsScriptTemplate.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -759,8 +759,8 @@ bool cmCPackInnoSetupGenerator::ProcessComponents()
bool cmCPackInnoSetupGenerator::ConfigureISScript()
{
const std::string& isScriptTemplate = FindTemplate("ISScript.template.in");
const std::string& isScriptFile =
std::string const& isScriptTemplate = FindTemplate("ISScript.template.in");
std::string const& isScriptFile =
cmStrCat(GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/ISScript.iss");
if (isScriptTemplate.empty()) {
@@ -772,12 +772,12 @@ bool cmCPackInnoSetupGenerator::ConfigureISScript()
// Create internal variables
std::vector<std::string> setupSection;
for (const auto& i : setupDirectives) {
for (auto const& i : setupDirectives) {
setupSection.emplace_back(cmStrCat(i.first, '=', TranslateBool(i.second)));
}
// Also create comments if the sections are empty
const std::string& defaultMessage =
std::string const& defaultMessage =
"; CPack didn't find any entries for this section";
if (!IsSetToEmpty("CPACK_CREATE_DESKTOP_LINKS")) {
@@ -837,28 +837,28 @@ bool cmCPackInnoSetupGenerator::ConfigureISScript()
bool cmCPackInnoSetupGenerator::Compile()
{
const std::string& isScriptFile =
std::string const& isScriptFile =
cmStrCat(GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/ISScript.iss");
const std::string& isccLogFile =
std::string const& isccLogFile =
cmStrCat(GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/ISCCOutput.log");
std::vector<std::string> isccArgs;
// Custom defines
for (const std::string& i : GetOptions()) {
for (std::string const& i : GetOptions()) {
if (cmHasPrefix(i, "CPACK_INNOSETUP_DEFINE_")) {
const std::string& name = i.substr(cmStrLen("CPACK_INNOSETUP_DEFINE_"));
std::string const& name = i.substr(cmStrLen("CPACK_INNOSETUP_DEFINE_"));
isccArgs.push_back(
cmStrCat("\"/D", name, '=', TranslateBool(GetOption(i)), '"'));
}
}
if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_EXECUTABLE_ARGUMENTS")) {
const cmList args(*v);
cmList const args(*v);
isccArgs.insert(isccArgs.end(), args.begin(), args.end());
}
const std::string& isccCmd =
std::string const& isccCmd =
cmStrCat(QuotePath(GetOption("CPACK_INSTALLER_PROGRAM"), PathType::Native),
' ', cmJoin(isccArgs, " "), ' ', QuotePath(isScriptFile));
@@ -866,7 +866,7 @@ bool cmCPackInnoSetupGenerator::Compile()
std::string output;
int retVal = 1;
const bool res = cmSystemTools::RunSingleCommand(
bool const res = cmSystemTools::RunSingleCommand(
isccCmd, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
cmDuration::zero());
@@ -885,11 +885,11 @@ bool cmCPackInnoSetupGenerator::Compile()
}
bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
cmCPackComponent* component, const std::string& uploadDirectory,
cmCPackComponent* component, std::string const& uploadDirectory,
std::string* hash)
{
// Remove the old archive, if one exists
const std::string& archiveFile =
std::string const& archiveFile =
uploadDirectory + '/' + component->ArchiveFile;
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Building downloaded component archive: " << archiveFile
@@ -922,16 +922,16 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
}
// The directory where this component's files reside
const std::string& dirName =
std::string const& dirName =
cmStrCat(GetOption("CPACK_TEMPORARY_DIRECTORY"), '/', component->Name);
// Build the list of files to go into this archive
const std::string& zipListFileName =
std::string const& zipListFileName =
cmStrCat(GetOption("CPACK_TEMPORARY_DIRECTORY"), "/winZip.filelist");
const bool needQuotesInFile = GetOption("CPACK_ZIP_NEED_QUOTES").IsOn();
bool const needQuotesInFile = GetOption("CPACK_ZIP_NEED_QUOTES").IsOn();
{ // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(zipListFileName);
for (const std::string& i : component->Files) {
for (std::string const& i : component->Files) {
out << (needQuotesInFile ? Quote(i) : i) << std::endl;
}
}
@@ -943,7 +943,7 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
zipListFileName.c_str());
std::string output;
int retVal = -1;
const bool res = cmSystemTools::RunSingleCommand(
bool const res = cmSystemTools::RunSingleCommand(
cmd, &output, &output, &retVal, dirName.c_str(), this->GeneratorVerbose,
cmDuration::zero());
if (!res || retVal) {
@@ -967,12 +967,12 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
}
#ifdef _WIN32
const std::string& hashCmd =
std::string const& hashCmd =
cmStrCat("certutil -hashfile ", QuotePath(archiveFile), " SHA256");
std::string hashOutput;
int hashRetVal = -1;
const bool hashRes = cmSystemTools::RunSingleCommand(
bool const hashRes = cmSystemTools::RunSingleCommand(
hashCmd, &hashOutput, &hashOutput, &hashRetVal, nullptr,
this->GeneratorVerbose, cmDuration::zero());
if (!hashRes || hashRetVal) {
@@ -993,7 +993,7 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
return true;
}
cmValue cmCPackInnoSetupGenerator::RequireOption(const std::string& key)
cmValue cmCPackInnoSetupGenerator::RequireOption(std::string const& key)
{
cmValue value = GetOption(key);
@@ -1006,7 +1006,7 @@ cmValue cmCPackInnoSetupGenerator::RequireOption(const std::string& key)
}
std::string cmCPackInnoSetupGenerator::CustomComponentInstallDirectory(
const cmCPackComponent* component)
cmCPackComponent const* component)
{
cmValue outputDir = GetOption(
cmStrCat("CPACK_INNOSETUP_", component->Name, "_INSTALL_DIRECTORY"));
@@ -1036,7 +1036,7 @@ std::string cmCPackInnoSetupGenerator::CustomComponentInstallDirectory(
return "{app}";
}
std::string cmCPackInnoSetupGenerator::TranslateBool(const std::string& value)
std::string cmCPackInnoSetupGenerator::TranslateBool(std::string const& value)
{
if (value.empty()) {
return value;
@@ -1056,13 +1056,13 @@ std::string cmCPackInnoSetupGenerator::TranslateBool(const std::string& value)
}
std::string cmCPackInnoSetupGenerator::ISKeyValueLine(
const cmCPackInnoSetupKeyValuePairs& params)
cmCPackInnoSetupKeyValuePairs const& params)
{
/*
* To simplify readability of the generated code, the keys are sorted.
* Unknown keys are ignored to avoid errors during compilation.
*/
static const char* const availableKeys[] = {
static char const* const availableKeys[] = {
"Source", "DestDir", "Name", "Filename",
"Description", "GroupDescription", "MessagesFile", "Types",
"ExternalSize", "BeforeInstall", "Flags", "Components",
@@ -1070,7 +1070,7 @@ std::string cmCPackInnoSetupGenerator::ISKeyValueLine(
};
std::vector<std::string> keys;
for (const char* i : availableKeys) {
for (char const* i : availableKeys) {
if (params.count(i)) {
keys.emplace_back(cmStrCat(i, ": ", params.at(i)));
}
@@ -1080,13 +1080,13 @@ std::string cmCPackInnoSetupGenerator::ISKeyValueLine(
}
std::string cmCPackInnoSetupGenerator::CreateRecursiveComponentPath(
cmCPackComponentGroup* group, const std::string& path)
cmCPackComponentGroup* group, std::string const& path)
{
if (!group) {
return path;
}
const std::string& newPath =
std::string const& newPath =
path.empty() ? group->Name : cmStrCat(group->Name, '\\', path);
return CreateRecursiveComponentPath(group->ParentGroup, newPath);
}
@@ -1114,7 +1114,7 @@ void cmCPackInnoSetupGenerator::CreateRecursiveComponentGroups(
}
}
std::string cmCPackInnoSetupGenerator::Quote(const std::string& string)
std::string cmCPackInnoSetupGenerator::Quote(std::string const& string)
{
if (cmHasPrefix(string, '"') && cmHasSuffix(string, '"')) {
return Quote(string.substr(1, string.length() - 2));
@@ -1126,7 +1126,7 @@ std::string cmCPackInnoSetupGenerator::Quote(const std::string& string)
return cmStrCat('"', nString, '"');
}
std::string cmCPackInnoSetupGenerator::QuotePath(const std::string& path,
std::string cmCPackInnoSetupGenerator::QuotePath(std::string const& path,
PathType type)
{
#ifdef _WIN32
@@ -1140,7 +1140,7 @@ std::string cmCPackInnoSetupGenerator::QuotePath(const std::string& path,
}
std::string cmCPackInnoSetupGenerator::PrepareForConstant(
const std::string& string)
std::string const& string)
{
std::string nString = string;

View File

@@ -37,7 +37,7 @@ protected:
int InitializeInternal() override;
int PackageFiles() override;
inline const char* GetOutputExtension() override { return ".exe"; }
inline char const* GetOutputExtension() override { return ".exe"; }
inline cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir()
const override
@@ -63,22 +63,22 @@ private:
bool Compile();
bool BuildDownloadedComponentArchive(cmCPackComponent* component,
const std::string& uploadDirectory,
std::string const& uploadDirectory,
std::string* hash);
/**
* Returns the option's value or an empty string if the option isn't set.
*/
cmValue RequireOption(const std::string& key);
cmValue RequireOption(std::string const& key);
std::string CustomComponentInstallDirectory(
const cmCPackComponent* component);
cmCPackComponent const* component);
/**
* Translates boolean expressions into "yes" or "no", as required in
* Inno Setup (only if "CPACK_INNOSETUP_USE_CMAKE_BOOL_FORMAT" is on).
*/
std::string TranslateBool(const std::string& value);
std::string TranslateBool(std::string const& value);
/**
* Creates a typical line of key and value pairs using the given map.
@@ -86,10 +86,10 @@ private:
* (e.g.: Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}";
* GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked)
*/
std::string ISKeyValueLine(const cmCPackInnoSetupKeyValuePairs& params);
std::string ISKeyValueLine(cmCPackInnoSetupKeyValuePairs const& params);
std::string CreateRecursiveComponentPath(cmCPackComponentGroup* group,
const std::string& path = "");
std::string const& path = "");
void CreateRecursiveComponentGroups(cmCPackComponentGroup* group);
@@ -97,8 +97,8 @@ private:
* These functions add quotes if the given value hasn't already quotes.
* Paths are converted into the format used by Windows before.
*/
std::string Quote(const std::string& string);
std::string QuotePath(const std::string& path,
std::string Quote(std::string const& string);
std::string QuotePath(std::string const& path,
PathType type = PathType::Windows);
/**
@@ -106,7 +106,7 @@ private:
* '|' '}' ',' '%' '"'
* Required for Inno Setup constants like {cm:...}
*/
std::string PrepareForConstant(const std::string& string);
std::string PrepareForConstant(std::string const& string);
std::vector<std::string> includeDirectives;
cmCPackInnoSetupKeyValuePairs setupDirectives;

View File

@@ -23,7 +23,7 @@ void cmCPackLog::SetLogOutputStream(std::ostream* os)
this->LogOutput = os;
}
bool cmCPackLog::SetLogOutputFile(const char* fname)
bool cmCPackLog::SetLogOutputFile(char const* fname)
{
this->LogOutputStream.reset();
if (fname) {
@@ -38,7 +38,7 @@ bool cmCPackLog::SetLogOutputFile(const char* fname)
return this->LogOutput != nullptr;
}
void cmCPackLog::Log(int tag, const char* file, int line, const char* msg,
void cmCPackLog::Log(int tag, char const* file, int line, char const* msg,
size_t length)
{
// By default no logging

View File

@@ -26,8 +26,8 @@ public:
cmCPackLog();
~cmCPackLog();
cmCPackLog(const cmCPackLog&) = delete;
cmCPackLog& operator=(const cmCPackLog&) = delete;
cmCPackLog(cmCPackLog const&) = delete;
cmCPackLog& operator=(cmCPackLog const&) = delete;
enum cm_log_tags
{
@@ -40,19 +40,19 @@ public:
};
//! Various signatures for logging.
void Log(const char* file, int line, const char* msg)
void Log(char const* file, int line, char const* msg)
{
this->Log(LOG_OUTPUT, file, line, msg);
}
void Log(const char* file, int line, const char* msg, size_t length)
void Log(char const* file, int line, char const* msg, size_t length)
{
this->Log(LOG_OUTPUT, file, line, msg, length);
}
void Log(int tag, const char* file, int line, const char* msg)
void Log(int tag, char const* file, int line, char const* msg)
{
this->Log(tag, file, line, msg, strlen(msg));
}
void Log(int tag, const char* file, int line, const char* msg,
void Log(int tag, char const* file, int line, char const* msg,
size_t length);
//! Set Verbose
@@ -84,7 +84,7 @@ public:
//! Set the log output file. The cmCPackLog will try to create file. If it
// cannot, it will report an error.
bool SetLogOutputFile(const char* fname);
bool SetLogOutputFile(char const* fname);
//! Set the various prefixes for the logging. SetPrefix sets the generic
// prefix that overwrites missing ones.
@@ -121,17 +121,17 @@ private:
class cmCPackLogWrite
{
public:
cmCPackLogWrite(const char* data, size_t length)
cmCPackLogWrite(char const* data, size_t length)
: Data(data)
, Length(length)
{
}
const char* Data;
char const* Data;
std::streamsize Length;
};
inline std::ostream& operator<<(std::ostream& os, const cmCPackLogWrite& c)
inline std::ostream& operator<<(std::ostream& os, cmCPackLogWrite const& c)
{
os.write(c.Data, c.Length);
os.flush();

View File

@@ -67,7 +67,7 @@ int cmCPackNSISGenerator::PackageFiles()
std::string outputDir = "$INSTDIR";
std::string fileN = cmSystemTools::RelativePath(this->toplevel, file);
if (!this->Components.empty()) {
const std::string::size_type pos = fileN.find('/');
std::string::size_type const pos = fileN.find('/');
// Use the custom component install directory if we have one
if (pos != std::string::npos) {
@@ -111,7 +111,7 @@ int cmCPackNSISGenerator::PackageFiles()
}
std::replace(fileN.begin(), fileN.end(), '/', '\\');
const std::string componentOutputDir =
std::string const componentOutputDir =
this->CustomComponentInstallDirectory(componentName);
dstr << " RMDir \"" << componentOutputDir << "\\" << fileN << "\""
@@ -212,7 +212,7 @@ int cmCPackNSISGenerator::PackageFiles()
if (cmValue wantedPosition =
this->GetOptionIfSet("CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION")) {
if (!wantedPosition->empty()) {
const std::set<std::string> possiblePositions{ "CENTER", "LEFT",
std::set<std::string> const possiblePositions{ "CENTER", "LEFT",
"RIGHT" };
if (possiblePositions.find(*wantedPosition) ==
possiblePositions.end()) {
@@ -629,7 +629,7 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str,
cmList::iterator it;
for (it = cpackMenuLinksList.begin(); it != cpackMenuLinksList.end(); ++it) {
std::string sourceName = *it;
const bool url = urlRegex.find(sourceName);
bool const url = urlRegex.find(sourceName);
// Convert / to \ in filenames, but not in urls:
//
@@ -666,12 +666,12 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str,
}
bool cmCPackNSISGenerator::GetListOfSubdirectories(
const char* topdir, std::vector<std::string>& dirs)
char const* topdir, std::vector<std::string>& dirs)
{
cmsys::Directory dir;
dir.Load(topdir);
for (unsigned long i = 0; i < dir.GetNumberOfFiles(); ++i) {
const char* fileName = dir.GetFile(i);
char const* fileName = dir.GetFile(i);
if (strcmp(fileName, ".") != 0 && strcmp(fileName, "..") != 0) {
std::string const fullPath =
std::string(topdir).append("/").append(fileName);
@@ -727,7 +727,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
componentCode += " SectionIn" + out.str() + "\n";
}
const std::string componentOutputDir =
std::string const componentOutputDir =
this->CustomComponentInstallDirectory(component->Name);
componentCode += cmStrCat(" SetOutPath \"", componentOutputDir, "\"\n");

View File

@@ -41,10 +41,10 @@ protected:
int InitializeInternal() override;
void CreateMenuLinks(std::ostream& str, std::ostream& deleteStr);
int PackageFiles() override;
const char* GetOutputExtension() override { return ".exe"; }
const char* GetOutputPostfix() override { return "win32"; }
char const* GetOutputExtension() override { return ".exe"; }
char const* GetOutputPostfix() override { return "win32"; }
bool GetListOfSubdirectories(const char* dir,
bool GetListOfSubdirectories(char const* dir,
std::vector<std::string>& dirs);
enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir()

View File

@@ -129,8 +129,8 @@ void cmCPackNuGetGenerator::AddGeneratedPackageNames()
return;
}
// add the generated packages to package file names list
const std::string& fileNames = *files_list;
const char sep = ';';
std::string const& fileNames = *files_list;
char const sep = ';';
std::string::size_type pos1 = 0;
std::string::size_type pos2 = fileNames.find(sep, pos1 + 1);
while (pos2 != std::string::npos) {

View File

@@ -20,7 +20,7 @@ protected:
bool SupportsComponentInstallation() const override;
int PackageFiles() override;
const char* GetOutputExtension() override { return ".nupkg"; }
char const* GetOutputExtension() override { return ".nupkg"; }
bool SupportsAbsoluteDestination() const override { return false; }
/**
* The method used to prepare variables when component

View File

@@ -35,7 +35,7 @@ int cmCPackPKGGenerator::InitializeInternal()
}
std::string cmCPackPKGGenerator::GetPackageName(
const cmCPackComponent& component)
cmCPackComponent const& component)
{
if (component.ArchiveFile.empty()) {
std::string packagesDir =
@@ -48,8 +48,8 @@ std::string cmCPackPKGGenerator::GetPackageName(
return cmStrCat(component.ArchiveFile, ".pkg");
}
void cmCPackPKGGenerator::CreateBackground(const char* themeName,
const char* metapackageFile,
void cmCPackPKGGenerator::CreateBackground(char const* themeName,
char const* metapackageFile,
cm::string_view genName,
cmXMLWriter& xout)
{
@@ -107,8 +107,8 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName,
xout.EndElement();
}
void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile,
const char* genName)
void cmCPackPKGGenerator::WriteDistributionFile(char const* metapackageFile,
char const* genName)
{
std::string distributionTemplate =
this->FindTemplate("CPack.distribution.dist.in");
@@ -206,7 +206,7 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile,
}
void cmCPackPKGGenerator::CreateChoiceOutline(
const cmCPackComponentGroup& group, cmXMLWriter& xout)
cmCPackComponentGroup const& group, cmXMLWriter& xout)
{
xout.StartElement("line");
xout.Attribute("choice", cmStrCat(group.Name, "Choice"));
@@ -223,7 +223,7 @@ void cmCPackPKGGenerator::CreateChoiceOutline(
xout.EndElement();
}
void cmCPackPKGGenerator::CreateChoice(const cmCPackComponentGroup& group,
void cmCPackPKGGenerator::CreateChoice(cmCPackComponentGroup const& group,
cmXMLWriter& xout)
{
xout.StartElement("choice");
@@ -238,7 +238,7 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponentGroup& group,
xout.EndElement();
}
void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component,
void cmCPackPKGGenerator::CreateChoice(cmCPackComponent const& component,
cmXMLWriter& xout)
{
std::string packageId;
@@ -278,7 +278,7 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component,
// on (B and A), while selecting something that depends on C--either D
// or E--will automatically cause C to get selected.
std::ostringstream selected("my.choice.selected", std::ios_base::ate);
std::set<const cmCPackComponent*> visited;
std::set<cmCPackComponent const*> visited;
AddDependencyAttributes(component, visited, selected);
visited.clear();
AddReverseDependencyAttributes(component, visited, selected);
@@ -350,8 +350,8 @@ void cmCPackPKGGenerator::CreateDomains(cmXMLWriter& xout)
}
void cmCPackPKGGenerator::AddDependencyAttributes(
const cmCPackComponent& component,
std::set<const cmCPackComponent*>& visited, std::ostringstream& out)
cmCPackComponent const& component,
std::set<cmCPackComponent const*>& visited, std::ostringstream& out)
{
if (visited.find(&component) != visited.end()) {
return;
@@ -365,8 +365,8 @@ void cmCPackPKGGenerator::AddDependencyAttributes(
}
void cmCPackPKGGenerator::AddReverseDependencyAttributes(
const cmCPackComponent& component,
std::set<const cmCPackComponent*>& visited, std::ostringstream& out)
cmCPackComponent const& component,
std::set<cmCPackComponent const*>& visited, std::ostringstream& out)
{
if (visited.find(&component) != visited.end()) {
return;
@@ -379,8 +379,8 @@ void cmCPackPKGGenerator::AddReverseDependencyAttributes(
}
}
bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name,
const std::string& dirName)
bool cmCPackPKGGenerator::CopyCreateResourceFile(std::string const& name,
std::string const& dirName)
{
std::string uname = cmSystemTools::UpperCase(name);
std::string cpackVar = cmStrCat("CPACK_RESOURCE_FILE_", uname);
@@ -426,8 +426,8 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name,
return true;
}
bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name,
const char* outName)
bool cmCPackPKGGenerator::CopyResourcePlistFile(std::string const& name,
char const* outName)
{
if (!outName) {
outName = name.c_str();
@@ -451,9 +451,9 @@ bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name,
return true;
}
int cmCPackPKGGenerator::CopyInstallScript(const std::string& resdir,
const std::string& script,
const std::string& name)
int cmCPackPKGGenerator::CopyInstallScript(std::string const& resdir,
std::string const& script,
std::string const& name)
{
std::string dst = cmStrCat(resdir, '/', name);
cmSystemTools::CopyFileAlways(script, dst);

View File

@@ -34,61 +34,61 @@ public:
protected:
int InitializeInternal() override;
const char* GetOutputPostfix() override { return "darwin"; }
char const* GetOutputPostfix() override { return "darwin"; }
// Copies or creates the resource file with the given name to the
// package or package staging directory dirName. The variable
// CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased
// version of name) specifies the input file to use for this file,
// which will be configured via ConfigureFile.
bool CopyCreateResourceFile(const std::string& name,
const std::string& dirName);
bool CopyResourcePlistFile(const std::string& name,
const char* outName = nullptr);
bool CopyCreateResourceFile(std::string const& name,
std::string const& dirName);
bool CopyResourcePlistFile(std::string const& name,
char const* outName = nullptr);
int CopyInstallScript(const std::string& resdir, const std::string& script,
const std::string& name);
int CopyInstallScript(std::string const& resdir, std::string const& script,
std::string const& name);
// Retrieve the name of package file that will be generated for this
// component. The name is just the file name with extension, and
// does not include the subdirectory.
std::string GetPackageName(const cmCPackComponent& component);
std::string GetPackageName(cmCPackComponent const& component);
// Writes a distribution.dist file, which turns a metapackage into a
// full-fledged distribution. This file is used to describe
// inter-component dependencies. metapackageFile is the name of the
// metapackage for the distribution. Only valid for a
// component-based install.
void WriteDistributionFile(const char* metapackageFile, const char* genName);
void WriteDistributionFile(char const* metapackageFile, char const* genName);
// Subroutine of WriteDistributionFile that writes out the
// dependency attributes for inter-component dependencies.
void AddDependencyAttributes(const cmCPackComponent& component,
std::set<const cmCPackComponent*>& visited,
void AddDependencyAttributes(cmCPackComponent const& component,
std::set<cmCPackComponent const*>& visited,
std::ostringstream& out);
// Subroutine of WriteDistributionFile that writes out the
// reverse dependency attributes for inter-component dependencies.
void AddReverseDependencyAttributes(
const cmCPackComponent& component,
std::set<const cmCPackComponent*>& visited, std::ostringstream& out);
cmCPackComponent const& component,
std::set<cmCPackComponent const*>& visited, std::ostringstream& out);
// Generates XML that encodes the hierarchy of component groups and
// their components in a form that can be used by distribution
// metapackages.
void CreateChoiceOutline(const cmCPackComponentGroup& group,
void CreateChoiceOutline(cmCPackComponentGroup const& group,
cmXMLWriter& xout);
/// Create the "choice" XML element to describe a component group
/// for the installer GUI.
void CreateChoice(const cmCPackComponentGroup& group, cmXMLWriter& xout);
void CreateChoice(cmCPackComponentGroup const& group, cmXMLWriter& xout);
/// Create the "choice" XML element to describe a component for the
/// installer GUI.
void CreateChoice(const cmCPackComponent& component, cmXMLWriter& xout);
void CreateChoice(cmCPackComponent const& component, cmXMLWriter& xout);
/// Creates a background in the distribution XML.
void CreateBackground(const char* themeName, const char* metapackageFile,
void CreateBackground(char const* themeName, char const* metapackageFile,
cm::string_view genName, cmXMLWriter& xout);
/// Create the "domains" XML element to indicate where the product can

View File

@@ -148,7 +148,7 @@ int cmCPackProductBuildGenerator::InitializeInternal()
return this->Superclass::InitializeInternal();
}
bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command)
bool cmCPackProductBuildGenerator::RunProductBuild(std::string const& command)
{
std::string tmpFile = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"),
"/ProductBuildOutput.log");
@@ -175,8 +175,8 @@ bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command)
}
bool cmCPackProductBuildGenerator::GenerateComponentPackage(
const std::string& packageFileDir, const std::string& packageFileName,
const std::string& packageDir, const cmCPackComponent* component)
std::string const& packageFileDir, std::string const& packageFileName,
std::string const& packageDir, cmCPackComponent const* component)
{
std::string packageFile = cmStrCat(packageFileDir, '/', packageFileName);
@@ -184,7 +184,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
"- Building component package: " << packageFile
<< std::endl);
const char* comp_name = component ? component->Name.c_str() : nullptr;
char const* comp_name = component ? component->Name.c_str() : nullptr;
cmValue preflight = this->GetComponentScript("PREFLIGHT", comp_name);
cmValue postflight = this->GetComponentScript("POSTFLIGHT", comp_name);
@@ -267,7 +267,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
}
cmValue cmCPackProductBuildGenerator::GetComponentScript(
const char* script, const char* component_name)
char const* script, char const* component_name)
{
std::string scriptname = cmStrCat("CPACK_", script, '_');
if (component_name) {

View File

@@ -30,21 +30,21 @@ public:
protected:
int InitializeInternal() override;
int PackageFiles() override;
const char* GetOutputExtension() override { return ".pkg"; }
char const* GetOutputExtension() override { return ".pkg"; }
// Run ProductBuild with the given command line, which will (if
// successful) produce the given package file. Returns true if
// ProductBuild succeeds, false otherwise.
bool RunProductBuild(const std::string& command);
bool RunProductBuild(std::string const& command);
// Generate a package in the file packageFile for the given
// component. All of the files within this component are stored in
// the directory packageDir. Returns true if successful, false
// otherwise.
bool GenerateComponentPackage(const std::string& packageFileDir,
const std::string& packageFileName,
const std::string& packageDir,
const cmCPackComponent* component);
bool GenerateComponentPackage(std::string const& packageFileDir,
std::string const& packageFileName,
std::string const& packageDir,
cmCPackComponent const* component);
cmValue GetComponentScript(const char* script, const char* script_component);
cmValue GetComponentScript(char const* script, char const* script_component);
};

View File

@@ -49,7 +49,7 @@ void cmCPackRPMGenerator::AddGeneratedPackageNames()
{
// add the generated packages to package file names list
std::string fileNames(this->GetOption("GEN_CPACK_OUTPUT_FILES"));
const char sep = ';';
char const sep = ';';
std::string::size_type pos1 = 0;
std::string::size_type pos2 = fileNames.find(sep, pos1 + 1);
while (pos2 != std::string::npos) {
@@ -107,7 +107,7 @@ int cmCPackRPMGenerator::PackageOnePack(std::string const& initialToplevel,
}
std::string cmCPackRPMGenerator::GetSanitizedDirOrFileName(
const std::string& name, bool isFullName) const
std::string const& name, bool isFullName) const
{
auto sanitizedName =
this->cmCPackGenerator::GetSanitizedDirOrFileName(name, isFullName);
@@ -363,7 +363,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
}
int cmCPackRPMGenerator::PackageComponentsAllInOne(
const std::string& compInstDirName)
std::string const& compInstDirName)
{
int retval = 1;
/* Reset package file name list it will be populated during the
@@ -445,7 +445,7 @@ bool cmCPackRPMGenerator::SupportsComponentInstallation() const
}
std::string cmCPackRPMGenerator::GetComponentInstallSuffix(
const std::string& componentName)
std::string const& componentName)
{
if (this->componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) {
return componentName;
@@ -465,7 +465,7 @@ std::string cmCPackRPMGenerator::GetComponentInstallSuffix(
}
std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix(
const std::string& componentName)
std::string const& componentName)
{
return this->GetSanitizedDirOrFileName(
this->GetComponentInstallSuffix(componentName));

View File

@@ -59,15 +59,15 @@ protected:
* Special case of component install where all
* components will be put in a single installer.
*/
int PackageComponentsAllInOne(const std::string& compInstDirName);
const char* GetOutputExtension() override { return ".rpm"; }
std::string GetSanitizedDirOrFileName(const std::string& name,
int PackageComponentsAllInOne(std::string const& compInstDirName);
char const* GetOutputExtension() override { return ".rpm"; }
std::string GetSanitizedDirOrFileName(std::string const& name,
bool isFullName = true) const override;
bool SupportsComponentInstallation() const override;
std::string GetComponentInstallSuffix(
const std::string& componentName) override;
std::string const& componentName) override;
std::string GetComponentInstallDirNameSuffix(
const std::string& componentName) override;
std::string const& componentName) override;
void AddGeneratedPackageNames();
};

View File

@@ -81,7 +81,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
}
this->SetOptionIfNotSet("CPACK_RESOURCE_FILE_LICENSE_CONTENT", licenseText);
const char headerLengthTag[] = "###CPACK_HEADER_LENGTH###";
char const headerLengthTag[] = "###CPACK_HEADER_LENGTH###";
// Create the header
std::string inFile = this->GetOption("CPACK_STGZ_HEADER_FILE");
@@ -96,7 +96,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
this->ConfigureString(packageHeaderText, res);
// Count the lines
const char* ptr = res.c_str();
char const* ptr = res.c_str();
while (*ptr) {
if (*ptr == '\n') {
counter++;

View File

@@ -39,14 +39,14 @@
#include "cmake.h"
namespace {
const cmDocumentationEntry cmDocumentationName = {
cmDocumentationEntry const cmDocumentationName = {
{},
" cpack - Packaging driver provided by CMake."
};
const cmDocumentationEntry cmDocumentationUsage = { {}, " cpack [options]" };
cmDocumentationEntry const cmDocumentationUsage = { {}, " cpack [options]" };
const cmDocumentationEntry cmDocumentationOptions[14] = {
cmDocumentationEntry const cmDocumentationOptions[14] = {
{ "-G <generators>", "Override/define CPACK_GENERATOR" },
{ "-C <Configuration>", "Specify the project configuration" },
{ "-D <var>=<value>", "Set a CPack variable." },
@@ -63,22 +63,22 @@ const cmDocumentationEntry cmDocumentationOptions[14] = {
{ "--list-presets", "List available package presets" }
};
void cpackProgressCallback(const std::string& message, float /*unused*/)
void cpackProgressCallback(std::string const& message, float /*unused*/)
{
std::cout << "-- " << message << '\n';
}
std::vector<cmDocumentationEntry> makeGeneratorDocs(
const cmCPackGeneratorFactory& gf)
cmCPackGeneratorFactory const& gf)
{
const auto& generators = gf.GetGeneratorsList();
auto const& generators = gf.GetGeneratorsList();
std::vector<cmDocumentationEntry> docs;
docs.reserve(generators.size());
std::transform(
generators.cbegin(), generators.cend(), std::back_inserter(docs),
[](const std::decay<decltype(generators)>::type::value_type& gen) {
[](std::decay<decltype(generators)>::type::value_type const& gen) {
return cmDocumentationEntry{ gen.first, gen.second };
});
return docs;
@@ -139,27 +139,27 @@ int main(int argc, char const* const* argv)
std::map<std::string, std::string> definitions;
auto const verboseLambda = [&log](const std::string&, cmake*,
auto const verboseLambda = [&log](std::string const&, cmake*,
cmMakefile*) -> bool {
log.SetVerbose(true);
cmCPack_Log(&log, cmCPackLog::LOG_OUTPUT, "Enable Verbose\n");
return true;
};
auto const debugLambda = [&log](const std::string&, cmake*,
auto const debugLambda = [&log](std::string const&, cmake*,
cmMakefile*) -> bool {
log.SetDebug(true);
cmCPack_Log(&log, cmCPackLog::LOG_OUTPUT, "Enable Debug\n");
return true;
};
auto const traceLambda = [](const std::string&, cmake* state,
auto const traceLambda = [](std::string const&, cmake* state,
cmMakefile*) -> bool {
state->SetTrace(true);
return true;
};
auto const traceExpandLambda = [](const std::string&, cmake* state,
auto const traceExpandLambda = [](std::string const&, cmake* state,
cmMakefile*) -> bool {
state->SetTrace(true);
state->SetTraceExpand(true);
@@ -209,7 +209,7 @@ int main(int argc, char const* const* argv)
CommandArgument::setToTrue(listPresets) },
CommandArgument{ "-D", CommandArgument::Values::One,
CommandArgument::RequiresSeparator::No,
[&log, &definitions](const std::string& arg, cmake*,
[&log, &definitions](std::string const& arg, cmake*,
cmMakefile*) -> bool {
std::string value = arg;
size_t pos = value.find_first_of('=');
@@ -255,12 +255,12 @@ int main(int argc, char const* const* argv)
// Set up presets
if (!preset.empty() || listPresets) {
const auto workingDirectory = cmSystemTools::GetLogicalWorkingDirectory();
auto const workingDirectory = cmSystemTools::GetLogicalWorkingDirectory();
auto const presetGeneratorsPresent =
[&generators](const cmCMakePresetsGraph::PackagePreset& p) {
[&generators](cmCMakePresetsGraph::PackagePreset const& p) {
return std::all_of(p.Generators.begin(), p.Generators.end(),
[&generators](const std::string& gen) {
[&generators](std::string const& gen) {
return generators.GetGeneratorsList().count(
gen) != 0;
});

View File

@@ -21,10 +21,10 @@
#include "cmXMLParser.h"
static int cmBZRXMLParserUnknownEncodingHandler(void* /*unused*/,
const XML_Char* name,
XML_Char const* name,
XML_Encoding* info)
{
static const int latin1[] = {
static int const latin1[] = {
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011,
0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A,
@@ -86,7 +86,7 @@ cmCTestBZR::~cmCTestBZR() = default;
class cmCTestBZR::InfoParser : public cmCTestVC::LineParser
{
public:
InfoParser(cmCTestBZR* bzr, const char* prefix)
InfoParser(cmCTestBZR* bzr, char const* prefix)
: BZR(bzr)
{
this->SetLog(&bzr->Log, prefix);
@@ -114,7 +114,7 @@ private:
class cmCTestBZR::RevnoParser : public cmCTestVC::LineParser
{
public:
RevnoParser(cmCTestBZR* bzr, const char* prefix, std::string& rev)
RevnoParser(cmCTestBZR* bzr, char const* prefix, std::string& rev)
: Rev(rev)
{
this->SetLog(&bzr->Log, prefix);
@@ -179,7 +179,7 @@ class cmCTestBZR::LogParser
, private cmXMLParser
{
public:
LogParser(cmCTestBZR* bzr, const char* prefix)
LogParser(cmCTestBZR* bzr, char const* prefix)
: OutputLogger(bzr->Log, prefix)
, BZR(bzr)
, EmailRegex("(.*) <([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+)>")
@@ -211,14 +211,14 @@ private:
cmsys::RegularExpression EmailRegex;
bool ProcessChunk(const char* data, int length) override
bool ProcessChunk(char const* data, int length) override
{
this->OutputLogger::ProcessChunk(data, length);
this->ParseChunk(data, length);
return true;
}
void StartElement(const std::string& name, const char** /*atts*/) override
void StartElement(std::string const& name, char const** /*atts*/) override
{
this->CData.clear();
if (name == "log") {
@@ -243,12 +243,12 @@ private:
}
}
void CharacterDataHandler(const char* data, int length) override
void CharacterDataHandler(char const* data, int length) override
{
cm::append(this->CData, data, data + length);
}
void EndElement(const std::string& name) override
void EndElement(std::string const& name) override
{
if (name == "log") {
this->BZR->DoRevision(this->Rev, this->Changes);
@@ -278,7 +278,7 @@ private:
this->CData.clear();
}
void ReportError(int /*line*/, int /*column*/, const char* msg) override
void ReportError(int /*line*/, int /*column*/, char const* msg) override
{
this->BZR->Log << "Error parsing bzr log xml: " << msg << "\n";
}
@@ -287,7 +287,7 @@ private:
class cmCTestBZR::UpdateParser : public cmCTestVC::LineParser
{
public:
UpdateParser(cmCTestBZR* bzr, const char* prefix)
UpdateParser(cmCTestBZR* bzr, char const* prefix)
: BZR(bzr)
{
this->SetLog(&bzr->Log, prefix);
@@ -298,12 +298,12 @@ private:
cmCTestBZR* BZR;
cmsys::RegularExpression RegexUpdate;
bool ProcessChunk(const char* first, int length) override
bool ProcessChunk(char const* first, int length) override
{
bool last_is_new_line = (*first == '\r' || *first == '\n');
const char* const last = first + length;
for (const char* c = first; c != last; ++c) {
char const* const last = first + length;
for (char const* c = first; c != last; ++c) {
if (*c == '\r' || *c == '\n') {
if (!last_is_new_line) {
// Log this line.
@@ -346,8 +346,8 @@ private:
}
cmSystemTools::ConvertToUnixSlashes(path);
const std::string dir = cmSystemTools::GetFilenamePath(path);
const std::string name = cmSystemTools::GetFilenameName(path);
std::string const dir = cmSystemTools::GetFilenamePath(path);
std::string const name = cmSystemTools::GetFilenameName(path);
if (c0 == 'C') {
this->BZR->Dirs[dir][name].Status = PathConflicting;
@@ -420,7 +420,7 @@ bool cmCTestBZR::LoadRevisions()
class cmCTestBZR::StatusParser : public cmCTestVC::LineParser
{
public:
StatusParser(cmCTestBZR* bzr, const char* prefix)
StatusParser(cmCTestBZR* bzr, char const* prefix)
: BZR(bzr)
{
this->SetLog(&bzr->Log, prefix);

View File

@@ -6,14 +6,14 @@
#include <utility>
bool cmCTestBinPackerAllocation::operator==(
const cmCTestBinPackerAllocation& other) const
cmCTestBinPackerAllocation const& other) const
{
return this->ProcessIndex == other.ProcessIndex &&
this->SlotsNeeded == other.SlotsNeeded && this->Id == other.Id;
}
bool cmCTestBinPackerAllocation::operator!=(
const cmCTestBinPackerAllocation& other) const
cmCTestBinPackerAllocation const& other) const
{
return !(*this == other);
}
@@ -35,8 +35,8 @@ namespace {
*/
template <typename AllocationStrategy>
bool AllocateCTestResources(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
const std::vector<std::string>& resourcesSorted, std::size_t currentIndex,
std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string> const& resourcesSorted, std::size_t currentIndex,
std::vector<cmCTestBinPackerAllocation*>& allocations)
{
// Iterate through all large enough resources until we find a solution
@@ -83,7 +83,7 @@ bool AllocateCTestResources(
template <typename AllocationStrategy>
bool AllocateCTestResources(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<cmCTestBinPackerAllocation>& allocations)
{
// Sort the resource requirements in descending order by slots needed
@@ -115,27 +115,27 @@ class RoundRobinAllocationStrategy
{
public:
static void InitialSort(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted);
static void IncrementalSort(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted, std::size_t lastAllocatedIndex);
};
void RoundRobinAllocationStrategy::InitialSort(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted)
{
std::stable_sort(
resourcesSorted.rbegin(), resourcesSorted.rend(),
[&resources](const std::string& id1, const std::string& id2) {
[&resources](std::string const& id1, std::string const& id2) {
return resources.at(id1).Free() < resources.at(id2).Free();
});
}
void RoundRobinAllocationStrategy::IncrementalSort(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted, std::size_t lastAllocatedIndex)
{
auto tmp = resourcesSorted[lastAllocatedIndex];
@@ -153,27 +153,27 @@ class BlockAllocationStrategy
{
public:
static void InitialSort(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted);
static void IncrementalSort(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted, std::size_t lastAllocatedIndex);
};
void BlockAllocationStrategy::InitialSort(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<std::string>& resourcesSorted)
{
std::stable_sort(
resourcesSorted.rbegin(), resourcesSorted.rend(),
[&resources](const std::string& id1, const std::string& id2) {
[&resources](std::string const& id1, std::string const& id2) {
return resources.at(id1).Free() < resources.at(id2).Free();
});
}
void BlockAllocationStrategy::IncrementalSort(
const std::map<std::string, cmCTestResourceAllocator::Resource>&,
std::map<std::string, cmCTestResourceAllocator::Resource> const&,
std::vector<std::string>& resourcesSorted, std::size_t lastAllocatedIndex)
{
auto tmp = resourcesSorted[lastAllocatedIndex];
@@ -187,7 +187,7 @@ void BlockAllocationStrategy::IncrementalSort(
}
bool cmAllocateCTestResourcesRoundRobin(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<cmCTestBinPackerAllocation>& allocations)
{
return AllocateCTestResources<RoundRobinAllocationStrategy>(resources,
@@ -195,7 +195,7 @@ bool cmAllocateCTestResourcesRoundRobin(
}
bool cmAllocateCTestResourcesBlock(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<cmCTestBinPackerAllocation>& allocations)
{
return AllocateCTestResources<BlockAllocationStrategy>(resources,

View File

@@ -15,14 +15,14 @@ struct cmCTestBinPackerAllocation
int SlotsNeeded;
std::string Id;
bool operator==(const cmCTestBinPackerAllocation& other) const;
bool operator!=(const cmCTestBinPackerAllocation& other) const;
bool operator==(cmCTestBinPackerAllocation const& other) const;
bool operator!=(cmCTestBinPackerAllocation const& other) const;
};
bool cmAllocateCTestResourcesRoundRobin(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<cmCTestBinPackerAllocation>& allocations);
bool cmAllocateCTestResourcesBlock(
const std::map<std::string, cmCTestResourceAllocator::Resource>& resources,
std::map<std::string, cmCTestResourceAllocator::Resource> const& resources,
std::vector<cmCTestBinPackerAllocation>& allocations);

View File

@@ -47,7 +47,7 @@ bool cmCTestBuildAndTest::RunCMake(cmake* cm)
args.push_back("-T" + this->BuildGeneratorToolset);
}
const char* config = nullptr;
char const* config = nullptr;
if (!this->CTest->GetConfigType().empty()) {
config = this->CTest->GetConfigType().c_str();
}
@@ -136,7 +136,7 @@ public:
: CM(cm)
{
cmSystemTools::SetMessageCallback(
[](const std::string& msg, const cmMessageMetadata& /* unused */) {
[](std::string const& msg, cmMessageMetadata const& /* unused */) {
std::cout << msg << std::endl;
});
@@ -145,7 +145,7 @@ public:
cmSystemTools::SetStderrCallback(
[](std::string const& m) { std::cout << m << std::flush; });
this->CM.SetProgressCallback([](const std::string& msg, float prog) {
this->CM.SetProgressCallback([](std::string const& msg, float prog) {
if (prog < 0) {
std::cout << msg << std::endl;
}
@@ -160,10 +160,10 @@ public:
cmSystemTools::SetMessageCallback(nullptr);
}
cmCTestBuildAndTestCaptureRAII(const cmCTestBuildAndTestCaptureRAII&) =
cmCTestBuildAndTestCaptureRAII(cmCTestBuildAndTestCaptureRAII const&) =
delete;
cmCTestBuildAndTestCaptureRAII& operator=(
const cmCTestBuildAndTestCaptureRAII&) = delete;
cmCTestBuildAndTestCaptureRAII const&) = delete;
};
int cmCTestBuildAndTest::Run()
@@ -247,7 +247,7 @@ int cmCTestBuildAndTest::Run()
return 1;
}
}
const char* config = nullptr;
char const* config = nullptr;
if (!this->CTest->GetConfigType().empty()) {
config = this->CTest->GetConfigType().c_str();
}

View File

@@ -65,10 +65,10 @@ std::unique_ptr<cmCTestGenericHandler> cmCTestBuildCommand::InitializeHandler(
: cmNonempty(ctestBuildConfiguration) ? *ctestBuildConfiguration
: this->CTest->GetConfigType();
const std::string& cmakeBuildAdditionalFlags = cmNonempty(args.Flags)
std::string const& cmakeBuildAdditionalFlags = cmNonempty(args.Flags)
? args.Flags
: mf.GetSafeDefinition("CTEST_BUILD_FLAGS");
const std::string& cmakeBuildTarget = cmNonempty(args.Target)
std::string const& cmakeBuildTarget = cmNonempty(args.Target)
? args.Target
: mf.GetSafeDefinition("CTEST_BUILD_TARGET");

View File

@@ -33,7 +33,7 @@
#include "cmValue.h"
#include "cmXMLWriter.h"
static const char* cmCTestErrorMatches[] = {
static char const* cmCTestErrorMatches[] = {
"^[Bb]us [Ee]rror", // noqa: spellcheck disable-line
"^[Ss]egmentation [Vv]iolation",
"^[Ss]egmentation [Ff]ault",
@@ -93,7 +93,7 @@ static const char* cmCTestErrorMatches[] = {
nullptr
};
static const char* cmCTestErrorExceptions[] = {
static char const* cmCTestErrorExceptions[] = {
"instantiated from ",
"candidates are:",
": warning",
@@ -109,7 +109,7 @@ static const char* cmCTestErrorExceptions[] = {
nullptr
};
static const char* cmCTestWarningMatches[] = {
static char const* cmCTestWarningMatches[] = {
"([^ :]+):([0-9]+): warning:",
"([^ :]+):([0-9]+): note:",
"^cc[^C]*CC: WARNING File = ([^,]+), Line = ([0-9]+)",
@@ -135,7 +135,7 @@ static const char* cmCTestWarningMatches[] = {
nullptr
};
static const char* cmCTestWarningExceptions[] = {
static char const* cmCTestWarningExceptions[] = {
R"(/usr/.*/X11/Xlib\.h:[0-9]+: war.*: ANSI C\+\+ forbids declaration)",
R"(/usr/.*/X11/Xutil\.h:[0-9]+: war.*: ANSI C\+\+ forbids declaration)",
R"(/usr/.*/X11/XResource\.h:[0-9]+: war.*: ANSI C\+\+ forbids declaration)",
@@ -157,7 +157,7 @@ static const char* cmCTestWarningExceptions[] = {
struct cmCTestBuildCompileErrorWarningRex
{
const char* RegularExpressionString;
char const* RegularExpressionString;
int FileIndex;
int LineIndex;
};
@@ -281,7 +281,7 @@ int cmCTestBuildHandler::ProcessHandler()
return -1;
}
const std::string& buildDirectory =
std::string const& buildDirectory =
this->CTest->GetCTestConfiguration("BuildDirectory");
if (buildDirectory.empty()) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
@@ -501,7 +501,7 @@ void cmCTestBuildHandler::GenerateXMLLaunched(cmXMLWriter& xml)
launchDir.Load(this->CTestLaunchDir);
unsigned long n = launchDir.GetNumberOfFiles();
for (unsigned long i = 0; i < n; ++i) {
const char* fname = launchDir.GetFile(i);
char const* fname = launchDir.GetFile(i);
if (this->IsLaunchedErrorFile(fname) && numErrorsAllowed) {
numErrorsAllowed--;
fragments.insert(this->CTestLaunchDir + '/' + fname);
@@ -611,14 +611,14 @@ void cmCTestBuildHandler::GenerateXMLFooter(cmXMLWriter& xml,
this->CTest->EndXML(xml);
}
bool cmCTestBuildHandler::IsLaunchedErrorFile(const char* fname)
bool cmCTestBuildHandler::IsLaunchedErrorFile(char const* fname)
{
// error-{hash}.xml
return (cmHasLiteralPrefix(fname, "error-") &&
cmHasLiteralSuffix(fname, ".xml"));
}
bool cmCTestBuildHandler::IsLaunchedWarningFile(const char* fname)
bool cmCTestBuildHandler::IsLaunchedWarningFile(char const* fname)
{
// warning-{hash}.xml
return (cmHasLiteralPrefix(fname, "warning-") &&
@@ -635,15 +635,15 @@ class cmCTestBuildHandler::LaunchHelper
public:
LaunchHelper(cmCTestBuildHandler* handler);
~LaunchHelper();
LaunchHelper(const LaunchHelper&) = delete;
LaunchHelper& operator=(const LaunchHelper&) = delete;
LaunchHelper(LaunchHelper const&) = delete;
LaunchHelper& operator=(LaunchHelper const&) = delete;
private:
cmCTestBuildHandler* Handler;
cmCTest* CTest;
void WriteLauncherConfig();
void WriteScrapeMatchers(const char* purpose,
void WriteScrapeMatchers(char const* purpose,
std::vector<std::string> const& matchers);
};
@@ -703,7 +703,7 @@ void cmCTestBuildHandler::LaunchHelper::WriteLauncherConfig()
}
void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers(
const char* purpose, std::vector<std::string> const& matchers)
char const* purpose, std::vector<std::string> const& matchers)
{
if (matchers.empty()) {
return;
@@ -716,8 +716,8 @@ void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers(
}
}
bool cmCTestBuildHandler::RunMakeCommand(const std::string& command,
int* retVal, const char* dir,
bool cmCTestBuildHandler::RunMakeCommand(std::string const& command,
int* retVal, char const* dir,
int timeout, std::ostream& ofs,
Encoding encoding)
{
@@ -869,7 +869,7 @@ bool cmCTestBuildHandler::RunMakeCommand(const std::string& command,
launchDir.Load(this->CTestLaunchDir);
unsigned long n = launchDir.GetNumberOfFiles();
for (unsigned long i = 0; i < n; ++i) {
const char* fname = launchDir.GetFile(i);
char const* fname = launchDir.GetFile(i);
if (cmHasLiteralSuffix(fname, ".xml")) {
launcherXMLFound = true;
break;
@@ -940,13 +940,13 @@ bool cmCTestBuildHandler::RunMakeCommand(const std::string& command,
// ######################################################################
// ######################################################################
void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length,
void cmCTestBuildHandler::ProcessBuffer(char const* data, size_t length,
size_t& tick, size_t tick_len,
std::ostream& ofs,
t_BuildProcessingQueueType* queue)
{
const std::string::size_type tick_line_len = 50;
const char* ptr;
std::string::size_type const tick_line_len = 50;
char const* ptr;
for (ptr = data; ptr < data + length; ptr++) {
queue->push_back(*ptr);
}
@@ -977,7 +977,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length,
this->CurrentProcessingLine.clear();
cm::append(this->CurrentProcessingLine, queue->begin(), it);
this->CurrentProcessingLine.push_back(0);
const char* line = this->CurrentProcessingLine.data();
char const* line = this->CurrentProcessingLine.data();
// Process the line
int lineType = this->ProcessSingleLine(line);
@@ -1074,7 +1074,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length,
ofs << cm::string_view(data, length);
}
int cmCTestBuildHandler::ProcessSingleLine(const char* data)
int cmCTestBuildHandler::ProcessSingleLine(char const* data)
{
if (this->UseCTestLaunch) {
// No log scraping when using launchers.

View File

@@ -49,7 +49,7 @@ private:
//! Run command specialized for make and configure. Returns process status
// and retVal is return value or exception.
bool RunMakeCommand(const std::string& command, int* retVal, const char* dir,
bool RunMakeCommand(std::string const& command, int* retVal, char const* dir,
int timeout, std::ostream& ofs,
Encoding encoding = cmProcessOutput::Auto);
@@ -86,8 +86,8 @@ private:
void GenerateXMLLaunched(cmXMLWriter& xml);
void GenerateXMLLogScraped(cmXMLWriter& xml);
void GenerateXMLFooter(cmXMLWriter& xml, cmDuration elapsed_build_time);
bool IsLaunchedErrorFile(const char* fname);
bool IsLaunchedWarningFile(const char* fname);
bool IsLaunchedErrorFile(char const* fname);
bool IsLaunchedWarningFile(char const* fname);
std::string StartBuild;
std::string EndBuild;
@@ -109,10 +109,10 @@ private:
using t_BuildProcessingQueueType = std::deque<char>;
void ProcessBuffer(const char* data, size_t length, size_t& tick,
void ProcessBuffer(char const* data, size_t length, size_t& tick,
size_t tick_len, std::ostream& ofs,
t_BuildProcessingQueueType* queue);
int ProcessSingleLine(const char* data);
int ProcessSingleLine(char const* data);
t_BuildProcessingQueueType BuildProcessingQueue;
t_BuildProcessingQueueType BuildProcessingErrorQueue;

View File

@@ -26,7 +26,7 @@ cmCTestCVS::~cmCTestCVS() = default;
class cmCTestCVS::UpdateParser : public cmCTestVC::LineParser
{
public:
UpdateParser(cmCTestCVS* cvs, const char* prefix)
UpdateParser(cmCTestCVS* cvs, char const* prefix)
: CVS(cvs)
{
this->SetLog(&cvs->Log, prefix);
@@ -106,7 +106,7 @@ class cmCTestCVS::LogParser : public cmCTestVC::LineParser
{
public:
using Revision = cmCTestCVS::Revision;
LogParser(cmCTestCVS* cvs, const char* prefix, std::vector<Revision>& revs)
LogParser(cmCTestCVS* cvs, char const* prefix, std::vector<Revision>& revs)
: CVS(cvs)
, Revisions(revs)
{
@@ -214,7 +214,7 @@ std::string cmCTestCVS::ComputeBranchFlag(std::string const& dir)
return "-b";
}
void cmCTestCVS::LoadRevisions(std::string const& file, const char* branchFlag,
void cmCTestCVS::LoadRevisions(std::string const& file, char const* branchFlag,
std::vector<Revision>& revisions)
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush);
@@ -231,7 +231,7 @@ void cmCTestCVS::LoadRevisions(std::string const& file, const char* branchFlag,
void cmCTestCVS::WriteXMLDirectory(cmXMLWriter& xml, std::string const& path,
Directory const& dir)
{
const char* slash = path.empty() ? "" : "/";
char const* slash = path.empty() ? "" : "/";
xml.StartElement("Directory");
xml.Element("Name", path);

View File

@@ -39,7 +39,7 @@ private:
std::map<std::string, Directory> Dirs;
std::string ComputeBranchFlag(std::string const& dir);
void LoadRevisions(std::string const& file, const char* branchFlag,
void LoadRevisions(std::string const& file, char const* branchFlag,
std::vector<Revision>& revisions);
void WriteXMLDirectory(cmXMLWriter& xml, std::string const& path,
Directory const& dir);

View File

@@ -51,7 +51,7 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments,
} else {
cmValue cmakeGeneratorName = mf.GetDefinition("CTEST_CMAKE_GENERATOR");
if (cmNonempty(cmakeGeneratorName)) {
const std::string& source_dir =
std::string const& source_dir =
this->CTest->GetCTestConfiguration("SourceDirectory");
if (source_dir.empty()) {
status.SetError(
@@ -61,8 +61,8 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments,
return nullptr;
}
const std::string cmlName = mf.GetSafeDefinition("CMAKE_LIST_FILE_NAME");
const std::string cmakelists_file = cmStrCat(
std::string const cmlName = mf.GetSafeDefinition("CMAKE_LIST_FILE_NAME");
std::string const cmakelists_file = cmStrCat(
source_dir, "/", cmlName.empty() ? "CMakeLists.txt" : cmlName);
if (!cmSystemTools::FileExists(cmakelists_file)) {
std::ostringstream e;

View File

@@ -361,7 +361,7 @@ int cmCTestCoverageHandler::ProcessHandler()
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet);
}
const std::string fullFileName = file.first;
std::string const fullFileName = file.first;
bool shouldIDoCoverage =
this->ShouldIDoCoverage(fullFileName, sourceDir, binaryDir);
if (!shouldIDoCoverage) {
@@ -392,10 +392,10 @@ int cmCTestCoverageHandler::ProcessHandler()
this->StartCoverageLogXML(covLogXML);
}
const std::string fileName = cmSystemTools::GetFilenameName(fullFileName);
const std::string shortFileName =
std::string const fileName = cmSystemTools::GetFilenameName(fullFileName);
std::string const shortFileName =
this->CTest->GetShortPathToFile(fullFileName);
const cmCTestCoverageHandlerContainer::SingleFileCoverageVector& fcov =
cmCTestCoverageHandlerContainer::SingleFileCoverageVector const& fcov =
file.second;
covLogXML.StartElement("File");
covLogXML.Attribute("Name", fileName);
@@ -609,7 +609,7 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile* mf)
# define fnc_prefix(s, t) cmHasPrefix(s, t)
#endif
static bool IsFileInDir(const std::string& infile, const std::string& indir)
static bool IsFileInDir(std::string const& infile, std::string const& indir)
{
std::string file = cmSystemTools::CollapseFullPath(infile);
std::string dir = cmSystemTools::CollapseFullPath(indir);
@@ -716,9 +716,9 @@ struct cmCTestCoverageHandlerLocale
cmSystemTools::UnsetEnv("LC_ALL");
}
}
cmCTestCoverageHandlerLocale(const cmCTestCoverageHandlerLocale&) = delete;
cmCTestCoverageHandlerLocale(cmCTestCoverageHandlerLocale const&) = delete;
cmCTestCoverageHandlerLocale& operator=(
const cmCTestCoverageHandlerLocale&) = delete;
cmCTestCoverageHandlerLocale const&) = delete;
std::string lc_all;
};
@@ -789,7 +789,7 @@ int cmCTestCoverageHandler::HandleDelphiCoverage(
return static_cast<int>(cont->TotalCoverage.size());
}
static std::string joinCommandLine(const std::vector<std::string>& args)
static std::string joinCommandLine(std::vector<std::string> const& args)
{
std::string ret;
@@ -946,7 +946,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
std::vector<std::string> covargs = basecovargs;
covargs.push_back(fileDir);
covargs.push_back(f);
const std::string command = joinCommandLine(covargs);
std::string const command = joinCommandLine(covargs);
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
command << std::endl, this->Quiet);
@@ -1306,7 +1306,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
std::vector<std::string> covargs =
cmSystemTools::ParseArguments(lcovExtraFlags);
covargs.insert(covargs.begin(), lcovCommand);
const std::string command = joinCommandLine(covargs);
std::string const command = joinCommandLine(covargs);
// In intel compiler we have to call codecov only once in each executable
// directory. It collects all *.dyn files to generate .dpi file.
@@ -1691,7 +1691,7 @@ std::string cmCTestCoverageHandler::FindFile(
// This is a header put on each marked up source file
namespace {
const char* bullseyeHelp[] = {
char const* bullseyeHelp[] = {
" Coverage produced by bullseye covbr tool: ",
" www.bullseye.com/help/ref_covbr.html",
" * An arrow --> indicates incomplete coverage.",
@@ -1838,7 +1838,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
}
int cmCTestCoverageHandler::RunBullseyeCommand(
cmCTestCoverageHandlerContainer* cont, const char* cmd, const char* arg,
cmCTestCoverageHandlerContainer* cont, char const* cmd, char const* arg,
std::string& outputFile)
{
std::string program = cmSystemTools::FindProgram(cmd);
@@ -2142,7 +2142,7 @@ void cmCTestCoverageHandler::LoadLabels()
}
}
void cmCTestCoverageHandler::LoadLabels(const char* dir)
void cmCTestCoverageHandler::LoadLabels(char const* dir)
{
LabelSet& dirLabels = this->TargetDirs[dir];
std::string fname = cmStrCat(dir, "/Labels.txt");

View File

@@ -100,7 +100,7 @@ private:
std::vector<std::string>& filesFullPath);
int RunBullseyeCommand(cmCTestCoverageHandlerContainer* cont,
const char* cmd, const char* arg,
char const* cmd, char const* arg,
std::string& outputFile);
bool ParseBullsEyeCovsrcLine(std::string const& inputLine,
std::string& sourceFile, int& functionsCalled,
@@ -139,7 +139,7 @@ private:
// Label reading and writing methods.
void LoadLabels();
void LoadLabels(const char* dir);
void LoadLabels(char const* dir);
void WriteXMLLabels(cmXMLWriter& xml, std::string const& source);
// Label-based filtering.

View File

@@ -15,8 +15,8 @@
#include "cmValue.h"
namespace {
const bool TLS_VERIFY_DEFAULT = true;
const int TLS_VERSION_DEFAULT = CURL_SSLVERSION_TLSv1_2;
bool const TLS_VERIFY_DEFAULT = true;
int const TLS_VERSION_DEFAULT = CURL_SSLVERSION_TLSv1_2;
}
cmCTestCurl::cmCTestCurl(cmCTest* ctest)
@@ -49,7 +49,7 @@ size_t curlWriteMemoryCallback(void* ptr, size_t size, size_t nmemb,
void* data)
{
int realsize = static_cast<int>(size * nmemb);
const char* chPtr = static_cast<char*>(ptr);
char const* chPtr = static_cast<char*>(ptr);
cm::append(*static_cast<std::vector<char>*>(data), chPtr, chPtr + realsize);
return realsize;
}

View File

@@ -26,8 +26,8 @@ class cmCTestCurl
public:
cmCTestCurl(cmCTest*);
~cmCTestCurl();
cmCTestCurl(const cmCTestCurl&) = delete;
cmCTestCurl& operator=(const cmCTestCurl&) = delete;
cmCTestCurl(cmCTestCurl const&) = delete;
cmCTestCurl& operator=(cmCTestCurl const&) = delete;
bool UploadFile(std::string const& local_file, std::string const& url,
std::string const& fields, std::string& response);
bool HttpRequest(std::string const& url, std::string const& fields,

View File

@@ -13,7 +13,7 @@
namespace {
// Try to remove the binary directory once
cmsys::Status TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath)
cmsys::Status TryToRemoveBinaryDirectoryOnce(std::string const& directoryPath)
{
cmsys::Directory directory;
directory.Load(directoryPath);
@@ -48,7 +48,7 @@ cmsys::Status TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath)
/*
* Empty Binary Directory
*/
bool EmptyBinaryDirectory(const std::string& sname, std::string& err)
bool EmptyBinaryDirectory(std::string const& sname, std::string& err)
{
// try to avoid deleting root
if (sname.size() < 2) {

View File

@@ -40,7 +40,7 @@ cmCTestGIT::~cmCTestGIT() = default;
class cmCTestGIT::OneLineParser : public cmCTestVC::LineParser
{
public:
OneLineParser(cmCTestGIT* git, const char* prefix, std::string& l)
OneLineParser(cmCTestGIT* git, char const* prefix, std::string& l)
: Line1(l)
{
this->SetLog(&git->Log, prefix);
@@ -326,7 +326,7 @@ unsigned int cmCTestGIT::GetGitVersion()
class cmCTestGIT::DiffParser : public cmCTestVC::LineParser
{
public:
DiffParser(cmCTestGIT* git, const char* prefix)
DiffParser(cmCTestGIT* git, char const* prefix)
: LineParser('\0', false)
, GIT(git)
{
@@ -366,16 +366,16 @@ protected:
this->DiffField = DiffFieldNone;
return true;
}
const char* src_mode_first = this->Line.c_str() + 1;
const char* src_mode_last = this->ConsumeField(src_mode_first);
const char* dst_mode_first = this->ConsumeSpace(src_mode_last);
const char* dst_mode_last = this->ConsumeField(dst_mode_first);
const char* src_sha1_first = this->ConsumeSpace(dst_mode_last);
const char* src_sha1_last = this->ConsumeField(src_sha1_first);
const char* dst_sha1_first = this->ConsumeSpace(src_sha1_last);
const char* dst_sha1_last = this->ConsumeField(dst_sha1_first);
const char* status_first = this->ConsumeSpace(dst_sha1_last);
const char* status_last = this->ConsumeField(status_first);
char const* src_mode_first = this->Line.c_str() + 1;
char const* src_mode_last = this->ConsumeField(src_mode_first);
char const* dst_mode_first = this->ConsumeSpace(src_mode_last);
char const* dst_mode_last = this->ConsumeField(dst_mode_first);
char const* src_sha1_first = this->ConsumeSpace(dst_mode_last);
char const* src_sha1_last = this->ConsumeField(src_sha1_first);
char const* dst_sha1_first = this->ConsumeSpace(src_sha1_last);
char const* dst_sha1_last = this->ConsumeField(dst_sha1_first);
char const* status_first = this->ConsumeSpace(dst_sha1_last);
char const* status_last = this->ConsumeField(status_first);
if (status_first != status_last) {
this->CurChange.Action = *status_first;
this->DiffField = DiffFieldSrc;
@@ -410,14 +410,14 @@ protected:
return true;
}
const char* ConsumeSpace(const char* c)
char const* ConsumeSpace(char const* c)
{
while (*c && cmIsSpace(*c)) {
++c;
}
return c;
}
const char* ConsumeField(const char* c)
char const* ConsumeField(char const* c)
{
while (*c && !cmIsSpace(*c)) {
++c;
@@ -448,7 +448,7 @@ protected:
class cmCTestGIT::CommitParser : public cmCTestGIT::DiffParser
{
public:
CommitParser(cmCTestGIT* git, const char* prefix)
CommitParser(cmCTestGIT* git, char const* prefix)
: DiffParser(git, prefix)
{
this->Separator = SectionSep[this->Section];
@@ -475,29 +475,29 @@ private:
long TimeZone = 0;
};
void ParsePerson(const char* str, Person& person)
void ParsePerson(char const* str, Person& person)
{
// Person Name <person@domain.com> 1234567890 +0000
const char* c = str;
char const* c = str;
while (*c && cmIsSpace(*c)) {
++c;
}
const char* name_first = c;
char const* name_first = c;
while (*c && *c != '<') {
++c;
}
const char* name_last = c;
char const* name_last = c;
while (name_last != name_first && cmIsSpace(*(name_last - 1))) {
--name_last;
}
person.Name.assign(name_first, name_last - name_first);
const char* email_first = *c ? ++c : c;
char const* email_first = *c ? ++c : c;
while (*c && *c != '>') {
++c;
}
const char* email_last = *c ? c++ : c;
char const* email_last = *c ? c++ : c;
person.EMail.assign(email_first, email_last - email_first);
person.Time = strtoul(c, const_cast<char**>(&c), 10);

View File

@@ -18,7 +18,7 @@ cmCTestGenericHandler::cmCTestGenericHandler(cmCTest* ctest)
cmCTestGenericHandler::~cmCTestGenericHandler() = default;
bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part,
const char* name,
char const* name,
cmGeneratedFileStream& xofs)
{
if (!name) {
@@ -54,7 +54,7 @@ bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part,
return true;
}
bool cmCTestGenericHandler::StartLogFile(const char* name,
bool cmCTestGenericHandler::StartLogFile(char const* name,
cmGeneratedFileStream& xofs)
{
if (!name) {

View File

@@ -66,9 +66,9 @@ public:
void SetCMakeInstance(cmake* cm) { this->CMake = cm; }
protected:
bool StartResultingXML(cmCTest::Part part, const char* name,
bool StartResultingXML(cmCTest::Part part, char const* name,
cmGeneratedFileStream& xofs);
bool StartLogFile(const char* name, cmGeneratedFileStream& xofs);
bool StartLogFile(char const* name, cmGeneratedFileStream& xofs);
bool AppendXML = false;
bool Quiet = false;

Some files were not shown because too many files have changed in this diff Show More