summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-02-02 10:29:22 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-02-02 17:42:08 (GMT)
commited0fa784ebb2b7e4d6db8b40d16f84f34692890a (patch)
tree11a18e2e286c31c806e9f44d984e440f940bc8d6 /Source
parent254b7260f49caaca78b16761d70d6239626d2129 (diff)
downloadCMake-ed0fa784ebb2b7e4d6db8b40d16f84f34692890a.zip
CMake-ed0fa784ebb2b7e4d6db8b40d16f84f34692890a.tar.gz
CMake-ed0fa784ebb2b7e4d6db8b40d16f84f34692890a.tar.bz2
cmSystemTools: Let `GetFileFormat` accept a `std::stding const&`
The `const char*` used formerly was converted to a `std::string` internally anyway.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx2
-rw-r--r--Source/cmQtAutoGenInitializer.cxx4
-rw-r--r--Source/cmSystemTools.cxx6
-rw-r--r--Source/cmSystemTools.h2
4 files changed, 6 insertions, 8 deletions
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index 2fa593c..0773edc 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -223,7 +223,7 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
for (cmSourceFile* s : sources) {
// check whether it is a source or a include file
// then put it accordingly into one of the two containers
- switch (cmSystemTools::GetFileFormat(s->GetExtension().c_str())) {
+ switch (cmSystemTools::GetFileFormat(s->GetExtension())) {
case cmSystemTools::C_FILE_FORMAT:
case cmSystemTools::CXX_FILE_FORMAT:
case cmSystemTools::CUDA_FILE_FORMAT:
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 41d29e8..1d64247 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -679,7 +679,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
// Register generated files that will be scanned by moc or uic
if (this->Moc.Enabled || this->Uic.Enabled) {
cmSystemTools::FileFormat const fileType =
- cmSystemTools::GetFileFormat(ext.c_str());
+ cmSystemTools::GetFileFormat(ext);
if ((fileType == cmSystemTools::CXX_FILE_FORMAT) ||
(fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
std::string const absPath = cmSystemTools::GetRealPath(fPath);
@@ -745,7 +745,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
continue;
}
cmSystemTools::FileFormat const fileType =
- cmSystemTools::GetFileFormat(sf->GetExtension().c_str());
+ cmSystemTools::GetFileFormat(sf->GetExtension());
if (!(fileType == cmSystemTools::CXX_FILE_FORMAT) &&
!(fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
continue;
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 5d8c079..1d20e2f 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1330,13 +1330,11 @@ bool cmSystemTools::SimpleGlob(const std::string& glob,
return res;
}
-cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext)
+cmSystemTools::FileFormat cmSystemTools::GetFileFormat(std::string const& ext)
{
- if (!cext || *cext == 0) {
+ if (ext.empty()) {
return cmSystemTools::NO_FILE_FORMAT;
}
- // std::string ext = cmSystemTools::LowerCase(cext);
- std::string ext = cext;
if (ext == "c" || ext == ".c" || ext == "m" || ext == ".m") {
return cmSystemTools::C_FILE_FORMAT;
}
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index fcb2cce..0f92fe2 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -334,7 +334,7 @@ public:
/**
* Determine the file type based on the extension
*/
- static FileFormat GetFileFormat(const char* ext);
+ static FileFormat GetFileFormat(std::string const& ext);
/** Windows if this is true, the CreateProcess in RunCommand will
* not show new console windows when running programs.