mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 20:00:38 -06:00
KWSys 2025-05-09 (c1e5779a)
Code extracted from:
https://gitlab.kitware.com/utils/kwsys.git
at commit c1e5779a296730461dd8c8584dfb44476e8e3ccd (master).
Upstream Shortlog
-----------------
Daniel Pfeifer (1):
c5bb3c4e SystemInformation: Strip trailing whitespace from ModelName
This commit is contained in:
committed by
Brad King
parent
43effccf86
commit
9df0cea115
@@ -2806,14 +2806,13 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement()
|
||||
|
||||
#if USE_CPUID
|
||||
// Used only in USE_CPUID implementation below.
|
||||
static void SystemInformationStripLeadingSpace(std::string& str)
|
||||
static void SystemInformationTrimSpace(std::string& s)
|
||||
{
|
||||
// Because some manufacturers have leading white space - we have to
|
||||
// post-process the name.
|
||||
std::string::size_type pos = str.find_first_not_of(" ");
|
||||
if (pos != std::string::npos) {
|
||||
str.erase(0, pos);
|
||||
}
|
||||
// Because some manufacturers have leading and/or trailing white space,
|
||||
// we have to post-process the name.
|
||||
auto const not_space = [](char c) { return c != ' '; };
|
||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_space));
|
||||
s.erase(std::find_if(s.rbegin(), s.rend(), not_space).base(), s.end());
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2859,9 +2858,10 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
|
||||
this->ChipID.ProcessorName = nbuf;
|
||||
this->ChipID.ModelName = nbuf;
|
||||
|
||||
// Because some manufacturers have leading white space - we have to
|
||||
// post-process the name.
|
||||
SystemInformationStripLeadingSpace(this->ChipID.ProcessorName);
|
||||
// Because some manufacturers have leading and/or trailing white space,
|
||||
// we have to post-process the names.
|
||||
SystemInformationTrimSpace(this->ChipID.ProcessorName);
|
||||
SystemInformationTrimSpace(this->ChipID.ModelName);
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user