mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 14:19:59 -05:00
Merge topic 'clang-tidy'
b932cd42clang-tidy: apply misc-redundant-expression fixes88da3d68clang-tidy: apply misc-suspicious-string-compare fixes58c66393clang-tidy: apply readability-static-definition-in-anonymous-namespace fixes85bfdddaclang-tidy: apply readability-redundant-control-flow fixes2988abd9clang-tidy: apply modernize-use-bool-literals fixesa74e6893clang-tidy: apply readability-redundant-string-init fixescac529ddclang-tidy: apply performance-faster-string-find fixes7c9db8f8clang-tidy: apply performance-unnecessary-value-param fixes
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
Generator->Logger->Log(logType, __FILE__, __LINE__, \
|
||||
cmCPackLog_msg.str().c_str()); \
|
||||
} \
|
||||
} while (0)
|
||||
} while (false)
|
||||
|
||||
cmCPackIFWInstaller::cmCPackIFWInstaller()
|
||||
: Generator(CM_NULLPTR)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
Generator->Logger->Log(logType, __FILE__, __LINE__, \
|
||||
cmCPackLog_msg.str().c_str()); \
|
||||
} \
|
||||
} while (0)
|
||||
} while (false)
|
||||
|
||||
//---------------------------------------------------------- CompareStruct ---
|
||||
cmCPackIFWPackage::CompareStruct::CompareStruct()
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
Generator->Logger->Log(logType, __FILE__, __LINE__, \
|
||||
cmCPackLog_msg.str().c_str()); \
|
||||
} \
|
||||
} while (0)
|
||||
} while (false)
|
||||
|
||||
cmCPackIFWRepository::cmCPackIFWRepository()
|
||||
: Update(None)
|
||||
|
||||
@@ -30,7 +30,7 @@ class cmMakefile;
|
||||
cmCPackLog_msg << msg; \
|
||||
this->Logger->Log(logType, __FILE__, __LINE__, \
|
||||
cmCPackLog_msg.str().c_str()); \
|
||||
} while (0)
|
||||
} while (false)
|
||||
|
||||
/** \class cmCPackGenerator
|
||||
* \brief A superclass of all CPack Generators
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
std::ostringstream cmCPackLog_msg; \
|
||||
cmCPackLog_msg << msg; \
|
||||
(ctSelf)->Log(logType, __FILE__, __LINE__, cmCPackLog_msg.str().c_str()); \
|
||||
} while (0)
|
||||
} while (false)
|
||||
|
||||
/** \class cmCPackLog
|
||||
* \brief A container for CPack generators
|
||||
|
||||
@@ -597,13 +597,11 @@ bool cmCPackNSISGenerator::GetListOfSubdirectories(
|
||||
{
|
||||
cmsys::Directory dir;
|
||||
dir.Load(topdir);
|
||||
size_t fileNum;
|
||||
for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) {
|
||||
if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), ".") &&
|
||||
strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), "..")) {
|
||||
std::string fullPath = topdir;
|
||||
fullPath += "/";
|
||||
fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
|
||||
for (unsigned long i = 0; i < dir.GetNumberOfFiles(); ++i) {
|
||||
const char* fileName = dir.GetFile(i);
|
||||
if (strcmp(fileName, ".") != 0 && strcmp(fileName, "..") != 0) {
|
||||
std::string const fullPath =
|
||||
std::string(topdir).append("/").append(fileName);
|
||||
if (cmsys::SystemTools::FileIsDirectory(fullPath) &&
|
||||
!cmsys::SystemTools::FileIsSymlink(fullPath)) {
|
||||
if (!this->GetListOfSubdirectories(fullPath.c_str(), dirs)) {
|
||||
|
||||
@@ -948,7 +948,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length,
|
||||
this->BuildOutputLogSize += length;
|
||||
|
||||
// until there are any lines left in the buffer
|
||||
while (1) {
|
||||
while (true) {
|
||||
// Find the end of line
|
||||
t_BuildProcessingQueueType::iterator it;
|
||||
for (it = queue->begin(); it != queue->end(); ++it) {
|
||||
|
||||
@@ -977,7 +977,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||
|
||||
std::set<std::string> missingFiles;
|
||||
|
||||
std::string actualSourceFile = "";
|
||||
std::string actualSourceFile;
|
||||
cmCTestOptionalLog(
|
||||
this->CTest, HANDLER_OUTPUT,
|
||||
" Processing coverage (each . represents one file):" << std::endl,
|
||||
@@ -1006,8 +1006,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
|
||||
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||
command << std::endl, this->Quiet);
|
||||
|
||||
std::string output = "";
|
||||
std::string errors = "";
|
||||
std::string output;
|
||||
std::string errors;
|
||||
int retVal = 0;
|
||||
*cont->OFS << "* Run coverage for: " << fileDir << std::endl;
|
||||
*cont->OFS << " Command: " << command << std::endl;
|
||||
@@ -1344,7 +1344,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
|
||||
|
||||
std::set<std::string> missingFiles;
|
||||
|
||||
std::string actualSourceFile = "";
|
||||
std::string actualSourceFile;
|
||||
cmCTestOptionalLog(
|
||||
this->CTest, HANDLER_OUTPUT,
|
||||
" Processing coverage (each . represents one file):" << std::endl,
|
||||
@@ -1371,8 +1371,8 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
|
||||
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||
command << std::endl, this->Quiet);
|
||||
|
||||
std::string output = "";
|
||||
std::string errors = "";
|
||||
std::string output;
|
||||
std::string errors;
|
||||
int retVal = 0;
|
||||
*cont->OFS << "* Run coverage for: " << fileDir << std::endl;
|
||||
*cont->OFS << " Command: " << command << std::endl;
|
||||
|
||||
@@ -38,8 +38,8 @@ std::string cmCTestCurl::Escape(std::string const& source)
|
||||
}
|
||||
|
||||
namespace {
|
||||
static size_t curlWriteMemoryCallback(void* ptr, size_t size, size_t nmemb,
|
||||
void* data)
|
||||
size_t curlWriteMemoryCallback(void* ptr, size_t size, size_t nmemb,
|
||||
void* data)
|
||||
{
|
||||
int realsize = (int)(size * nmemb);
|
||||
|
||||
@@ -49,8 +49,8 @@ static size_t curlWriteMemoryCallback(void* ptr, size_t size, size_t nmemb,
|
||||
return realsize;
|
||||
}
|
||||
|
||||
static size_t curlDebugCallback(CURL* /*unused*/, curl_infotype /*unused*/,
|
||||
char* chPtr, size_t size, void* data)
|
||||
size_t curlDebugCallback(CURL* /*unused*/, curl_infotype /*unused*/,
|
||||
char* chPtr, size_t size, void* data)
|
||||
{
|
||||
std::vector<char>* vec = static_cast<std::vector<char>*>(data);
|
||||
vec->insert(vec->end(), chPtr, chPtr + size);
|
||||
|
||||
@@ -256,7 +256,7 @@ void cmCTestMultiProcessHandler::StartNextTests()
|
||||
bool allTestsFailedTestLoadCheck = false;
|
||||
bool usedFakeLoadForTesting = false;
|
||||
size_t minProcessorsRequired = this->ParallelLevel;
|
||||
std::string testWithMinProcessors = "";
|
||||
std::string testWithMinProcessors;
|
||||
|
||||
cmsys::SystemInformation info;
|
||||
|
||||
|
||||
@@ -119,10 +119,9 @@ void cmCTestRunTest::CompressOutput()
|
||||
strm.next_out = out;
|
||||
ret = deflate(&strm, Z_FINISH);
|
||||
|
||||
if (ret == Z_STREAM_ERROR || ret != Z_STREAM_END) {
|
||||
if (ret != Z_STREAM_END) {
|
||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||
"Error during output "
|
||||
"compression. Sending uncompressed output."
|
||||
"Error during output compression. Sending uncompressed output."
|
||||
<< std::endl);
|
||||
delete[] out;
|
||||
return;
|
||||
|
||||
@@ -388,7 +388,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
|
||||
*this->LogFile << "\tUpload file: " << local_file << " to "
|
||||
<< remote_file << std::endl;
|
||||
|
||||
std::string ofile = "";
|
||||
std::string ofile;
|
||||
for (kk = 0; kk < remote_file.size(); kk++) {
|
||||
char c = remote_file[kk];
|
||||
char hexCh[4] = { 0, 0, 0, 0 };
|
||||
@@ -582,7 +582,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
|
||||
void cmCTestSubmitHandler::ParseResponse(
|
||||
cmCTestSubmitHandlerVectorOfChar chunk)
|
||||
{
|
||||
std::string output = "";
|
||||
std::string output;
|
||||
output.append(chunk.begin(), chunk.end());
|
||||
|
||||
if (output.find("<cdash") != output.npos) {
|
||||
@@ -662,7 +662,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<std::string>& files,
|
||||
::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void*)&chunkDebug);
|
||||
|
||||
std::string rfile = remoteprefix + cmSystemTools::GetFilenameName(*file);
|
||||
std::string ofile = "";
|
||||
std::string ofile;
|
||||
std::string::iterator kk;
|
||||
for (kk = rfile.begin(); kk < rfile.end(); ++kk) {
|
||||
char c = *kk;
|
||||
@@ -748,7 +748,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command,
|
||||
{
|
||||
if (scp_command.empty() || localprefix.empty() || files.empty() ||
|
||||
remoteprefix.empty() || url.empty()) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<const char*> argv;
|
||||
@@ -852,7 +852,7 @@ bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix,
|
||||
<< "\tremoteprefix: " << remoteprefix << "\n"
|
||||
<< "\tdestination: " << destination << std::endl);
|
||||
/* clang-format on */
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
cmCTest::SetOfStrings::const_iterator file;
|
||||
|
||||
@@ -718,7 +718,7 @@ void cmCTestTestHandler::ComputeTestList()
|
||||
// Now create a final list of tests to run
|
||||
int cnt = 0;
|
||||
inREcnt = 0;
|
||||
std::string last_directory = "";
|
||||
std::string last_directory;
|
||||
ListOfTests finalList;
|
||||
for (it = this->TestList.begin(); it != this->TestList.end(); it++) {
|
||||
cnt++;
|
||||
@@ -1649,7 +1649,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
|
||||
int numFiles =
|
||||
static_cast<int>(cmsys::Directory::GetNumberOfFilesInDirectory(dirName));
|
||||
std::string pattern = "LastTestsFailed";
|
||||
std::string logName = "";
|
||||
std::string logName;
|
||||
|
||||
for (int i = 0; i < numFiles; ++i) {
|
||||
std::string fileName = directory.GetFile(i);
|
||||
|
||||
@@ -54,7 +54,7 @@ protected:
|
||||
void StartElement(const std::string& name, const char** atts) CM_OVERRIDE
|
||||
{
|
||||
std::string FoundSource;
|
||||
std::string finalpath = "";
|
||||
std::string finalpath;
|
||||
if (name == "source") {
|
||||
this->InSource = true;
|
||||
} else if (name == "sources") {
|
||||
|
||||
@@ -52,8 +52,7 @@ void onsig(int /*unused*/)
|
||||
initscr(); /* Initialization */
|
||||
noecho(); /* Echo off */
|
||||
cbreak(); /* nl- or cr not needed */
|
||||
keypad(stdscr, TRUE); /* Use key symbols as
|
||||
KEY_DOWN*/
|
||||
keypad(stdscr, true); /* Use key symbols as KEY_DOWN */
|
||||
refresh();
|
||||
int x, y;
|
||||
getmaxyx(stdscr, y, x);
|
||||
@@ -128,8 +127,7 @@ int main(int argc, char const* const* argv)
|
||||
initscr(); /* Initialization */
|
||||
noecho(); /* Echo off */
|
||||
cbreak(); /* nl- or cr not needed */
|
||||
keypad(stdscr, TRUE); /* Use key symbols as
|
||||
KEY_DOWN*/
|
||||
keypad(stdscr, true); /* Use key symbols as KEY_DOWN */
|
||||
|
||||
signal(SIGWINCH, onsig);
|
||||
|
||||
|
||||
@@ -576,8 +576,7 @@ int cmCursesMainForm::Configure(int noconfigure)
|
||||
}
|
||||
this->CMakeInstance->SetProgressCallback(CM_NULLPTR, CM_NULLPTR);
|
||||
|
||||
keypad(stdscr, TRUE); /* Use key symbols as
|
||||
KEY_DOWN*/
|
||||
keypad(stdscr, true); /* Use key symbols as KEY_DOWN */
|
||||
|
||||
if (retVal != 0 || !this->Errors.empty()) {
|
||||
// see if there was an error
|
||||
@@ -630,8 +629,7 @@ int cmCursesMainForm::Generate()
|
||||
int retVal = this->CMakeInstance->Generate();
|
||||
|
||||
this->CMakeInstance->SetProgressCallback(CM_NULLPTR, CM_NULLPTR);
|
||||
keypad(stdscr, TRUE); /* Use key symbols as
|
||||
KEY_DOWN*/
|
||||
keypad(stdscr, true); /* Use key symbols as KEY_DOWN */
|
||||
|
||||
if (retVal != 0 || !this->Errors.empty()) {
|
||||
// see if there was an error
|
||||
|
||||
@@ -28,9 +28,9 @@ void cmCursesWidget::Move(int x, int y, bool isNewPage)
|
||||
|
||||
move_field(this->Field, y, x);
|
||||
if (isNewPage) {
|
||||
set_new_page(this->Field, TRUE);
|
||||
set_new_page(this->Field, true);
|
||||
} else {
|
||||
set_new_page(this->Field, FALSE);
|
||||
set_new_page(this->Field, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ bool cmAddCustomTargetCommand::InitialPass(
|
||||
bool nameOk = cmGeneratorExpression::IsValidTargetName(targetName) &&
|
||||
!cmGlobalGenerator::IsReservedTarget(targetName);
|
||||
if (nameOk) {
|
||||
nameOk = targetName.find(":") == std::string::npos;
|
||||
nameOk = targetName.find(':') == std::string::npos;
|
||||
}
|
||||
if (!nameOk) {
|
||||
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
|
||||
|
||||
@@ -61,7 +61,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
|
||||
!cmGlobalGenerator::IsReservedTarget(exename);
|
||||
|
||||
if (nameOk && !importTarget && !isAlias) {
|
||||
nameOk = exename.find(":") == std::string::npos;
|
||||
nameOk = exename.find(':') == std::string::npos;
|
||||
}
|
||||
if (!nameOk) {
|
||||
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
|
||||
|
||||
@@ -173,7 +173,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
|
||||
!cmGlobalGenerator::IsReservedTarget(libName);
|
||||
|
||||
if (nameOk && !importTarget && !isAlias) {
|
||||
nameOk = libName.find(":") == std::string::npos;
|
||||
nameOk = libName.find(':') == std::string::npos;
|
||||
}
|
||||
if (!nameOk) {
|
||||
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
|
||||
|
||||
@@ -242,7 +242,7 @@ std::string cmJoin(Range const& r, const char* delimiter)
|
||||
}
|
||||
|
||||
template <typename Range>
|
||||
std::string cmJoin(Range const& r, std::string delimiter)
|
||||
std::string cmJoin(Range const& r, std::string const& delimiter)
|
||||
{
|
||||
return cmJoin(r, delimiter.c_str());
|
||||
}
|
||||
@@ -344,13 +344,13 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r)
|
||||
}
|
||||
|
||||
template <typename Range>
|
||||
std::string cmWrap(std::string prefix, Range const& r, std::string suffix,
|
||||
std::string sep)
|
||||
std::string cmWrap(std::string const& prefix, Range const& r,
|
||||
std::string const& suffix, std::string const& sep)
|
||||
{
|
||||
if (r.empty()) {
|
||||
return std::string();
|
||||
}
|
||||
return prefix + cmJoin(r, (suffix + sep + prefix).c_str()) + suffix;
|
||||
return prefix + cmJoin(r, suffix + sep + prefix) + suffix;
|
||||
}
|
||||
|
||||
template <typename Range>
|
||||
|
||||
@@ -49,7 +49,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
|
||||
for (size_t i = 0; i < numfiles; ++i) {
|
||||
std::string file = dir.GetFile(static_cast<unsigned long>(i));
|
||||
// Split the filename into base and extension
|
||||
std::string::size_type dotpos = file.rfind(".");
|
||||
std::string::size_type dotpos = file.rfind('.');
|
||||
if (dotpos != std::string::npos) {
|
||||
std::string ext = file.substr(dotpos + 1);
|
||||
std::string base = file.substr(0, dotpos);
|
||||
|
||||
@@ -733,7 +733,6 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir,
|
||||
e << " ." << *ext;
|
||||
}
|
||||
cmSystemTools::Error(e.str().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir,
|
||||
|
||||
+3
-3
@@ -1509,7 +1509,7 @@ bool cmCTest::SubmitExtraFiles(const VectorOfStrings& files)
|
||||
bool cmCTest::SubmitExtraFiles(const char* cfiles)
|
||||
{
|
||||
if (!cfiles) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
VectorOfStrings files;
|
||||
@@ -1518,7 +1518,7 @@ bool cmCTest::SubmitExtraFiles(const char* cfiles)
|
||||
|
||||
files = cmSystemTools::SplitString(cfiles, ';');
|
||||
if (files.empty()) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return this->SubmitExtraFiles(files);
|
||||
@@ -2787,7 +2787,7 @@ bool cmCTest::CompressString(std::string& str)
|
||||
strm.next_out = &out[0];
|
||||
ret = deflate(&strm, Z_FINISH);
|
||||
|
||||
if (ret == Z_STREAM_ERROR || ret != Z_STREAM_END) {
|
||||
if (ret != Z_STREAM_END) {
|
||||
cmCTestLog(this, ERROR_MESSAGE, "Error during gzip compression."
|
||||
<< std::endl);
|
||||
return false;
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@ class cmXMLWriter;
|
||||
cmCTestLog_msg << msg; \
|
||||
(ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__, \
|
||||
cmCTestLog_msg.str().c_str()); \
|
||||
} while (0)
|
||||
} while (false)
|
||||
|
||||
#define cmCTestOptionalLog(ctSelf, logType, msg, suppress) \
|
||||
do { \
|
||||
@@ -35,7 +35,7 @@ class cmXMLWriter;
|
||||
cmCTestLog_msg << msg; \
|
||||
(ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__, \
|
||||
cmCTestLog_msg.str().c_str(), suppress); \
|
||||
} while (0)
|
||||
} while (false)
|
||||
|
||||
/** \class cmCTest
|
||||
* \brief Represents a ctest invocation.
|
||||
@@ -242,7 +242,7 @@ public:
|
||||
|
||||
/** Used for parallel ctest job scheduling */
|
||||
std::string GetScheduleType() { return this->ScheduleType; }
|
||||
void SetScheduleType(std::string type) { this->ScheduleType = type; }
|
||||
void SetScheduleType(std::string const& type) { this->ScheduleType = type; }
|
||||
|
||||
/** The max output width */
|
||||
int GetMaxTestNameWidth() const;
|
||||
|
||||
@@ -806,18 +806,13 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir)
|
||||
|
||||
cmsys::Directory dir;
|
||||
dir.Load(binDir);
|
||||
size_t fileNum;
|
||||
std::set<std::string> deletedFiles;
|
||||
for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) {
|
||||
if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), ".") &&
|
||||
strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), "..")) {
|
||||
|
||||
if (deletedFiles.find(dir.GetFile(
|
||||
static_cast<unsigned long>(fileNum))) == deletedFiles.end()) {
|
||||
deletedFiles.insert(dir.GetFile(static_cast<unsigned long>(fileNum)));
|
||||
std::string fullPath = binDir;
|
||||
fullPath += "/";
|
||||
fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
|
||||
for (unsigned long i = 0; i < dir.GetNumberOfFiles(); ++i) {
|
||||
const char* fileName = dir.GetFile(i);
|
||||
if (strcmp(fileName, ".") != 0 && strcmp(fileName, "..") != 0) {
|
||||
if (deletedFiles.insert(fileName).second) {
|
||||
std::string const fullPath =
|
||||
std::string(binDir).append("/").append(fileName);
|
||||
if (cmSystemTools::FileIsDirectory(fullPath)) {
|
||||
this->CleanupFiles(fullPath.c_str());
|
||||
cmSystemTools::RemoveADirectory(fullPath);
|
||||
@@ -901,5 +896,4 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName,
|
||||
emsg << cmWrap(" " + this->BinaryDirectory, searchDirs, tmpOutputFile, "\n")
|
||||
<< "\n";
|
||||
this->FindErrorMessage = emsg.str();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ cmDependsJavaParserHelper::~cmDependsJavaParserHelper()
|
||||
void cmDependsJavaParserHelper::CurrentClass::AddFileNamesForPrinting(
|
||||
std::vector<std::string>* files, const char* prefix, const char* sep) const
|
||||
{
|
||||
std::string rname = "";
|
||||
std::string rname;
|
||||
if (prefix) {
|
||||
rname += prefix;
|
||||
rname += sep;
|
||||
@@ -341,7 +341,7 @@ int cmDependsJavaParserHelper::ParseFile(const char* file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string fullfile = "";
|
||||
std::string fullfile;
|
||||
std::string line;
|
||||
while (cmSystemTools::GetLineFromStream(ifs, line)) {
|
||||
fullfile += line + "\n";
|
||||
|
||||
@@ -156,7 +156,7 @@ void cmDocumentationFormatter::PrintColumn(std::ostream& os, const char* text)
|
||||
|
||||
// Move to beginning of next word. Skip over whitespace.
|
||||
l = r;
|
||||
while (*l && (*l == ' ')) {
|
||||
while (*l == ' ') {
|
||||
++l;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
|
||||
const cmGeneratorTarget* target, std::ostream& os,
|
||||
const ImportPropertyMap& properties)
|
||||
{
|
||||
std::string config = "";
|
||||
std::string config;
|
||||
if (!this->Configurations.empty()) {
|
||||
config = this->Configurations[0];
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode(
|
||||
os << targetName << "\n";
|
||||
os << "LOCAL_SRC_FILES := $(_IMPORT_PREFIX)/";
|
||||
os << target->Target->GetProperty("__dest") << "/";
|
||||
std::string config = "";
|
||||
std::string config;
|
||||
if (!this->Configurations.empty()) {
|
||||
config = this->Configurations[0];
|
||||
}
|
||||
@@ -94,7 +94,7 @@ void cmExportInstallAndroidMKGenerator::GenerateInterfaceProperties(
|
||||
cmGeneratorTarget const* target, std::ostream& os,
|
||||
const ImportPropertyMap& properties)
|
||||
{
|
||||
std::string config = "";
|
||||
std::string config;
|
||||
if (!this->Configurations.empty()) {
|
||||
config = this->Configurations[0];
|
||||
}
|
||||
|
||||
@@ -180,5 +180,4 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
|
||||
}
|
||||
}
|
||||
fout << "endif()\n";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,6 @@ void Tree::InsertPath(const std::vector<std::string>& splitted,
|
||||
// last part of splitted
|
||||
newFolder.files.push_back(fileName);
|
||||
folders.push_back(newFolder);
|
||||
return;
|
||||
}
|
||||
|
||||
void Tree::BuildVirtualFolder(cmXMLWriter& xml) const
|
||||
|
||||
@@ -172,7 +172,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
|
||||
cmGeneratedFileStream& fout, MapSourceFileFlags& sourceFileFlags)
|
||||
{
|
||||
std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
|
||||
std::string compiler = "";
|
||||
std::string compiler;
|
||||
if (!lgs.empty()) {
|
||||
this->AppendTarget(fout, "all", lgs[0], CM_NULLPTR, make.c_str(), mf,
|
||||
compiler.c_str(), sourceFileFlags, true);
|
||||
|
||||
@@ -71,7 +71,7 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
|
||||
commandLines.push_back(commandLine);
|
||||
|
||||
// Add command for generating the .h and .cxx files
|
||||
std::string no_main_dependency = "";
|
||||
std::string no_main_dependency;
|
||||
const char* no_comment = CM_NULLPTR;
|
||||
const char* no_working_dir = CM_NULLPTR;
|
||||
this->Makefile->AddCustomCommandToOutput(
|
||||
|
||||
@@ -768,7 +768,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
|
||||
}
|
||||
}
|
||||
|
||||
std::string output = "";
|
||||
std::string output;
|
||||
bool first = true;
|
||||
for (; i != args.end(); ++i) {
|
||||
if (*i == "LIST_DIRECTORIES") {
|
||||
@@ -2343,9 +2343,8 @@ size_t cmWriteToMemoryCallback(void* ptr, size_t size, size_t nmemb,
|
||||
return realsize;
|
||||
}
|
||||
|
||||
static size_t cmFileCommandCurlDebugCallback(CURL*, curl_infotype type,
|
||||
char* chPtr, size_t size,
|
||||
void* data)
|
||||
size_t cmFileCommandCurlDebugCallback(CURL*, curl_infotype type, char* chPtr,
|
||||
size_t size, void* data)
|
||||
{
|
||||
cmFileCommandVectorOfChar* vec =
|
||||
static_cast<cmFileCommandVectorOfChar*>(data);
|
||||
@@ -2414,9 +2413,8 @@ private:
|
||||
std::string Text;
|
||||
};
|
||||
|
||||
static int cmFileDownloadProgressCallback(void* clientp, double dltotal,
|
||||
double dlnow, double ultotal,
|
||||
double ulnow)
|
||||
int cmFileDownloadProgressCallback(void* clientp, double dltotal, double dlnow,
|
||||
double ultotal, double ulnow)
|
||||
{
|
||||
cURLProgressHelper* helper = reinterpret_cast<cURLProgressHelper*>(clientp);
|
||||
|
||||
@@ -2433,9 +2431,8 @@ static int cmFileDownloadProgressCallback(void* clientp, double dltotal,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmFileUploadProgressCallback(void* clientp, double dltotal,
|
||||
double dlnow, double ultotal,
|
||||
double ulnow)
|
||||
int cmFileUploadProgressCallback(void* clientp, double dltotal, double dlnow,
|
||||
double ultotal, double ulnow)
|
||||
{
|
||||
cURLProgressHelper* helper = reinterpret_cast<cURLProgressHelper*>(clientp);
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file,
|
||||
{
|
||||
std::string fileName = file;
|
||||
std::string frameWorkName;
|
||||
std::string::size_type pos = fileName.find("/");
|
||||
std::string::size_type pos = fileName.find('/');
|
||||
// if there is a / in the name try to find the header as a framework
|
||||
// For example bar/foo.h would look for:
|
||||
// bar.framework/Headers/foo.h
|
||||
@@ -83,7 +83,7 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file,
|
||||
frameWorkName =
|
||||
frameWorkName.substr(0, frameWorkName.size() - fileName.size() - 1);
|
||||
// if the framework has a path in it then just use the filename
|
||||
if (frameWorkName.find("/") != frameWorkName.npos) {
|
||||
if (frameWorkName.find('/') != frameWorkName.npos) {
|
||||
fileName = file;
|
||||
frameWorkName = "";
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn,
|
||||
|
||||
std::string cmFindProgramCommand::FindProgram()
|
||||
{
|
||||
std::string program = "";
|
||||
std::string program;
|
||||
|
||||
if (this->SearchAppBundleFirst || this->SearchAppBundleOnly) {
|
||||
program = FindAppBundle();
|
||||
@@ -214,7 +214,7 @@ std::string cmFindProgramCommand::FindAppBundle()
|
||||
|
||||
std::string cmFindProgramCommand::GetBundleExecutable(std::string bundlePath)
|
||||
{
|
||||
std::string executable = "";
|
||||
std::string executable;
|
||||
(void)bundlePath;
|
||||
#if defined(__APPLE__)
|
||||
// Started with an example on developer.apple.com about finding bundles
|
||||
|
||||
@@ -52,7 +52,7 @@ cmFortranParser_s::cmFortranParser_s(std::vector<std::string> const& includes,
|
||||
, PPDefinitions(defines)
|
||||
, Info(info)
|
||||
{
|
||||
this->InInterface = 0;
|
||||
this->InInterface = false;
|
||||
this->InPPFalseBranch = 0;
|
||||
|
||||
// Initialize the lexical scanner.
|
||||
@@ -83,9 +83,9 @@ bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname)
|
||||
cmFortran_yy_create_buffer(CM_NULLPTR, 16384, parser->Scanner);
|
||||
cmFortran_yy_switch_to_buffer(buffer, parser->Scanner);
|
||||
parser->FileStack.push(f);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cmFortranParser_FilePop(cmFortranParser* parser)
|
||||
@@ -93,7 +93,7 @@ bool cmFortranParser_FilePop(cmFortranParser* parser)
|
||||
// Pop one file off the stack and close it. Switch the lexer back
|
||||
// to the next one on the stack.
|
||||
if (parser->FileStack.empty()) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
cmFortranFile f = parser->FileStack.top();
|
||||
parser->FileStack.pop();
|
||||
@@ -101,7 +101,7 @@ bool cmFortranParser_FilePop(cmFortranParser* parser)
|
||||
YY_BUFFER_STATE current = cmFortranLexer_GetCurrentBuffer(parser->Scanner);
|
||||
cmFortran_yy_delete_buffer(current, parser->Scanner);
|
||||
cmFortran_yy_switch_to_buffer(f.Buffer, parser->Scanner);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
int cmFortranParser_Input(cmFortranParser* parser, char* buffer,
|
||||
|
||||
@@ -351,7 +351,8 @@ std::string cmGeneratorExpression::Preprocess(const std::string& input,
|
||||
return stripExportInterface(input, context, resolveRelative);
|
||||
}
|
||||
|
||||
assert(0 && "cmGeneratorExpression::Preprocess called with invalid args");
|
||||
assert(false &&
|
||||
"cmGeneratorExpression::Preprocess called with invalid args");
|
||||
return std::string();
|
||||
}
|
||||
|
||||
|
||||
@@ -65,13 +65,15 @@ private:
|
||||
struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator
|
||||
{
|
||||
GeneratorExpressionContent(const char* startContent, size_t length);
|
||||
void SetIdentifier(std::vector<cmGeneratorExpressionEvaluator*> identifier)
|
||||
void SetIdentifier(
|
||||
std::vector<cmGeneratorExpressionEvaluator*> const& identifier)
|
||||
{
|
||||
this->IdentifierChildren = identifier;
|
||||
}
|
||||
|
||||
void SetParameters(
|
||||
std::vector<std::vector<cmGeneratorExpressionEvaluator*> > parameters)
|
||||
std::vector<std::vector<cmGeneratorExpressionEvaluator*> > const&
|
||||
parameters)
|
||||
{
|
||||
this->ParamChildren = parameters;
|
||||
}
|
||||
|
||||
@@ -1377,7 +1377,7 @@ cmPolicies::PolicyStatus statusForTarget(cmGeneratorTarget const* tgt,
|
||||
|
||||
#undef RETURN_POLICY
|
||||
|
||||
assert(0 && "Unreachable code. Not a valid policy");
|
||||
assert(false && "Unreachable code. Not a valid policy");
|
||||
return cmPolicies::WARN;
|
||||
}
|
||||
|
||||
@@ -1392,7 +1392,7 @@ cmPolicies::PolicyID policyForString(const char* policy_id)
|
||||
|
||||
#undef RETURN_POLICY_ID
|
||||
|
||||
assert(0 && "Unreachable code. Not a valid policy");
|
||||
assert(false && "Unreachable code. Not a valid policy");
|
||||
return cmPolicies::CMP0002;
|
||||
}
|
||||
|
||||
|
||||
@@ -242,11 +242,11 @@ void cmGeneratorExpressionParser::ParseContent(
|
||||
if (this->NestingLevel == 0) {
|
||||
extendText(result, this->it);
|
||||
} else {
|
||||
assert(0 && "Got unexpected syntax token.");
|
||||
assert(false && "Got unexpected syntax token.");
|
||||
}
|
||||
assert(this->it != this->Tokens.end());
|
||||
++this->it;
|
||||
return;
|
||||
}
|
||||
assert(0 && "Unhandled token in generator expression.");
|
||||
assert(false && "Unhandled token in generator expression.");
|
||||
}
|
||||
|
||||
@@ -3389,7 +3389,8 @@ const char* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
|
||||
{
|
||||
switch (t) {
|
||||
case BoolType:
|
||||
assert(0 && "String compatibility check function called for boolean");
|
||||
assert(false &&
|
||||
"String compatibility check function called for boolean");
|
||||
return CM_NULLPTR;
|
||||
case StringType:
|
||||
return tgt->GetLinkInterfaceDependentStringProperty(prop, config);
|
||||
@@ -3398,7 +3399,7 @@ const char* getLinkInterfaceDependentProperty(cmGeneratorTarget const* tgt,
|
||||
case NumberMaxType:
|
||||
return tgt->GetLinkInterfaceDependentNumberMaxProperty(prop, config);
|
||||
}
|
||||
assert(0 && "Unreachable!");
|
||||
assert(false && "Unreachable!");
|
||||
return CM_NULLPTR;
|
||||
}
|
||||
|
||||
@@ -3589,7 +3590,7 @@ std::string compatibilityType(CompatibleType t)
|
||||
case NumberMinType:
|
||||
return "Numeric minimum compatibility";
|
||||
}
|
||||
assert(0 && "Unreachable!");
|
||||
assert(false && "Unreachable!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -3603,7 +3604,7 @@ std::string compatibilityAgree(CompatibleType t, bool dominant)
|
||||
case NumberMinType:
|
||||
return dominant ? "(Dominant)\n" : "(Ignored)\n";
|
||||
}
|
||||
assert(0 && "Unreachable!");
|
||||
assert(false && "Unreachable!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -3713,7 +3714,7 @@ std::pair<bool, const char*> consistentProperty(const char* lhs,
|
||||
|
||||
switch (t) {
|
||||
case BoolType:
|
||||
assert(0 && "consistentProperty for strings called with BoolType");
|
||||
assert(false && "consistentProperty for strings called with BoolType");
|
||||
return std::pair<bool, const char*>(false, null_ptr);
|
||||
case StringType:
|
||||
return consistentStringProperty(lhs, rhs);
|
||||
@@ -3721,7 +3722,7 @@ std::pair<bool, const char*> consistentProperty(const char* lhs,
|
||||
case NumberMaxType:
|
||||
return consistentNumberProperty(lhs, rhs, t);
|
||||
}
|
||||
assert(0 && "Unreachable!");
|
||||
assert(false && "Unreachable!");
|
||||
return std::pair<bool, const char*>(false, null_ptr);
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
|
||||
case cmStateEnums::INTERFACE_LIBRARY:
|
||||
// Not reachable. We never create a cmInstallTargetGenerator for
|
||||
// an INTERFACE_LIBRARY.
|
||||
assert(0 && "INTERFACE_LIBRARY targets have no installable outputs.");
|
||||
assert(false &&
|
||||
"INTERFACE_LIBRARY targets have no installable outputs.");
|
||||
break;
|
||||
case cmStateEnums::OBJECT_LIBRARY:
|
||||
case cmStateEnums::UTILITY:
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
void AppendDefines(std::set<std::string>& defines,
|
||||
const char* defines_list) const;
|
||||
void AppendDefines(std::set<std::string>& defines,
|
||||
std::string defines_list) const
|
||||
std::string const& defines_list) const
|
||||
{
|
||||
this->AppendDefines(defines, defines_list.c_str());
|
||||
}
|
||||
|
||||
@@ -961,7 +961,7 @@ void cmMakefile::AddCustomCommandOldStyle(
|
||||
commandLines, comment, CM_NULLPTR);
|
||||
} else {
|
||||
// The source may not be a real file. Do not use a main dependency.
|
||||
std::string no_main_dependency = "";
|
||||
std::string no_main_dependency;
|
||||
std::vector<std::string> depends2 = depends;
|
||||
depends2.push_back(source);
|
||||
sf = this->AddCustomCommandToOutput(output, depends2, no_main_dependency,
|
||||
@@ -1051,7 +1051,7 @@ cmTarget* cmMakefile::AddUtilityCommand(
|
||||
force += utilityName;
|
||||
std::vector<std::string> forced;
|
||||
forced.push_back(force);
|
||||
std::string no_main_dependency = "";
|
||||
std::string no_main_dependency;
|
||||
bool no_replace = false;
|
||||
this->AddCustomCommandToOutput(
|
||||
forced, byproducts, depends, no_main_dependency, commandLines, comment,
|
||||
|
||||
@@ -538,7 +538,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
|
||||
case cmStateEnums::EXECUTABLE:
|
||||
break;
|
||||
default:
|
||||
assert(0 && "Unexpected target type");
|
||||
assert(false && "Unexpected target type");
|
||||
}
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
|
||||
this->GetMakefile()->GetRequiredDefinition(ppVar);
|
||||
|
||||
// Explicit preprocessing always uses a depfile.
|
||||
std::string const ppDeptype = ""; // no deps= for multiple outputs
|
||||
std::string const ppDeptype; // no deps= for multiple outputs
|
||||
std::string const ppDepfile = "$DEP_FILE";
|
||||
|
||||
cmRulePlaceholderExpander::RuleVariables ppVars;
|
||||
|
||||
@@ -9,7 +9,8 @@ unsigned int cmProcessOutput::defaultCodepage =
|
||||
KWSYS_ENCODING_DEFAULT_CODEPAGE;
|
||||
#endif
|
||||
|
||||
cmProcessOutput::Encoding cmProcessOutput::FindEncoding(std::string name)
|
||||
cmProcessOutput::Encoding cmProcessOutput::FindEncoding(
|
||||
std::string const& name)
|
||||
{
|
||||
Encoding encoding = Auto;
|
||||
if (name == "UTF8") {
|
||||
@@ -54,9 +55,13 @@ cmProcessOutput::~cmProcessOutput()
|
||||
bool cmProcessOutput::DecodeText(std::string raw, std::string& decoded,
|
||||
size_t id)
|
||||
{
|
||||
#if !defined(_WIN32)
|
||||
static_cast<void>(id);
|
||||
decoded.swap(raw);
|
||||
return true;
|
||||
#else
|
||||
bool success = true;
|
||||
decoded = raw;
|
||||
#if defined(_WIN32)
|
||||
if (id > 0) {
|
||||
if (rawparts.size() < id) {
|
||||
rawparts.reserve(id);
|
||||
@@ -113,10 +118,8 @@ bool cmProcessOutput::DecodeText(std::string raw, std::string& decoded,
|
||||
success = DoDecodeText(raw, decoded, NULL);
|
||||
}
|
||||
}
|
||||
#else
|
||||
static_cast<void>(id);
|
||||
#endif
|
||||
return success;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool cmProcessOutput::DecodeText(const char* data, size_t length,
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
* \param name a encoding name.
|
||||
* \return encoding enum value or Auto if \a name was not found.
|
||||
*/
|
||||
static Encoding FindEncoding(std::string name);
|
||||
static Encoding FindEncoding(std::string const& name);
|
||||
|
||||
/// The code page that is used as internal encoding to which we will encode.
|
||||
static unsigned int defaultCodepage;
|
||||
|
||||
@@ -77,7 +77,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args,
|
||||
depends.push_back(moc_exe);
|
||||
depends.push_back(hname);
|
||||
|
||||
std::string no_main_dependency = "";
|
||||
std::string no_main_dependency;
|
||||
const char* no_working_dir = CM_NULLPTR;
|
||||
this->Makefile->AddCustomCommandToOutput(
|
||||
newName, depends, no_main_dependency, commandLines, "Qt Wrapped File",
|
||||
|
||||
@@ -108,7 +108,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args,
|
||||
|
||||
std::vector<std::string> depends;
|
||||
depends.push_back(uiName);
|
||||
std::string no_main_dependency = "";
|
||||
std::string no_main_dependency;
|
||||
const char* no_comment = CM_NULLPTR;
|
||||
const char* no_working_dir = CM_NULLPTR;
|
||||
this->Makefile->AddCustomCommandToOutput(
|
||||
|
||||
@@ -110,7 +110,7 @@ cmQtAutoGenerators::cmQtAutoGenerators()
|
||||
, GenerateAll(false)
|
||||
{
|
||||
|
||||
std::string colorEnv = "";
|
||||
std::string colorEnv;
|
||||
cmsys::SystemTools::GetEnv("COLOR", colorEnv);
|
||||
if (!colorEnv.empty()) {
|
||||
if (cmSystemTools::IsOn(colorEnv.c_str())) {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
static std::vector<std::string> getConfigurations(const cmake* cm)
|
||||
std::vector<std::string> getConfigurations(const cmake* cm)
|
||||
{
|
||||
std::vector<std::string> configurations;
|
||||
auto makefiles = cm->GetGlobalGenerator()->GetMakefiles();
|
||||
@@ -47,7 +47,7 @@ static std::vector<std::string> getConfigurations(const cmake* cm)
|
||||
return configurations;
|
||||
}
|
||||
|
||||
static bool hasString(const Json::Value& v, const std::string& s)
|
||||
bool hasString(const Json::Value& v, const std::string& s)
|
||||
{
|
||||
return !v.isNull() &&
|
||||
std::find_if(v.begin(), v.end(), [s](const Json::Value& i) {
|
||||
@@ -56,7 +56,7 @@ static bool hasString(const Json::Value& v, const std::string& s)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static Json::Value fromStringList(const T& in)
|
||||
Json::Value fromStringList(const T& in)
|
||||
{
|
||||
Json::Value result = Json::arrayValue;
|
||||
for (const std::string& i : in) {
|
||||
@@ -65,7 +65,7 @@ static Json::Value fromStringList(const T& in)
|
||||
return result;
|
||||
}
|
||||
|
||||
static std::vector<std::string> toStringList(const Json::Value& in)
|
||||
std::vector<std::string> toStringList(const Json::Value& in)
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
for (const auto& it : in) {
|
||||
@@ -74,12 +74,11 @@ static std::vector<std::string> toStringList(const Json::Value& in)
|
||||
return result;
|
||||
}
|
||||
|
||||
static void getCMakeInputs(const cmGlobalGenerator* gg,
|
||||
const std::string& sourceDir,
|
||||
const std::string& buildDir,
|
||||
std::vector<std::string>* internalFiles,
|
||||
std::vector<std::string>* explicitFiles,
|
||||
std::vector<std::string>* tmpFiles)
|
||||
void getCMakeInputs(const cmGlobalGenerator* gg, const std::string& sourceDir,
|
||||
const std::string& buildDir,
|
||||
std::vector<std::string>* internalFiles,
|
||||
std::vector<std::string>* explicitFiles,
|
||||
std::vector<std::string>* tmpFiles)
|
||||
{
|
||||
const std::string cmakeRootDir = cmSystemTools::GetCMakeRoot() + '/';
|
||||
std::vector<cmMakefile*> const& makefiles = gg->GetMakefiles();
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ const char* cmState::GetTargetTypeName(cmStateEnums::TargetType targetType)
|
||||
case cmStateEnums::UNKNOWN_LIBRARY:
|
||||
return "UNKNOWN_LIBRARY";
|
||||
}
|
||||
assert(0 && "Unexpected target type");
|
||||
assert(false && "Unexpected target type");
|
||||
return CM_NULLPTR;
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ bool cmStringCommand::HandleAsciiCommand(std::vector<std::string> const& args)
|
||||
}
|
||||
std::string::size_type cc;
|
||||
std::string outvar = args[args.size() - 1];
|
||||
std::string output = "";
|
||||
std::string output;
|
||||
for (cc = 1; cc < args.size() - 1; cc++) {
|
||||
int ch = atoi(args[cc].c_str());
|
||||
if (ch > 0 && ch < 256) {
|
||||
@@ -342,7 +342,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
|
||||
std::vector<RegexReplacement> replacement;
|
||||
std::string::size_type l = 0;
|
||||
while (l < replace.length()) {
|
||||
std::string::size_type r = replace.find("\\", l);
|
||||
std::string::size_type r = replace.find('\\', l);
|
||||
if (r == std::string::npos) {
|
||||
r = replace.length();
|
||||
replacement.push_back(replace.substr(l, r - l));
|
||||
|
||||
@@ -1664,7 +1664,7 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
|
||||
std::vector<char>::iterator erriter = err.begin();
|
||||
cmProcessOutput processOutput;
|
||||
std::string strdata;
|
||||
while (1) {
|
||||
while (true) {
|
||||
// Check for a newline in stdout.
|
||||
for (; outiter != out.end(); ++outiter) {
|
||||
if ((*outiter == '\r') && ((outiter + 1) == out.end())) {
|
||||
|
||||
@@ -82,7 +82,7 @@ time_t cmTimestamp::CreateUtcTimeTFromTm(struct tm& tm) const
|
||||
#else
|
||||
// From Linux timegm() manpage.
|
||||
|
||||
std::string tz_old = "";
|
||||
std::string tz_old;
|
||||
cmSystemTools::GetEnv("TZ", tz_old);
|
||||
tz_old = "TZ=" + tz_old;
|
||||
|
||||
|
||||
+8
-8
@@ -169,13 +169,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
||||
return 1;
|
||||
}
|
||||
// If error occurs we want to continue copying next files.
|
||||
bool return_value = 0;
|
||||
bool return_value = false;
|
||||
for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) {
|
||||
if (!cmSystemTools::cmCopyFile(args[cc].c_str(),
|
||||
args[args.size() - 1].c_str())) {
|
||||
std::cerr << "Error copying file \"" << args[cc] << "\" to \""
|
||||
<< args[args.size() - 1] << "\".\n";
|
||||
return_value = 1;
|
||||
return_value = true;
|
||||
}
|
||||
}
|
||||
return return_value;
|
||||
@@ -192,13 +192,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
||||
return 1;
|
||||
}
|
||||
// If error occurs we want to continue copying next files.
|
||||
bool return_value = 0;
|
||||
bool return_value = false;
|
||||
for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) {
|
||||
if (!cmSystemTools::CopyFileIfDifferent(
|
||||
args[cc].c_str(), args[args.size() - 1].c_str())) {
|
||||
std::cerr << "Error copying file (if different) from \"" << args[cc]
|
||||
<< "\" to \"" << args[args.size() - 1] << "\".\n";
|
||||
return_value = 1;
|
||||
return_value = true;
|
||||
}
|
||||
}
|
||||
return return_value;
|
||||
@@ -207,12 +207,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
||||
// Copy directory content
|
||||
if (args[1] == "copy_directory" && args.size() > 3) {
|
||||
// If error occurs we want to continue copying next files.
|
||||
bool return_value = 0;
|
||||
bool return_value = false;
|
||||
for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) {
|
||||
if (!cmSystemTools::CopyADirectory(args[cc], args[args.size() - 1])) {
|
||||
std::cerr << "Error copying directory from \"" << args[cc]
|
||||
<< "\" to \"" << args[args.size() - 1] << "\".\n";
|
||||
return_value = 1;
|
||||
return_value = true;
|
||||
}
|
||||
}
|
||||
return return_value;
|
||||
@@ -479,11 +479,11 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
||||
|
||||
if (args[1] == "make_directory" && args.size() > 2) {
|
||||
// If error occurs we want to continue copying next files.
|
||||
bool return_value = 0;
|
||||
bool return_value = false;
|
||||
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
|
||||
if (!cmSystemTools::MakeDirectory(args[cc].c_str())) {
|
||||
std::cerr << "Error creating directory \"" << args[cc] << "\".\n";
|
||||
return_value = 1;
|
||||
return_value = true;
|
||||
}
|
||||
}
|
||||
return return_value;
|
||||
|
||||
Reference in New Issue
Block a user