Commit ed0fa784 authored by Sebastian Holtermann's avatar Sebastian Holtermann
Browse files

cmSystemTools: Let `GetFileFormat` accept a `std::stding const&`

The `const char*` used formerly was converted to a `std::string`
internally anyway.
parent 254b7260
...@@ -223,7 +223,7 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles( ...@@ -223,7 +223,7 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
for (cmSourceFile* s : sources) { for (cmSourceFile* s : sources) {
// check whether it is a source or a include file // check whether it is a source or a include file
// then put it accordingly into one of the two containers // 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::C_FILE_FORMAT:
case cmSystemTools::CXX_FILE_FORMAT: case cmSystemTools::CXX_FILE_FORMAT:
case cmSystemTools::CUDA_FILE_FORMAT: case cmSystemTools::CUDA_FILE_FORMAT:
......
...@@ -679,7 +679,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() ...@@ -679,7 +679,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
// Register generated files that will be scanned by moc or uic // Register generated files that will be scanned by moc or uic
if (this->Moc.Enabled || this->Uic.Enabled) { if (this->Moc.Enabled || this->Uic.Enabled) {
cmSystemTools::FileFormat const fileType = cmSystemTools::FileFormat const fileType =
cmSystemTools::GetFileFormat(ext.c_str()); cmSystemTools::GetFileFormat(ext);
if ((fileType == cmSystemTools::CXX_FILE_FORMAT) || if ((fileType == cmSystemTools::CXX_FILE_FORMAT) ||
(fileType == cmSystemTools::HEADER_FILE_FORMAT)) { (fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
std::string const absPath = cmSystemTools::GetRealPath(fPath); std::string const absPath = cmSystemTools::GetRealPath(fPath);
...@@ -745,7 +745,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() ...@@ -745,7 +745,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
continue; continue;
} }
cmSystemTools::FileFormat const fileType = cmSystemTools::FileFormat const fileType =
cmSystemTools::GetFileFormat(sf->GetExtension().c_str()); cmSystemTools::GetFileFormat(sf->GetExtension());
if (!(fileType == cmSystemTools::CXX_FILE_FORMAT) && if (!(fileType == cmSystemTools::CXX_FILE_FORMAT) &&
!(fileType == cmSystemTools::HEADER_FILE_FORMAT)) { !(fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
continue; continue;
......
...@@ -1330,13 +1330,11 @@ bool cmSystemTools::SimpleGlob(const std::string& glob, ...@@ -1330,13 +1330,11 @@ bool cmSystemTools::SimpleGlob(const std::string& glob,
return res; 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; return cmSystemTools::NO_FILE_FORMAT;
} }
// std::string ext = cmSystemTools::LowerCase(cext);
std::string ext = cext;
if (ext == "c" || ext == ".c" || ext == "m" || ext == ".m") { if (ext == "c" || ext == ".c" || ext == "m" || ext == ".m") {
return cmSystemTools::C_FILE_FORMAT; return cmSystemTools::C_FILE_FORMAT;
} }
......
...@@ -334,7 +334,7 @@ public: ...@@ -334,7 +334,7 @@ public:
/** /**
* Determine the file type based on the extension * 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 /** Windows if this is true, the CreateProcess in RunCommand will
* not show new console windows when running programs. * not show new console windows when running programs.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment