COMP: Fixing type declarations and type conversions that could potentially
truncate 64 bits types into 32 bits types.
This commit is contained in:
parent
147aa6bf80
commit
7f601830a2
|
@ -257,10 +257,10 @@ protected:
|
||||||
|
|
||||||
// Evaluate the memory information.
|
// Evaluate the memory information.
|
||||||
int QueryMemory();
|
int QueryMemory();
|
||||||
unsigned long TotalVirtualMemory;
|
size_t TotalVirtualMemory;
|
||||||
unsigned long AvailableVirtualMemory;
|
size_t AvailableVirtualMemory;
|
||||||
unsigned long TotalPhysicalMemory;
|
size_t TotalPhysicalMemory;
|
||||||
unsigned long AvailablePhysicalMemory;
|
size_t AvailablePhysicalMemory;
|
||||||
|
|
||||||
size_t CurrentPositionInFile;
|
size_t CurrentPositionInFile;
|
||||||
|
|
||||||
|
@ -2771,7 +2771,7 @@ bool SystemInformationImplementation::ParseSysCtl()
|
||||||
uint64_t value = 0;
|
uint64_t value = 0;
|
||||||
size_t len = sizeof(value);
|
size_t len = sizeof(value);
|
||||||
sysctlbyname("hw.memsize", &value, &len, NULL, 0);
|
sysctlbyname("hw.memsize", &value, &len, NULL, 0);
|
||||||
this->TotalPhysicalMemory = value/1048576;
|
this->TotalPhysicalMemory = static_cast< size_t >( value/1048576 );
|
||||||
|
|
||||||
// Parse values for Mac
|
// Parse values for Mac
|
||||||
this->AvailablePhysicalMemory = 0;
|
this->AvailablePhysicalMemory = 0;
|
||||||
|
@ -2782,7 +2782,7 @@ bool SystemInformationImplementation::ParseSysCtl()
|
||||||
{
|
{
|
||||||
err = sysctlbyname("hw.pagesize", &value, &len, NULL, 0);
|
err = sysctlbyname("hw.pagesize", &value, &len, NULL, 0);
|
||||||
int64_t available_memory = vmstat.free_count * value;
|
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
|
#ifdef VM_SWAPUSAGE
|
||||||
|
@ -2794,8 +2794,8 @@ bool SystemInformationImplementation::ParseSysCtl()
|
||||||
err = sysctl(mib, miblen, &swap, &len, NULL, 0);
|
err = sysctl(mib, miblen, &swap, &len, NULL, 0);
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
{
|
{
|
||||||
this->AvailableVirtualMemory = swap.xsu_avail/1048576;
|
this->AvailableVirtualMemory = static_cast< size_t >( swap.xsu_avail/1048576 );
|
||||||
this->TotalVirtualMemory = swap.xsu_total/1048576;
|
this->TotalVirtualMemory = static_cast< size_t >( swap.xsu_total/1048576 );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
this->AvailableVirtualMemory = 0;
|
this->AvailableVirtualMemory = 0;
|
||||||
|
@ -2811,7 +2811,7 @@ bool SystemInformationImplementation::ParseSysCtl()
|
||||||
|
|
||||||
len = sizeof(value);
|
len = sizeof(value);
|
||||||
sysctlbyname("hw.cpufrequency", &value, &len, NULL, 0);
|
sysctlbyname("hw.cpufrequency", &value, &len, NULL, 0);
|
||||||
this->CPUSpeedInMHz = value / 1048576;
|
this->CPUSpeedInMHz = static_cast< float >( value )/ 1048576;
|
||||||
|
|
||||||
|
|
||||||
// Chip family
|
// Chip family
|
||||||
|
@ -2859,14 +2859,14 @@ bool SystemInformationImplementation::ParseSysCtl()
|
||||||
// Chip Model
|
// Chip Model
|
||||||
len = sizeof(value);
|
len = sizeof(value);
|
||||||
err = sysctlbyname("machdep.cpu.model", &value, &len, NULL, 0);
|
err = sysctlbyname("machdep.cpu.model", &value, &len, NULL, 0);
|
||||||
this->ChipID.Model = value;
|
this->ChipID.Model = static_cast< int >( value );
|
||||||
}
|
}
|
||||||
// Cache size
|
// Cache size
|
||||||
len = sizeof(value);
|
len = sizeof(value);
|
||||||
err = sysctlbyname("hw.l1icachesize", &value, &len, NULL, 0);
|
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);
|
err = sysctlbyname("hw.l2cachesize", &value, &len, NULL, 0);
|
||||||
this->Features.L2CacheSize = value;
|
this->Features.L2CacheSize = static_cast< int >( value );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue