diff options
author | Luis Ibanez <luis.ibanez@kitware.com> | 2009-11-15 20:57:06 (GMT) |
---|---|---|
committer | Luis Ibanez <luis.ibanez@kitware.com> | 2009-11-15 20:57:06 (GMT) |
commit | 7f601830a20f827003fc9c9a54fcbaca78eaafbc (patch) | |
tree | 3598c50c636a770b5c976a6e421e8cc20a1bfb93 /Source/kwsys/SystemInformation.cxx | |
parent | 147aa6bf8075e3802af97cc162c6c78c279a100f (diff) | |
download | CMake-7f601830a20f827003fc9c9a54fcbaca78eaafbc.zip CMake-7f601830a20f827003fc9c9a54fcbaca78eaafbc.tar.gz CMake-7f601830a20f827003fc9c9a54fcbaca78eaafbc.tar.bz2 |
COMP: Fixing type declarations and type conversions that could potentially
truncate 64 bits types into 32 bits types.
Diffstat (limited to 'Source/kwsys/SystemInformation.cxx')
-rw-r--r-- | Source/kwsys/SystemInformation.cxx | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 23d396f..d460344 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -257,10 +257,10 @@ protected: // Evaluate the memory information. int QueryMemory(); - unsigned long TotalVirtualMemory; - unsigned long AvailableVirtualMemory; - unsigned long TotalPhysicalMemory; - unsigned long AvailablePhysicalMemory; + size_t TotalVirtualMemory; + size_t AvailableVirtualMemory; + size_t TotalPhysicalMemory; + size_t AvailablePhysicalMemory; size_t CurrentPositionInFile; @@ -2771,7 +2771,7 @@ bool SystemInformationImplementation::ParseSysCtl() uint64_t value = 0; size_t len = sizeof(value); sysctlbyname("hw.memsize", &value, &len, NULL, 0); - this->TotalPhysicalMemory = value/1048576; + this->TotalPhysicalMemory = static_cast< size_t >( value/1048576 ); // Parse values for Mac this->AvailablePhysicalMemory = 0; @@ -2782,7 +2782,7 @@ bool SystemInformationImplementation::ParseSysCtl() { err = sysctlbyname("hw.pagesize", &value, &len, NULL, 0); int64_t available_memory = vmstat.free_count * value; - this->AvailablePhysicalMemory = available_memory / 1048576; + this->AvailablePhysicalMemory = static_cast< size_t >( available_memory / 1048576 ); } #ifdef VM_SWAPUSAGE @@ -2794,8 +2794,8 @@ bool SystemInformationImplementation::ParseSysCtl() err = sysctl(mib, miblen, &swap, &len, NULL, 0); if (err == 0) { - this->AvailableVirtualMemory = swap.xsu_avail/1048576; - this->TotalVirtualMemory = swap.xsu_total/1048576; + this->AvailableVirtualMemory = static_cast< size_t >( swap.xsu_avail/1048576 ); + this->TotalVirtualMemory = static_cast< size_t >( swap.xsu_total/1048576 ); } #else this->AvailableVirtualMemory = 0; @@ -2811,7 +2811,7 @@ bool SystemInformationImplementation::ParseSysCtl() len = sizeof(value); sysctlbyname("hw.cpufrequency", &value, &len, NULL, 0); - this->CPUSpeedInMHz = value / 1048576; + this->CPUSpeedInMHz = static_cast< float >( value )/ 1048576; // Chip family @@ -2859,14 +2859,14 @@ bool SystemInformationImplementation::ParseSysCtl() // Chip Model len = sizeof(value); err = sysctlbyname("machdep.cpu.model", &value, &len, NULL, 0); - this->ChipID.Model = value; + this->ChipID.Model = static_cast< int >( value ); } // Cache size len = sizeof(value); err = sysctlbyname("hw.l1icachesize", &value, &len, NULL, 0); - this->Features.L1CacheSize = value; + this->Features.L1CacheSize = static_cast< int >( value ); err = sysctlbyname("hw.l2cachesize", &value, &len, NULL, 0); - this->Features.L2CacheSize = value; + this->Features.L2CacheSize = static_cast< int >( value ); return true; #else |