mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 06:09:52 -06:00
Merge branch 'upstream-KWSys' into update-kwsys
# By KWSys Upstream * upstream-KWSys: KWSys 2025-05-09 (c1e5779a)
This commit is contained in:
@@ -2806,14 +2806,13 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement()
|
|||||||
|
|
||||||
#if USE_CPUID
|
#if USE_CPUID
|
||||||
// Used only in USE_CPUID implementation below.
|
// 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
|
// Because some manufacturers have leading and/or trailing white space,
|
||||||
// post-process the name.
|
// we have to post-process the name.
|
||||||
std::string::size_type pos = str.find_first_not_of(" ");
|
auto const not_space = [](char c) { return c != ' '; };
|
||||||
if (pos != std::string::npos) {
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_space));
|
||||||
str.erase(0, pos);
|
s.erase(std::find_if(s.rbegin(), s.rend(), not_space).base(), s.end());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2859,9 +2858,10 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
|
|||||||
this->ChipID.ProcessorName = nbuf;
|
this->ChipID.ProcessorName = nbuf;
|
||||||
this->ChipID.ModelName = nbuf;
|
this->ChipID.ModelName = nbuf;
|
||||||
|
|
||||||
// Because some manufacturers have leading white space - we have to
|
// Because some manufacturers have leading and/or trailing white space,
|
||||||
// post-process the name.
|
// we have to post-process the names.
|
||||||
SystemInformationStripLeadingSpace(this->ChipID.ProcessorName);
|
SystemInformationTrimSpace(this->ChipID.ProcessorName);
|
||||||
|
SystemInformationTrimSpace(this->ChipID.ModelName);
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user