summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-12-10 15:49:34 (GMT)
committerBrad King <brad.king@kitware.com>2016-12-12 19:04:16 (GMT)
commit88da3d68c2d205688762fd6a7e84fd730533e844 (patch)
tree59c1b137d9e25fc2b8afb2a75eb01ffff6d00f16
parent58c66393cfb999f23bfb6ff72122ecbc531434c0 (diff)
downloadCMake-88da3d68c2d205688762fd6a7e84fd730533e844.zip
CMake-88da3d68c2d205688762fd6a7e84fd730533e844.tar.gz
CMake-88da3d68c2d205688762fd6a7e84fd730533e844.tar.bz2
clang-tidy: apply misc-suspicious-string-compare fixes
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx12
-rw-r--r--Source/cmCoreTryCompile.cxx17
2 files changed, 11 insertions, 18 deletions
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 2c9ca63..1940953 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -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)) {
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index e0b3120..f12c9e8 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -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);