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

The `const char*` used formerly was converted to a `std::string`
internally anyway.
This commit is contained in:
Sebastian Holtermann 2019-02-02 11:29:22 +01:00
parent 254b7260f4
commit ed0fa784eb
4 changed files with 6 additions and 8 deletions

View File

@ -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:

View File

@ -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;

View File

@ -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;
}

View File

@ -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.